-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yml
199 lines (189 loc) · 4.25 KB
/
docker-compose.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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
version: "3.8"
services:
api:
extends:
file: ./docker-compose.common.yml
service: application
container_name: todo_api
command:
[
"uvicorn",
"src.main:application",
"--reload",
"--host",
"0.0.0.0",
"--port",
"8000"
]
networks:
- todo_network
ports:
- "8000:8000"
restart: always
healthcheck:
test:
[
"CMD-SHELL",
"curl --fail http://localhost:8000/ping || exit 1"
]
interval: 5s
timeout: 5s
retries: 10
depends_on:
postgres:
condition: service_healthy
rabbitmq:
condition: service_healthy
celery-beat-scheduler:
extends:
file: ./docker-compose.common.yml
service: application
container_name: todo_celery_beat_scheduler
command:
[
"celery",
"--app",
"src.background_tasks.main",
"beat",
"--loglevel",
"info"
]
networks:
- todo_network
restart: always
depends_on:
postgres:
condition: service_healthy
rabbitmq:
condition: service_healthy
celery-worker:
extends:
file: ./docker-compose.common.yml
service: application
container_name: todo_celery_worker
command:
[
"celery",
"--app",
"src.background_tasks.main",
"worker",
"--loglevel",
"info"
]
networks:
- todo_network
restart: always
healthcheck:
test:
[
"CMD-SHELL",
"celery -A src.background_tasks.main inspect ping"
]
interval: 5s
timeout: 5s
retries: 10
depends_on:
postgres:
condition: service_healthy
rabbitmq:
condition: service_healthy
postgres:
image: postgres:15.2-alpine
container_name: todo_postgres
command:
[
"postgres",
"-c",
"timezone=UTC",
"-c",
"shared_buffers=2GB",
"-c",
"work_mem=16GB",
# rough estimate of the number of how much memory is available
# for disk caching by the OS
"-c",
"effective_cache_size=4GB"
]
environment:
- POSTGRES_DB
- POSTGRES_USER
- POSTGRES_PASSWORD
volumes:
- todo_postgres_volume:/var/lib/postgresql/data:rw
networks:
- todo_network
ports:
- "4444:5432"
restart: always
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U ${POSTGRES_USER}" ]
interval: 5s
timeout: 5s
retries: 10
postgres_test:
image: postgres:15.2-alpine
container_name: todo_postgres_test
environment:
- POSTGRES_DB=test_database
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=test_password
networks:
- todo_network
ports:
- "4445:5432"
restart: always
rabbitmq:
image: rabbitmq:3.11-management
container_name: todo_rabbitmq
environment:
- RABBITMQ_DEFAULT_USER=${RABBITMQ_USER}
- RABBITMQ_DEFAULT_PASS=${RABBITMQ_PASSWORD}
- RABBITMQ_DEFAULT_VHOST=${RABBITMQ_VIRTUAL_HOST}
volumes:
- todo_rabbitmq_volume:/var/lib/rabbitmq:rw
networks:
- todo_network
ports:
- "15672:15672"
restart: always
healthcheck:
test: [ "CMD-SHELL", "rabbitmq-diagnostics -q ping" ]
interval: 5s
timeout: 5s
retries: 10
flower:
image: mher/flower:1.2
container_name: todo_flower
command:
[
"celery",
"--broker=amqp://${RABBITMQ_USER}:${RABBITMQ_PASSWORD}@${RABBITMQ_HOST}:5672/${RABBITMQ_VIRTUAL_HOST}",
"flower",
"--broker_api=http://${RABBITMQ_USER}:${RABBITMQ_PASSWORD}@${RABBITMQ_HOST}:15672/api/",
"--basic_auth=${FLOWER_USER}:${FLOWER_PASSWORD}"
]
networks:
- todo_network
ports:
- "5555:5555"
restart: always
mailhog:
image: mailhog/mailhog:v1.0.1
container_name: todo_mailhog
networks:
- todo_network
ports:
- "1025:1025"
- "8025:8025"
restart: always
networks:
todo_network:
name: todo_network
driver: bridge
volumes:
todo_postgres_volume:
name: todo_postgres_volume
driver: local
todo_rabbitmq_volume:
name: todo_rabbitmq_volume
driver: local