-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathcompose.localprod.yml
More file actions
310 lines (293 loc) · 10.8 KB
/
Copy pathcompose.localprod.yml
File metadata and controls
310 lines (293 loc) · 10.8 KB
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
include:
- compose.dev.yml
x-backend-common-envs: &backend-common-envs
DB_NAME: ${DB_NAME:?}
DB_USER: ${DB_USER:?}
DB_PASSWORD: ${DB_PASSWORD:?}
DB_PORT: 5432
DJANGO_MANAGEPY_MIGRATE: "off"
TZ: "Europe/Paris"
SECURE_COOKIES: "false"
USER_ASSOCIATION_TOKEN_SECRET_KEY: ${USER_ASSOCIATION_TOKEN_SECRET_KEY:?}
GUNICORN_CONFIGURATION: ${GUNICORN_CONFIGURATION}
EURYDICE_CONTACT: ${EURYDICE_CONTACT}
EURYDICE_CONTACT_FR: ${EURYDICE_CONTACT_FR}
UI_BADGE_CONTENT: ${UI_BADGE_CONTENT}
UI_BADGE_COLOR: ${UI_BADGE_COLOR}
LOG_TO_FILE: ${LOG_TO_FILE}
LOG_LEVEL: ${LOG_LEVEL}
x-backend: &backend
build:
context: "backend"
dockerfile: docker/Dockerfile
target: prod
image: eurydice_backend:localprod
user: ${PUID:?}:${PGID:?}
read_only: true
tmpfs:
- /tmp:uid=${PUID:?},gid=${PGID:?},mode=770
networks:
- eurydice
x-common-origin-envs: &common-origin-envs
DB_HOST: db-origin
TRANSFERABLE_STORAGE_DIR: /home/eurydice/data
TRANSFERABLE_MAX_SIZE: 54975581388800
x-common-destination-envs: &common-destination-envs
DB_HOST: db-destination
TRANSFERABLE_STORAGE_DIR: /home/eurydice/data
x-common-auth-envs: &common-auth-envs
REMOTE_USER_HEADER_AUTHENTICATION_ENABLED: ${REMOTE_USER_HEADER_AUTHENTICATION_ENABLED}
x-frontend: &frontend
build:
context: "frontend"
dockerfile: docker/Dockerfile
target: prod
image: eurydice_frontend:localprod
networks:
- eurydice
user: ${PUID:?}:${PGID:?}
read_only: true
tmpfs:
- /tmp:uid=${PUID:?},gid=${PGID:?},mode=770
- /var/cache/nginx:uid=${PUID:?},gid=${PGID:?},mode=770
- /etc/nginx/conf.d:uid=${PUID:?},gid=${PGID:?},mode=770
services:
################ Origin Services ################
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:
- ${PYTHON_LOGS_DIR:?}/dbtrimmer-origin:/var/log/app
environment:
<<: [*backend-common-envs, *common-origin-envs]
DBTRIMMER_TRIM_TRANSFERABLES_AFTER: ${DBTRIMMER_TRIM_TRANSFERABLES_AFTER}
DBTRIMMER_RUN_EVERY: ${DBTRIMMER_RUN_EVERY}
DBTRIMMER_POLL_EVERY: ${DBTRIMMER_POLL_EVERY}
command:
- make
- run-origin-dbtrimmer
db-migrations-origin:
<<: *backend
environment:
<<: [*backend-common-envs, *common-origin-envs]
SECRET_KEY: ${DJANGO_SECRET_KEY:?}
ALLOWED_HOSTS: ${BACKEND_HOSTNAMES:?}
EURYDICE_API: origin
tmpfs:
- /var/log/app:uid=${PUID:?},gid=${PGID:?},mode=770
command:
- make
- migrate
depends_on:
db-origin:
condition: service_healthy
frontend-origin:
<<: *frontend
networks:
- eurydice
environment:
NGINX_SERVER_NAME: origin.localhost
NGINX_ROOT_DIR: origin
labels:
traefik.enable: "true"
traefik.http.routers.frontend-origin.rule: Host(`origin.localhost`)
traefik.http.routers.frontend-origin.priority: "1"
traefik.http.routers.frontend-origin.service: frontend-origin-service
traefik.http.services.frontend-origin-service.loadbalancer.server.port: 8080
traefik.http.middlewares.frontend-origin-headers.headers.customrequestheaders.X-Remote-User: user
traefik.http.middlewares.frontend-origin-headers.headers.customrequestheaders.X-Remote-Roles: user
traefik.http.routers.frontend-origin.middlewares: frontend-origin-headers
backend-origin:
<<: *backend
depends_on:
db-migrations-origin:
condition: service_completed_successfully
volumes:
- ${PYTHON_LOGS_DIR:?}/backend-origin:/var/log/app
- ${ORIGIN_TRANSFERABLE_STORAGE_DIR:?}:/home/eurydice/data
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: ""
METRICS_SLIDING_WINDOW: ${METRICS_SLIDING_WINDOW:-60min}
UI_BADGE_CONTENT: ${UI_BADGE_CONTENT:-Guichet origine localprod}
UI_BADGE_COLOR: ${UI_BADGE_COLOR:-#01426a}
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`)
traefik.http.middlewares.backend-origin-headers.headers.customrequestheaders.X-Remote-User: user
traefik.http.middlewares.backend-origin-headers.headers.customrequestheaders.X-Remote-Roles: user
traefik.http.routers.backend-origin.middlewares: backend-origin-headers
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
lidis:
condition: service_started
volumes:
- ${PYTHON_LOGS_DIR:?}/sender:/var/log/app
- ${ORIGIN_TRANSFERABLE_STORAGE_DIR:?}:/home/eurydice/data
extra_hosts:
- "lidis.docker.host:${LIDIS_DOCKER_HOST:-host-gateway}"
environment:
<<: [*backend-common-envs, *common-origin-envs]
DB_HOST: db-origin
LIDIS_HOST: lidis.docker.host
LIDIS_PORT: ${LIDIS_PORT}
TRANSFERABLE_HISTORY_DURATION: ${TRANSFERABLE_HISTORY_DURATION}
TRANSFERABLE_HISTORY_SEND_EVERY: ${TRANSFERABLE_HISTORY_SEND_EVERY}
SENDER_RANGE_FILLER_CLASS: ${SENDER_RANGE_FILLER_CLASS}
command:
- make
- run-sender
################ Destination Services ################
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
volumes:
- ${PYTHON_LOGS_DIR:?}/receiver:/var/log/app
- ${DESTINATION_TRANSFERABLE_STORAGE_DIR:?}:/home/eurydice/data
environment:
<<: [*backend-common-envs, *common-destination-envs]
PACKET_RECEIVER_HOST: "0.0.0.0"
PACKET_RECEIVER_PORT: "7000"
RECEIVER_BUFFER_MAX_ITEMS: "${RECEIVER_BUFFER_MAX_ITEMS}"
ports:
- "127.0.0.1:7000:7000"
command:
- make
- run-receiver
db-migrations-destination:
<<: *backend
environment:
<<: [*backend-common-envs, *common-destination-envs]
SECRET_KEY: ${DJANGO_SECRET_KEY:?}
ALLOWED_HOSTS: ${BACKEND_HOSTNAMES:?}
EURYDICE_API: destination
tmpfs:
- /var/log/app:uid=${PUID:?},gid=${PGID:?},mode=770
command:
- make
- migrate
depends_on:
db-destination:
condition: service_healthy
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:
- ${PYTHON_LOGS_DIR:?}/dbtrimmer-destination:/var/log/app
- ${DESTINATION_TRANSFERABLE_STORAGE_DIR:?}:/home/eurydice/data
environment:
<<: [*backend-common-envs, *common-destination-envs]
DBTRIMMER_TRIM_TRANSFERABLES_AFTER: ${DBTRIMMER_TRIM_TRANSFERABLES_AFTER}
DBTRIMMER_RUN_EVERY: ${DBTRIMMER_RUN_EVERY}
DBTRIMMER_POLL_EVERY: ${DBTRIMMER_POLL_EVERY}
command:
- make
- run-destination-dbtrimmer
backend-destination:
<<: *backend
depends_on:
db-migrations-destination:
condition: service_completed_successfully
volumes:
- ${PYTHON_LOGS_DIR:?}/backend-destination:/var/log/app
- ${DESTINATION_TRANSFERABLE_STORAGE_DIR:?}:/home/eurydice/data
environment:
<<: [*backend-common-envs, *common-destination-envs, *common-auth-envs]
SECRET_KEY: "${DJANGO_SECRET_KEY:?}"
EURYDICE_API: destination
ALLOWED_HOSTS: destination.localhost,backend-destination
CSRF_TRUSTED_ORIGINS: ${CSRF_TRUSTED_ORIGINS}
METRICS_SLIDING_WINDOW: ${METRICS_SLIDING_WINDOW}
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`)
traefik.http.middlewares.backend-destination-headers.headers.customrequestheaders.X-Remote-User: user
traefik.http.middlewares.backend-destination-headers.headers.customrequestheaders.X-Remote-Roles: user
traefik.http.routers.backend-destination.middlewares: backend-destination-headers
command:
- make
- run-destination-api
file-remover:
<<: *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:
- ${PYTHON_LOGS_DIR:?}/file-remover:/var/log/app
- ${DESTINATION_TRANSFERABLE_STORAGE_DIR:?}:/home/eurydice/data
environment:
<<: [*backend-common-envs, *common-destination-envs]
FILE_REMOVER_EXPIRE_TRANSFERABLES_AFTER: ${FILE_REMOVER_EXPIRE_TRANSFERABLES_AFTER}
FILE_REMOVER_RUN_EVERY: ${FILE_REMOVER_RUN_EVERY}
FILE_REMOVER_POLL_EVERY: ${FILE_REMOVER_POLL_EVERY}
command:
- make
- run-destination-file-remover
frontend-destination:
<<: *frontend
networks:
- eurydice
environment:
NGINX_SERVER_NAME: destination.localhost
NGINX_ROOT_DIR: destination
labels:
traefik.enable: "true"
traefik.http.routers.frontend-destination.rule: Host(`destination.localhost`)
traefik.http.routers.frontend-destination.priority: "1"
traefik.http.routers.frontend-destination.service: frontend-destination-service
traefik.http.services.frontend-destination-service.loadbalancer.server.port: 8080
traefik.http.middlewares.frontend-destination-headers.headers.customrequestheaders.X-Remote-User: user
traefik.http.middlewares.frontend-destination-headers.headers.customrequestheaders.X-Remote-Roles: user
traefik.http.routers.frontend-destination.middlewares: frontend-destination-headers