-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdocker-compose.prod.yml
139 lines (132 loc) · 3.58 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
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
version: "3.7"
services:
database:
hostname: database
image: postgres:12-alpine
volumes:
- postgres_data:/var/lib/postgresql/data/
deploy:
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 5
window: 10s
environment:
POSTGRES_DB: ticketvise
POSTGRES_USER: ${SQL_USER}
POSTGRES_PASSWORD: ${SQL_PASSWORD}
web:
image: "ticketvise/backend:sha-${GIT_DIGEST}"
command: >
sh -c "python manage.py wait_for_database &&
python manage.py configure_s3 &&
python manage.py migrate --no-input &&
python manage.py collectstatic --no-input --clear &&
gunicorn ticketvise.wsgi:application --bind 0.0.0.0:6000"
deploy:
replicas: 1
update_config:
parallelism: 1
delay: 10s
order: start-first
failure_action: rollback
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 5
window: 10s
environment:
DEBUG: 0
SEND_MAIL: 1
DJANGO_SECRET: ${DJANGO_SECRET}
SMTP_OUTBOUND_PASSWORD: ${EMAIL_PASSWORD}
SQL_HOST: database
SQL_DATABASE: ticketvise
SQL_ENGINE: django.db.backends.postgresql
SQL_USER: ${SQL_USER}
SQL_PASSWORD: ${SQL_PASSWORD}
LTI_KEY: ${LTI_KEY}
LTI_SECRET: ${LTI_SECRET}
DOMAIN: ${DOMAIN}
HOST: ${DOMAIN}
S3_USE_HTTPS: 0
S3_ACCESS_KEY: ${S3_ACCESS_KEY}
S3_SECRET_KEY: ${S3_SECRET_KEY}
MICROSOFT_CLIENT_ID: ${MICROSOFT_CLIENT_ID}
MICROSOFT_CLIENT_SECRET: ${MICROSOFT_CLIENT_SECRET}
frontend:
image: "ticketvise/frontend:sha-${GIT_DIGEST}"
deploy:
replicas: 1
update_config:
parallelism: 1
delay: 10s
order: start-first
failure_action: rollback
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 5
window: 10s
proxy:
image: "ticketvise/proxy:sha-${GIT_DIGEST}"
deploy:
replicas: 1
update_config:
parallelism: 1
delay: 10s
order: start-first
failure_action: rollback
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 5
window: 10s
environment:
NGINX_DOMAIN: ${DOMAIN}
ports:
- "80:80"
- "443:443"
volumes:
- cert_conf:/etc/letsencrypt
- cert_www:/var/www/certbot
command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"
s3:
image: minio/minio:latest
volumes:
- minio_data:/data
entrypoint: sh
command: -c 'mkdir -p /data/$$S3_BUCKET_NAME && minio server /data --console-address ":9001"'
deploy:
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 5
window: 10s
environment:
MINIO_ROOT_USER: ${S3_ACCESS_KEY}
MINIO_ROOT_PASSWORD: ${S3_SECRET_KEY}
S3_ENDPOINT_URL: ${S3_ENDPOINT_URL}
S3_BUCKET_NAME: ${S3_BUCKET_NAME}
# healthcheck:
# test: [ "CMD", "curl", "-f", ${MINIO_ENDPOINT_URL}"/minio/health/live" ]
# interval: 30s
# timeout: 20s
# retries: 3
certbot:
image: certbot/certbot:v1.18.0
deploy:
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 5
window: 10s
volumes:
- cert_conf:/etc/letsencrypt
- cert_www:/var/www/certbot
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
volumes:
cert_conf:
cert_www:
postgres_data:
minio_data: