-
Notifications
You must be signed in to change notification settings - Fork 9
/
docker-compose.prod.yml
executable file
·123 lines (107 loc) · 3.65 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
version: "3"
# To deploy in prod we use a nginx proxy for docker containers with a companion to enable HTTPS with LetsEncrypt
# https://github.com/nginx-proxy/nginx-proxy
# https://github.com/nginx-proxy/acme-companion
services:
api:
volumes:
- /data/database/backup:/backup
environment:
- VIRTUAL_HOST=api.dsri.maastrichtuniversity.nl
- LETSENCRYPT_HOST=api.dsri.maastrichtuniversity.nl
- VIRTUAL_PORT=80
# Run the API on a single thread just for the CRON job in prod (enabled with env variable)
# Because gunicorn would run the process on every workers
cron:
build: ./server
restart: unless-stopped
depends_on:
- mysql
- phpmyadmin
volumes:
- /data/database/backup:/backup
environment:
- SQL_URL=mysql://${DB_USER}:${DB_PASSWORD-password}@${DB_HOST-mysql}:3306/${DB_NAME}
- SLACK_BOT_TOKEN=${SLACK_BOT_TOKEN-xoxb}
- SLACK_CHANNEL=${SLACK_CHANNEL-UQL6BCQJH}
# - CLUSTER_USER=${CLUSTER_USER-Vincent.Emonet}
# - CLUSTER_PASSWORD=${CLUSTER_PASSWORD-password}
- CLUSTER_API_KEY=${CLUSTER_API_KEY-token}
- API_PASSWORD=${API_PASSWORD-password}
- ENABLE_CRON=true
command: uvicorn api.main:app --host 0.0.0.0 --port 80
gpu-calendar:
environment:
- VIRTUAL_HOST=calendar.dsri.maastrichtuniversity.nl
- LETSENCRYPT_HOST=calendar.dsri.maastrichtuniversity.nl
- VIRTUAL_PORT=80
gpu-booking:
environment:
- VIRTUAL_HOST=booking.dsri.maastrichtuniversity.nl
- LETSENCRYPT_HOST=booking.dsri.maastrichtuniversity.nl
- VIRTUAL_PORT=80
- DB_PASSWORD=${DB_PASSWORD}
- DB_USER=${DB_USER}
- DB_NAME=${DB_NAME}
- DB_HOST=${DB_HOST-mysql}
- SMTP_HOST=${SMTP_HOST-localhost}
- SMTP_PORT=${SMTP_PORT-25}
- SMTP_FROM=${SMTP_FROM}
- SAML_SP_ENTITY_ID=${SAML_SP_ENTITY_ID}
- SAML_SALT=${SAML_SALT}
- SAML_ADMIN_PW=${SAML_ADMIN_PW}
- SAML_TRUSTED_DOMAINS=${SAML_TRUSTED_DOMAINS}
- SAML_BASEURLPATH=${SAML_BASEURLPATH}
mysql:
volumes:
- /data/database/data:/var/lib/mysql
- /data/database/backup:/backup
phpmyadmin:
environment:
- PMA_ABSOLUTE_URI=https://admin.dsri.maastrichtuniversity.nl
- VIRTUAL_HOST=admin.dsri.maastrichtuniversity.nl
- LETSENCRYPT_HOST=admin.dsri.maastrichtuniversity.nl
- VIRTUAL_PORT=80
# https://github.com/nginx-proxy/nginx-proxy
nginx-proxy:
image: nginxproxy/nginx-proxy:latest
container_name: nginx-proxy
ports:
- 80:80
- 443:443
volumes:
- /data/certs:/etc/nginx/certs:ro
- /var/run/docker.sock:/tmp/docker.sock:ro
- vhost:/etc/nginx/vhost.d
- html:/usr/share/nginx/html
restart: unless-stopped
# Use letsencrypt to serve HTTPS https://github.com/nginx-proxy/acme-companion
# Docs: https://github.com/nginx-proxy/acme-companion/wiki/Container-configuration
nginx-encrypt-https:
image: nginxproxy/acme-companion:latest
container_name: acme-companion
depends_on:
- nginx-proxy
volumes:
- /data/certs:/etc/nginx/certs:rw
- /var/run/docker.sock:/var/run/docker.sock:ro
- acme:/etc/acme.sh
volumes_from:
- nginx-proxy:rw
environment:
- NGINX_PROXY_CONTAINER=nginx-proxy
- REUSE_KEY=false
- DEBUG=true
restart: unless-stopped
## Website could be also served with nginx from the same server as the API
# website:
# build: website
# environment:
# - VIRTUAL_HOST=dsri.maastrichtuniversity.nl
# - LETSENCRYPT_HOST=dsri.maastrichtuniversity.nl
# - VIRTUAL_PORT=80
volumes:
vhost:
html:
acme: