* local question answering over analysis notebooks with LightRAG, Neo4j, Qdrant and Ollama * RAGAS evaluation with a generator x judge comparison matrix, fully local * docs in README and OKF
126 lines
4.0 KiB
YAML
126 lines
4.0 KiB
YAML
services:
|
||
|
||
# ===== Main askme RAG application ==========================================
|
||
askme:
|
||
build: .
|
||
container_name: askme
|
||
volumes:
|
||
- .:/usr/askme # live code reload
|
||
- ./data:/usr/askme/data # notebooks, processed text, indexes
|
||
environment:
|
||
- PYTHONPATH=/usr/askme
|
||
- DATA_DIR=/usr/askme/data
|
||
- NEO4J_URI=neo4j://neo4j:7687
|
||
- NEO4J_USERNAME=neo4j
|
||
- NEO4J_PASSWORD=${NEO4J_PASSWORD:-askme_neo4j}
|
||
- QDRANT_URL=http://qdrant:6333
|
||
- OLLAMA_HOST=http://ollama:11434
|
||
- LLM_MODEL=${LLM_MODEL:-qwen2.5:7b}
|
||
- LLM_TIMEOUT=900
|
||
- EMBEDDING_TIMEOUT=300
|
||
- EMBEDDING_MODEL=${EMBEDDING_MODEL:-nomic-embed-text}
|
||
env_file:
|
||
- .env
|
||
ports:
|
||
- "8000:8000"
|
||
depends_on:
|
||
neo4j:
|
||
condition: service_healthy
|
||
qdrant:
|
||
condition: service_started
|
||
ollama-init:
|
||
condition: service_completed_successfully
|
||
restart: unless-stopped
|
||
|
||
# ==== Neo4j – graph storage for LightRAG knowledge graph ===================
|
||
neo4j:
|
||
image: neo4j:5-community
|
||
container_name: askme-neo4j
|
||
environment:
|
||
- NEO4J_AUTH=neo4j/${NEO4J_PASSWORD:-askme_neo4j}
|
||
- NEO4J_PLUGINS=["apoc"]
|
||
- NEO4J_dbms_memory_heap_max__size=2G
|
||
- NEO4J_dbms_memory_pagecache_size=1G
|
||
ports:
|
||
- "7474:7474" # Neo4j Browser UI
|
||
- "7687:7687" # Bolt protocol
|
||
volumes:
|
||
- neo4j_data:/data
|
||
- neo4j_logs:/logs
|
||
healthcheck:
|
||
test: ["CMD", "cypher-shell", "-u", "neo4j", "-p", "${NEO4J_PASSWORD:-askme_neo4j}", "RETURN 1"]
|
||
interval: 15s
|
||
timeout: 10s
|
||
retries: 10
|
||
restart: unless-stopped
|
||
|
||
# ==== Qdrant – vector storage for dense retrieval ==========================
|
||
qdrant:
|
||
image: qdrant/qdrant:latest
|
||
container_name: askme-qdrant
|
||
ports:
|
||
- "6333:6333" # REST API
|
||
- "6334:6334" # gRPC
|
||
volumes:
|
||
- qdrant_data:/qdrant/storage
|
||
restart: unless-stopped
|
||
|
||
# ==== Ollama – local LLM server (Qwen2.5-7B + embedding model) =============
|
||
ollama:
|
||
image: ollama/ollama:latest
|
||
container_name: askme-ollama
|
||
environment:
|
||
# #ADJUST memory: parallel request slots per loaded model; each costs KV-cache
|
||
# VRAM — too many spill the model to CPU (much slower). Speed, not scores.
|
||
- OLLAMA_NUM_PARALLEL=2
|
||
- OLLAMA_KEEP_ALIVE=${OLLAMA_KEEP_ALIVE:-5m} # long enough to stay warm across ingest calls; frees the GPU when idle
|
||
# #ADJUST context management: default window for requests that set none (eval
|
||
# generators and judges via /v1). Longer prompts are truncated silently; larger
|
||
# windows cost VRAM.
|
||
- OLLAMA_CONTEXT_LENGTH=16384 # default ctx for the RAGAS judge (LightRAG pins its own 4096)
|
||
- GGML_CUDA_FORCE_CUBLAS=1
|
||
ports:
|
||
- "11434:11434"
|
||
volumes:
|
||
- ollama_models:/root/.ollama
|
||
healthcheck:
|
||
test: ["CMD", "ollama", "list"]
|
||
interval: 10s
|
||
timeout: 10s
|
||
retries: 12
|
||
start_period: 20s
|
||
# GPU passthrough via CDI — requires NVIDIA Container Toolkit on host and a
|
||
# generated spec: `sudo nvidia-ctk cdi generate --output=/etc/cdi/nvidia.yaml`
|
||
# (re-run after driver updates). The legacy `driver: nvidia` hook left CUDA
|
||
# failing with cuInit 999 inside the container on driver 610.
|
||
deploy:
|
||
resources:
|
||
reservations:
|
||
devices:
|
||
- driver: cdi
|
||
device_ids: ["nvidia.com/gpu=all"]
|
||
capabilities: [gpu]
|
||
restart: unless-stopped
|
||
|
||
# ==== Pull required models once on first start ==============================
|
||
ollama-init:
|
||
image: ollama/ollama:latest
|
||
container_name: askme-ollama-init
|
||
depends_on:
|
||
ollama:
|
||
condition: service_healthy
|
||
environment:
|
||
- OLLAMA_HOST=http://ollama:11434
|
||
entrypoint: ["/bin/sh", "-c"]
|
||
command:
|
||
- |
|
||
ollama pull ${LLM_MODEL:-qwen2.5:7b} &&
|
||
ollama pull ${EMBEDDING_MODEL:-nomic-embed-text}
|
||
restart: "no"
|
||
|
||
volumes:
|
||
neo4j_data:
|
||
neo4j_logs:
|
||
qdrant_data:
|
||
ollama_models:
|