-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
233 lines (223 loc) · 6.96 KB
/
Copy pathdocker-compose.yml
File metadata and controls
233 lines (223 loc) · 6.96 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
services:
# ---------------------------------------------------------------------------
# 1. CORE API BACKEND (FastAPI + PyTorch + FAISS + APEX Ensemble)
# ---------------------------------------------------------------------------
apex-backend:
build:
context: .
dockerfile: backend/Dockerfile
container_name: apex-backend
restart: unless-stopped
ports:
- "8000:8000"
environment:
- ENVIRONMENT=production
- NOVA_SERVING_PROFILE=full
- NOVA_SERVING_TIER=tier2
- APEX_DP_EPSILON=1.0
- KAFKA_BROKER_URL=kafka:9092
volumes:
- ./data:/app/data # Share the Delta Lake with the backend
depends_on:
kafka:
condition: service_healthy
spark-master:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"]
interval: 30s
timeout: 10s
retries: 5
start_period: 60s
networks:
- apex-net
# ---------------------------------------------------------------------------
# 2. FRONTEND (React + Vite UI)
# ---------------------------------------------------------------------------
apex-frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: apex-frontend
restart: unless-stopped
ports:
- "5173:5173"
environment:
- VITE_API_URL=http://localhost:8000
depends_on:
apex-backend:
condition: service_healthy
networks:
- apex-net
# ---------------------------------------------------------------------------
# 3. MESSAGE BROKER (Kafka for Real-Time Active Inference Stream)
# ---------------------------------------------------------------------------
zookeeper:
image: confluentinc/cp-zookeeper:7.3.0
container_name: zookeeper
restart: unless-stopped
environment:
ZOOKEEPER_CLIENT_PORT: 2181
healthcheck:
test: ["CMD", "nc", "-z", "localhost", "2181"]
interval: 10s
timeout: 5s
retries: 5
networks:
- apex-net
kafka:
image: confluentinc/cp-kafka:7.3.0
container_name: kafka
restart: unless-stopped
depends_on:
zookeeper:
condition: service_healthy
ports:
- "9092:9092"
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,PLAINTEXT_HOST://localhost:29092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
healthcheck:
test: ["CMD", "kafka-broker-api-versions", "--bootstrap-server", "localhost:9092"]
interval: 30s
timeout: 10s
retries: 5
start_period: 30s
networks:
- apex-net
# ---------------------------------------------------------------------------
# 3.5 HIGH-THROUGHPUT FEATURE STORE (Redis)
# ---------------------------------------------------------------------------
redis:
image: redis:7-alpine
container_name: redis-feature-store
restart: unless-stopped
ports:
- "6379:6379"
command: redis-server --save 60 1 --loglevel warning
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- apex-net
# ---------------------------------------------------------------------------
# 4. BIG DATA COMPUTE (Distributed PySpark Cluster)
# ---------------------------------------------------------------------------
spark-master:
image: bitnami/spark:3.4.1
container_name: spark-master
restart: unless-stopped
environment:
- SPARK_MODE=master
- SPARK_RPC_AUTHENTICATION_ENABLED=no
- SPARK_RPC_ENCRYPTION_ENABLED=no
- SPARK_LOCAL_STORAGE_ENCRYPTION_ENABLED=no
- SPARK_SSL_ENABLED=no
ports:
- "8080:8080" # Spark UI
- "7077:7077" # Master Port
volumes:
- ./data:/app/data # Mount Data Lake
- ./scripts:/app/scripts # Mount Medallion Pipeline Scripts
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080"]
interval: 30s
timeout: 10s
retries: 5
start_period: 30s
networks:
- apex-net
spark-worker:
image: bitnami/spark:3.4.1
container_name: spark-worker
restart: unless-stopped
environment:
- SPARK_MODE=worker
- SPARK_MASTER_URL=spark://spark-master:7077
- SPARK_WORKER_MEMORY=4G
- SPARK_WORKER_CORES=2
- SPARK_RPC_AUTHENTICATION_ENABLED=no
- SPARK_RPC_ENCRYPTION_ENABLED=no
- SPARK_LOCAL_STORAGE_ENCRYPTION_ENABLED=no
- SPARK_SSL_ENABLED=no
depends_on:
spark-master:
condition: service_healthy
volumes:
- ./data:/app/data
- ./scripts:/app/scripts
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8081"]
interval: 30s
timeout: 10s
retries: 5
start_period: 30s
networks:
- apex-net
# ---------------------------------------------------------------------------
# 5. RELATIONAL DATABASE (PostgreSQL for Multi-Tenancy & Auth)
# ---------------------------------------------------------------------------
postgres:
image: postgres:15-alpine
container_name: postgres-db
restart: unless-stopped
environment:
# Override these in a .env file or shell environment for local dev.
# NEVER commit real credentials. See .env.example for variable names.
POSTGRES_USER: ${POSTGRES_USER:-nova_user}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-nova_password}
POSTGRES_DB: ${POSTGRES_DB:-apex_db}
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./sql:/docker-entrypoint-initdb.d
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-nova_user}"]
interval: 10s
timeout: 5s
retries: 5
networks:
- apex-net
# ---------------------------------------------------------------------------
# 6. OBSERVABILITY (Prometheus + Grafana for RED Metrics)
# ---------------------------------------------------------------------------
prometheus:
image: prom/prometheus:latest
container_name: prometheus
restart: unless-stopped
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
- ./prometheus.rules.yml:/etc/prometheus/prometheus.rules.yml
ports:
- "9090:9090"
networks:
- apex-net
grafana:
image: grafana/grafana:latest
container_name: grafana
restart: unless-stopped
ports:
- "3000:3000"
environment:
- GF_SECURITY_ADMIN_PASSWORD=${GF_ADMIN_PASSWORD:-change-me-in-env}
- GF_PATHS_PROVISIONING=/etc/grafana/provisioning
volumes:
- ./grafana/provisioning:/etc/grafana/provisioning
- ./grafana/dashboards:/etc/grafana/dashboards
depends_on:
- prometheus
networks:
- apex-net
networks:
apex-net:
driver: bridge
volumes:
postgres_data: