-
Notifications
You must be signed in to change notification settings - Fork 0
Deployment
Lucius Morningstar edited this page Aug 8, 2026
·
1 revision
- Python 3.11+
- Docker and Docker Compose
- OpenRouter API key (or local LLM)
- 8GB+ RAM (16GB+ for local models)
docker compose -f docker/docker-compose.yml up -dServices:
| Service | Port | Purpose |
|---|---|---|
| Postgres 16 | 5432 | Catalog, checkpointer, audit log |
| ClickHouse | 8123/9000 | Langfuse analytics |
| Langfuse | 3000 | Trace viewer UI |
| Ollama (profile) | 11434 | Local LLM (Phase 10) |
cp .env.example .envCritical variables:
OPENROUTER_API_KEY=sk-or-v1-...
DATABASE_URL=postgresql+asyncpg://mailroom:mailroom@localhost:5432/mailroom
DATABASE_URL_SYNC=postgresql+psycopg://mailroom:mailroom@localhost:5432/mailroompip install -e ".[dev]"Three processes:
python pipeline/watcher.py & # Pipeline processor
python api/main.py & # FastAPI server
python pipeline/ops_monitor.py & # Health sweeps (optional)curl -X POST http://localhost:8000/upload \
-F "file=@tests/fixtures/contract/sample_msa.txt" \
-F "matter_id=TEST-001"
curl http://localhost:8000/ops/statusUse systemd, supervisord, or Docker for the three processes.
- Use managed Postgres or ensure proper backups
- Audit log is append-only — partition by date for long retention
- Encrypt
/archiveat rest - Enable Postgres encryption at rest
- Access-control FastAPI endpoints (API keys, OAuth, network)
- Access-control Langfuse UI (exposes full document content in traces)
- Never expose Postgres/ClickHouse ports publicly
- Back up
/archiveand audit log table independently
- Threaded watcher + single process is sufficient for dozens/day
- For higher volume: Redis-based queuing (deferred), multiple workers
- Langfuse: LLM call traces, latency, token usage
-
/ops/status: Pipeline metrics - Ops monitor: Automated periodic health sweeps
Add application services to docker-compose:
services:
mailroom-api:
build: .
command: python api/main.py
ports: ["8000:8000"]
environment:
- OPENROUTER_API_KEY=${OPENROUTER_API_KEY}
- DATABASE_URL=postgresql+asyncpg://mailroom:mailroom@postgres:5432/mailroom
volumes:
- mailroom_data:/data
depends_on:
postgres:
condition: service_healthy| Issue | Fix |
|---|---|
| Watcher not picking up files | Check MAILROOM_BASE_DIR, file extensions, watcher logs |
| Postgres connection errors | Verify DATABASE_URL, check Postgres is running |
| Langfuse no traces | Verify host, API keys, check container health |
| LLM provider errors | Check API key, credits, network connectivity |
Mailroom — Multi-Agent Legal Document Processing Pipeline. Built with LangGraph, OpenRouter, and Postgres.