-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.prod.yml
158 lines (139 loc) · 3.69 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
version: '3.8'
services:
client:
container_name: client
build:
context: ./client
dockerfile: Dockerfile.prod
restart: unless-stopped
depends_on:
- core
volumes:
- build_volume:/usr/src/app/client/dist
core:
container_name: core
build:
context: ./core
dockerfile: Dockerfile.prod
restart: unless-stopped
entrypoint: ./entrypoint.prod.sh
command: daphne core.asgi:application -b 0.0.0.0 -p 8000
depends_on:
database:
condition: service_healthy
elastic:
condition: service_healthy
redis:
condition: service_healthy
celery:
condition: service_healthy
expose:
- 8000
volumes:
- django_static_volume:/usr/src/app/django_static
- django_media_volume:/usr/src/app/django_media
env_file:
- ./env_files/core/.prod.env
database:
container_name: database
image: postgres:15-alpine
restart: unless-stopped
expose:
- 5432
volumes:
- database_volume:/var/lib/postgresql/data
env_file:
- ./env_files/database/.prod.env
healthcheck:
test: pg_isready
interval: 30s
timeout: 10s
retries: 5
redis:
container_name: redis
image: redis:7-alpine
restart: unless-stopped
expose:
- 6379
command: redis-server /usr/local/etc/redis/redis.prod.conf
volumes:
- ./redis/redis.prod.conf:/usr/local/etc/redis/redis.prod.conf
healthcheck:
test: redis-cli -a $REDIS_PASSWORD --raw incr ping
interval: 30s
timeout: 10s
retries: 5
celery:
container_name: celery
build:
context: ./core
dockerfile: Dockerfile.prod
restart: unless-stopped
command: celery -A core.celery_app worker --loglevel=info --logfile=logs/celery.log
volumes:
- celery_logs:/usr/src/app/logs
- django_media_volume:/usr/src/app/django_media
env_file:
- ./env_files/core/.prod.env
- ./env_files/celery/.prod.env
depends_on:
redis:
condition: service_healthy
healthcheck:
test: celery -A core.celery_app inspect ping
interval: 30s
timeout: 10s
retries: 5
flower:
container_name: flower
build:
context: ./core
dockerfile: Dockerfile.prod
restart: unless-stopped
command: celery -A core.celery_app flower --port=5555 --url-prefix=flower
expose:
- 5555
env_file:
- ./env_files/core/.prod.env
- ./env_files/flower/.prod.env
depends_on:
redis:
condition: service_healthy
celery:
condition: service_healthy
nginx:
container_name: nginx
build: ./nginx
restart: unless-stopped
ports:
- 80:80
volumes:
- django_static_volume:/usr/src/app/django_static
- django_media_volume:/usr/src/app/django_media
- build_volume:/usr/src/app/build
depends_on:
- core
- client
elastic:
container_name: elastic
image: elasticsearch:7.14.0
restart: unless-stopped
expose:
- 9200
environment:
- "bootstrap.memory_lock=true"
- "ES_JAVA_OPTS=-Xms1024m -Xmx1024m"
env_file:
- ./env_files/elastic/.prod.env
healthcheck:
test: curl -s http://elastic:$ELASTIC_PASSWORD@elastic:9200 >/dev/null || exit 1
interval: 30s
timeout: 10s
start_period: 10s
retries: 10
volumes:
database_volume:
celery_logs:
django_static_volume:
django_media_volume:
build_volume: