-
Notifications
You must be signed in to change notification settings - Fork 0
/
compose.yml
469 lines (443 loc) · 13 KB
/
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
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
x-backend-common-envs: &backend-common-envs
DB_NAME: eurydice
DB_USER: eurydice
DB_PASSWORD: eurydice
DB_PORT: "5432"
DJANGO_ENV: DEV
DEBUG: "True"
DJANGO_MANAGEPY_MIGRATE: "off"
MINIO_ACCESS_KEY: minio
MINIO_SECRET_KEY: miniominio
TZ: "Europe/Paris"
SECURE_COOKIES: "false"
USER_ASSOCIATION_TOKEN_SECRET_KEY: "Baby shark for 36 bytes dudududududu"
EURYDICE_CONTACT: ${EURYDICE_CONTACT:-the development team}
EURYDICE_CONTACT_FR: ${EURYDICE_CONTACT_FR:-par courrier recommandé en 3 exemplaires}
UI_BADGE_CONTENT: Dev -> Dev
UI_BADGE_COLOR: "green"
LOG_TO_FILE: true
x-backend: &backend
build:
context: "backend"
dockerfile: docker/Dockerfile
target: dev
# NOTE: we tag local dev images with our registry otherwise the image is tagged
# using the docker hub as a registry
# https://docs.docker.com/engine/reference/commandline/tag/#extended-description
image: eurydice/backend:dev
networks:
- eurydice
command:
- make
- run-dev
x-common-origin-envs: &common-origin-envs
DB_HOST: db-origin
MINIO_ENABLED: true
MINIO_ENDPOINT: minio:9000
MINIO_BUCKET_NAME: eurydice-origin
# Maximum object size per operation allowed by minio (50 TiB)
# https://min.io/docs/minio/linux/operations/checklists/thresholds.html#minio-server-limits
TRANSFERABLE_MAX_SIZE: 54975581388800
x-common-destination-envs: &common-destination-envs
DB_HOST: db-destination
MINIO_ENABLED: false
TRANSFERABLE_STORAGE_DIR: /tmp/eurydice-data/
MINIO_BUCKET_NAME: eurydice-destination
x-common-auth-envs: &common-auth-envs
REMOTE_USER_HEADER_AUTHENTICATION_ENABLED: "true"
x-db: &db
image: postgres:15
read_only: true
networks:
- eurydice
environment:
POSTGRES_DB: eurydice
POSTGRES_USER: eurydice
POSTGRES_PASSWORD: eurydice
TZ: "Europe/Paris"
PGTZ: "Europe/Paris"
tmpfs:
- /tmp
- /run
command:
- "postgres"
- "-c" # turn on csv logging
- "logging_collector=on"
- "-c"
- "log_destination=csvlog"
- "-c"
- "log_directory=/var/log/postgresql"
- "-c" # filebeat format
- "log_line_prefix=%m [%p] %q%u@%d "
- "-c" # turn on hour-based log rotation
- "log_truncate_on_rotation=on"
- "-c"
- "log_filename=postgresql-%H.log"
- "-c"
- "log_rotation_age=60"
- "-c"
- "log_file_mode=0644"
- "-c" # print statements that took more than 200ms...
- "log_min_duration_statement=200"
- "-c" # ...do not print other statements...
- "log_statement=none"
- "-c" # ...do not even print the duration of these other statements
- "log_duration=off"
healthcheck:
# NOTE: DB will become healthy as soon as it has created the eurydice table
test:
- "CMD-SHELL"
- 'psql -U eurydice -lqtA | grep -q "^eurydice|"'
interval: 5s
timeout: 5s
retries: 5
services:
################ Common Services ################
traefik:
image: traefik:2.10
networks:
- eurydice
command:
- "--log.level=DEBUG"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--api.dashboard=true"
ports:
- "80:80"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
labels:
traefik.enable: "true"
traefik.http.routers.dashboard.rule: Host(`traefik.localhost`)
traefik.http.routers.dashboard.service: api@internal
minio:
image: minio/minio:RELEASE.2023-08-23T10-07-06Z
networks:
- eurydice
environment:
MINIO_ROOT_USER: minio
MINIO_ROOT_PASSWORD: miniominio
volumes:
- minio-data:/data
- minio-config:/config
ports:
- 9000:9000
command:
- server
- /data
- --config-dir
- /config/
- --certs-dir
- /config/.certs/
labels:
traefik.enable: "true"
traefik.http.routers.minio.rule: Host(`minio.localhost`)
healthcheck:
test:
- "CMD-SHELL"
- "curl http://127.0.0.1:9000/minio/health/live"
interval: 5s
timeout: 5s
retries: 10
start_period: 2s
frontend:
build:
context: "frontend"
dockerfile: docker/Dockerfile
target: dev
# note: we tag local dev images with our registry otherwise the image is tagged
# using the docker hub as a registry
# https://docs.docker.com/engine/reference/commandline/tag/#extended-description
image: eurydice/frontend:dev
networks:
- eurydice
volumes:
- ./frontend:/home/eurydice/frontend
command:
- make
- dev
environment:
NODE_ENV: development
# workaround for vue-cli container detection not working, see:
# https://github.com/vuejs/vue-cli/issues/6726
CODESANDBOX_SSE: "1"
labels:
traefik.enable: "true"
traefik.http.routers.frontend.rule: Host(`origin.localhost`) || Host(`destination.localhost`)
traefik.http.routers.frontend.priority: "1"
################ Origin Services ################
backend-origin:
<<: *backend
depends_on:
db-origin:
condition: service_started
minio:
condition: service_healthy
volumes:
- ./backend:/home/eurydice/backend
- backend-origin-logs:/var/log/app
environment:
<<: [*backend-common-envs, *common-origin-envs, *common-auth-envs]
SECRET_KEY: GhSZiXkmYyty
EURYDICE_API: origin
ALLOWED_HOSTS: origin.localhost,backend-origin
CSRF_TRUSTED_ORIGINS: ""
DJANGO_MANAGEPY_MIGRATE: "on"
METRICS_SLIDING_WINDOW: ${METRICS_SLIDING_WINDOW:-60min}
healthcheck:
test:
- "CMD"
- /healthcheck.py
interval: 5s
timeout: 5s
retries: 5
# NOTE: in the dev image the stat period is longer because we expect
# the container to apply migrations on first startup
# (in production this should be done by a different service)
start_period: 5s
labels:
traefik.enable: "true"
traefik.http.routers.backend-origin.rule: Host(`origin.localhost`) && PathPrefix(`/api`, `/admin`, `/static`)
command:
- make
- run-origin-api
sender:
<<: *backend
depends_on:
# NOTE: we await for the backend container to be healthy
# because it is the one runnning the migrations in
# the developement environment
backend-origin:
condition: service_healthy
minio:
condition: service_healthy
lidis:
condition: service_started
volumes:
- ./backend:/home/eurydice/backend
- sender-logs:/var/log/app
extra_hosts:
- "lidis.docker.host:${LIDIS_DOCKER_HOST:-host-gateway}"
environment:
<<: [*backend-common-envs, *common-origin-envs]
DB_HOST: db-origin
MINIO_BUCKET_NAME: eurydice-origin
LIDIS_HOST: "lidis.docker.host"
LIDIS_PORT: "5000"
SENDER_RANGE_FILLER_CLASS: "UserRotatingTransferableRangeFiller"
command:
- make
- run-sender
dbtrimmer-origin:
<<: *backend
depends_on:
# NOTE: we await for the backend container to be healthy
# because it is the one runnning the migrations in
# the developement environment
backend-origin:
condition: service_healthy
volumes:
- ./backend:/home/eurydice/backend
- dbtrimmer-origin-logs:/var/log/app
environment:
<<: [*backend-common-envs, *common-origin-envs]
DBTRIMMER_TRIM_TRANSFERABLES_AFTER: "2h"
DBTRIMMER_RUN_EVERY: "6h"
DBTRIMMER_POLL_EVERY: "200ms"
command:
- make
- run-origin-dbtrimmer
db-origin:
<<: *db
ports:
- 5432:5432
volumes:
- db-origin-data:/var/lib/postgresql/data
- db-origin-logs:/var/log/postgresql/:rw
lidis:
image: eurydice/lidi-send:latest
network_mode: "host"
environment:
RUST_LOG: ${RUST_LOG:-INFO}
depends_on:
lidir:
condition: service_started
read_only: true
command:
- "--from_tcp"
- "0.0.0.0:5000"
- "--to_udp"
- "0.0.0.0:6000"
- "--nb_clients"
- "1"
################ Destination Services ################
lidir:
image: eurydice/lidi-receive:latest
network_mode: "host"
environment:
RUST_LOG: ${RUST_LOG:-INFO}
depends_on:
receiver:
condition: service_started
read_only: true
command:
- "--from_udp"
- "0.0.0.0:6000"
- "--to_tcp"
- "0.0.0.0:7000"
- "--nb_clients"
- "1"
db-destination:
<<: *db
ports:
- 5433:5432
volumes:
- db-destination-data:/var/lib/postgresql/data
- db-destination-logs:/var/log/postgresql/
receiver:
<<: *backend
depends_on:
# NOTE: we await for the backend container to be healthy
# because it is the one runnning the migrations in
# the developement environment
backend-destination:
condition: service_healthy
minio:
condition: service_healthy
volumes:
- ./backend:/home/eurydice/backend
- receiver-logs:/var/log/app
- destination-data-storage:/tmp/eurydice-data
environment:
<<: [*backend-common-envs, *common-destination-envs]
PACKET_RECEIVER_HOST: "0.0.0.0"
PACKET_RECEIVER_PORT: "7000"
RECEIVER_BUFFER_MAX_ITEMS: "4"
ports:
- "127.0.0.1:7000:7000"
command:
- make
- run-receiver
dbtrimmer-destination:
<<: *backend
depends_on:
# NOTE: we await for the backend container to be healthy
# because it is the one runnning the migrations in
# the developement environment
backend-destination:
condition: service_healthy
volumes:
- ./backend:/home/eurydice/backend
- dbtrimmer-destination-logs:/var/log/app
- destination-data-storage:/tmp/eurydice-data
environment:
<<: [*backend-common-envs, *common-destination-envs]
DBTRIMMER_TRIM_TRANSFERABLES_AFTER: "2h"
DBTRIMMER_RUN_EVERY: "6h"
DBTRIMMER_POLL_EVERY: "200ms"
command:
- make
- run-destination-dbtrimmer
s3remover:
<<: *backend
depends_on:
# NOTE: we await for the backend container to be healthy
# because it is the one runnning the migrations in
# the developement environment
backend-destination:
condition: service_healthy
minio:
condition: service_healthy
volumes:
- ./backend:/home/eurydice/backend
- s3remover-logs:/var/log/app
- destination-data-storage:/tmp/eurydice-data
environment:
<<: [*backend-common-envs, *common-destination-envs]
S3REMOVER_EXPIRE_TRANSFERABLES_AFTER: "1hour"
S3REMOVER_RUN_EVERY: "30s"
S3REMOVER_POLL_EVERY: "200ms"
command:
- make
- run-destination-s3remover
backend-destination:
<<: *backend
depends_on:
db-destination:
condition: service_healthy
minio:
condition: service_healthy
volumes:
- ./backend:/home/eurydice/backend
- backend-destination-logs:/var/log/app
- destination-data-storage:/tmp/eurydice-data
environment:
<<: [*backend-common-envs, *common-destination-envs, *common-auth-envs]
SECRET_KEY: jBS0nmi4MOQIeXcN
EURYDICE_API: destination
ALLOWED_HOSTS: destination.localhost,backend-destination
CSRF_TRUSTED_ORIGINS: ""
DJANGO_MANAGEPY_MIGRATE: "on"
METRICS_SLIDING_WINDOW: ${METRICS_SLIDING_WINDOW:-60min}
healthcheck:
test:
- CMD
- /healthcheck.py
interval: 5s
timeout: 5s
retries: 5
# NOTE: in the dev image the stat period is longer because we expect
# the container to apply migrations on first startup
# (in production this should be done by a different service)
start_period: 5s
labels:
traefik.enable: "true"
traefik.http.routers.backend-destination.rule: Host(`destination.localhost`) && PathPrefix(`/api`, `/admin`, `/static`)
command:
- make
- run-destination-api
################ Dev Tools ################
pgadmin:
build:
context: pgadmin
target: dev
# NOTE: we tag local dev images with our registry otherwise the image is tagged
# using the docker hub as a registry
# https://docs.docker.com/engine/reference/commandline/tag/#extended-description
image: eurydice/pgadmin4:dev
environment:
PGADMIN_DEFAULT_EMAIL: admin@example.com
PGADMIN_DEFAULT_PASSWORD: admin
PGADMIN_CONFIG_SERVER_MODE: "False"
PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED: "False"
networks:
- eurydice
volumes:
- pgadmin:/var/lib/pgadmin
labels:
traefik.enable: "true"
traefik.http.routers.pgadmin.rule: Host(`pgadmin.localhost`)
volumes:
db-origin-data:
db-origin-logs:
db-destination-data:
db-destination-logs:
minio-data:
minio-config:
pgadmin:
backend-origin-logs:
sender-logs:
dbtrimmer-origin-logs:
backend-destination-logs:
receiver-logs:
dbtrimmer-destination-logs:
s3remover-logs:
destination-data-storage:
networks:
eurydice:
driver: bridge
name: eurydice
ipam:
config:
- subnet: ${EURYDICE_IPV4_SUBNET:-172.18.0.0/24}