-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
277 lines (265 loc) · 9.32 KB
/
docker-compose.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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
---
x-shared-env:
kratos_dsn: &kratos-dsn DSN=mysql://${KRATOS_DATABASE_USER}:${KRATOS_DATABASE_PASSWORD}@tcp(kratos_database:3306)/${KRATOS_DATABASE_SCHEMA}?sql_mode=''&max_conns=20&max_idle_conns=4
kratos_version: &kratos-version VERSION=${KRATOS_VERSION}
log_level: &log-level LOG_LEVEL=${LOG_LEVEL}
traefik-labels: &traefik-labels
traefik.docker.network: gateway
traefik.enable: 'true'
traefik.http.middlewares.https-redirect.redirectscheme.scheme: https
traefik.http.middlewares.auth.forwardauth.address: http://oathkeeper:4456/decisions
traefik.http.middlewares.auth.forwardauth.authResponseHeaders: X-Id-Token,Authorization
traefik.http.middlewares.auth.forwardauth.trustForwardHeader: 'true'
traefik.http.routers.traefik-http.entrypoints: http
traefik.http.routers.traefik-http.middlewares: https-redirect
traefik.http.routers.traefik-http.rule: Host(`traefik.${HOSTNAME}`)
traefik.http.routers.traefik-https.entrypoints: https
traefik.http.routers.traefik-https.rule: Host(`traefik.${HOSTNAME}`)
traefik.http.routers.traefik-https.service: api@internal
traefik.http.routers.traefik-https.tls.certresolver: digitalocean
traefik.http.routers.traefik-https.tls.domains[0].main: ${HOSTNAME}
traefik.http.routers.traefik-https.tls.domains[0].sans: '*.${HOSTNAME}'
traefik.http.routers.traefik-https.tls: 'true'
# traefik.http.routers.traefik-https.middlewares: auth@docker
traefik.http.services.traefik.loadbalancer.server.port: 8080
auth-labels: &auth-labels
traefik.docker.network: gateway
traefik.enable: 'true'
traefik.http.routers.auth-http.entrypoints: http
traefik.http.routers.auth-http.middlewares: https-redirect
traefik.http.routers.auth-http.rule: Host(`auth.${HOSTNAME}`)
traefik.http.routers.auth-https.entrypoints: https
traefik.http.routers.auth-https.rule: Host(`auth.${HOSTNAME}`)
traefik.http.routers.auth-https.service: auth
traefik.http.routers.auth-https.tls: 'true'
traefik.http.services.auth.loadbalancer.server.port: 4455
admin-labels: &admin-labels
traefik.docker.network: gateway
traefik.enable: 'true'
traefik.http.routers.admin-http.entrypoints: http
traefik.http.routers.admin-http.middlewares: https-redirect
traefik.http.routers.admin-http.rule: Host(`admin.${HOSTNAME}`)
traefik.http.routers.admin-https.entrypoints: https
traefik.http.routers.admin-https.rule: Host(`admin.${HOSTNAME}`)
traefik.http.routers.admin-https.service: admin
traefik.http.routers.admin-https.tls: 'true'
traefik.http.routers.admin-https.middlewares: auth@docker
traefik.http.services.admin.loadbalancer.server.port: 80
mail-labels: &mail-labels
traefik.docker.network: gateway
traefik.enable: 'true'
traefik.http.routers.mail-http.entrypoints: http
traefik.http.routers.mail-http.middlewares: https-redirect
traefik.http.routers.mail-http.rule: Host(`mail.${HOSTNAME}`)
traefik.http.routers.mail-https.entrypoints: https
traefik.http.routers.mail-https.rule: Host(`mail.${HOSTNAME}`)
traefik.http.routers.mail-https.service: mail
traefik.http.routers.mail-https.tls: 'true'
traefik.http.routers.mail-https.middlewares: auth@docker
traefik.http.services.mail.loadbalancer.server.port: 1080
whoami-labels: &whoami-labels
traefik.docker.network: gateway
traefik.enable: 'true'
traefik.http.routers.whoami-http.entrypoints: http
traefik.http.routers.whoami-http.middlewares: https-redirect
traefik.http.routers.whoami-http.rule: Host(`whoami.${HOSTNAME}`)
traefik.http.routers.whoami-https.entrypoints: https
traefik.http.routers.whoami-https.rule: Host(`whoami.${HOSTNAME}`)
traefik.http.routers.whoami-https.service: whoami
traefik.http.routers.whoami-https.tls: 'true'
traefik.http.routers.whoami-https.middlewares: auth@docker
traefik.http.services.whoami.loadbalancer.server.port: 80
networks:
database:
external: false
default:
external: false
gateway:
attachable: true
driver: overlay
external: false
services:
kratos_migrate:
command: -c /etc/config/kratos/kratos.yml migrate sql -e --yes
depends_on:
- kratos_database
environment:
- *kratos-dsn
- *log-level
- *kratos-version
image: oryd/kratos:${KRATOS_VERSION}
networks:
- database
restart: on-failure
volumes:
- ./etc/kratos:/etc/config/kratos
kratos_database:
environment:
- MYSQL_ROOT_PASSWORD=${KRATOS_DATABASE_ROOT_PASSWORD}
- MYSQL_DATABASE=${KRATOS_DATABASE_SCHEMA}
- MYSQL_USER=${KRATOS_DATABASE_USER}
- MYSQL_PASSWORD=${KRATOS_DATABASE_PASSWORD}
image: mariadb:${MARIADB_VERSION}
networks:
- database
ports:
- 3316:3306
restart: unless-stopped
volumes:
- ./var/kratos/mysql:/var/lib/mysql
kratos_server:
command: serve -c /etc/config/kratos/kratos.yml --dev --watch-courier
depends_on:
- kratos_database
environment:
- *kratos-dsn
- *log-level
- *kratos-version
- COOKIES_DOMAIN=${HOSTNAME}
- SERVE_PUBLIC_BASE_URL=https://auth.${HOSTNAME}/.ory/kratos/public/
- SERVE_PUBLIC_CORS_ALLOWED_ORIGINS=https://*.${HOSTNAME}
- SELFSERVICE_ALLOWED_RETURN_URLS=https://*.${HOSTNAME}
- SELFSERVICE_DEFAULT_BROWSER_RETURN_URL=https://auth.${HOSTNAME}/welcome
- SELFSERVICE_FLOWS_ERROR_UI_URL=https://auth.${HOSTNAME}/error
- SELFSERVICE_FLOWS_SETTINGS_UI_URL=https://auth.${HOSTNAME}/settings
- SELFSERVICE_FLOWS_RECOVERY_UI_URL=https://auth.${HOSTNAME}/recovery
- SELFSERVICE_FLOWS_VERIFICATION_UI_URL=https://auth.${HOSTNAME}/verification
- SELFSERVICE_FLOWS_VERIFICATION_AFTER_DEFAULT_BROWSER_RETURN_URL=https://auth.${HOSTNAME}/welcome
- SELFSERVICE_FLOWS_LOGOUT_AFTER_DEFAULT_BROWSER_RETURN_URL=https://auth.${HOSTNAME}/welcome
- SELFSERVICE_FLOWS_LOGIN_UI_URL=https://auth.${HOSTNAME}/login
- SELFSERVICE_FLOWS_REGISTRATION_UI_URL=https://auth.${HOSTNAME}/registration
image: oryd/kratos:${KRATOS_VERSION}
networks:
- database
- default
# ports:
# - 4433:4433 # public api
# - 4434:4434 # private api
restart: unless-stopped
volumes:
- ./etc/kratos:/etc/config/kratos
kratos_self_ui:
depends_on:
- kratos_server
environment:
- PORT=4435
- JWKS_URL=http://oathkeeper:4456/.well-known/jwks.json
- SECURITY_MODE=jwks
- KRATOS_BROWSER_URL=https://auth.${HOSTNAME}/.ory/kratos/public
- KRATOS_PUBLIC_URL=http://kratos_server:4433
- KRATOS_ADMIN_URL=http://kratos_server:4434
image: oryd/kratos-selfservice-ui-node:${KRATOS_SELF_UI_VERSION}
networks:
- default
# ports:
# - 4435:4435
restart: on-failure
kratos_admin_ui:
depends_on:
- kratos_server
deploy:
labels:
<<: *admin-labels
environment:
KRATOS_ADMIN_URL: http://kratos_server:4433
KRATOS_PUBLIC_URL: http://kratos_server:4434
hostname: admin.${HOSTNAME}
image: ghcr.io/dfoxg/kratos-admin-ui
labels:
<<: *admin-labels
networks:
- default
- gateway
mail:
deploy:
labels:
<<: *mail-labels
environment:
- MAILDEV_SMTP_PORT=1025
- MAILDEV_WEB_PORT=1080
- MAILDEV_MAIL_DIRECTORY=/maildir
hostname: mail.${HOSTNAME}
image: maildev/maildev:${MAILDEV_VERSION}
labels:
<<: *mail-labels
networks:
- default
- gateway
# ports:
# - 1080:1080
volumes:
- ./var/lib/mail:/maildir
rules:
environment:
NGINX_ENVSUBST_TEMPLATE_DIR: /templates
NGINX_ENVSUBST_TEMPLATE_SUFFIX: .tpl
NGINX_ENVSUBST_OUTPUT_DIR: /usr/share/nginx/html
HOSTNAME: ${HOSTNAME}
image: nginx:${NGINX_VERSION:-1.25}
# ports:
# - 8082:80
networks:
- default
volumes:
- ./etc/oathkeeper/access-rules.yml.tpl:/templates/access-rules.yml.tpl
oathkeeper:
command: serve proxy -c "/etc/config/oathkeeper/oathkeeper.yml"
depends_on:
- kratos_server
- kratos_self_ui
deploy:
labels:
<<: *auth-labels
environment:
- *log-level
- SERVE_PROXY_CORS_ALLOWED_ORIGINS=https://*.${HOSTNAME}
- ERRORS_HANDLERS_REDIRECT_CONFIG_TO=https://auth.${HOSTNAME}/login
- MUTATORS_ID_TOKEN_CONFIG_ISSUER_URL=https://${HOSTNAME}
image: oryd/oathkeeper:${OATHKEEPER_VERSION}
labels:
<<: *auth-labels
hostname: auth.${HOSTNAME}
networks:
- default
- gateway
# ports:
# - 4455:4455 # public api
# - 4456:4456 # private api
restart: on-failure
volumes:
- ./etc/oathkeeper:/etc/config/oathkeeper
traefik:
deploy:
labels:
<<: *traefik-labels
mode: global
placement:
constraints:
- node.role==manager
environment:
- DO_AUTH_TOKEN
hostname: traefik.${HOSTNAME}
image: traefik:${TRAEFIK_VERSION}
labels:
<<: *traefik-labels
networks:
- default
- gateway
ports:
- 80:80
- 443:443
volumes:
- ./etc/traefik/traefik.yaml:/traefik.yaml
- ./etc/traefik/acme.json:/acme.json
- /var/run/docker.sock:/var/run/docker.sock:ro
whoami:
deploy:
labels:
<<: *whoami-labels
hostname: whoami.${HOSTNAME}
image: traefik/whoami
networks:
- gateway
labels:
<<: *whoami-labels
version: '3'