-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.prod.yml
104 lines (95 loc) · 2.91 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
version: '3.8'
services:
# Update service for self-hosted Docker images for completely automatic deployment
# Only updates images marked with the label "com.centurylinklabs.watchtower.enable=true"
watchtower:
image: containrrr/watchtower
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /root/.docker/config.json:/config.json
command: --interval 60 --label-enable
# Database service
postgres:
image: ghcr.io/hpi-sam/dps_training_k-postgres:latest
container_name: K-dPS-postgres
labels:
- "com.centurylinklabs.watchtower.enable=true"
env_file:
- .env.prod
volumes:
- local_postgres_data:/var/lib/postgresql/data:Z
- local_postgres_data_backups:/backups:z
healthcheck:
test: [ "CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}" ]
interval: 10s
timeout: 5s
retries: 5
# Caching service
redis:
image: redis:7.2.5
container_name: K-dPS-redis
# Backend service
django:
image: ghcr.io/hpi-sam/dps_training_k-django:latest
container_name: K-dPS-django
labels:
- "com.centurylinklabs.watchtower.enable=true"
restart: unless-stopped
depends_on:
- postgres
- redis
env_file:
- .env.prod
environment:
- RUN_MIGRATIONS=1 # only django should run migrations
volumes:
- static_volume:/app/staticfiles
command: uvicorn configuration.asgi:application --host 0.0.0.0 --reload
# Celery worker service (e.g. scheduled tasks)
celeryworker:
image: ghcr.io/hpi-sam/dps_training_k-celeryworker:latest
container_name: K-dPS-celeryworker
labels:
- "com.centurylinklabs.watchtower.enable=true"
depends_on:
- django
env_file:
- .env.prod
command: /start-celeryworker
# Celery beat service (e.g. scheduled tasks)
celerybeat:
image: ghcr.io/hpi-sam/dps_training_k-celerybeat:latest
container_name: K-dPS-celerybeat
labels:
- "com.centurylinklabs.watchtower.enable=true"
depends_on:
- django
env_file:
- .env.prod
command: /start-celerybeat
# Nginx service (reverse proxy for Backend)
nginx:
image: ghcr.io/hpi-sam/dps_training_k-nginx:latest
container_name: K-dPS-nginx
labels:
- "com.centurylinklabs.watchtower.enable=true"
depends_on:
- django
volumes:
- static_volume:/app/staticfiles
- /etc/letsencrypt/live/klinik-dps.de/fullchain.pem:/etc/nginx/ssl/fullchain.pem:ro
- /etc/letsencrypt/live/klinik-dps.de/privkey.pem:/etc/nginx/ssl/privkey.pem:ro
- ./nginx_prod.conf:/etc/nginx/conf.d/nginx.conf
ports:
- "80:80"
- "443:443"
# Frontend service
frontend:
image: ghcr.io/hpi-sam/dps_training_k-frontend:latest
container_name: K-dPS-frontend
labels:
- "com.centurylinklabs.watchtower.enable=true"
volumes:
local_postgres_data: { }
local_postgres_data_backups: { }
static_volume: { }