Overview
LatentGEO supports two canonical Docker deployment modes:- Standard Mode (
docker-compose.yml) - Production-ready containerized deployment - Development Mode (
docker-compose.dev.yml) - Hot reload for active development
Both modes use Supabase for PostgreSQL and Storage, with Redis for caching and SSE (Server-Sent Events).
Standard Mode (Production)
Configuration
The standard mode usesdocker-compose.yml with the following characteristics:
- Backend and worker containers without code mounts
- Frontend in production mode (optimized build)
- Server-side API URL:
http://backend:8000 - Browser-side API URL:
http://localhost:8000
Quick Start
Prepare environment file
Copy Key variables:
.env.example to .env and configure your environment variables:DATABASE_URL- Your Supabase PostgreSQL connection stringREDIS_URL- Redis connection URL (default:redis://redis:6379/0)SSE_SOURCE- SSE source (redisordb, default:redis)SUPABASE_URL- Your Supabase project URLSUPABASE_KEY- Your Supabase anon keySUPABASE_SERVICE_ROLE_KEY- Your Supabase service role key
Services
Backend
- Image: Built from
Dockerfile.backend - Port: 8000
- Command:
uvicorn app.main:app --host 0.0.0.0 --port 8000 - Health Check:
GET /health/liveevery 30s
Frontend
- Image: Built from
Dockerfile.frontend - Port: 3000
- Mode: Production (optimized build)
- Environment:
API_URL=http://backend:8000(server-side)NEXT_PUBLIC_API_URL=http://localhost:8000(browser)
Worker (Celery)
- Image: Built from
Dockerfile.backend - Command:
celery -A app.workers.tasks worker --loglevel=info --concurrency=2 --prefetch-multiplier=1 --max-tasks-per-child=20 - Resources: 2GB memory limit, 512MB reservation
Redis
- Image:
redis:7-alpine - Port: 6379 (internal)
- Purpose: Caching, Celery broker, SSE events
Development Mode
Configuration
The development mode usesdocker-compose.dev.yml with:
- Hot reload for backend (FastAPI with
--reload) - Hot reload for frontend (Next.js dev server)
- Code mounted as volumes for instant changes
- Optimized for fast iteration
Quick Start
Access services
- Frontend: http://localhost:3000
- Backend: http://localhost:8000
- API Docs: http://localhost:8000/docs
Development Features
Backend Hot Reload
Frontend Hot Reload
Resource Limits
- Backend: 2 CPU / 1GB memory
- Frontend: 2 CPU / 2GB memory
- Worker: 1 CPU / 512MB memory
- Redis: 0.5 CPU / 256MB memory
Environment Variables
Database & Cache
SSE Configuration
SSE (Server-Sent Events) provides real-time progress updates for audits. Redis is the primary source with automatic database fallback.
Supabase
Auth0
API Keys
Troubleshooting
Container Issues
Redis Connection Issues
SSE Not Working
Database Connection Issues
Frontend Build Failures
Worker Not Processing Tasks
Docker Commands Reference
Starting Services
Stopping Services
Viewing Logs
Executing Commands
Rebuilding
Production Considerations
Security
- Generate secure secrets using
python -c "import secrets; print(secrets.token_urlsafe(32))" - Never commit
.envfiles to version control - Use environment-specific
.envfiles (.env.production,.env.staging) - Rotate secrets regularly (every 90 days)
Performance
- Set appropriate worker concurrency based on CPU cores
- Configure database pool sizes based on connection limits
- Use Redis for SSE primary source (better performance than DB fallback)
- Monitor container resource usage with
docker stats
Monitoring
Next Steps
AWS Deployment
Deploy to AWS ECS with RDS and ElastiCache
Supabase Migration
Migrate between Supabase regions