Environment Configuration
Required Variables
SECRET_KEY_BASE
Purpose: Phoenix signing/encryption secret for session security.Generate:Requirements:Validation:
- Minimum 64 bytes
- Keep secret (never commit to version control)
- Use same value across all nodes in a cluster
PHX_HOST
Purpose: Public hostname for URL generation and CORS.Set:Examples:
- Single region:
rpc.example.com - Multi-region:
us-east-1.rpc.example.com,eu-west-1.rpc.example.com
PHX_SERVER
Purpose: Start the HTTP server (required for releases).Set:Note: Automatically set in Dockerfile. Verify in non-Docker deployments.
LASSO_NODE_ID
Purpose: Unique, stable identifier for this node.Set:Requirements:
- Unique per node
- Stable (don’t change after deployment)
- Convention: use region names for geo-distributed deployments
us-east-1,eu-west-1,ap-southeast-1(cloud regions)iad,lhr,sin(datacenter codes)production-1,staging-1(environment-based)
Provider API Keys
Identify required providers
Review your profile YAML files for Example output:
${ENV_VAR} placeholders:Clustering (Optional)
Set clustering variables (if clustering)
Profile Configuration
Validate Profile YAML
Verify required fields
Each profile must have:
name: Display nameslug: URL-safe identifierchains: At least one chain with providers
Rate Limits
Health Checks
Configure Health Endpoint
TLS/HTTPS
Terminate TLS at Load Balancer
Configure reverse proxy
Lasso serves HTTP. Terminate TLS at your reverse proxy or load balancer.nginx:Cloud Load Balancers:
- AWS ALB: Configure HTTPS listener with ACM certificate
- GCP Load Balancer: Use Google-managed certificates
- Azure Application Gateway: Configure SSL termination
Logging
Structured JSON Logs
Monitoring
Dashboard Access
Metrics Collection
Monitor key metrics
Track these metrics:Request metrics:
- Requests per second (total and per provider)
- Latency (P50, P95, P99)
- Error rate
- Circuit breaker state
- CPU usage
- Memory usage
- BEAM scheduler utilization
- Process count
- Provider availability
- Provider latency
- Circuit breaker trips
- Failover rate
Network & Firewall
Port Configuration
Open required ports
Single node:
- 4000 (HTTP, configurable via
PORT)
- 4000 (HTTP)
- 4369 (EPMD)
- 9000-9999 (Erlang distribution, configurable)
Capacity Planning
Resource Allocation
Estimate request volume
Calculate expected requests per second (RPS):Example:
- 1000 users
- 10 requests per user per minute
- = 167 RPS
Size compute resources
CPU:
- 1 vCPU per 500 RPS (approximate)
- Example: 334 RPS → 2 vCPUs
- Base: 512MB
- Add 256MB per 1000 RPS
- Example: 334 RPS → 1GB
- Minimal (logs only, unless persisting metrics)
- 10GB should suffice
Disaster Recovery
Backup Configuration
Failover Testing
Pre-Launch Checklist
Complete verification before production launch:Environment
-
SECRET_KEY_BASEset (64+ bytes) -
PHX_HOSTset to public hostname -
PHX_SERVER=trueset -
LASSO_NODE_IDset to unique, stable value -
PORTconfigured (if not using 4000) - Provider API keys set for all
${ENV_VAR}in profiles - If clustering:
CLUSTER_DNS_QUERYandCLUSTER_NODE_BASENAMEset - If clustering: DNS resolution verified
- If clustering: Erlang distribution ports open between nodes
Configuration
- Profile YAML validated (no syntax errors)
- Profile YAML startup tested (no unresolved
${ENV_VAR}) - Rate limits configured in profile frontmatter
- Provider capabilities defined (or defaults accepted)
- Circuit breaker thresholds reviewed (or defaults accepted)
Infrastructure
- Health check (
GET /api/health) monitored by orchestrator/LB - TLS terminated at reverse proxy or load balancer
- Firewall rules configured (4000 public, 4369/9000+ internal only)
- Load balancer configured (if multiple nodes per region)
- GeoDNS/anycast configured (if multi-region)
Observability
- Structured JSON logs verified
- Log aggregation configured (Fluentd, CloudWatch, etc.)
- Dashboard access secured (auth, VPN, or internal-only)
- Metrics monitoring configured (CPU, memory, RPS, latency)
- Alerts configured (high error rate, circuit breaker, slow response)
Testing
- Load testing completed (verify RPS capacity)
- Provider failover tested (circuit breaker triggers correctly)
- Rate limiting tested (429 responses after exceeding limit)
- If clustered: Node failure tested (dashboard shows :disconnected)
- If multi-region: Regional failover tested (GeoDNS/LB routes correctly)
Documentation
- Runbook created (restart procedures, troubleshooting)
- Environment variables documented in secrets manager
- Profile configuration backed up
- On-call team trained (dashboard usage, common issues)
Post-Launch Monitoring
Monitor these metrics in the first 24-48 hours:- Request volume: Verify within expected range
- Error rate: Should be <1%
- Latency: P95/P99 within acceptable thresholds
- Circuit breaker trips: Investigate any provider issues
- Memory/CPU: Verify resources are adequate
- Log errors: Review for unexpected issues
Next Steps
- Docker Deployment - Containerized deployment guide
- Clustering - Multi-node setup
- Geo-Distributed - Multi-region architecture