Repository navigation
Expand file tree
/
Copy pathdocker-compose.prod.yaml
More file actions
40 lines (38 loc) · 2.02 KB
/
Copy pathdocker-compose.prod.yaml
File metadata and controls
40 lines (38 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Traefik routing, layered on top of docker-compose.yaml:
#
# docker compose -f docker-compose.yaml -f docker-compose.prod.yaml up -d --build
#
# Requires a Traefik instance already running on the host and attached to the
# `traefik` network. Everything else stays in the base file, so the image
# deployed here is the same one built locally.
#
# The hostname is the only value that differs per deployment, so it is the
# only thing read from `.env`.
services:
web:
labels:
- "traefik.enable=true"
- "traefik.http.routers.morphicblocks-web.entrypoints=websecure"
- "traefik.http.routers.morphicblocks-web.rule=Host(`${DEPLOY_DOMAIN:?set DEPLOY_DOMAIN in .env}`)"
# nginx listens on 80 inside the container; Traefik terminates TLS.
- "traefik.http.services.morphicblocks-web.loadbalancer.server.port=80"
# www.<domain> gets its own certificate and redirects permanently to the
# bare domain, keeping the path.
- "traefik.http.routers.morphicblocks-www.entrypoints=websecure"
- "traefik.http.routers.morphicblocks-www.rule=Host(`www.${DEPLOY_DOMAIN:?set DEPLOY_DOMAIN in .env}`)"
- "traefik.http.routers.morphicblocks-www.service=morphicblocks-web"
- "traefik.http.routers.morphicblocks-www.middlewares=morphicblocks-www-redirect"
- "traefik.http.middlewares.morphicblocks-www-redirect.redirectregex.regex=^https://www\\.(.*)"
- "traefik.http.middlewares.morphicblocks-www-redirect.redirectregex.replacement=https://$${1}"
- "traefik.http.middlewares.morphicblocks-www-redirect.redirectregex.permanent=true"
# Uncomment when the entrypoint has no default certificate resolver and
# these routers should request their own, for example from Let's Encrypt.
# The name is the resolver as configured in Traefik.
# - "traefik.http.routers.morphicblocks-web.tls.certresolver=letsencrypt"
# - "traefik.http.routers.morphicblocks-www.tls.certresolver=letsencrypt"
networks:
- traefik
networks:
traefik:
external: true
name: traefik