-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
124 lines (115 loc) · 2.67 KB
/
docker-compose.prod.yml
File metadata and controls
124 lines (115 loc) · 2.67 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
version: '3.8'
services:
frontend:
build:
dockerfile: Dockerfile.prod
context: ./frontend/
command: >
sh -c "yes | npx serve -l 3000 -s -n build"
container_name: frontend
volumes:
- /app/node_modules
- /app/build
- ./frontend:/app
ports:
- "82:3000"
environment:
- CHOKIDAR_USEPOLLING=true
depends_on:
- backend
stdin_open: true
tty: true
backend:
build:
dockerfile: Dockerfile
context: ./backend
command: >
sh -c "python manage.py migrate --run-syncdb &&
python manage.py collectstatic --noinput &&
python manage.py runserver 0.0.0.0:8000"
container_name: backend
image: backend-img
volumes:
- ./backend:/app
ports:
- "81:8000"
env_file:
- .env.prod
depends_on:
db:
condition: service_healthy
nginx:
image: nginx:latest
container_name: nginx
ports:
- "80:80"
- "443:443"
depends_on:
- backend
- frontend
volumes:
- ./nginx/nginx.prod.conf:/etc/nginx/nginx.conf:ro
- /etc/letsencrypt/live/psycholebedenko.com/fullchain.pem:/etc/nginx/ssl/fullchain.pem:ro
- /etc/letsencrypt/live/psycholebedenko.com/privkey.pem:/etc/nginx/ssl/privkey.pem:ro
telebot:
image: backend-img
container_name: telebot
env_file:
- .env.prod
command: >
sh -c "python manage.py runbot"
depends_on:
- backend
db:
image: postgres:15.4
container_name: db
volumes:
- ./data/db:/var/lib/postgresql/data
env_file:
- .env.db
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
interval: 20s
timeout: 10s
retries: 3
rabbitmq:
restart: always
image: rabbitmq:latest
container_name: rabbitmq
hostname: rabbit
environment:
- RABBITMQ_DEFAULT_USER=admin
- RABBITMQ_DEFAULT_PASS=admin
- RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS=+sbwt none +sbwtdcpu none +sbwtdio none
ports:
- "5672:5672"
worker:
image: backend-img
container_name: worker
env_file:
- .env.prod
command: >
sh -c "celery -A app worker -l info
--without-heartbeat --without-gossip --without-mingle"
depends_on:
- rabbitmq
celery-beat:
image: backend-img
container_name: celery-beat
env_file:
- .env.prod
command: >
sh -c "celery -A app beat -l info"
depends_on:
- rabbitmq
redis:
image: redis:latest
container_name: redis
command: redis-server
hostname: redis
volumes:
- ./redis:/var/lib/redis
ports:
- 6379:6379