forked from ijpatricio/traefik-for-forge
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdocker-compose.dev.yml
74 lines (67 loc) · 3 KB
/
docker-compose.dev.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
version: "3.7"
networks:
proxy:
external: true
services:
traefik:
image: traefik:v2.10
container_name: "traefik"
restart: always
networks:
- proxy
ports:
- "80:80"
- "443:443"
# Uncomment for debug
# - "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./letsencrypt:/letsencrypt
- ./traefik.auth:/auth/traefik.auth
command:
# # Uncomment for debug
# - --api.insecure=true
- --entrypoints.web.address=:80
#- "--log.level=DEBUG"
- --api.insecure=true
- --providers.docker=true
- --providers.docker.exposedbydefault=false
- --entrypoints.websecure.address=:443
- --certificatesresolvers.leresolver.acme.tlschallenge=true
#- --certificatesresolvers.leresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory
- --certificatesresolvers.leresolver.acme.email=${LETS_ENCRYPT_EMAIL}
- --certificatesresolvers.leresolver.acme.storage=/letsencrypt/acme.json
labels:
## TRAEFIK ROUTER & DASHBOARD
- traefik.enable=true
- traefik.http.routers.traefik.entrypoints=websecure
- traefik.http.routers.traefik.rule=Host(`${TRAEFIK_DASHBOARD_HOST}`)
## TLS - https://docs.traefik.io/https/tls/
## Specifically, we don't allow connections via the IP address, only via the domain name
## https://doc.traefik.io/traefik/https/tls/#strict-sni-checking
## - traefik.http.routers.myrouter.tls.options.default.sniStrict=true
- traefik.http.routers.traefik.service=api@internal
- traefik.http.routers.traefik.middlewares=auth
- traefik.http.routers.traefik.tls.certresolver=leresolver
- traefik.http.services.traefik.loadbalancer.server.port=8080
# https://github.com/traefik/traefik/issues/1254#issuecomment-299114960
# https://gist.github.com/thomas15v/a446ac1745829f5a6a5f19c574739af8
# Traefik was sometimes working, but only sometimes. Telling it specifically
# which network to choose to run on was what seemed to fix it.
- traefik.docker.network=proxy
## Middleware for http to https redirect
- traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=websecure
## AUTH
- traefik.http.middlewares.auth.basicauth.usersfile=/auth/traefik.auth
## Catch-all redirect to domain
- traefik.http.routers.catchall.rule=hostregexp(`{any:.+}`)
- traefik.http.routers.catchall.entrypoints=web
- traefik.http.routers.catchall.middlewares=redirect
## Middleware
- traefik.http.middlewares.redirect.redirectregex.regex=.*
- traefik.http.middlewares.redirect.redirectregex.replacement=https://example.com
## Global redirect to HTTPS
#- traefik.http.routers.http-catchall.rule=hostregexp(`{host:.+}`)
#- traefik.http.routers.http-catchall.rule=Host(`${TRAEFIK_DASHBOARD_HOST}`)
#- traefik.http.routers.http-catchall.entrypoints=web
#- traefik.http.routers.http-catchall.middlewares=redirect-to-https