Rollback deployment to previous version with safety checks, database considerations, and monitoring
npx claude-code-templates@latest --skill β’β’β’β’β’β’β’β’β’β’β’β’β’β’β’β’β’β’β’β’Unlock this skill to run and inspect the interactive installation sequence.
Rollback deployment to previous version: $ARGUMENTS
curl -s https://api.example.com/version 2>/dev/null || kubectl get deployments -o wide 2>/dev/null | head -3 || echo "Version detection needed"git tag --sort=-version:refname | head -5docker ps --format "table {{.Names}}\t{{.Image}}\t{{.Status}}" 2>/dev/null | head -5 || echo "No containers"kubectl get deployments 2>/dev/null || echo "No K8s access"curl -sf https://api.example.com/health 2>/dev/null && echo "β
Healthy" || echo "β Unhealthy"Systematic rollback procedure: $ARGUMENTS
- Assess the severity and impact of the current deployment issues
- Determine if rollback is necessary or if forward fix is better
- Identify affected systems, users, and business functions
- Consider data integrity and consistency implications
- Document the decision rationale and timeline
# Activate incident response team # Set up communication channels # Notify stakeholders immediately # Example emergency notification echo "π¨ ROLLBACK INITIATED Issue: Critical performance degradation after v1.3.0 deployment Action: Rolling back to v1.2.9 ETA: 15 minutes Impact: Temporary service interruption possible Status channel: #incident-rollback-202401"
# Verify current production version curl -s https://api.example.com/version kubectl get deployments -o wide # Check system status curl -s https://api.example.com/health | jq . # Identify target rollback version git tag --sort=-version:refname | head -5 # Verify rollback target exists and is deployable git show v1.2.9 --stat
# Check for database migrations since last version ./check-migrations.sh v1.2.9 v1.3.0 # If migrations exist, plan database rollback # WARNING: Database rollbacks can cause data loss # Consider forward fix instead if migrations are present # Create database backup before rollback ./backup-database.sh "pre-rollback-$(date +%Y%m%d-%H%M%S)"
# Prepare to redirect traffic # Option 1: Maintenance page ./enable-maintenance-mode.sh # Option 2: Load balancer management ./drain-traffic.sh --gradual # Option 3: Circuit breaker activation ./activate-circuit-breaker.sh
# Kubernetes rollback kubectl rollout history deployment/app-deployment kubectl rollout undo deployment/app-deployment # Or rollback to specific revision kubectl rollout undo deployment/app-deployment --to-revision=3 # Monitor rollback progress kubectl rollout status deployment/app-deployment --timeout=300s # Verify pods are running kubectl get pods -l app=your-app
# List service history docker service ps app-service --no-trunc # Rollback to previous version docker service update --rollback app-service # Or update to specific image docker service update --image app:v1.2.9 app-service # Monitor rollback docker service ps app-service
# Blue-Green deployment rollback ./switch-to-blue.sh # or green, depending on current # Rolling deployment rollback ./deploy-version.sh v1.2.9 --rolling # Symlink-based rollback ln -sfn /releases/v1.2.9 /current sudo systemctl restart app-service
# Update load balancer to point to old version aws elbv2 modify-target-group --target-group-arn $TG_ARN --targets Id=old-instance # Clear CDN cache if needed aws cloudfront create-invalidation --distribution-id $DIST_ID --paths \"/*\" # Update DNS if necessary (last resort, has propagation delay) # aws route53 change-resource-record-sets ...
# Step 1: Initialize skill agent setup
npx skills add Rollback Deploy --install-production
python -m pip install -r requirements.txt
codex plugin install Rollback Deploy@latest
export API_KEY=secret_token_key_here
Unlock this skill to reveal complete step-by-step setup guides, terminal commands, configuration recipes, repository links, and interactive installation video walkthroughs.
Get instant access to complete setup guides, repository source code, and integration assets.
Generate a complete test file for a specified source file or component. Use when the user explicitly asks to write, create, or generate tests for a specific file.
Multi-framework structured analysis: surfaces hidden assumptions, generates competing solutions, stress-tests each with adversarial reasoning, and delivers confidence-calibrated recommendations
Generate comprehensive architecture documentation with diagrams, ADRs, and interactive visualization