-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
320 lines (302 loc) · 8.36 KB
/
docker-compose.yml
File metadata and controls
320 lines (302 loc) · 8.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
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
services:
postgres:
image: postgres:15
environment:
POSTGRES_USER: tagger
POSTGRES_PASSWORD: tagger
POSTGRES_DB: tagger
ports:
- "5432:5432"
volumes:
- ./data/postgres:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U tagger"]
interval: 10s
timeout: 5s
retries: 5
mlflow:
image: ghcr.io/mlflow/mlflow:v2.13.0
ports:
- "5001:5000"
volumes:
- ./data/mlflow_artifacts:/mlflow/artifacts
depends_on:
postgres:
condition: service_healthy
entrypoint: ["sh", "-c", "pip install psycopg2-binary -q && mlflow server --backend-store-uri postgresql://tagger:tagger@postgres:5432/tagger --default-artifact-root /mlflow/artifacts --host 0.0.0.0 --port 5000"]
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:5000/health')"]
interval: 15s
timeout: 5s
retries: 5
serving:
build:
context: ./serving
dockerfile: Dockerfile
ports:
- "8000:8000"
environment:
DB_URL: postgresql://tagger:tagger@postgres:5432/tagger
MLFLOW_TRACKING_URI: http://mlflow:5000
USE_ONNX: "false"
USE_STUB_MODEL: "false"
BUNDLE_PATH: /models/model_bundle.joblib
PROMETHEUS_MULTIPROC_DIR: /tmp/prometheus_multiproc
volumes:
# Shared model store — training writes here, serving reads from here
# This allows hot-reload via /admin/load-model without rebuilding the image
- ./serving/models:/models
depends_on:
postgres:
condition: service_healthy
mlflow:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
retries: 3
nextcloud:
image: nextcloud:27
ports:
- "8080:80"
volumes:
- ./data/nextcloud:/var/www/html
- ./nextcloud-app:/var/www/html/custom_apps/smartfiletagger:ro
environment:
NEXTCLOUD_ADMIN_USER: admin
NEXTCLOUD_ADMIN_PASSWORD: admin
SQLITE_DATABASE: nextcloud
NEXTCLOUD_TRUSTED_DOMAINS: localhost nextcloud
SIDECAR_URL: http://serving:8000
NEXTCLOUD_INTERNAL_URL: http://nextcloud
depends_on:
serving:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/status.php"]
interval: 30s
timeout: 10s
retries: 5
start_period: 60s
training:
build:
context: ./training
dockerfile: Dockerfile
environment:
DB_URL: postgresql://tagger:tagger@postgres:5432/tagger
MLFLOW_TRACKING_URI: http://mlflow:5000
ARTIFACT_DIR: /app/artifacts
SERVING_MODEL_BUNDLE_PATH: /app/serving_models/model_bundle.joblib
FEEDBACK_THRESHOLD: "300"
volumes:
- ./training/artifacts:/app/artifacts
- ./data/artifacts:/app/data_artifacts:ro
# Same host directory as serving's /models mount
- ./serving/models:/app/serving_models
depends_on:
postgres:
condition: service_healthy
mlflow:
condition: service_healthy
profiles:
- training
retrain-cron:
build:
context: ./training
dockerfile: Dockerfile.retrain
environment:
DB_URL: postgresql://tagger:tagger@postgres:5432/tagger
MLFLOW_TRACKING_URI: http://mlflow:5000
ARTIFACT_DIR: /app/artifacts
SERVING_MODEL_BUNDLE_PATH: /app/serving_models/model_bundle.joblib
FEEDBACK_THRESHOLD: "300"
volumes:
- ./training/artifacts:/app/artifacts
- ./data/artifacts:/app/data_artifacts:ro
- ./serving/models:/app/serving_models
- ./data:/app/data_pipeline:ro
- ./data/mlflow_artifacts:/mlflow/artifacts
depends_on:
postgres:
condition: service_healthy
mlflow:
condition: service_healthy
entrypoint: >
sh -c "while true; do
echo '[retrain-cron] Checking feedback trigger at $$(date)';
python retrain_trigger.py;
echo '[retrain-cron] Sleeping 1h.';
sleep 3600;
done"
monitor:
build:
context: ./serving
dockerfile: Dockerfile.monitor
environment:
DB_URL: postgresql://tagger:tagger@postgres:5432/tagger
MLFLOW_TRACKING_URI: http://mlflow:5000
SERVING_URL: http://serving:8000
PROMETHEUS_URL: http://prometheus:9090
CHECK_INTERVAL_SECONDS: "300"
ERROR_RATE_THRESHOLD: "0.05"
CORRECTION_RATE_THRESHOLD: "0.65"
volumes:
- ./data/mlflow_artifacts:/mlflow/artifacts
- ./serving/models:/serving_models
depends_on:
- serving
- prometheus
- postgres
- mlflow
entrypoint: ["python", "monitor.py"]
healthcheck:
test: ["CMD-SHELL", "python -c 'import sys; sys.exit(0)'"]
interval: 30s
timeout: 10s
retries: 3
qdrant:
image: qdrant/qdrant:latest
ports:
- "6333:6333"
qdrant-demo:
build:
context: ./data
dockerfile: Dockerfile.qdrant
entrypoint: ["python", "qdrant_demo.py"]
volumes:
- ./data/artifacts:/app/artifacts
depends_on:
- qdrant
command:
- --input
- /app/artifacts/ocw_dataset.parquet
- --qdrant-host
- qdrant
synthetic-expansion:
build:
context: ./data
entrypoint: ["python", "synthetic_expansion.py"]
volumes:
- ./data/artifacts:/app/artifacts
command:
- --input
- /app/artifacts/ocw_dataset.parquet
- --output
- /app/artifacts/ocw_dataset_expanded.parquet
- --multiplier
- "5"
- --seed
- "42"
batch-pipeline:
build:
context: ./data
entrypoint: ["python", "batch_pipeline.py"]
environment:
DB_URL: postgresql://tagger:tagger@postgres:5432/tagger
volumes:
- ./data/artifacts:/app/artifacts
depends_on:
postgres:
condition: service_healthy
command:
- --dataset
- /app/artifacts/ocw_dataset_expanded.parquet
- --feedback-source
- postgres
- --db-url
- postgresql://tagger:tagger@postgres:5432/tagger
- --output-dir
- /app/artifacts/versions
- --version
- v6
drift-monitor:
build:
context: ./data
entrypoint: ["python", "drift_monitor.py"]
environment:
DB_URL: postgresql://tagger:tagger@postgres:5432/tagger
volumes:
- ./data/artifacts:/app/artifacts
depends_on:
postgres:
condition: service_healthy
command:
- --baseline
- /app/artifacts/versions/v6/train_llm_merged_ops.parquet
- --output
- /app/artifacts/drift_report.json
- --version
- v6
- --interval
- "3600"
mock-predict:
build:
context: ./data
entrypoint: ["python", "mock_predict_server.py"]
ports:
- "8001:8000"
data-generator:
build:
context: ./data
entrypoint: ["python", "load_generator.py"]
environment:
PREDICT_URL: http://serving:8000/predict-text
FEEDBACK_URL: http://serving:8000/feedback
DATA_PATH: /app/artifacts/ocw_dataset.parquet
DELAY_SECS: "30"
USER_ID: load-generator
volumes:
- ./data/artifacts:/app/artifacts
depends_on:
serving:
condition: service_healthy
command:
- --input
- /app/artifacts/ocw_dataset.parquet
- --output
- /app/artifacts/production_feedback.jsonl
- --predict-url
- http://serving:8000/predict
- --feedback-url
- http://serving:8000/feedback
ocw-pipeline:
build:
context: ./data
volumes:
- ./data:/app/workspace:ro
- ./data/artifacts:/app/artifacts
command:
- --root
- /app/workspace
- --output
- /app/artifacts/ocw_dataset.parquet
- --summary-output
- /app/artifacts/ocw_summary.json
prometheus:
image: prom/prometheus:latest
ports:
- "9090:9090"
volumes:
- ./infra/prometheus.yml:/etc/prometheus/prometheus.yml:ro
depends_on:
- serving
grafana:
image: grafana/grafana:latest
ports:
- "3000:3000"
environment:
GF_SECURITY_ADMIN_USER: proj29-grafana
GF_SECURITY_ADMIN_PASSWORD: proj29-grafana
volumes:
- ./data/grafana:/var/lib/grafana
- ./infra/grafana/provisioning:/etc/grafana/provisioning:ro
depends_on:
- prometheus
adminer:
image: adminer
ports:
- "8081:8080"
restart: always
depends_on:
- postgres