-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose-prod.yaml
More file actions
132 lines (125 loc) · 3.39 KB
/
docker-compose-prod.yaml
File metadata and controls
132 lines (125 loc) · 3.39 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
services:
db:
image: postgres:16
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- "127.0.0.1:15432:5432" # left open for manual intervention
volumes:
- db-data:/var/lib/postgresql/data
networks:
- app-network
healthcheck:
test: [ "CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}" ]
interval: 10s
timeout: 5s
retries: 5
backend:
build:
context: .
dockerfile: Dockerfile
networks:
- app-network
environment: &backend-environment
- VOLUNTEERS_LOGGING__LEVEL=${VOLUNTEERS_LOGGING__LEVEL}
- VOLUNTEERS_JWT__SECRET=${VOLUNTEERS_JWT__SECRET}
- VOLUNTEERS_JWT__ALGORITHM=${VOLUNTEERS_JWT__ALGORITHM}
- VOLUNTEERS_JWT__EXPIRATION=${VOLUNTEERS_JWT__EXPIRATION}
- VOLUNTEERS_JWT__REFRESH_EXPIRATION=${VOLUNTEERS_JWT__REFRESH_EXPIRATION}
- VOLUNTEERS_TELEGRAM__TOKEN=${VOLUNTEERS_TELEGRAM__TOKEN}
- VOLUNTEERS_TELEGRAM__EXPIRATION_TIME=${VOLUNTEERS_TELEGRAM__EXPIRATION_TIME}
- VOLUNTEERS_DATABASE__URL=${VOLUNTEERS_DATABASE__URL}
- VOLUNTEERS_SERVER__PORT=${VOLUNTEERS_SERVER__PORT}
- VOLUNTEERS_SERVER__HOST=${VOLUNTEERS_SERVER__HOST}
healthcheck:
test: [ "CMD-SHELL", "curl http://localhost:8000/hc 2> /dev/null | grep -q 'OK'" ]
interval: 10s
timeout: 5s
retries: 5
depends_on:
db:
condition: service_healthy
backend-db-migration:
condition: service_completed_successfully
backend-db-migration:
build:
context: .
dockerfile: Dockerfile
networks:
- app-network
command: bash -c "alembic upgrade head"
environment: *backend-environment
depends_on:
db:
condition: service_healthy
frontend:
build:
context: ui
dockerfile: Dockerfile
args:
- PUBLIC_URL=${PUBLIC_URL}
- MODE=${MODE}
- VITE_TELEGRAM_BOT_HANDLE=${VITE_TELEGRAM_BOT_HANDLE}
- VITE_TELEGRAM_BOT_ORIGIN=${VITE_TELEGRAM_BOT_ORIGIN}
networks:
- app-network
healthcheck:
test: ["CMD-SHELL", "curl http://localhost:8000/nginx-hc 2> /dev/null | grep -q 'OK'"]
interval: 10s
timeout: 5s
retries: 5
proxy:
build:
context: proxy
dockerfile: Dockerfile
ports:
- "${PUBLIC_PORT}:8000"
networks:
- app-network
- proxy
environment:
- PORT=8000
- BACKEND_SITE=http://backend:8000
- FRONTEND_SITE=http://frontend:8000
- VIRTUAL_HOST=${PUBLIC_URL}
- VIRTUAL_PORT=8000
healthcheck:
test: ["CMD-SHELL", "curl http://localhost:$$PORT/nginx-hc | grep -q 'OK'"]
interval: 10s
timeout: 5s
retries: 5
depends_on:
backend:
condition: service_healthy
frontend:
condition: service_healthy
backup:
build:
context: backup
dockerfile: Dockerfile
networks:
- app-network
environment:
- DB_HOST=db
- DB_PORT=5432
- DB_NAME=postgres
- DB_USER=postgres
- DB_PASSWORD=postgres
- BACKUP_DIR=/backups
- RETENTION_DAYS=2
volumes:
- ./backups:/backups
- ./backups/log.txt:/var/log/backup.log
depends_on:
db:
condition: service_healthy
restart: unless-stopped
volumes:
db-data:
networks:
app-network:
driver: bridge
proxy:
external: true