feat: Refactor LLM router and integrate health check endpoint

- Simplified LLM call logic in llm_router.py, removing tool adapter complexity and enhancing error handling.
- Added health check endpoint to main.py for system status verification.
- Cleaned up router.py by removing unused imports and commented-out code, streamlining the structure.
- Updated docker-compose.yml to unify services under a single Lyra container, enhancing deployment simplicity.
- Created Dockerfile for unified container setup, including both Relay and Cortex services.
- Added QUICKSTART.md for improved onboarding and usage instructions.
- Implemented start.sh script to manage service startup and health checks.
This commit is contained in:
2026-05-29 18:20:56 -04:00
parent 376b8114ad
commit 5f53fb32a4
14 changed files with 802 additions and 1665 deletions
+22 -161
View File
@@ -3,101 +3,40 @@ networks:
driver: bridge
volumes:
postgres_data:
nebula_fallback:
driver: local
neo4j_data:
driver: local
code_executions:
relay_sessions:
driver: local
services:
# # ============================================================
# # NeoMem: Postgres
# # ============================================================
# neomem-postgres:
# image: ankane/pgvector:v0.5.1
# container_name: neomem-postgres
# restart: unless-stopped
# environment:
# POSTGRES_USER: neomem
# POSTGRES_PASSWORD: neomempass
# POSTGRES_DB: neomem
# volumes:
# - ./volumes/postgres_data:/var/lib/postgresql/data
# ports:
# - "5432:5432"
# healthcheck:
# test: ["CMD-SHELL", "pg_isready -U neomem -d neomem || exit 1"]
# interval: 5s
# timeout: 5s
# retries: 10
# networks:
# - lyra_net
# # ============================================================
# # NeoMem: Neo4j Graph
# # ============================================================
# neomem-neo4j:
# image: neo4j:5
# container_name: neomem-neo4j
# restart: unless-stopped
# environment:
# NEO4J_AUTH: "neo4j/neomemgraph"
# NEO4JLABS_PLUGINS: '["graph-data-science"]'
# volumes:
# - ./volumes/neo4j_data:/data
# ports:
# - "7474:7474"
# - "7687:7687"
# healthcheck:
# test: ["CMD-SHELL", "cypher-shell -u neo4j -p neomemgraph 'RETURN 1' || exit 1"]
# interval: 10s
# timeout: 10s
# retries: 10
# networks:
# - lyra_net
# ============================================================
# NeoMem API
# Lyra (Unified: Relay + Cortex + Intake)
# ============================================================
# neomem-api:
# build:
# context: ./neomem
# image: lyra-neomem:latest
# container_name: neomem-api
# restart: unless-stopped
# env_file:
# - ./neomem/.env
# - ./.env
# volumes:
# - ./neomem_history:/app/history
# ports:
# - "7077:7077"
# depends_on:
# neomem-postgres:
# condition: service_healthy
# neomem-neo4j:
# condition: service_healthy
# networks:
# - lyra_net
# ============================================================
# Relay (host mode)
# ============================================================
relay:
lyra:
build:
context: ./core/relay
container_name: relay
context: .
dockerfile: Dockerfile
container_name: lyra
restart: unless-stopped
env_file:
- ./.env
volumes:
- ./core/relay/sessions:/app/sessions
- relay_sessions:/app/relay/sessions
- nebula_fallback:/app/.nebula_fallback
- ./cortex:/app/cortex # Mount for hot reload during development
- /var/run/docker.sock:/var/run/docker.sock:ro
ports:
- "7078:7078"
- "7078:7078" # Relay API (user-facing)
- "7081:7081" # Cortex API (internal/debug)
networks:
- lyra_net
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:7078/_health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
# ============================================================
# UI Server
@@ -112,84 +51,6 @@ services:
- ./core/ui:/usr/share/nginx/html:ro
networks:
- lyra_net
# ============================================================
# Cortex
# ============================================================
cortex:
build:
context: ./cortex
container_name: cortex
restart: unless-stopped
env_file:
- ./cortex/.env
- ./.env
volumes:
- ./cortex:/app
- /var/run/docker.sock:/var/run/docker.sock:ro
ports:
- "7081:7081"
networks:
- lyra_net
# ============================================================
# Code Sandbox (for tool execution)
# ============================================================
code-sandbox:
build:
context: ./sandbox
container_name: lyra-code-sandbox
restart: unless-stopped
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
cap_add:
- CHOWN
- SETUID
- SETGID
network_mode: "none"
volumes:
- code_executions:/executions
mem_limit: 512m
cpus: 1.0
pids_limit: 100
user: sandbox
command: tail -f /dev/null
# ============================================================
# Intake
# ============================================================
# intake:
# build:
# context: ./intake
# container_name: intake
# restart: unless-stopped
# env_file:
# - ./intake/.env
# - ./.env
# ports:
# - "7080:7080"
# volumes:
# - ./intake:/app
# - ./intake-logs:/app/logs
# depends_on:
# - cortex
# networks:
# - lyra_net
# ============================================================
# RAG Service
# ============================================================
# rag:
# build:
# context: ./rag
# container_name: rag
# restart: unless-stopped
# environment:
# NEOMEM_URL: http://neomem-api:7077
# ports:
# - "7090:7090"
# networks:
# - lyra_net
depends_on:
lyra:
condition: service_healthy