-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
375 lines (353 loc) · 9.95 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
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
# For local development
# Copyright (c) 2024 MultiFactor
# License: https://github.com/MultiDirectoryLab/MultiDirectory/blob/main/LICENSE
services:
traefik:
image: "traefik:v2.6"
container_name: "traefik"
command:
- "--log.level=INFO"
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.ldap.address=:389"
- "--entrypoints.ldaps.address=:636"
- "--entrypoints.kadmind.address=:749"
- "--entrypoints.kpasswd.address=:464"
- "--entrypoints.bind_dns.address=:53"
ports:
- "80:80"
- "8080:8080"
- "389:389"
- "636:636"
- "749:749"
- "464:464"
- "530:53"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
ldap_server:
build:
context: .
dockerfile: ./.docker/dev.Dockerfile
args:
DOCKER_BUILDKIT: 1
target: runtime
image: multidirectory
restart: unless-stopped
# container_name: multidirectory
volumes:
- ./app:/app
- ./certs:/certs
- ldap_keytab:/LDAP_keytab/
env_file:
local.env
command: python -OO multidirectory.py --ldap
tty: true
depends_on:
migrations:
condition: service_completed_successfully
cert_local_check:
condition: service_completed_successfully
deploy:
mode: replicated
replicas: 2
endpoint_mode: dnsrr
resources:
limits:
cpus: '1.0'
memory: 100M
reservations:
cpus: '0.25'
memory: 20M
labels:
- traefik.enable=true
- traefik.tcp.routers.ldap.rule=HostSNI(`*`)
- traefik.tcp.routers.ldap.entrypoints=ldap
- traefik.tcp.routers.ldap.service=ldap
- traefik.tcp.services.ldap.loadbalancer.server.port=389
- traefik.tcp.routers.ldaps.rule=HostSNI(`*`)
- traefik.tcp.routers.ldaps.entrypoints=ldaps
- traefik.tcp.routers.ldaps.service=ldaps
- traefik.tcp.services.ldaps.loadbalancer.server.port=636
healthcheck:
test: ["CMD-SHELL", "nc -zv 127.0.0.1 389 636"]
interval: 30s
timeout: 10s
retries: 10
start_period: 3s
api:
image: multidirectory
container_name: multidirectory_api
volumes:
- ./app:/app
- ./certs:/certs
- dns_server_file:/DNS_server_file/
- dns_server_config:/DNS_server_configs/
- ldap_keytab:/LDAP_keytab/
env_file:
local.env
command: python multidirectory.py --http
tty: true
labels:
- "traefik.enable=true"
- "traefik.http.routers.api.rule=Host(`md.localhost`) && PathPrefix(`/api`)"
- "traefik.http.routers.api.entrypoints=web"
- "traefik.http.services.api.loadbalancer.server.port=8000"
- "traefik.http.routers.api.service=api"
- "traefik.http.routers.api.middlewares=api_strip"
- "traefik.http.middlewares.api_strip.stripprefix.prefixes=/api"
- "traefik.http.middlewares.api_strip.stripprefix.forceslash=false"
depends_on:
migrations:
condition: service_completed_successfully
deploy:
mode: global
resources:
limits:
cpus: '0.50'
memory: 150M
migrations:
image: multidirectory
container_name: multidirectory_migrations
restart: "no"
volumes:
- ./app:/app
env_file:
local.env
command: alembic upgrade head
depends_on:
postgres:
condition: service_healthy
cert_check:
image: multidirectory
container_name: multidirectory_certs_check
restart: "no"
volumes:
- ./certs:/certs
- ./app:/app
command: ./extra/generate_cert.sh
cert_local_check:
image: multidirectory
container_name: multidirectory_local_certs_check
restart: "no"
volumes:
- ./certs:/certs
command: bash -c "test -f /certs/cert.pem && echo 'CERT EXISTS, SKIPPING...' || openssl req -nodes -new -x509 -keyout /certs/privkey.pem -out /certs/cert.pem -subj '/C=RU/ST=Moscow/L=Moscow/O=Global Security/OU=Multifactor/CN=md.multifactor.dev'";
postgres:
container_name: MD-postgres
image: postgres:16
restart: unless-stopped
environment:
POSTGRES_USER: user1
POSTGRES_PASSWORD: password123
PGDATA: /data/postgres
volumes:
- postgres:/data/postgres
ports:
- 5432:5432
healthcheck:
test: ["CMD-SHELL", "pg_isready -d postgres -U user1"]
interval: 1s
timeout: 15s
retries: 10
start_period: 3s
pgadmin:
container_name: pgadmin_container
image: dpage/pgadmin4
environment:
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-pgadmin4@pgadmin.org}
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-admin}
PGADMIN_CONFIG_SERVER_MODE: 'False'
volumes:
- pgadmin:/var/lib/pgadmin
restart: unless-stopped
logging:
driver: "none"
labels:
- "traefik.enable=true"
- "traefik.http.routers.pg.rule=Host(`pg.localhost`)"
- "traefik.http.routers.pg.entrypoints=web"
- "traefik.http.services.pg.loadbalancer.server.port=80"
kadmin_api:
image: krb5md
container_name: kadmin_api
restart: unless-stopped
volumes:
- ./certs:/certs
- .kerberos/:/server/
- kdc:/etc
tty: true
depends_on:
ldap_server:
condition: service_healthy
restart: true
cert_check:
condition: service_completed_successfully
ports:
- 8000:8000
working_dir: /server
command: uvicorn --factory config_server:create_app
--host 0.0.0.0 --ssl-keyfile=/certs/krbkey.pem
--ssl-certfile=/certs/krbcert.pem
--reload
bind_dns:
image: ubuntu/bind9:latest
container_name: bind9
hostname: bind9
restart: unless-stopped
volumes:
- dns_server_file:/opt/
- dns_server_config:/etc/bind/
tty: true
depends_on:
ldap_server:
condition: service_healthy
restart: true
command: bash -c "chown bind:bind /opt && test -f /opt/zone.key && echo 'KEY EXISTS, SKIPPING...' || tsig-keygen zone. > /opt/zone.key && source docker-entrypoint.sh"
labels:
- traefik.enable=true
- traefik.tcp.routers.bind_dns.rule=HostSNI(`*`)
- traefik.tcp.routers.bind_dns.entrypoints=bind_dns
- traefik.tcp.routers.bind_dns.service=bind_dns
- traefik.tcp.services.bind_dns.loadbalancer.server.port=53
kdc:
build:
context: .
dockerfile: ./.docker/krb.Dockerfile
container_name: kdc
hostname: kerberos
restart: unless-stopped
volumes:
- kdc:/etc
image: krb5md
tty: true
command: krb5kdc -n -w 4
ports:
- "88:88"
- "88:88/udp"
depends_on:
ldap_server:
condition: service_healthy
restart: true
kadmind:
container_name: kadmind
restart: unless-stopped
hostname: kerberos
volumes:
- kdc:/etc
- psync_queue:/var/spool/krb5-sync
image: krb5md
tty: true
command: kadmind -nofork
depends_on:
ldap_server:
condition: service_healthy
restart: true
kdc:
condition: service_started
labels:
- traefik.enable=true
- traefik.tcp.routers.kadmind.rule=HostSNI(`*`)
- traefik.tcp.routers.kadmind.entrypoints=kadmind
- traefik.tcp.routers.kadmind.service=kadmind
- traefik.tcp.services.kadmind.loadbalancer.server.port=749
- traefik.tcp.routers.kpasswd.rule=HostSNI(`*`)
- traefik.tcp.routers.kpasswd.entrypoints=kpasswd
- traefik.tcp.routers.kpasswd.service=kpasswd
- traefik.tcp.services.kpasswd.loadbalancer.server.port=464
shadow_api:
image: multidirectory
container_name: shadow_api
restart: unless-stopped
tty: true
depends_on:
migrations:
condition: service_completed_successfully
ldap_server:
condition: service_healthy
restart: true
volumes:
- ./app:/app
env_file:
local.env
command: python multidirectory.py --shadow
maintence:
image: multidirectory
container_name: md_maintence
volumes:
- ./certs:/certs
- ./app:/app
- psync_queue:/var/spool/krb5-sync
- ldap_keytab:/LDAP_keytab/
env_file:
local.env
command: python multidirectory.py --scheduler
tty: true
depends_on:
migrations:
condition: service_completed_successfully
deploy:
resources:
limits:
cpus: '1.0'
memory: 100M
reservations:
cpus: '0.1'
memory: 6M
interface:
container_name: multidirectory_interface
build:
context: ./interface
dockerfile: configurations/docker/Dockerfile.dev
restart: 'no'
environment:
- HUSKY=0
- API_URL=https://md.localhost/api
- NODE_ENV=development
ports:
- 9080:80
working_dir: /app
labels:
- 'traefik.enable=true'
- 'traefik.http.routers.multidirectory-app.rule=Host(`md.localhost`)'
- 'traefik.http.routers.multidirectory-app.entrypoints=web'
command:
ng serve --host 0.0.0.0 --port 80 --poll 2000
dragonfly:
image: 'docker.dragonflydb.io/dragonflydb/dragonfly'
container_name: dragonfly
expose:
- 6379
deploy:
resources:
limits:
cpus: '4.0'
memory: 6GiB
reservations:
cpus: '0.75'
memory: 1.5GiB
redis-commander:
container_name: redis-commander
hostname: redis-commander
image: ghcr.io/joeferner/redis-commander:latest
restart: always
environment:
- REDIS_HOSTS=sessions:dragonfly:6379:1
user: redis
labels:
- "traefik.enable=true"
- "traefik.http.routers.rc.rule=Host(`rc.localhost`)"
- "traefik.http.routers.rc.entrypoints=web"
- "traefik.http.services.rc.loadbalancer.server.port=8081"
- "traefik.http.routers.rc.service=rc"
volumes:
postgres:
pgadmin:
wireshark:
kdc:
psync_queue:
dns_server_file:
dns_server_config:
ldap_keytab:
dragonflydata: