forked from Context-Engine-AI/Context-Engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.dev-remote.yml
More file actions
416 lines (394 loc) · 14.5 KB
/
docker-compose.dev-remote.yml
File metadata and controls
416 lines (394 loc) · 14.5 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
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
# Development Docker Compose for Remote Upload System Testing
# This file simulates Kubernetes environment with shared volumes that simulate the Kubernetes CephFS RWX PVC behavior.
# Repos stored in /work/ (which is project root - avoiding docker volumes) and metadata are stored in /work/.codebase/repos (project root/.codebase)
# Updated to use separate PVCs for workspace and codebase to eliminate circular dependencies
version: '3.8'
services:
# Qdrant vector database - same as base compose
qdrant:
image: qdrant/qdrant:latest
container_name: qdrant-db-dev-remote
ports:
- "6333:6333"
- "6334:6334"
volumes:
- qdrant_storage_dev_remote:/qdrant/storage
networks:
- dev-remote-network
# MCP search service - same as base compose
mcp:
build:
context: .
dockerfile: Dockerfile.mcp
container_name: mcp-search-dev-remote
user: "1000:1000"
depends_on:
- qdrant
env_file:
- .env
environment:
- FASTMCP_HOST=${FASTMCP_HOST}
- FASTMCP_PORT=${FASTMCP_PORT}
- QDRANT_URL=${QDRANT_URL}
- COLLECTION_NAME=${COLLECTION_NAME}
- PATH_EMIT_MODE=container
- HF_HOME=/work/.cache/huggingface
- TRANSFORMERS_CACHE=/work/.cache/huggingface
- HUGGINGFACE_HUB_CACHE=/work/.cache/huggingface
- EMBEDDING_MODEL=${EMBEDDING_MODEL}
- EMBEDDING_PROVIDER=${EMBEDDING_PROVIDER}
- TOOL_STORE_DESCRIPTION=${TOOL_STORE_DESCRIPTION}
- TOOL_FIND_DESCRIPTION=${TOOL_FIND_DESCRIPTION}
- FASTMCP_HEALTH_PORT=18000
- HF_HOME=/home/user/.cache
- TRANSFORMERS_CACHE=/home/user/.cache
ports:
- "18000:18000"
- "8000:8000"
volumes:
- workspace_pvc:/work:ro
- huggingface_cache:/home/user/.cache
networks:
- dev-remote-network
# MCP indexer service - same as base compose
mcp_indexer:
build:
context: .
dockerfile: Dockerfile.mcp-indexer
container_name: mcp-indexer-dev-remote
user: "1000:1000"
# In K8s, scripts would be accessed directly at /app/scripts/ or via proper initContainer
# For Docker Compose dev-remote simulation, create symlink so /work/scripts/ works
# Use /tmp/huggingface for cache to avoid permission issues (universally writable)
# Set CORRECT environment variables for HuggingFace and FastEmbed
command: ["sh", "-c", "mkdir -p /tmp/huggingface/hub /tmp/huggingface/transformers /tmp/huggingface/fastembed && exec python /app/scripts/mcp_indexer_server.py"]
depends_on:
- qdrant
env_file:
- .env
environment:
- FASTMCP_HEALTH_PORT=18001
- FASTMCP_HOST=${FASTMCP_HOST}
- FASTMCP_INDEXER_PORT=${FASTMCP_INDEXER_PORT}
- QDRANT_URL=${QDRANT_URL}
- REFRAG_DECODER=${REFRAG_DECODER:-1}
- REFRAG_RUNTIME=${REFRAG_RUNTIME:-llamacpp}
- GLM_API_KEY=${GLM_API_KEY}
- GLM_API_BASE=${GLM_API_BASE:-https://api.z.ai/api/paas/v4/}
- GLM_MODEL=${GLM_MODEL:-glm-4.6}
- LLAMACPP_URL=${LLAMACPP_URL:-http://llamacpp:8080}
- COLLECTION_NAME=${COLLECTION_NAME}
- PATH_EMIT_MODE=container
- HF_HOME=/tmp/huggingface
- HF_HUB_CACHE=/tmp/huggingface/hub
- TRANSFORMERS_CACHE=/tmp/huggingface/transformers
- FASTEMBED_CACHE_PATH=/tmp/huggingface/fastembed
- EMBEDDING_MODEL=${EMBEDDING_MODEL}
- EMBEDDING_PROVIDER=${EMBEDDING_PROVIDER}
- QDRANT_TIMEOUT=${QDRANT_TIMEOUT:-60}
- INDEX_SEMANTIC_CHUNKS=${INDEX_SEMANTIC_CHUNKS:-0}
- INDEX_MICRO_CHUNKS=${INDEX_MICRO_CHUNKS:-0}
- INDEX_UPSERT_BATCH=${INDEX_UPSERT_BATCH:-512}
- INDEX_UPSERT_RETRIES=${INDEX_UPSERT_RETRIES:-5}
- MAX_MICRO_CHUNKS_PER_FILE=${MAX_MICRO_CHUNKS_PER_FILE:-200}
ports:
- "${FASTMCP_INDEXER_PORT:-8001}:8001"
- "18001:18001"
volumes:
- workspace_pvc:/work:rw
- codebase_pvc:/work/.codebase:rw
networks:
- dev-remote-network
# MCP HTTP search service - same as base compose
mcp_http:
build:
context: .
dockerfile: Dockerfile.mcp
container_name: mcp-search-http-dev-remote
user: "1000:1000"
depends_on:
- qdrant
env_file:
- .env
environment:
- FASTMCP_HOST=${FASTMCP_HOST}
- FASTMCP_PORT=8000
- FASTMCP_TRANSPORT=${FASTMCP_HTTP_TRANSPORT}
- QDRANT_URL=${QDRANT_URL}
- COLLECTION_NAME=${COLLECTION_NAME}
- PATH_EMIT_MODE=container
- HF_HOME=/work/.cache/huggingface
- TRANSFORMERS_CACHE=/work/.cache/huggingface
- HUGGINGFACE_HUB_CACHE=/work/.cache/huggingface
- EMBEDDING_MODEL=${EMBEDDING_MODEL}
- EMBEDDING_PROVIDER=${EMBEDDING_PROVIDER}
- TOOL_STORE_DESCRIPTION=${TOOL_STORE_DESCRIPTION}
- TOOL_FIND_DESCRIPTION=${TOOL_FIND_DESCRIPTION}
- FASTMCP_HEALTH_PORT=18000
- HF_HOME=/home/user/.cache
- TRANSFORMERS_CACHE=/home/user/.cache
ports:
- "${FASTMCP_HTTP_HEALTH_PORT:-18002}:18000"
- "${FASTMCP_HTTP_PORT:-8002}:8000"
volumes:
- workspace_pvc:/work:ro
- huggingface_cache:/home/user/.cache
networks:
- dev-remote-network
# MCP HTTP indexer service - same as base compose
mcp_indexer_http:
build:
context: .
dockerfile: Dockerfile.mcp-indexer
container_name: mcp-indexer-http-dev-remote
user: "1000:1000"
# In K8s, scripts would be accessed directly at /app/scripts/ or via proper initContainer
# For Docker Compose dev-remote simulation, create symlink so /work/scripts/ works
# Use /tmp/huggingface for cache to avoid permission issues (universally writable)
# Set CORRECT environment variables for HuggingFace and FastEmbed
command: ["sh", "-c", "mkdir -p /tmp/huggingface/hub /tmp/huggingface/transformers /tmp/huggingface/fastembed && exec python /app/scripts/mcp_indexer_server.py"]
depends_on:
- qdrant
env_file:
- .env
environment:
- FASTMCP_HOST=${FASTMCP_HOST}
- FASTMCP_INDEXER_PORT=8001
- FASTMCP_TRANSPORT=${FASTMCP_HTTP_TRANSPORT}
- QDRANT_URL=${QDRANT_URL}
- REFRAG_DECODER=${REFRAG_DECODER:-1}
- REFRAG_RUNTIME=${REFRAG_RUNTIME:-llamacpp}
- GLM_API_KEY=${GLM_API_KEY}
- GLM_API_BASE=${GLM_API_BASE:-https://api.z.ai/api/paas/v4/}
- GLM_MODEL=${GLM_MODEL:-glm-4.6}
- LLAMACPP_URL=${LLAMACPP_URL:-http://llamacpp:8080}
- FASTMCP_HEALTH_PORT=18001
- COLLECTION_NAME=${COLLECTION_NAME}
- PATH_EMIT_MODE=container
- HF_HOME=/tmp/huggingface
- HF_HUB_CACHE=/tmp/huggingface/hub
- TRANSFORMERS_CACHE=/tmp/huggingface/transformers
- FASTEMBED_CACHE_PATH=/tmp/huggingface/fastembed
- EMBEDDING_MODEL=${EMBEDDING_MODEL}
- EMBEDDING_PROVIDER=${EMBEDDING_PROVIDER}
- QDRANT_TIMEOUT=${QDRANT_TIMEOUT:-60}
- INDEX_SEMANTIC_CHUNKS=${INDEX_SEMANTIC_CHUNKS:-0}
- INDEX_MICRO_CHUNKS=${INDEX_MICRO_CHUNKS:-0}
- INDEX_UPSERT_BATCH=${INDEX_UPSERT_BATCH:-512}
- INDEX_UPSERT_RETRIES=${INDEX_UPSERT_RETRIES:-5}
- MAX_MICRO_CHUNKS_PER_FILE=${MAX_MICRO_CHUNKS_PER_FILE:-200}
ports:
- "${FASTMCP_INDEXER_HTTP_PORT:-8003}:8001"
- "${FASTMCP_INDEXER_HTTP_HEALTH_PORT:-18003}:18001"
volumes:
- workspace_pvc:/work:rw
- codebase_pvc:/work/.codebase:rw
networks:
- dev-remote-network
# Llama.cpp decoder service - same as base compose
llamacpp:
image: ghcr.io/ggerganov/llama.cpp:server
container_name: llama-decoder-dev-remote
environment:
- LLAMA_ARG_MODEL=/models/model.gguf
- LLAMA_ARG_CTX_SIZE=8192
- LLAMA_ARG_HOST=0.0.0.0
- LLAMA_ARG_PORT=8080
ports:
- "8080:8080"
volumes:
- ./models:/models:ro
command: ["--model", "/models/model.gguf", "--host", "0.0.0.0", "--port", "8080", "--no-warmup"]
networks:
- dev-remote-network
# Indexer service - modified for PVC volumes
indexer:
build:
context: .
dockerfile: Dockerfile.indexer
container_name: indexer-dev-remote
depends_on:
- qdrant
env_file:
- .env
environment:
- QDRANT_URL=${QDRANT_URL}
- COLLECTION_NAME=${COLLECTION_NAME}
- HF_HOME=/work/.cache/huggingface
- TRANSFORMERS_CACHE=/work/.cache/huggingface
- HUGGINGFACE_HUB_CACHE=/work/.cache/huggingface
- EMBEDDING_MODEL=${EMBEDDING_MODEL}
- HF_HOME=/home/user/.cache
- HOST_INDEX_PATH=/work
- TRANSFORMERS_CACHE=/home/user/.cache
- QDRANT_TIMEOUT=${QDRANT_TIMEOUT:-60}
- INDEX_SEMANTIC_CHUNKS=${INDEX_SEMANTIC_CHUNKS:-0}
- INDEX_MICRO_CHUNKS=${INDEX_MICRO_CHUNKS:-0}
- INDEX_UPSERT_BATCH=${INDEX_UPSERT_BATCH:-512}
- INDEX_UPSERT_RETRIES=${INDEX_UPSERT_RETRIES:-5}
- MAX_MICRO_CHUNKS_PER_FILE=${MAX_MICRO_CHUNKS_PER_FILE:-200}
volumes:
- workspace_pvc:/work:rw
- codebase_pvc:/work/.codebase:rw
- huggingface_cache:/home/user/.cache
entrypoint: ["sh", "-c", "mkdir -p /tmp/logs && /app/scripts/wait-for-qdrant.sh && cd /app && python /app/scripts/ingest_code.py --root /work"]
restart: "no" # Run once on startup, do not restart after completion
networks:
- dev-remote-network
# Watcher service - modified for PVC volumes
watcher:
build:
context: .
dockerfile: Dockerfile.indexer
container_name: watcher-dev-remote
user: "1000:1000"
depends_on:
- qdrant
env_file:
- .env
environment:
- QDRANT_URL=${QDRANT_URL}
- COLLECTION_NAME=${COLLECTION_NAME}
- HF_HOME=/tmp/huggingface
- HF_HUB_CACHE=/tmp/huggingface/hub
- TRANSFORMERS_CACHE=/tmp/huggingface/transformers
- FASTEMBED_CACHE_PATH=/tmp/huggingface/fastembed
- EMBEDDING_MODEL=${EMBEDDING_MODEL}
- EMBEDDING_PROVIDER=${EMBEDDING_PROVIDER}
- WATCH_ROOT=${WATCH_ROOT:-/work}
- HOST_INDEX_PATH=/work
- QDRANT_TIMEOUT=${QDRANT_TIMEOUT:-60}
- INDEX_SEMANTIC_CHUNKS=${INDEX_SEMANTIC_CHUNKS:-0}
- INDEX_MICRO_CHUNKS=${INDEX_MICRO_CHUNKS:-0}
- INDEX_UPSERT_BATCH=${INDEX_UPSERT_BATCH:-512}
- INDEX_UPSERT_RETRIES=${INDEX_UPSERT_RETRIES:-5}
- MAX_MICRO_CHUNKS_PER_FILE=${MAX_MICRO_CHUNKS_PER_FILE:-200}
- WATCH_DEBOUNCE_SECS=${WATCH_DEBOUNCE_SECS:-1.5}
- REMOTE_UPLOAD_ENABLED=${REMOTE_UPLOAD_ENABLED:-0}
volumes:
- workspace_pvc:/work:rw
- codebase_pvc:/work/.codebase:rw
command: ["sh", "-c", "mkdir -p /tmp/huggingface/hub /tmp/huggingface/transformers /tmp/huggingface/fastembed && exec python /app/scripts/watch_index.py"]
networks:
- dev-remote-network
# Init payload service - modified for PVC volumes with complete bootstrap
init_payload:
build:
context: .
dockerfile: Dockerfile.indexer
container_name: init-payload-dev-remote
user: "1000:1000"
depends_on:
- qdrant
env_file:
- .env
environment:
- QDRANT_URL=${QDRANT_URL}
- COLLECTION_NAME=${COLLECTION_NAME}
- HF_HOME=/work/.cache/huggingface
- TRANSFORMERS_CACHE=/work/.cache/huggingface
- HUGGINGFACE_HUB_CACHE=/work/.cache/huggingface
- WORKDIR=/work
- TOKENIZER_URL=${TOKENIZER_URL:-https://huggingface.co/BAAI/bge-base-en-v1.5/resolve/main/tokenizer.json}
- TOKENIZER_PATH=${TOKENIZER_PATH:-/work/models/tokenizer.json}
- EMBEDDING_MODEL=${EMBEDDING_MODEL}
volumes:
- workspace_pvc:/work:rw
- codebase_pvc:/work/.codebase:rw
command: [
"sh",
"-c",
"mkdir -p /tmp/logs && echo 'Starting initialization sequence...' && /app/scripts/wait-for-qdrant.sh && PYTHONPATH=/app python /app/scripts/create_indexes.py && echo 'Collections and metadata created' && python /app/scripts/warm_all_collections.py && echo 'Search caches warmed for all collections' && python /app/scripts/health_check.py && echo 'Initialization completed successfully!'"
]
restart: "no" # Run once on startup
networks:
- dev-remote-network
# NEW: Upload Service for Remote Upload System
upload_service:
build:
context: .
dockerfile: Dockerfile.upload-service
container_name: upload-service-dev-remote
user: "0:0" # Windows bind-mount to /work requires root to create workspace dirs
depends_on:
- qdrant
env_file:
- .env
environment:
# Upload service configuration
- UPLOAD_SERVICE_HOST=0.0.0.0
- UPLOAD_SERVICE_PORT=8002
- QDRANT_URL=${QDRANT_URL}
- WORKDIR=/work
- MAX_BUNDLE_SIZE_MB=100
- UPLOAD_TIMEOUT_SECS=300
# Indexing configuration
- COLLECTION_NAME=${COLLECTION_NAME}
- HF_HOME=/work/.cache/huggingface
- TRANSFORMERS_CACHE=/work/.cache/huggingface
- HUGGINGFACE_HUB_CACHE=/work/.cache/huggingface
- EMBEDDING_MODEL=${EMBEDDING_MODEL}
- EMBEDDING_PROVIDER=${EMBEDDING_PROVIDER}
- USE_TREE_SITTER=${USE_TREE_SITTER}
- INDEX_SEMANTIC_CHUNKS=${INDEX_SEMANTIC_CHUNKS}
- INDEX_MICRO_CHUNKS=${INDEX_MICRO_CHUNKS}
# Remote upload mode configuration
- REMOTE_UPLOAD_ENABLED=1
- REMOTE_UPLOAD_MODE=development
- REMOTE_UPLOAD_DEBUG=1
# Qdrant configuration
- QDRANT_TIMEOUT=${QDRANT_TIMEOUT}
- MAX_MICRO_CHUNKS_PER_FILE=${MAX_MICRO_CHUNKS_PER_FILE}
- INDEX_UPSERT_BATCH=${INDEX_UPSERT_BATCH}
- INDEX_UPSERT_RETRIES=${INDEX_UPSERT_RETRIES}
ports:
- "8004:8002" # Map to different host port to avoid conflicts
- "18004:18000" # Health check port
volumes:
- workspace_pvc:/work:rw
- codebase_pvc:/work/.codebase:rw
- upload_temp:/tmp/uploads
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8002/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
restart: unless-stopped
networks:
- dev-remote-network
# PVCs to simulate CephFS RWX behavior (production-like)
volumes:
# Main workspace volume - simulates CephFS RWX for repository storage
workspace_pvc:
driver: local
driver_opts:
type: none
o: bind
device: ${HOST_INDEX_PATH:-./dev-workspace}
# Codebase metadata volume - simulates CephFS RWX for indexing metadata
codebase_pvc:
driver: local
driver_opts:
type: none
o: bind
device: ./.codebase
# Temporary upload storage
upload_temp:
driver: local
# HuggingFace cache for model downloads
huggingface_cache:
driver: local
# Indexer cache for model downloads
indexer_cache:
driver: local
# Qdrant storage - separate from base compose to avoid conflicts
qdrant_storage_dev_remote:
driver: local
# Custom network for service discovery
networks:
dev-remote-network:
driver: bridge
ipam:
config:
- subnet: 172.20.0.0/16