-
Notifications
You must be signed in to change notification settings - Fork 7
/
traefik-stack-v8.yml
155 lines (149 loc) · 5 KB
/
traefik-stack-v8.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
version: '3.7'
networks:
traefik:
external: true
volumes:
db_data:
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")'
- '--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.email=it@me.com'
- '--certificatesresolvers.route53.acme.storage=/var/lib/traefik/acme.json'
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'
ports:
- '80:80'
- '443:443'
- '8080:8080'
- '8082:8082'
deploy:
labels:
- traefik.enable=true
- 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.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.routers.blog.tls=true
- traefik.http.routers.blog.rule=Host(`blog.wshihadeh.cloud`)
- traefik.http.routers.blog.service=blog
- traefik.http.routers.blog.entrypoints=websecure
- traefik.http.routers.blog.middlewares=my-http-headers
- 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'