-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
291 lines (265 loc) · 7.84 KB
/
docker-compose.yml
File metadata and controls
291 lines (265 loc) · 7.84 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
version: '3.8'
services:
# Light worker - KB-only processing
light-worker:
build:
context: .
dockerfile: Dockerfile.worker
container_name: light-worker
ports:
- "9004:9004" # API_PORT
- "9005:9005" # SERVICE_PORT (healthz/metrics)
environment:
- WORKER_TYPE=light
- WORKER_PORT=9004
- HYPOTHESES_DIR=/app/hypotheses
- LOG_LEVEL=${LOG_LEVEL:-info}
- ARTIFACTS_DIR=/app/artifacts
- EMBEDDINGS_MODE=${EMBEDDINGS_MODE:-lmstudio}
- VECTOR_BACKEND=${VECTOR_BACKEND:-qdrant}
- QDRANT_URL=${QDRANT_URL:-http://qdrant:6333}
- QDRANT_API_KEY=${QDRANT_API_KEY:-}
- EMBEDDINGS_MODEL=${EMBEDDINGS_MODEL:-text-embedding-3-small}
- LMSTUDIO_BASE_URL=${LMSTUDIO_BASE_URL:-http://host.docker.internal:1234}
- INDEX_ON_START=${INDEX_ON_START:-true}
volumes:
- ./hypotheses:/app/hypotheses
- ./artifacts:/app/artifacts:ro
- ./router.yaml:/app/router.yaml:ro
networks:
- agent_network
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:9005/healthz"]
interval: 30s
timeout: 10s
retries: 3
# Heavy worker (LLM+WASM+KB)
heavy-worker:
build:
context: .
dockerfile: Dockerfile.worker
container_name: heavy-worker
ports:
- "9002:9002" # API_PORT
- "9003:9003" # SERVICE_PORT (healthz/metrics)
environment:
- WORKER_TYPE=heavy
- WORKER_PORT=9002
- HYPOTHESES_DIR=/app/hypotheses
- LOG_LEVEL=${LOG_LEVEL:-info}
- LLM_MODE=${LLM_MODE:-router}
- POLICY_ALLOW_TOOLS=${POLICY_ALLOW_TOOLS:-true}
- SANDBOX_MEM_MB=${SANDBOX_MEM_MB:-128}
- TASK_TIMEOUT=${TASK_TIMEOUT:-30s}
- ARTIFACTS_DIR=/app/artifacts
- SANDBOX_MEM_MB=64
- TASK_TIMEOUT=60s
- EMBEDDINGS_MODE=${EMBEDDINGS_MODE:-lmstudio}
- VECTOR_BACKEND=${VECTOR_BACKEND:-qdrant}
- QDRANT_URL=${QDRANT_URL:-http://qdrant:6333}
- QDRANT_API_KEY=${QDRANT_API_KEY:-}
- EMBEDDINGS_MODEL=${EMBEDDINGS_MODEL:-text-embedding-3-small}
- LMSTUDIO_BASE_URL=${LMSTUDIO_BASE_URL:-http://host.docker.internal:1234}
- INDEX_ON_START=${INDEX_ON_START:-true}
# LLM Router configuration
- LLM_ROUTER_URL=http://llmrouter:9000
- DEFAULT_MODEL=${DEFAULT_MODEL:-openai:gpt-4o-mini}
- MODEL_TAG=${MODEL_TAG:-general}
volumes:
- ./hypotheses:/app/hypotheses
- ./artifacts:/app/artifacts
- ./router.yaml:/app/router.yaml:ro
networks:
- agent_network
depends_on:
- llmrouter
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:9003/healthz"]
interval: 30s
timeout: 10s
retries: 3
# Router (capability-based routing)
router:
build:
context: .
dockerfile: Dockerfile.router
container_name: router
ports:
- "9006:9006" # API_PORT
- "9007:9007" # SERVICE_PORT (healthz/metrics)
environment:
- ROUTER_PORT=9006
- LOG_LEVEL=${LOG_LEVEL:-info}
- LIGHT_WORKER_URL=http://light-worker:9004
- HEAVY_WORKER_URL=http://heavy-worker:9002
volumes:
- ./router.yaml:/app/router.yaml:ro
networks:
- agent_network
depends_on:
- light-worker
- heavy-worker
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:9007/healthz"]
interval: 30s
timeout: 10s
# Optional: Nginx reverse proxy for load balancing
nginx:
image: nginx:alpine
ports:
- "80:80"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- router
networks:
- agent_network
restart: unless-stopped
profiles:
- with-nginx
# LLM Router (REST API + SSE)
llmrouter:
build:
context: .
dockerfile: Dockerfile
container_name: llmrouter
ports:
- "9000:9000" # API_PORT
- "9001:9001" # SERVICE_PORT (healthz/metrics)
environment:
# API Keys
- OPENAI_API_KEY=${OPENAI_API_KEY:-}
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY:-}
- OPENROUTER_API_KEY=${OPENROUTER_API_KEY:-}
# Base URLs
- OLLAMA_BASE_URL=${OLLAMA_BASE_URL:-http://ollama:11434}
- VLLM_BASE_URL=${VLLM_BASE_URL:-http://vllm:8000}
- LMSTUDIO_BASE_URL=${LMSTUDIO_BASE_URL:-http://lmstudio:1234}
# Service Configuration
- LLMROUTER_PORT=9000
- CONFIG=/config/router.yaml
# Logging
- LOG_LEVEL=${LOG_LEVEL:-info}
- LOG_FORMAT=${LOG_FORMAT:-json}
# Observability
- JAEGER_ENDPOINT=${JAEGER_ENDPOINT:-http://jaeger:14268/api/traces}
- SERVICE_NAME=llmrouter
- SERVICE_VERSION=1.0.0
- ENVIRONMENT=${ENVIRONMENT:-production}
# Accounting
- USE_SQLITE=${USE_SQLITE:-false}
- DB_PATH=${DB_PATH:-/data/costs.db}
# Cache
- CACHE_MAX_SIZE=${CACHE_MAX_SIZE:-1000}
- CACHE_DEFAULT_TTL=${CACHE_DEFAULT_TTL:-5m}
# Rate Limiting
- RATE_LIMIT_ENABLED=${RATE_LIMIT_ENABLED:-true}
- CIRCUIT_BREAKER_ENABLED=${CIRCUIT_BREAKER_ENABLED:-true}
volumes:
# Mount configuration file
- ./router.yaml:/config/router.yaml:ro
# Mount data directory for SQLite (if enabled)
- llmrouter_data:/data
# Mount logs directory (optional)
- llmrouter_logs:/logs
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:9001/healthz"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
restart: unless-stopped
extra_hosts:
- "host.docker.internal:host-gateway"
# Resource limits
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
reservations:
memory: 256M
cpus: '0.25'
# Network configuration
networks:
- agent_network
# Optional: Jaeger for tracing
jaeger:
image: jaegertracing/all-in-one:latest
container_name: jaeger
ports:
- "16686:16686" # Jaeger UI
- "14268:14268" # Jaeger collector
environment:
- COLLECTOR_OTLP_ENABLED=true
networks:
- agent_network
profiles:
- tracing
# Optional: Prometheus for metrics
prometheus:
image: prom/prometheus:latest
container_name: prometheus
ports:
- "9090:9090"
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/etc/prometheus/console_libraries'
- '--web.console.templates=/etc/prometheus/consoles'
- '--web.enable-lifecycle'
networks:
- agent_network
profiles:
- monitoring
# Optional: Grafana for dashboards
grafana:
image: grafana/grafana:latest
container_name: grafana
ports:
- "3000:3000"
environment:
- GF_SECURITY_ADMIN_PASSWORD=admin
volumes:
- grafana_data:/var/lib/grafana
networks:
- agent_network
profiles:
- monitoring
# Qdrant vector database
qdrant:
image: qdrant/qdrant:latest
container_name: qdrant
ports:
- "6333:6333" # REST API
- "6334:6334" # gRPC API
environment:
- QDRANT__SERVICE__HTTP_PORT=6333
- QDRANT__SERVICE__GRPC_PORT=6334
volumes:
- qdrant_data:/qdrant/storage
networks:
- agent_network
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:6333/health"]
interval: 30s
timeout: 10s
retries: 3
volumes:
llmrouter_data:
driver: local
llmrouter_logs:
driver: local
grafana_data:
driver: local
qdrant_data:
driver: local
networks:
agent_network:
driver: bridge