-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.workers.dev.yml
More file actions
392 lines (366 loc) · 16 KB
/
docker-compose.workers.dev.yml
File metadata and controls
392 lines (366 loc) · 16 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
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
# docker-compose.workers.dev.yml
#
# DEVELOPMENT version of docker-compose.workers.yml
#
# Project name: comses-agentspace-workers
# IMPORTANT: Use -p comses-agentspace-workers flag to group separately in Docker Desktop
# Note: The 'name:' field is being ignored, so you MUST use -p flag
#
# Key differences from production (docker-compose.workers.yml):
# - Mounts source code as volumes for live editing (no rebuild needed!)
# - Mounts pyproject.toml and uv.lock for dependency changes
# - Adds debugpy port mappings for remote debugging
# - Disables health checks for faster startup
# - Uses 'restart: "no"' for easier debugging (manual restart)
# - Adds DEBUG environment variables
# - Uses host networking mode for easier debugging
#
# Usage (MUST use -p flag or use Makefile commands):
# # Development with live code reload
# make dw-dev
# # OR manually:
# docker compose -p comses-agentspace-workers -f docker-compose.workers.dev.yml up -d
#
# # Watch logs
# make dw-dev-logs
# # OR manually:
# docker compose -p comses-agentspace-workers -f docker-compose.workers.dev.yml logs -f
#
# # Restart a specific worker after code changes
# make dw-dev-restart WORKER=postgres-worker
# # OR manually:
# docker compose -p comses-agentspace-workers -f docker-compose.workers.dev.yml restart postgres-worker
#
# # Stop all workers
# make kdw-dev
# # OR manually:
# docker compose -p comses-agentspace-workers -f docker-compose.workers.dev.yml down
#
# Benefits:
# ✅ Edit code on host, changes reflected immediately in container
# ✅ No need to rebuild Docker images during development
# ✅ Remote debugging support with debugpy
# ✅ Faster iteration cycle
# ✅ Test worker code changes without full rebuild
#
# Note: You'll still need to rebuild if you change:
# - System dependencies in Dockerfile
# - Python dependencies in pyproject.toml (run `uv sync` in container)
# =============================================================================
# Common Worker Environment Variables (YAML Anchor)
# =============================================================================
x-workers-common-env: &workers-common-env # Temporal
TEMPORAL_ADDRESS: temporal-nginx:7233
TEMPORAL_NAMESPACE: default
# Database (use container name from main docker-compose)
# Use postgresql+asyncpg:// scheme for async database operations
COMSES_RAG_DB_URL: postgresql+asyncpg://${COMSES_RAG_DB_USER}:${COMSES_RAG_DB_PASSWORD}@comses-rag-db:${COMSES_RAG_DB_PORT:-5432}/${COMSES_RAG_DB_NAME}
# MinIO (use container name from main docker-compose)
MINIO_HOST: minio
MINIO_PORT: 9000
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-minioadmin}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-minioadmin}
MINIO_BUCKET_NAME: ${MINIO_BUCKET_NAME:-models}
# Qdrant (use container name from main docker-compose)
QDRANT_HOST: qdrant
QDRANT_PORT: 6333
QDRANT_API_KEY: ${QDRANT_API_KEY:-}
# Redis (use container name from main docker-compose)
REDIS_HOST: redis
REDIS_PORT: 6379
REDIS_PASSWORD: ${REDIS_PASSWORD:-}
# LiteLLM (override to use Docker service name instead of localhost)
LITELLM_PROXY_API_BASE: http://litellm-proxy:4000
LITELLM_PROXY_API_KEY: ${LITELLM_PROXY_API_KEY:-}
DEFAULT_AGENT_MODEL: ${DEFAULT_AGENT_MODEL}
DEFAULT_CHAT_COMPLETION_MODEL: ${DEFAULT_CHAT_COMPLETION_MODEL}
DEFAULT_SMART_CHAT_COMPLETION_MODEL: ${DEFAULT_SMART_CHAT_COMPLETION_MODEL}
DEFAULT_LONG_CONTEXT_CHAT_COMPLETION_MODEL: ${DEFAULT_LONG_CONTEXT_CHAT_COMPLETION_MODEL}
DEFAULT_EMBEDDING_MODEL: ${DEFAULT_EMBEDDING_MODEL}
DEFAULT_RERANKING_MODEL: ${DEFAULT_RERANKING_MODEL}
# File Storage (override to use container path, not host path)
FILE_STORAGE_ROOT: /app/storage
# Metrics & Monitoring (Global Flags)
ENABLE_WORKER_METRICS: ${ENABLE_WORKER_METRICS:-true}
# Logging Configuration
WORKER_LOGGING_LEVEL: ${WORKER_LOGGING_LEVEL:-INFO}
LOG_FORMAT: ${LOG_FORMAT:-json}
# OpenTelemetry Tracing
ENABLE_TRACING: ${ENABLE_TRACING:-false}
OTEL_EXPORTER_OTLP_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT:-http://jaeger:4317}
# Sentry Error Tracking (Shared DSN)
ENABLE_SENTRY: ${ENABLE_SENTRY:-false}
SENTRY_DSN: ${SENTRY_DSN:-}
SENTRY_ENVIRONMENT: ${SENTRY_ENVIRONMENT:-development}
SENTRY_TRACES_SAMPLE_RATE: ${SENTRY_TRACES_SAMPLE_RATE:-1.0}
# Development flags
PYTHONUNBUFFERED: 1
PYTHONDONTWRITEBYTECODE: 1
# =============================================================================
# Common Development Volumes (can't use YAML anchor for lists with additions)
# Each service will duplicate these mounts + service-specific ones
# =============================================================================
# =============================================================================
# Services
# =============================================================================
services:
# ---------------------------------------------------------------------------
# Postgres Worker - Database operations
# ---------------------------------------------------------------------------
postgres-worker:
build:
context: .
dockerfile: src/shared/worker-base/Dockerfile
command: python -m src.shared.services.postgres.worker
environment:
<<: *workers-common-env
POSTGRES_WORKER_MAX_CONCURRENT_ACTIVITIES: ${POSTGRES_WORKER_MAX_CONCURRENT_ACTIVITIES:-10}
POSTGRES_WORKER_MAX_ACTIVITIES_PER_SECOND: ${POSTGRES_WORKER_MAX_ACTIVITIES_PER_SECOND:-100.0}
POSTGRES_WORKER_METRICS_PORT: ${POSTGRES_WORKER_METRICS_PORT:-10090}
ports:
- "${POSTGRES_WORKER_METRICS_PORT:-10090}:${POSTGRES_WORKER_METRICS_PORT:-10090}" # Prometheus metrics
- "5690:5678" # debugpy (optional)
volumes:
- ./src:/app/src:rw
- ./pyproject.toml:/app/pyproject.toml:ro
- ./uv.lock:/app/uv.lock:ro
- worker-dev-venv:/app/.venv
restart: "no" # Manual restart for debugging
networks:
- comses-agentspace-network
- temporal-network
# ---------------------------------------------------------------------------
# LiteLLM Worker - LLM operations
# ---------------------------------------------------------------------------
litellm-worker:
build:
context: .
dockerfile: src/shared/worker-base/Dockerfile
command: python -m src.shared.services.llms.worker
environment:
<<: *workers-common-env
LITELLM_WORKER_METRICS_PORT: ${LITELLM_WORKER_METRICS_PORT:-10091}
ports:
- "${LITELLM_WORKER_METRICS_PORT:-10091}:${LITELLM_WORKER_METRICS_PORT:-10091}" # Prometheus metrics
- "5691:5678" # debugpy (optional)
volumes:
- ./src:/app/src:rw
- ./pyproject.toml:/app/pyproject.toml:ro
- ./uv.lock:/app/uv.lock:ro
- worker-dev-venv:/app/.venv
restart: "no"
networks:
- comses-agentspace-network
- temporal-network
# ---------------------------------------------------------------------------
# Qdrant Worker - Vector operations
# ---------------------------------------------------------------------------
qdrant-worker:
build:
context: .
dockerfile: src/shared/worker-base/Dockerfile
command: python -m src.shared.services.vectors.worker
environment:
<<: *workers-common-env
QDRANT_WORKER_MAX_CONCURRENT_ACTIVITIES: ${QDRANT_WORKER_MAX_CONCURRENT_ACTIVITIES:-4}
QDRANT_WORKER_MAX_ACTIVITIES_PER_SECOND: ${QDRANT_WORKER_MAX_ACTIVITIES_PER_SECOND:-4.0}
QDRANT_WORKER_METRICS_PORT: ${QDRANT_WORKER_METRICS_PORT:-10092}
ports:
- "${QDRANT_WORKER_METRICS_PORT:-10092}:${QDRANT_WORKER_METRICS_PORT:-10092}" # Prometheus metrics
- "5692:5678" # debugpy (optional)
volumes:
- ./src:/app/src:rw
- ./pyproject.toml:/app/pyproject.toml:ro
- ./uv.lock:/app/uv.lock:ro
- worker-dev-venv:/app/.venv
restart: "no"
networks:
- comses-agentspace-network
- temporal-network
# ---------------------------------------------------------------------------
# MinIO Worker - File operations
# ---------------------------------------------------------------------------
minio-worker:
build:
context: .
dockerfile: src/shared/worker-base/Dockerfile
command: python -m src.shared.services.files.worker
environment:
<<: *workers-common-env
MINIO_WORKER_MAX_CONCURRENT_ACTIVITIES: ${MINIO_WORKER_MAX_CONCURRENT_ACTIVITIES:-1}
MINIO_WORKER_MAX_ACTIVITIES_PER_SECOND: ${MINIO_WORKER_MAX_ACTIVITIES_PER_SECOND:-1.0}
MINIO_WORKER_METRICS_PORT: ${MINIO_WORKER_METRICS_PORT:-10093}
ports:
- "${MINIO_WORKER_METRICS_PORT:-10093}:${MINIO_WORKER_METRICS_PORT:-10093}" # Prometheus metrics
- "5693:5678" # debugpy (optional)
volumes:
- ./src:/app/src:rw
- ./pyproject.toml:/app/pyproject.toml:ro
- ./uv.lock:/app/uv.lock:ro
- worker-dev-venv:/app/.venv
- ${WORKER_STORAGE_PATH:-./local_data/worker-storage/minio}:/app/storage
restart: "no"
networks:
- comses-agentspace-network
- temporal-network
# ---------------------------------------------------------------------------
# Redis Worker - Cache operations
# ---------------------------------------------------------------------------
redis-worker:
build:
context: .
dockerfile: src/shared/worker-base/Dockerfile
command: python -m src.shared.services.store.worker
environment:
<<: *workers-common-env
REDIS_WORKER_MAX_CONCURRENT_ACTIVITIES: ${REDIS_WORKER_MAX_CONCURRENT_ACTIVITIES:-50}
REDIS_WORKER_MAX_ACTIVITIES_PER_SECOND: ${REDIS_WORKER_MAX_ACTIVITIES_PER_SECOND:-1000.0}
REDIS_WORKER_METRICS_PORT: ${REDIS_WORKER_METRICS_PORT:-10094}
ports:
- "${REDIS_WORKER_METRICS_PORT:-10094}:${REDIS_WORKER_METRICS_PORT:-10094}" # Prometheus metrics
- "5694:5678" # debugpy (optional)
volumes:
- ./src:/app/src:rw
- ./pyproject.toml:/app/pyproject.toml:ro
- ./uv.lock:/app/uv.lock:ro
- worker-dev-venv:/app/.venv
restart: "no"
networks:
- comses-agentspace-network
- temporal-network
# ---------------------------------------------------------------------------
# Ingestion Worker - Model ingestion pipeline
# ---------------------------------------------------------------------------
ingestion-worker:
build:
context: .
dockerfile: src/shared/worker-base/Dockerfile
command: python -m src.modules.ingestion.workers.ingestion_worker
environment:
<<: *workers-common-env
INGEST_WORKER_MAX_CONCURRENT_ACTIVITIES: ${INGEST_WORKER_MAX_CONCURRENT_ACTIVITIES:-12}
INGEST_WORKER_MAX_ACTIVITIES_PER_SECOND: ${INGEST_WORKER_MAX_ACTIVITIES_PER_SECOND:-100.0}
INGESTION_WORKER_METRICS_PORT: ${INGESTION_WORKER_METRICS_PORT:-10095}
ports:
- "${INGESTION_WORKER_METRICS_PORT:-10095}:${INGESTION_WORKER_METRICS_PORT:-10095}" # Prometheus metrics
- "5695:5678" # debugpy (optional)
volumes:
- ./src:/app/src:rw
- ./pyproject.toml:/app/pyproject.toml:ro
- ./uv.lock:/app/uv.lock:ro
- worker-dev-venv:/app/.venv
- ${WORKER_STORAGE_PATH:-./local_data/worker-storage/ingestion}:/app/storage
restart: "no"
networks:
- comses-agentspace-network
- temporal-network
# ---------------------------------------------------------------------------
# PDF Converter Worker - PDF to Markdown conversion
# Uses specialized Dockerfile with marker-pdf dependencies (~9 GB)
# ---------------------------------------------------------------------------
pdf-converter-worker:
build:
context: .
dockerfile: src/shared/worker-base/Dockerfile.pdf-worker
command: python -m src.modules.ingestion.workers.pdf_converter_worker
environment:
<<: *workers-common-env
PDF_CONVERTER_WORKER_MAX_CONCURRENT_ACTIVITIES: ${PDF_CONVERTER_WORKER_MAX_CONCURRENT_ACTIVITIES:-1}
PDF_CONVERTER_WORKER_MAX_ACTIVITIES_PER_SECOND: ${PDF_CONVERTER_WORKER_MAX_ACTIVITIES_PER_SECOND:-0.2}
PDF_CONVERTER_WORKER_METRICS_PORT: ${PDF_CONVERTER_WORKER_METRICS_PORT:-10096}
# Explicitly set XDG cache directory for marker-pdf models
# Using /app/.cache instead of /home/worker/.cache to avoid permission issues
XDG_CACHE_HOME: /app/.cache
ports:
- "${PDF_CONVERTER_WORKER_METRICS_PORT:-10096}:${PDF_CONVERTER_WORKER_METRICS_PORT:-10096}" # Prometheus metrics
- "5696:5678" # debugpy (optional)
volumes:
- ./src:/app/src:rw
- ./pyproject.toml:/app/pyproject.toml:ro
- ./uv.lock:/app/uv.lock:ro
- worker-dev-pdf-venv:/app/.venv
- ${WORKER_STORAGE_PATH:-./local_data/worker-storage/pdf-converter}:/app/storage
# Persistent cache for marker-pdf models and other XDG cache data
# Mounted to /app/.cache (owned by worker) instead of /home/worker/.cache
- marker-pdf-models-cache:/app/.cache
restart: "no"
networks:
- comses-agentspace-network
- temporal-network
# ---------------------------------------------------------------------------
# Retrieval Worker - Workflow-only retrieval operations
# ---------------------------------------------------------------------------
retrieval-worker:
build:
context: .
dockerfile: src/shared/worker-base/Dockerfile
command: python -m src.modules.retrieval.worker
environment:
<<: *workers-common-env
RETRIEVAL_WORKER_MAX_CONCURRENT_ACTIVITIES: ${RETRIEVAL_WORKER_MAX_CONCURRENT_ACTIVITIES:-10}
RETRIEVAL_WORKER_MAX_ACTIVITIES_PER_SECOND: ${RETRIEVAL_WORKER_MAX_ACTIVITIES_PER_SECOND:-50.0}
RETRIEVAL_WORKER_METRICS_PORT: ${RETRIEVAL_WORKER_METRICS_PORT:-10097}
ports:
- "${RETRIEVAL_WORKER_METRICS_PORT:-10097}:${RETRIEVAL_WORKER_METRICS_PORT:-10097}" # Prometheus metrics
- "5697:5678" # debugpy (optional)
volumes:
- ./src:/app/src:rw
- ./pyproject.toml:/app/pyproject.toml:ro
- ./uv.lock:/app/uv.lock:ro
- worker-dev-venv:/app/.venv
restart: "no"
networks:
- comses-agentspace-network
- temporal-network
# ---------------------------------------------------------------------------
# COMSES Agent Worker - Chat agent operations
# ---------------------------------------------------------------------------
comses-agent-worker:
build:
context: .
dockerfile: src/shared/worker-base/Dockerfile
command: python -m src.apps.chat.backend.agents.comses_library_agent.worker
environment:
<<: *workers-common-env
COMSES_AGENT_WORKER_MAX_CONCURRENT_ACTIVITIES: ${COMSES_AGENT_WORKER_MAX_CONCURRENT_ACTIVITIES:-10}
COMSES_AGENT_WORKER_MAX_ACTIVITIES_PER_SECOND: ${COMSES_AGENT_WORKER_MAX_ACTIVITIES_PER_SECOND:-50.0}
COMSES_AGENT_WORKER_METRICS_PORT: ${COMSES_AGENT_WORKER_METRICS_PORT:-10098}
ports:
- "${COMSES_AGENT_WORKER_METRICS_PORT:-10098}:${COMSES_AGENT_WORKER_METRICS_PORT:-10098}" # Prometheus metrics
- "5698:5678" # debugpy (optional)
volumes:
- ./src:/app/src:rw
- ./pyproject.toml:/app/pyproject.toml:ro
- ./uv.lock:/app/uv.lock:ro
- worker-dev-venv:/app/.venv
restart: "no"
networks:
- comses-agentspace-network
- temporal-network
# =============================================================================
# Networks
# =============================================================================
networks:
comses-agentspace-network:
name: comses-agentspace-network
external: true
temporal-network:
name: temporal-network
external: true
# =============================================================================
# Volumes
# =============================================================================
volumes:
# Shared .venv volume for all workers (except pdf-converter)
# This preserves installed packages across restarts
# To update dependencies: docker compose -f docker-compose.workers.dev.yml exec <worker> uv sync
worker-dev-venv:
driver: local
# Separate .venv volume for pdf-converter-worker
# PDF converter has heavy dependencies (marker-pdf, PyTorch) that other workers don't need
worker-dev-pdf-venv:
driver: local
# Persistent cache for marker-pdf models (~2-3 GB)
# Prevents re-downloading models on every container restart
marker-pdf-models-cache:
driver: local