LightRAG/render.yaml
Clément THOMAS 62b2a71dda feat(api): add multi-workspace server support for multi-tenant deployments
Enable a single LightRAG server instance to serve multiple isolated workspaces
via HTTP header-based routing. This allows multi-tenant SaaS deployments where
each tenant's data is completely isolated.

Key features:
- Header-based workspace routing (LIGHTRAG-WORKSPACE, X-Workspace-ID fallback)
- Process-local pool of LightRAG instances with LRU eviction
- FastAPI dependency (get_rag) for workspace resolution per request
- Full backward compatibility - existing deployments work unchanged
- Strict multi-tenant mode option (LIGHTRAG_ALLOW_DEFAULT_WORKSPACE=false)
- Configurable pool size (LIGHTRAG_MAX_WORKSPACES_IN_POOL)
- Graceful shutdown with workspace finalization

Configuration:
- LIGHTRAG_DEFAULT_WORKSPACE: Default workspace (falls back to WORKSPACE)
- LIGHTRAG_ALLOW_DEFAULT_WORKSPACE: Require explicit header when false
- LIGHTRAG_MAX_WORKSPACES_IN_POOL: Max concurrent workspace instances (default: 50)

Files:
- New: lightrag/api/workspace_manager.py (core multi-workspace module)
- New: tests/test_multi_workspace_server.py (17 unit tests)
- New: render.yaml (Render deployment blueprint)
- Modified: All route files to use get_rag dependency
- Updated: README.md, env.example with documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 12:07:22 +01:00

74 lines
1.9 KiB
YAML

# Render Blueprint for LightRAG Server with Multi-Workspace Support
# https://render.com/docs/blueprint-spec
services:
- type: web
name: lightrag
runtime: docker
dockerfilePath: ./Dockerfile
# Health check
healthCheckPath: /health
# Auto-scaling (adjust based on your plan)
autoDeploy: true
# Disk for persistent storage (required for file-based storage)
disk:
name: lightrag-data
mountPath: /app/data
sizeGB: 10 # Adjust based on your needs
# Environment variables
envVars:
# Server configuration
- key: PORT
value: 9621
- key: HOST
value: 0.0.0.0
# Multi-workspace configuration
- key: LIGHTRAG_DEFAULT_WORKSPACE
value: default
- key: LIGHTRAG_ALLOW_DEFAULT_WORKSPACE
value: "true" # Set to "false" for strict multi-tenant mode
- key: LIGHTRAG_MAX_WORKSPACES_IN_POOL
value: "50"
# Storage paths (using persistent disk)
- key: WORKING_DIR
value: /app/data/rag_storage
- key: INPUT_DIR
value: /app/data/inputs
# LLM Configuration (set these in Render dashboard as secrets)
- key: LLM_BINDING
sync: false # Configure in dashboard
- key: LLM_MODEL
sync: false
- key: LLM_BINDING_HOST
sync: false
- key: LLM_BINDING_API_KEY
sync: false
# Embedding Configuration (set these in Render dashboard as secrets)
- key: EMBEDDING_BINDING
sync: false
- key: EMBEDDING_MODEL
sync: false
- key: EMBEDDING_DIM
sync: false
- key: EMBEDDING_BINDING_HOST
sync: false
- key: EMBEDDING_BINDING_API_KEY
sync: false
# Optional: API Key protection (set in dashboard as secret)
- key: LIGHTRAG_API_KEY
sync: false
# Optional: JWT Auth (set in dashboard as secrets)
- key: AUTH_ACCOUNTS
sync: false
- key: TOKEN_SECRET
sync: false