Overview
This guide covers deploying Beacon in production environments, including cloud platforms, containerization, scaling strategies, monitoring, and security hardening.Deployment Options
Docker Deployment
Beacon includes a multi-stage Dockerfile for optimized production builds. Dockerfile (Dockerfile:1-27):
- Multi-stage build reduces image size from ~1.5GB to ~100MB
- Only includes runtime dependencies (ca-certificates)
- Strips debug symbols and build artifacts
Docker Compose
Deploy Beacon with Redis using Docker Compose:docker-compose.yml
Render.com Deployment
Beacon includes a Render deployment configuration:render.yaml
- Connect your GitHub repository to Render
- Create a new Web Service
- Select “Docker” as the environment
- Add environment variables in Render dashboard
- Deploy
Kubernetes Deployment
For production-grade deployments:k8s/deployment.yaml
Scaling Strategies
Horizontal Scaling
Beacon is stateless and can be horizontally scaled: Docker Compose:Load Balancing
Nginx Reverse Proxy:Redis Scaling
For high traffic, use Redis Cluster or managed services: Redis Sentinel (HA):- AWS ElastiCache:
rediss://master.xxx.cache.amazonaws.com:6379 - Google Cloud Memorystore: Built-in HA
- Azure Cache for Redis: Premium tier with clustering
Monitoring
Health Checks
Beacon provides a health endpoint:Logging
Beacon usestracing for structured logging:
Metrics Collection
Add Prometheus metrics (requiresprometheus crate):
Distributed Tracing
Integrate with OpenTelemetry:Cargo.toml
Security Hardening
TLS/HTTPS
Option 1: Nginx Terminationaxum-server with TLS feature):
API Key Authentication
Add authentication middleware:CORS Configuration
Rate Limit Bypassing Protection
Prevent header spoofing:Secret Management
Option 1: Environment VariablesDatabase Setup
Supabase Tables
Create the required tables in Supabase:Connection Pooling
For high traffic, configure Supabase connection pooling:Custom AI Provider Endpoints
Self-Hosted Gemini/Claude
Override API endpoints:src/inferrer.rs:18-23
Local LLM Integration
Add support for local models (Ollama, LM Studio):Performance Optimization
Caching Layer
Add Redis caching for repeated requests:Connection Keep-Alive
Reuse HTTP connections:src/inferrer.rs:8-13
Binary Size Reduction
Optimize for smaller Docker images:Cargo.toml
Disaster Recovery
Backup Strategy
- Redis Backups: Enable AOF and RDB snapshots
- Database Backups: Supabase automatic daily backups
- Configuration Backups: Version control all configs
High Availability
Cost Optimization
Free Tier Limits
- Render: 750 hours/month free
- Supabase: 500MB database, 2GB bandwidth
- Redis Cloud: 30MB free
- Gemini: Free tier available
Resource Limits
docker-compose.yml
Checklist
Before going to production:- Enable HTTPS/TLS
- Configure proper CORS
- Set up monitoring and alerts
- Enable Redis persistence
- Configure database backups
- Set resource limits
- Implement health checks
- Add structured logging
- Rotate API keys
- Test failover scenarios
- Document runbooks
- Set up CI/CD pipeline
Next Steps
Configuration
Review all environment variables
Rate Limiting
Customize rate limits for production