-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
281 lines (263 loc) · 7.69 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
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
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
version: '3'
x-spark-common: &spark-common
image: bitnami/spark:3.2.4
volumes:
- ./project-core:/opt/bitnami/spark/jobs
command: bin/spark-class org.apache.spark.deploy.worker.Worker ${SPARK_MASTER_URL}
depends_on:
- spark-master
env_file:
- .env
environment:
SPARK_MODE: worker
SPARK_WORKER_CORES: ${SPARK_WORKER_CORES}
SPARK_WORKER_MEMORY: ${SPARK_WORKER_MEMORY}
SPARK_MASTER_URL: ${SPARK_MASTER_URL}
MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY}
MINIO_SECRET_KEY: ${MINIO_SECRET_KEY}
networks:
- app-network
services:
zookeeper:
image: confluentinc/cp-zookeeper:7.4.0
hostname: zookeeper
container_name: zookeeper
ports:
- "2181:2181"
env_file:
- .env
healthcheck:
test: [ 'CMD', 'bash', '-c', "echo 'ruok' | nc localhost ${ZOOKEEPER_CLIENT_PORT}" ]
interval: 10s
timeout: 5s
retries: 5
networks:
- app-network
broker:
image: confluentinc/cp-server:7.4.0
hostname: broker
container_name: broker
depends_on:
zookeeper:
condition: service_healthy
ports:
- "9092:9092"
- "9101:9101"
environment:
KAFKA_BROKER_ID: ${KAFKA_BROKER_ID}
KAFKA_ZOOKEEPER_CONNECT: ${KAFKA_ZOOKEEPER_CONNECT}
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: ${KAFKA_LISTENER_SECURITY_PROTOCOL_MAP}
KAFKA_ADVERTISED_LISTENERS: ${KAFKA_ADVERTISED_LISTENERS}
KAFKA_METRIC_REPORTERS: ${KAFKA_METRIC_REPORTERS}
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: ${KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR}
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: ${KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS}
KAFKA_CONFLUENT_LICENSE_TOPIC_REPLICATION_FACTOR: ${KAFKA_CONFLUENT_LICENSE_TOPIC_REPLICATION_FACTOR}
KAFKA_CONFLUENT_BALANCER_TOPIC_REPLICATION_FACTOR: ${KAFKA_CONFLUENT_BALANCER_TOPIC_REPLICATION_FACTOR}
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: ${KAFKA_TRANSACTION_STATE_LOG_MIN_ISR}
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: ${KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR}
KAFKA_JMX_PORT: ${KAFKA_JMX_PORT}
KAFKA_JMX_HOSTNAME: ${KAFKA_JMX_HOSTNAME}
KAFKA_CONFLUENT_SCHEMA_REGISTRY_URL: ${KAFKA_CONFLUENT_SCHEMA_REGISTRY_URL}
CONFLUENT_METRICS_REPORTER_BOOTSTRAP_SERVERS: ${CONFLUENT_METRICS_REPORTER_BOOTSTRAP_SERVERS}
CONFLUENT_METRICS_REPORTER_TOPIC_REPLICAS: ${CONFLUENT_METRICS_REPORTER_TOPIC_REPLICAS}
CONFLUENT_METRICS_ENABLE: ${CONFLUENT_METRICS_ENABLE}
CONFLUENT_SUPPORT_CUSTOMER_ID: ${CONFLUENT_SUPPORT_CUSTOMER_ID}
healthcheck:
test: [ 'CMD', 'bash', '-c', "nc -z localhost 9092" ]
interval: 10s
timeout: 5s
retries: 5
networks:
- app-network
restart: on-failure
init-kafka:
build: ./init-kafka
networks:
- app-network
depends_on:
broker:
condition: service_healthy
spark-master:
image: bitnami/spark:3.2.4
volumes:
- ./project-core:/opt/bitnami/spark/jobs
env_file:
- .env
environment:
MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY}
MINIO_SECRET_KEY: ${MINIO_SECRET_KEY}
command: bin/spark-class org.apache.spark.deploy.master.Master
ports:
- "9090:8080"
- "7077:7077"
networks:
- app-network
twitter-streamer-1:
build: ./twitter-streamer
volumes:
- ./project-core/src:/app/src
env_file:
- .env
networks:
- app-network
depends_on:
- broker
reddit-streamer-1:
build: ./reddit-streamer
volumes:
- ./project-core/src:/app/src
env_file:
- .env
networks:
- app-network
depends_on:
- broker
fastapi-ml-endpoint:
build: ./fastapi-ml-endpoint
ports:
- "8000:8000"
restart: always
networks:
- app-network
spark-worker-1:
<<: *spark-common
spark-worker-2:
<<: *spark-common
flask-backend:
build: ./flask-dashboard # Now it builds from the Dockerfile
container_name: flask-backend
volumes:
- ./flask-dashboard:/app # Mounts the app folder
ports:
- "5000:5000"
networks:
- app-network
minio:
image: minio/minio:latest
container_name: minio
ports:
- "9000:9000" # web console/API
- "9001:9001" # web admin console
env_file:
- .env
command: server /data --console-address ":9001"
volumes:
- ./minio/data:/data
networks:
- app-network
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:9000/minio/health/live" ]
interval: 30s
timeout: 10s
retries: 3
minio-init:
image: minio/mc:latest
container_name: minio-init
depends_on:
minio:
condition: service_healthy # Ensures MinIO is ready
entrypoint: >
/bin/sh -c " echo 'Waiting for MinIO...'; mc alias set myminio http://minio:9000 admin password; mc mb myminio/reddit-data; mc mb myminio/twitter-data; mc mb myminio/mlflow; mc mb myminio/processed-data; mc mb myminio/zenml; echo 'Buckets created!'; exit 0;"
networks:
- app-network
redis:
image: redis:latest
ports:
- "6379:6379"
volumes:
- ./redis:/data
command: [ "redis-server", "--appendonly", "yes" ]
restart: always
networks:
- app-network
postgres:
image: postgres:14
env_file:
- .env
ports:
- "5432:5432"
volumes:
- ./postgres:/var/lib/postgresql/data
networks:
- app-network
command: >
bash -c "
docker-entrypoint.sh postgres &
until pg_isready -U $$POSTGRES_USER -h localhost; do sleep 2; done &&
psql -U $$POSTGRES_USER -tc \"SELECT 1 FROM pg_database WHERE datname = 'mlflow'\" | grep -q 1 || echo \"CREATE DATABASE mlflow;\" | psql -U $$POSTGRES_USER &&
psql -U $$POSTGRES_USER -tc \"SELECT 1 FROM pg_database WHERE datname = 'airflow'\" | grep -q 1 || echo \"CREATE DATABASE airflow;\" | psql -U $$POSTGRES_USER &&
psql -U $$POSTGRES_USER -tc \"SELECT 1 FROM pg_database WHERE datname = 'zenml'\" | grep -q 1 || echo \"CREATE DATABASE zenml;\" | psql -U $$POSTGRES_USER &&
wait"
restart: always
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U $POSTGRES_USER -h localhost" ]
interval: 10s
timeout: 5s
retries: 5
mlflow:
image: mlflow:latest
build: ./mlflow
env_file:
- .env
depends_on:
postgres:
condition: service_healthy
minio:
condition: service_healthy
ports:
- "5001:5001"
networks:
- app-network
command: mlflow server --host 0.0.0.0 --port 5001 --backend-store-uri postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/mlflow --default-artifact-root s3://mlflow/
restart: always
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5001/api/2.0/mlflow/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
kafka-minio:
build: ./kafka-minio
volumes:
- ./project-core/src:/app/src
env_file:
- .env
networks:
- app-network
depends_on:
broker:
condition: service_healthy
minio:
condition: service_healthy
etl-data-aggregator:
build: ./etl-data-aggregator
volumes:
- ./project-core/src:/app/src
env_file:
- .env
networks:
- app-network
depends_on:
minio:
condition: service_healthy
zenml:
image: zenmldocker/zenml-server:latest
ports:
- "8082:8080"
env_file:
- .env
networks:
- app-network
depends_on:
postgres:
condition: service_healthy
minio:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
networks:
app-network: