-
Notifications
You must be signed in to change notification settings - Fork 7
/
traefik-stack-v11.yml
203 lines (195 loc) · 6.72 KB
/
traefik-stack-v11.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
version: '3.7'
networks:
traefik:
external: true
volumes:
db_data:
secrets:
trusted_ca:
file: ./trusted_ca.pem
services:
proxy:
image: traefik:v2.1
command:
- '--providers.docker=true'
- '--entryPoints.web.address=:80'
- '--entryPoints.websecure.address=:443'
- '--entryPoints.metrics.address=:8082'
- '--providers.providersThrottleDuration=2s'
- '--providers.docker.watch=true'
- '--providers.docker.swarmMode=true'
- '--providers.docker.swarmModeRefreshSeconds=15s'
- '--providers.docker.exposedbydefault=false'
- '--providers.docker.defaultRule=Host("wshihadeh.cloud")'
- '--providers.docker.constraints=Label(`traefik.tags`,`public`)'
- '--accessLog.bufferingSize=0'
- '--api=true'
- '--api.dashboard=true'
- '--api.insecure=true'
- '--ping.entryPoint=web'
- '--metrics.prometheus=true'
- '--metrics.prometheus.addEntryPointsLabels=true'
- '--metrics.prometheus.addServicesLabels=true'
- '--metrics.prometheus.manualrouting=true'
- '--certificatesresolvers.route53.acme.dnschallenge=true'
- '--certificatesresolvers.route53.acme.dnschallenge.provider=route53'
- '--certificatesresolvers.route53.acme.storage=/var/lib/traefik/acme.json'
- '--providers.file.filename=/run/traefik.toml'
environment:
AWS_ACCESS_KEY_ID: '${TRAEFIK_AWS_ACCESS_KEY_ID}'
AWS_SECRET_ACCESS_KEY: '${TRAEFIK_AWS_SECRET_ACCESS_KEY}'
volumes:
- '/var/run/docker.sock:/var/run/docker.sock:ro'
- './cert:/var/lib/traefik'
- './traefik.toml:/run/traefik.toml'
secrets:
- trusted_ca
ports:
- '80:80'
- '443:443'
- '8080:8080'
- '8082:8082'
deploy:
labels:
- traefik.enable=true
- traefik.tags=public
- traefik.docker.network=traefik
- traefik.http.middlewares.my-basic-auth.basicauth.users=traefik:$$apr1$$SnHDtk1N$$cpc7xSXXrMVnPYdF01WdC0
- traefik.http.services.prometheus.loadbalancer.server.port=8082
- traefik.http.routers.prometheus.rule=PathPrefix(`/metrics`)
- traefik.http.routers.prometheus.service=prometheus@internal
- traefik.http.routers.prometheus.entrypoints=metrics
- traefik.http.routers.prometheus.middlewares=my-basic-auth
- traefik.http.routers.wildcard.tls=true
- traefik.http.routers.wildcard.tls.certresolver=route53
- traefik.http.routers.wildcard.tls.domains[0].main=wshihadeh.cloud
- traefik.http.routers.wildcard.tls.domains[0].sans=*.wshihadeh.cloud
- traefik.http.middlewares.https_redirect.redirectscheme.scheme=https
- traefik.http.middlewares.https_redirect.redirectscheme.permanent=true
- traefik.http.routers.http_catchall.rule=HostRegexp(`{any:.+}`)
- traefik.http.routers.http_catchall.entrypoints=web
- traefik.http.routers.http_catchall.middlewares=https_redirect
restart_policy:
condition: any
delay: 5s
max_attempts: 3
window: 120s
update_config:
delay: 10s
order: start-first
parallelism: 1
rollback_config:
parallelism: 0
order: stop-first
logging:
driver: json-file
options:
'max-size': '10m'
'max-file': '5'
networks:
- traefik
mysql:
image: mysql:5.7
command: mysqld --general-log=1 --general-log-file=/var/log/mysql/general-log.log
deploy:
restart_policy:
condition: any
delay: 5s
max_attempts: 3
window: 120s
update_config:
delay: 10s
order: start-first
parallelism: 1
rollback_config:
parallelism: 0
order: stop-first
logging:
driver: json-file
options:
'max-size': '10m'
'max-file': '5'
networks:
- traefik
volumes:
- db_data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: dummy
MYSQL_DATABASE: rails_blog_production
rails_blog_web:
image: wshihadeh/rails_blog:demo-v1
command: 'web'
deploy:
labels:
- traefik.enable=true
- traefik.tags=public
- traefik.http.services.blog.loadbalancer.server.port=8080
- traefik.http.middlewares.my-http-headers.headers.customrequestheaders.X-REQUEST-SOURCE=public
- traefik.http.middlewares.my-http-headers.headers.customresponseheaders.X-RESPONSE-SOURCE=rails
- traefik.http.middlewares.blog-redirect.redirectregex.regex=^(https?://)www.wshihadeh.cloud/(.*)$$
- traefik.http.middlewares.blog-redirect.redirectregex.replacement=$${1}blog.wshihadeh.cloud/users/sign_up
- traefik.http.middlewares.blog-redirect.redirectregex.permanent=true
- traefik.http.middlewares.blog-client-cert.passtlsclientcert.pem=true
- traefik.http.routers.blog.tls=true
- traefik.http.routers.blog.tls.options=my-tls-opt@file
- traefik.http.routers.blog.rule=Host(`blog.wshihadeh.cloud`) || Host(`wshihadeh.cloud`) || Host(`www.wshihadeh.cloud`)
- traefik.http.routers.blog.service=blog
- traefik.http.routers.blog.entrypoints=websecure
- traefik.http.routers.blog.middlewares=my-http-headers,blog-redirect,my-basic-auth,blog-client-cert
- traefik.docker.network=traefik
restart_policy:
condition: any
delay: 5s
max_attempts: 3
window: 120s
update_config:
delay: 10s
order: start-first
parallelism: 1
rollback_config:
parallelism: 0
order: stop-first
logging:
driver: json-file
options:
'max-size': '10m'
'max-file': '5'
networks:
- traefik
depends_on:
- mysql
environment:
DATABASE_URL: mysql2://root:dummy@mysql/rails_blog_production
RAILS_SERVE_STATIC_FILES: 'true'
mailcatcher:
image: sj26/mailcatcher
deploy:
labels:
- traefik.enable=true
- traefik.tags=public
- traefik.http.services.mailcatcher.loadbalancer.server.port=1080
- traefik.http.routers.mailcatcher.tls=true
- traefik.http.routers.mailcatcher.rule=Host(`mailcatcher.wshihadeh.cloud`)
- traefik.http.routers.mailcatcher.service=mailcatcher
- traefik.http.routers.mailcatcher.entrypoints=web
- traefik.docker.network=traefik
restart_policy:
condition: any
delay: 5s
max_attempts: 3
window: 120s
update_config:
delay: 10s
order: start-first
parallelism: 1
rollback_config:
parallelism: 0
order: stop-first
logging:
driver: json-file
options:
'max-size': '10m'
'max-file': '5'
networks:
- traefik