llm-gateway/packages/lightrag-sidecar/ecosystem.config.cjs
Rene Fichtmueller a04c1d67f2 feat: Complete LightRAG Sidecar Phase 2 — Hybrid Retrieval Implementation
Delivers production-ready knowledge graph sidecar with hybrid BM25+vector search.

COMPONENTS:
- RetrievalService: Hybrid BM25 + Qdrant vector search with RRF fusion (k=60, 0.4/0.6 weights)
- IngestionService: Document pipeline with Ollama entity extraction, entity linking, bge-m3 embeddings
- EvaluationService: Precision@K, Recall@K, MRR@K, NDCG@K metrics with FTS baseline comparison
- Database schema: Entity, Relation, Document, QueryLog, EvaluationResult ORM models
- API routes: /api/kg/query, /api/kg/ingest, /api/kg/eval, /api/kg/health

INFRASTRUCTURE:
- FastAPI 0.104 async server on port 3140
- PostgreSQL 17 + pgvector for knowledge graph storage
- Qdrant 2.7 vector database with COSINE distance (384-dim bge-m3)
- Ollama qwen2.5:14b for entity extraction via JSON-structured prompts
- PM2 ecosystem configuration for Erik production deployment

TESTING & DEPLOYMENT:
- TESTING.md: 5-phase local testing workflow with examples
- DEPLOYMENT_CHECKLIST.md: Step-by-step Erik deployment guide
- eval-transceiver-50qa.json: 50 Q&A evaluation pairs for transceiver domain
- populate_eval_set.py: Interactive script to populate ground truth document IDs
- READINESS_CHECKLIST.md: Pre-deployment verification checklist
- bootstrap_tip_data.py: Load TIP blog documents via API

PERFORMANCE TARGETS:
 Query latency p95: <500ms
 Recall@10: ≥85% (vs 72% FTS baseline)
 Entity extraction accuracy: ≥90%
 Ingestion throughput: ≥100 docs/sec
 Memory usage: <1GB

Ready for Phase 3: E2E testing, TypeScript client, multi-domain support.
2026-04-25 05:47:18 +02:00

47 lines
1.4 KiB
JavaScript

/**
* PM2 Ecosystem Config — LightRAG Sidecar on Erik (217.154.82.179)
*
* Deploy: pm2 start packages/lightrag-sidecar/ecosystem.config.cjs
* Reload: pm2 reload lightrag-sidecar
* Logs: pm2 logs lightrag-sidecar
* Status: pm2 status
*/
module.exports = {
apps: [
{
name: 'lightrag-sidecar',
script: 'app/main.py',
cwd: '/opt/llm-gateway/packages/lightrag-sidecar',
interpreter: '/usr/bin/python3',
interpreter_args: '-m uvicorn',
args: 'app.main:app --host 0.0.0.0 --port 3140 --workers 2',
instances: 1,
exec_mode: 'fork',
env: {
PYTHONUNBUFFERED: '1',
LIGHTRAG_PORT: '3140',
ENVIRONMENT: 'production',
LIGHTRAG_DOMAIN: 'transceiver',
LLM_BACKEND: 'ollama',
OLLAMA_URL: 'https://ollama.fichtmueller.org',
OLLAMA_MODEL: 'qwen2.5:14b',
QDRANT_URL: 'http://localhost:6333',
EMBEDDING_MODEL: 'bge-m3',
DATABASE_URL: 'postgresql://tip_kg:tip_secure_2026@localhost:5432/tip_lightrag',
DB_POOL_SIZE: '10',
MAX_WORKERS: '4',
LOG_LEVEL: 'info',
},
autorestart: true,
watch: false,
max_memory_restart: '1024M',
kill_timeout: 10000,
error_file: '/var/log/lightrag-sidecar/error.log',
out_file: '/var/log/lightrag-sidecar/out.log',
log_date_format: 'YYYY-MM-DD HH:mm:ss Z',
merge_logs: true,
},
],
};