-
Notifications
You must be signed in to change notification settings - Fork 3
/
docker-compose.prod.yml
100 lines (90 loc) · 2.31 KB
/
docker-compose.prod.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
x-app: &default-app
image: adit_prod:latest
volumes:
- web_data:/var/www/web
- ${SSL_CERT_FILE:?}:/etc/web/ssl/cert.pem
- ${SSL_KEY_FILE:?}:/etc/web/ssl/key.pem
environment:
DJANGO_EMAIL_URL: ${DJANGO_EMAIL_URL:?}
DJANGO_SETTINGS_MODULE: "adit.settings.production"
DJANGO_STATIC_ROOT: "/var/www/web/static/"
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?}
x-deploy: &deploy
replicas: 1
restart_policy:
condition: on-failure
max_attempts: 3
services:
# We can't use those manage commands inside the web container in production because
# the web service may have multiple replicas. So we make sure to only run them once
# and wait for it to be finished by the web service containers.
init:
<<: *default-app
hostname: init.local
command: >
bash -c "
wait-for-it -s postgres.local:5432 -t 60 &&
./manage.py migrate &&
./manage.py collectstatic --no-input &&
./manage.py create_superuser &&
./manage.py ok_server --host 0.0.0.0 --port 8000
"
deploy:
<<: *deploy
web:
<<: *default-app
build:
target: production
ports:
- "${WEB_HTTP_PORT:-80}:80"
- "${WEB_HTTPS_PORT:-443}:443"
command: >
bash -c "
wait-for-it -s init.local:8000 -t 300 &&
echo 'Starting web server ...' &&
daphne -b 0.0.0.0 -p 80 \\
-e ssl:443:privateKey=/etc/web/ssl/key.pem:certKey=/etc/web/ssl/cert.pem \\
adit.asgi:application
"
deploy:
<<: *deploy
replicas: ${WEB_REPLICAS:-3}
default_worker:
<<: *default-app
command: >
bash -c "
wait-for-it -s postgres.local:5432 -t 60 &&
./manage.py bg_worker -q default
"
deploy:
<<: *deploy
dicom_worker:
<<: *default-app
command: >
bash -c "
wait-for-it -s postgres.local:5432 -t 60 &&
./manage.py bg_worker -q dicom
"
deploy:
<<: *deploy
replicas: ${DICOM_WORKER_REPLICAS:-3}
receiver:
<<: *default-app
ports:
- "11112:11112"
command: ./manage.py receiver
deploy:
<<: *deploy
postgres:
environment:
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?}
deploy:
<<: *deploy
orthanc1:
deploy:
<<: *deploy
orthanc2:
deploy:
<<: *deploy
volumes:
web_data: