Skip to main content

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 .env with 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-ready config.yaml:

2. Environment Variables

Create .env for production:

3. Deploy with Observability Stack

Resource Limits

Configure resource limits in docker-compose.yml:

High Availability Setup

Active-Passive Configuration

Deploy two Blocklight instances:
  1. Primary Instance: Actively processing transactions
  2. Standby Instance: Ready to take over on failure
Use a load balancer (HAProxy, Nginx) with health checks:

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:
Use different start_block values to partition workload.

Monitoring and Observability

Prometheus Metrics

Key metrics to monitor:

Grafana Dashboards

Import the pre-configured dashboard:
  1. Open Grafana at http://localhost:3000
  2. Navigate to DashboardsImport
  3. Upload config/grafana/dashboards/blocklight-detections.json
  4. Select Loki and Prometheus data sources

Alerting Rules

Configure Prometheus alerts:

Backup and Disaster Recovery

Configuration Backup

Backup critical files daily:

Disaster Recovery Plan

  1. RTO (Recovery Time Objective): < 15 minutes
  2. RPO (Recovery Point Objective): < 1 hour
Recovery Steps:

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 full
Issue: High memory usage
Issue: Slow transaction processing

Debug 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