Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ SEMANTIC_EXPANSION_CACHE_TTL=3600

# Codebase state backend (for .codebase/state.json, .codebase/cache.json, symbols)
# Set CODEBASE_STATE_BACKEND=redis to use Redis (recommended for K8s)
# When switching backends, existing state is automatically migrated on startup.
# CODEBASE_STATE_BACKEND=file
# CODEBASE_STATE_REDIS_ENABLED=0
# CODEBASE_STATE_REDIS_URL=redis://redis:6379/0
Expand All @@ -169,6 +170,7 @@ SEMANTIC_EXPANSION_CACHE_TTL=3600
# CODEBASE_STATE_REDIS_LOCK_WAIT_MS=2000
# CODEBASE_STATE_REDIS_SOCKET_TIMEOUT=2
# CODEBASE_STATE_REDIS_CONNECT_TIMEOUT=2
# CODEBASE_STATE_SKIP_MIGRATION=0 # Set to 1 to disable auto-migration on backend switch

# Query Optimization (adaptive HNSW_EF tuning for 2x faster simple queries)
QUERY_OPTIMIZER_ADAPTIVE=1
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,7 @@ ctx_config.json
/deploy/eks-cdk
/deploy/eks-cdk-PATHFUL
.env
.contextstream/config.json
.contextstream/ignore
.cursorrules
GEMINI.md
31 changes: 31 additions & 0 deletions .qdrantignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,34 @@

# Dev workspace contains uploaded client workspaces - indexed separately
/dev-workspace

# CDK build artifacts (large, auto-generated)
/deploy/eks-cdk*/cdk.out/**
/deploy/eks-cdk*/**/*.js
/deploy/eks-cdk*/**/*.d.ts
/deploy/eks-cdk*/node_modules/**

# Node modules
/node_modules
**/node_modules

# Python virtual environments
/.venv*
/venv

# Model binaries
/models
*.onnx
*.bin
*.safetensors

# Test fixtures
/test-repos
/.selftest_repo

# IDE/Editor
/.idea
/.vscode

# ContextStream local cache
/.contextstream
44 changes: 43 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,24 @@
version: '3.8'

services:
# Redis cache/state backend
redis:
image: redis:7-alpine
container_name: redis-cache
ports:
- "6379:6379"
command: ["redis-server", "--appendonly", "yes", "--maxmemory", "256mb", "--maxmemory-policy", "allkeys-lru"]
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
networks:
- dev-remote-network

# Qdrant vector database - same as base compose
qdrant:
image: qdrant/qdrant:latest
Expand Down Expand Up @@ -102,6 +120,7 @@ services:
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
- redis
env_file:
- .env
environment:
Expand Down Expand Up @@ -172,6 +191,10 @@ services:
- RERANKER_WEIGHTS_DIR=/tmp/rerank_weights
- RERANK_EVENTS_DIR=/tmp/rerank_events
- RERANK_EVENTS_ENABLED=${RERANK_EVENTS_ENABLED:-1}
# Redis state backend
- CODEBASE_STATE_BACKEND=${CODEBASE_STATE_BACKEND:-file}
- CODEBASE_STATE_REDIS_URL=${CODEBASE_STATE_REDIS_URL:-redis://redis:6379/0}
- CODEBASE_STATE_REDIS_PREFIX=${CODEBASE_STATE_REDIS_PREFIX:-context-engine:codebase}
ports:
- "${FASTMCP_INDEXER_PORT:-8001}:8001"
- "18001:18001"
Expand All @@ -193,7 +216,7 @@ services:
command: ["sh", "-c", "mkdir -p /tmp/huggingface/hub /tmp/huggingface/transformers /tmp/huggingface/fastembed && exec python /app/scripts/learning_reranker_worker.py --daemon"]
depends_on:
- qdrant
- mcp_indexer
- redis
env_file:
- .env
environment:
Expand Down Expand Up @@ -316,6 +339,7 @@ services:
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
- redis
env_file:
- .env
environment:
Expand Down Expand Up @@ -378,6 +402,10 @@ services:
- RERANKER_WEIGHTS_DIR=/tmp/rerank_weights
- RERANK_EVENTS_DIR=/tmp/rerank_events
- RERANK_EVENTS_ENABLED=${RERANK_EVENTS_ENABLED:-1}
# Redis state backend
- CODEBASE_STATE_BACKEND=${CODEBASE_STATE_BACKEND:-file}
- CODEBASE_STATE_REDIS_URL=${CODEBASE_STATE_REDIS_URL:-redis://redis:6379/0}
- CODEBASE_STATE_REDIS_PREFIX=${CODEBASE_STATE_REDIS_PREFIX:-context-engine:codebase}
ports:
- "${FASTMCP_INDEXER_HTTP_PORT:-8003}:8001"
- "${FASTMCP_INDEXER_HTTP_HEALTH_PORT:-18003}:18001"
Expand Down Expand Up @@ -415,6 +443,7 @@ services:
user: "1000:1000"
depends_on:
- qdrant
- redis
env_file:
- .env
environment:
Expand Down Expand Up @@ -459,6 +488,10 @@ services:
- PSEUDO_DEFER_TO_WORKER=${PSEUDO_DEFER_TO_WORKER:-1}
# Parallel indexing - number of worker threads (default: 4, use -1 for CPU count)
- INDEX_WORKERS=${INDEX_WORKERS:-4}
# Redis state backend
- CODEBASE_STATE_BACKEND=${CODEBASE_STATE_BACKEND:-file}
- CODEBASE_STATE_REDIS_URL=${CODEBASE_STATE_REDIS_URL:-redis://redis:6379/0}
- CODEBASE_STATE_REDIS_PREFIX=${CODEBASE_STATE_REDIS_PREFIX:-context-engine:codebase}
volumes:
- workspace_pvc:/work:rw
- codebase_pvc:/work/.codebase:rw
Expand All @@ -477,6 +510,7 @@ services:
user: "1000:1000"
depends_on:
- qdrant
- redis
env_file:
- .env
environment:
Expand Down Expand Up @@ -524,6 +558,10 @@ services:
- NEO4J_GRAPH=${NEO4J_GRAPH:-}
# Defer pseudo-tag generation - watcher runs backfill worker thread
- PSEUDO_DEFER_TO_WORKER=${PSEUDO_DEFER_TO_WORKER:-1}
# Redis state backend
- CODEBASE_STATE_BACKEND=${CODEBASE_STATE_BACKEND:-file}
- CODEBASE_STATE_REDIS_URL=${CODEBASE_STATE_REDIS_URL:-redis://redis:6379/0}
- CODEBASE_STATE_REDIS_PREFIX=${CODEBASE_STATE_REDIS_PREFIX:-context-engine:codebase}
volumes:
- workspace_pvc:/work:rw
- codebase_pvc:/work/.codebase:rw
Expand Down Expand Up @@ -702,6 +740,10 @@ volumes:
rerank_events:
driver: local

# Redis data persistence
redis_data:
driver: local

# Custom network for service discovery
networks:
dev-remote-network:
Expand Down
4 changes: 4 additions & 0 deletions scripts/admin_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ def render_admin_acl(
users: Any,
collections: Any,
grants: Any,
api_keys: Optional[Any] = None,
neo4j_status: Optional[Dict[str, Any]] = None,
deletion_enabled: bool = False,
work_dir: str = "/work",
refresh_ms: int = 5000,
Expand All @@ -62,6 +64,8 @@ def render_admin_acl(
"users": users,
"collections": collections,
"grants": grants,
"api_keys": api_keys or [],
"neo4j_status": neo4j_status or {},
"deletion_enabled": bool(deletion_enabled),
"work_dir": work_dir,
"staging_enabled": bool(is_staging_enabled() if callable(is_staging_enabled) else False),
Expand Down
Loading