-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
260 lines (239 loc) · 6.36 KB
/
docker-compose.yml
File metadata and controls
260 lines (239 loc) · 6.36 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
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
volumes:
postgres-data:
driver: local
kafka-data:
driver: local
clickhouse-data:
driver: local
redis-data:
driver: local
services:
haproxy:
image: haproxy:3.0-alpine
ports:
- "3000:3000"
volumes:
- ./docker-compose/haproxy/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg
depends_on:
- core
- query
- ui
redis:
image: redis:7-alpine
volumes:
- redis-data:/data
kafka:
image: docker.io/bitnami/kafka:3.7
environment:
ALLOW_PLAINTEXT_LISTENER: "yes"
KAFKA_BROKER_ID: "1"
KAFKA_CFG_NODE_ID: "1"
KAFKA_CFG_ADVERTISED_LISTENERS: "PLAINTEXT://kafka:9092"
KAFKA_CFG_CONTROLLER_LISTENER_NAMES: "CONTROLLER"
KAFKA_CFG_CONTROLLER_QUORUM_VOTERS: "1@kafka:9093"
KAFKA_CFG_LISTENERS: "CONTROLLER://kafka:9093,PLAINTEXT://:9092"
KAFKA_CFG_PROCESS_ROLES: "broker,controller"
KAFKA_ENABLE_KRAFT: "yes"
volumes:
- ./docker-compose/kafka/initdb.d:/docker-entrypoint-initdb.d
- kafka-data:/bitnami
healthcheck:
test: ["CMD-SHELL", "kafka-topics.sh --bootstrap-server kafka:9092 --list"]
interval: 30s
timeout: 10s
retries: 50
postgres:
image: postgres:17
environment:
POSTGRES_HOST_AUTH_METHOD: trust
volumes:
- ./docker-compose/postgres/create-db.sql:/docker-entrypoint-initdb.d/create-db.sql
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
start_period: 1m
clickhouse:
image: clickhouse/clickhouse-server:24-alpine
depends_on:
kafka:
condition: service_started
restart: on-failure
volumes:
- ./docker-compose/clickhouse/config.d:/etc/clickhouse-server/config.d
- ./docker-compose/clickhouse/initdb.d:/docker-entrypoint-initdb.d
- clickhouse-data:/var/lib/clickhouse
ulimits:
nofile:
soft: 262144
hard: 262144
cap_add:
- SYS_NICE
- NET_ADMIN
- IPC_LOCK
- SYS_PTRACE
healthcheck:
test: wget --no-verbose --tries=1 --spider http://clickhouse:8123/ping || exit 1
interval: 30s
timeout: 10s
retries: 50
core: &core-config
build:
context: .
dockerfile: core.srv/Dockerfile
target: development
volumes:
- ./core.srv:/app
depends_on:
redis:
condition: service_started
postgres:
condition: service_healthy
environment:
API_PORT: "8000"
CELERY_BROKER_URL: "redis://redis:6379/0"
DB_DATABASE: "weatherapp_core"
DB_HOST: "postgres"
DB_PASSWORD: ""
DB_USERNAME: "postgres"
DEBUG: ${DEBUG:-1}
KAFKA_BOOTSTRAP_SERVERS: "kafka:9092"
SECRET_KEY: ${SECRET_KEY:-security_key}
SENTRY_DSN: ${SENTRY_DSN:-}
SENTRY_ENVIRONMENT: ${SENTRY_ENVIRONMENT:-}
UVICORN_HOST: "0.0.0.0"
UVICORN_PORT: "8000"
ports:
- "8000:8000"
core-worker:
<<: *core-config
depends_on:
kafka:
condition: service_healthy
redis:
condition: service_started
postgres:
condition: service_healthy
ports: []
command: celery -A weatherapp_core.celery worker -c 1
core-beat:
<<: *core-config
depends_on:
redis:
condition: service_started
ports: []
command: celery -A weatherapp_core.celery beat
core-migrate:
<<: *core-config
ports: []
profiles: ["migrate"]
command: python manage.py migrate
core-stream:
<<: *core-config
ports: []
profiles: ["stream"]
command: python manage.py kafkastreamer_refresh
core-test:
<<: *core-config
ports: []
profiles: ["test"]
command: pytest ${PYTEST_OPTS:-}
loader: &loader-config
build:
context: .
dockerfile: loader.srv/Dockerfile
target: development
volumes:
- ./loader.srv:/app
depends_on:
redis:
condition: service_started
kafka:
condition: service_healthy
environment:
KAFKA_BOOTSTRAP_SERVERS: "kafka:9092"
REDIS_QUEUE_URL: "redis://redis:6379/1"
REDIS_STORAGE_URL: "redis://redis:6379/2"
SENTRY_DSN: ${SENTRY_DSN:-}
SENTRY_ENVIRONMENT: ${SENTRY_ENVIRONMENT:-}
loader-tasks:
<<: *loader-config
command: python -m weatherapp_loader.tasks.worker
loader-stream:
<<: *loader-config
profiles: ["stream"]
command: python -m weatherapp_loader.tasks.run stream-weather
loader-test:
<<: *loader-config
environment:
REDIS_QUEUE_URL: "redis://redis:6379/11"
REDIS_STORAGE_URL: "redis://redis:6379/12"
profiles: ["test"]
command: pytest ${PYTEST_OPTS:-}
query: &query-config
build:
context: .
dockerfile: query.srv/Dockerfile
target: development
volumes:
- ./query.srv:/app
depends_on:
clickhouse:
condition: service_healthy
ports:
- "8001:8001"
environment:
CLICKHOUSE_URL: "http://clickhouse:8123"
CLICKHOUSE_DATABASE: weatherapp_query
CLICKHOUSE_USER: default
CLICKHOUSE_PASSWORD: ""
SECRET_KEY: ${SECRET_KEY:-security_key}
SENTRY_DSN: ${SENTRY_DSN:-}
SENTRY_ENVIRONMENT: ${SENTRY_ENVIRONMENT:-}
UVICORN_HOST: "0.0.0.0"
UVICORN_PORT: 8001
query-migrate:
build:
context: query.srv
dockerfile: Dockerfile.migrations
volumes:
- ./query.srv/migrations:/migrations
depends_on:
clickhouse:
condition: service_healthy
environment:
GOOSE_DRIVER: clickhouse
GOOSE_DBSTRING: "clickhouse://default@clickhouse:9000/weatherapp_query"
profiles: ["migrate"]
command: goose up
query-test:
<<: *query-config
ports: []
command: pytest ${PYTEST_OPTS:-}
ui:
build:
context: .
dockerfile: ui/Dockerfile
target: development
volumes:
- ./ui/public:/app/public
- ./ui/src:/app/src
environment:
VITE_CORE_API_BASE_URL: "http://localhost:3000/core/api"
VITE_QUERY_API_BASE_URL: "http://localhost:3000/query/api"
ports:
- "3039:3039"
kafka-ui:
image: provectuslabs/kafka-ui:latest
ports:
- 8080:8080
depends_on:
- kafka
environment:
KAFKA_CLUSTERS_0_NAME: kafka
KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS: kafka:9092
KAFKA_CLUSTERS_0_METRICS_PORT: 9997
DYNAMIC_CONFIG_ENABLED: 'true'
profiles: ["monitor"]