1.9 KiB
1.9 KiB
Lovdata Chat Development Environment
This setup creates a container-per-visitor architecture for the Norwegian legal research chat interface with socket-based Docker communication.
Quick Start
-
Set up environment variables:
cp .env.example .env # Edit .env with your API keys and MCP server URL -
Start the services:
docker-compose up --build -
Create a session:
curl http://localhost/api/sessions -X POST -
Access the chat interface: Open the returned URL in your browser
Architecture
- session-manager: FastAPI service managing container lifecycles with socket-based Docker communication
- lovdata-mcp: External Norwegian legal research MCP server (configured via MCP_SERVER env var)
- caddy: Reverse proxy with dynamic session-based routing
Security Features
- Socket-based Docker communication: Direct Unix socket access for container management
- Container isolation: Each visitor gets dedicated container with resource limits
- Automatic cleanup: Sessions expire after 60 minutes of inactivity
- Resource quotas: 4GB RAM, 1 CPU core per container, max 3 concurrent sessions
Development Notes
- Session data persists in ./sessions/ directory
- Docker socket mounted from host for development
- External MCP server configured via environment variables
- Health checks ensure service reliability
API Endpoints
POST /api/sessions- Create new sessionGET /api/sessions- List all sessionsGET /api/sessions/{id}- Get session infoDELETE /api/sessions/{id}- Delete sessionPOST /api/cleanup- Manual cleanupGET /api/health- Health check/{path}- Dynamic proxy routing (with X-Session-ID header)
Environment Variables
# Required
MCP_SERVER=http://your-lovdata-mcp-server:8001
# Optional LLM API keys
OPENAI_API_KEY=your_key
ANTHROPIC_API_KEY=your_key
GOOGLE_API_KEY=your_key