Overview
This guide covers production-grade deployment of Blocklight with enterprise features including high availability, horizontal scaling, comprehensive monitoring, and disaster recovery.Pre-Deployment Checklist
Before deploying to production, ensure you have:- Validated all detection rules with
blocklight config check - Configured
.envwith production API keys - Set up monitoring infrastructure (Prometheus, Grafana, Loki)
- Configured alerting channels (Slack, PagerDuty, etc.)
- Planned backup and disaster recovery strategy
- Reviewed security best practices
- Load tested with expected transaction volume
Docker Compose Production Deployment
1. Configuration
Create a production-readyconfig.yaml:
2. Environment Variables
Create.env for production:
3. Deploy with Observability Stack
Resource Limits
Configure resource limits indocker-compose.yml:
High Availability Setup
Active-Passive Configuration
Deploy two Blocklight instances:- Primary Instance: Actively processing transactions
- Standby Instance: Ready to take over on failure
Health Checks
Configure comprehensive health checks:Scaling Considerations
Vertical Scaling
For high-throughput chains:- CPU: 4-8 cores for Ethereum mainnet
- Memory: 4-8GB RAM
- Disk: SSD with 100GB+ for logs and findings
- Network: 1Gbps+ for WebSocket connections
Horizontal Scaling
Deploy multiple instances per chain:start_block values to partition workload.
Monitoring and Observability
Prometheus Metrics
Key metrics to monitor:Grafana Dashboards
Import the pre-configured dashboard:- Open Grafana at
http://localhost:3000 - Navigate to Dashboards → Import
- Upload
config/grafana/dashboards/blocklight-detections.json - Select Loki and Prometheus data sources
Alerting Rules
Configure Prometheus alerts:Backup and Disaster Recovery
Configuration Backup
Backup critical files daily:Disaster Recovery Plan
- RTO (Recovery Time Objective): < 15 minutes
- RPO (Recovery Point Objective): < 1 hour
Security Best Practices
Network Security
- Use internal networks for service communication
- Expose only necessary ports
- Implement firewall rules
Secrets Management
Use Docker secrets or external secret managers:API Authentication
Enable authentication for gRPC API:Performance Tuning
Optimize Configuration
Database Optimization
For Loki:Cache Configuration
Troubleshooting
Common Issues
Issue: Event channel fullDebug Mode
Enable debug logging temporarily:Maintenance
Rolling Updates
Log Rotation
Configure log rotation:Database Maintenance
Compact Loki data:Cost Optimization
RPC Provider Optimization
- Use caching to reduce RPC calls
- Implement request batching
- Consider running your own node for high volumes
Resource Right-Sizing
Monitor actual usage and adjust:Support and Monitoring
Health Endpoints
- Basic Health:
GET /health - Detailed Health:
GET /health/detailed - Metrics:
GET /metrics
Logging
All logs are structured JSON for easy parsing:Next Steps
- Pipeline Integration - Integrate with SIEM and log aggregators
- Observability - Advanced monitoring and alerting
- Best Practices - Security and operational best practices