The Kubernetes, ECS, PM2, and Docker Compose procedures below are legacy examples. For the current backend deployment, use Dokploy rollback and the release checks in the production deployment guide.
Overview
This document provides procedures for rolling back deployments in the Learnille platform. Rollbacks may be necessary due to application failures, performance issues, or other critical problems.Rollback Types
1. Automated Rollback
- Trigger: Health check failures, error thresholds exceeded
- Execution: Immediate, no manual intervention required
- Duration: < 5 minutes
- Scope: Application container rollback
2. Manual Rollback
- Trigger: Detected issues requiring human judgment
- Execution: Manual command execution
- Duration: 10-30 minutes
- Scope: Application, database, or infrastructure
3. Emergency Rollback
- Trigger: Critical system failure, security breach
- Execution: Immediate action by on-call engineer
- Duration: < 15 minutes
- Scope: Complete environment restoration
Pre-Rollback Checklist
Assessment
- Identify the issue and impact
- Determine rollback scope (application, database, infrastructure)
- Check current system status and monitoring
- Notify stakeholders if needed
- Gather evidence (logs, metrics, user reports)
Preparation
- Verify backup availability and integrity
- Check previous version stability
- Prepare rollback commands/scripts
- Ensure access to deployment tools
- Coordinate with team members if needed
Automated Rollback Procedures
Application Rollback (Kubernetes)
Immediate Rollback
Blue-Green Rollback
Database Rollback
Migration Rollback
Data Restore (if needed)
Manual Rollback Procedures
1. Application Rollback
Self-Hosted PM2 / Git Rollback
AWS ECS rollback (legacy)
Using Docker Compose
2. Infrastructure Rollback
Terraform Rollback
CloudFormation Rollback
3. Configuration Rollback
Environment Variables
Configuration Files
Emergency Rollback Procedures
Critical System Failure
-
Immediate Assessment
-
Execute Emergency Rollback
-
Traffic Management
Security Incident Response
-
Isolate Affected Systems
-
Data Recovery
-
Security Validation
Post-Rollback Procedures
Validation Steps
- Application health checks passing
- Database connectivity verified
- User functionality tested
- Performance metrics normal
- Monitoring alerts cleared
Documentation
Communication
- Notify internal team via Slack
- Update external status page
- Send customer communication if needed
- Schedule post-mortem meeting
Investigation
- Analyze root cause of deployment failure
- Review monitoring data during incident
- Update deployment processes if needed
- Document lessons learned
Monitoring During Rollback
Key Metrics to Monitor
- Application response time
- Error rates by endpoint
- Database connection pool usage
- Infrastructure resource utilization
- User session success rate
Alerting During Rollback
Rollback Testing
Regular Testing
- Monthly rollback drills
- Automated rollback testing in staging
- Documentation review and updates
- Team training sessions
Test Scenarios
- Application deployment failure
- Database migration failure
- Infrastructure configuration error
- Security vulnerability discovery
- Performance degradation
Tools and Resources
Rollback Scripts
Monitoring Dashboard
- Rollback status dashboard
- Real-time metrics during rollback
- Historical rollback data
- Success/failure analytics
Contact Information
Emergency Contacts
- Primary On-call: +1-555-0123 (DevOps Engineer)
- Secondary On-call: +1-555-0124 (Senior Engineer)
- Management: +1-555-0125 (Engineering Manager)
Communication Channels
- Slack: #incidents
- Email: incidents@learnille.com
- Status Page: https://status.learnille.com
- Runbook Repository: https://github.com/learnille/runbooks
Continuous Improvement
Metrics Tracking
- Rollback frequency and success rate
- Mean time to rollback
- Customer impact assessment
- Process efficiency improvements
Process Updates
- Regular review of rollback procedures
- Incorporation of lessons learned
- Tool and automation improvements
- Team training and preparedness