-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.production.yml
59 lines (55 loc) · 2.76 KB
/
docker-compose.production.yml
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
version: "3"
services:
traefik:
command:
# Enable Docker in Traefik, so that it reads labels from Docker services
- --providers.docker
# Do not expose all Docker services, only the ones explicitly exposed
- --providers.docker.exposedbydefault=false
# Define an entrypoint called http that will listen on port 80
- --entrypoints.http.address=:80
# Define an entrypoint called https that will listen on port 443
- --entrypoints.https.address=:443
# Create certificate resolver "le" for Let's Encrypt, uses the environment variable EMAIL
- --certificatesresolvers.le.acme.email=${EMAIL}
# Store Let's Encrypt certificates in the mounted volume
- --certificatesresolvers.le.acme.storage=/certificates/acme.json
# Use TLS challenge for Let's Encrypt
- --certificatesresolvers.le.acme.tlschallenge=true
# Enable the access log, with HTTP requests
- --accesslog
# Enable the Traefik log, for configurations and errors
- --log
# Enable the Dashboard and API
- --api
ports:
- 80:80
- 443:443
labels:
# Make the router use this domain in HTTPS
- traefik.http.routers.traefik-dashboard-https.entrypoints=https
- traefik.http.routers.traefik-dashboard-https.rule=Host(`traefik.${DOMAIN?Variable not set}`)
- traefik.http.routers.traefik-dashboard-https.tls=true
# Use the "le" Let's Encrypt resolver
- traefik.http.routers.traefik-dashboard-https.tls.certresolver=le
# "https-redirect" middleware to redirect HTTP to HTTPS
- traefik.http.middlewares.https-redirect.redirectscheme.scheme=https
- traefik.http.middlewares.https-redirect.redirectscheme.permanent=true
# Set the middleware "traefik-dashboard-http" router
- traefik.http.routers.traefik-dashboard-http.middlewares=https-redirect
# Enable HTTP Basic Auth, using the middleware
- traefik.http.routers.traefik-dashboard-https.middlewares=admin-auth
app:
labels:
# Make the router use this domain in HTTPS
- traefik.http.routers.app-https.entrypoints=https
# backend subdomain is added in the case if you are intentionally using DOMAIN variable for your whole project
- traefik.http.routers.app-https.rule=Host(`backend.${DOMAIN?Variable not set}`)
- traefik.http.routers.app-https.tls=true
# Use the "le" Let's Encrypt resolver
- traefik.http.routers.app-https.tls.certResolver=le
# "https-redirect" middleware to redirect HTTP to HTTPS
- traefik.http.middlewares.https-redirect.redirectscheme.scheme=https
- traefik.http.middlewares.https-redirect.redirectscheme.permanent=true
# Set the middleware "app-http" router
- traefik.http.routers.app-http.middlewares=https-redirect