Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
184 lines (174 loc) · 6.21 KB
/
Copy pathdocker-compose.yml
File metadata and controls
184 lines (174 loc) · 6.21 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
# Stack locale VigiRoute
#
# Services :
# - zookeeper (Apache Kafka coordination)
# - kafka (1 broker, écoute localhost:9092 + kafka:29092)
# - redis (index géospatial pour position_updater / danger_detector)
# - minio (data lake S3-compatible, console http://localhost:9001)
# - spark-master (cluster Spark master, UI http://localhost:8080)
# - spark-worker (1 worker, UI http://localhost:8081)
#
# Les 5 composants applicatifs (Scala/sbt) tournent en dehors du compose :
# sbt "producer/run" / "positionUpdater/run" / "dangerDetector/run"
# / "notifier/run" / "bronzeWriter/run"
# et `spark-submit` pour les jobs `batch`.
#
# Couche de démo (soutenance), également hors compose :
# - demo-bridge (pont SSE/REST) : sbt "demoBridge/run" (port 8090)
# - front React/Vite : cd web && npm i && npm run dev (port 5173)
# Procédure complète : docs/DEMO.md
#
# Démarrage : docker compose up -d
# Arrêt : docker compose down
# Reset total : docker compose down -v
services:
zookeeper:
image: confluentinc/cp-zookeeper:7.6.1
container_name: vigiroute-zookeeper
ports:
- "2181:2181"
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
volumes:
- zookeeper-data:/var/lib/zookeeper/data
- zookeeper-log:/var/lib/zookeeper/log
healthcheck:
# L'image cp-zookeeper ne fournit pas `nc` et n'active pas la commande
# `ruok` ; on sonde simplement l'ouverture du port client via /dev/tcp.
test: ["CMD-SHELL", "bash -c 'echo > /dev/tcp/localhost/2181'"]
interval: 10s
timeout: 5s
retries: 10
kafka:
image: confluentinc/cp-kafka:7.6.1
container_name: vigiroute-kafka
depends_on:
zookeeper:
condition: service_healthy
ports:
- "9092:9092"
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
# Deux listeners : un pour les autres containers (kafka:29092),
# un pour le host (localhost:9092).
KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:29092,PLAINTEXT_HOST://0.0.0.0:9092
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "false"
volumes:
- kafka-data:/var/lib/kafka/data
healthcheck:
test: ["CMD-SHELL", "kafka-broker-api-versions --bootstrap-server localhost:9092 >/dev/null 2>&1"]
interval: 15s
timeout: 10s
retries: 10
# Création automatique des topics au premier démarrage.
# `vehicle-telemetry` partitionné par zone géo (clé Kafka = zone_id).
kafka-init:
image: confluentinc/cp-kafka:7.6.1
container_name: vigiroute-kafka-init
depends_on:
kafka:
condition: service_healthy
entrypoint: ["/bin/bash", "-c"]
command: |
"
kafka-topics --bootstrap-server kafka:29092 --create --if-not-exists --topic vehicle-telemetry --partitions 6 --replication-factor 1 &&
kafka-topics --bootstrap-server kafka:29092 --create --if-not-exists --topic driver-alerts --partitions 3 --replication-factor 1 &&
kafka-topics --bootstrap-server kafka:29092 --create --if-not-exists --topic driver-alerts.dlq --partitions 1 --replication-factor 1 &&
echo '--- topics créés ---' &&
kafka-topics --bootstrap-server kafka:29092 --list
"
restart: "no"
redis:
image: redis:7.4-alpine
container_name: vigiroute-redis
ports:
- "6379:6379"
volumes:
- redis-data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 5
minio:
image: minio/minio:RELEASE.2025-04-22T22-12-26Z
container_name: vigiroute-minio
ports:
- "9000:9000" # S3 API
- "9001:9001" # Console web
environment:
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadmin
command: server /data --console-address ":9001"
volumes:
- minio-data:/data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 10s
timeout: 5s
retries: 5
# Création automatique du bucket `vigiroute` et des dossiers bronze/silver/gold.
minio-init:
image: minio/mc:RELEASE.2025-04-16T18-13-26Z
container_name: vigiroute-minio-init
depends_on:
minio:
condition: service_healthy
entrypoint: ["/bin/sh", "-c"]
command: |
"
mc alias set local http://minio:9000 minioadmin minioadmin &&
mc mb --ignore-existing local/vigiroute &&
mc mb --ignore-existing local/vigiroute/bronze &&
mc mb --ignore-existing local/vigiroute/silver &&
mc mb --ignore-existing local/vigiroute/gold &&
echo '--- bucket vigiroute prêt ---'
"
restart: "no"
# Image officielle Apache Spark (le namespace bitnami/* a été retiré de Docker
# Hub en 2025). On lance master/worker directement via `spark-class`, en
# contournant l'entrypoint k8s de l'image (entrypoint vidé).
spark-master:
image: apache/spark:3.5.1
container_name: vigiroute-spark-master
entrypoint: ["/opt/spark/bin/spark-class"]
command: ["org.apache.spark.deploy.master.Master"]
ports:
- "7077:7077" # cluster
- "8080:8080" # web UI
volumes:
- ./batch:/workspace/batch:ro
# Montage en écriture pour l'export des analyses de démo
# (com.vigiroute.batch.AnalyticsExport → /workspace/demo-data). Cf. docs/DEMO.md.
- ./demo-data:/workspace/demo-data
spark-worker:
image: apache/spark:3.5.1
container_name: vigiroute-spark-worker
depends_on:
- spark-master
entrypoint: ["/opt/spark/bin/spark-class"]
command:
- "org.apache.spark.deploy.worker.Worker"
- "spark://spark-master:7077"
- "--cores"
- "2"
- "--memory"
- "2G"
ports:
- "8081:8081"
volumes:
- ./batch:/workspace/batch:ro
volumes:
zookeeper-data:
zookeeper-log:
kafka-data:
redis-data:
minio-data: