Rollbacks
Learn how to rollback your application to a previous release when issues occur.
Overview
Section titled “Overview”Rollbacks allow you to instantly revert your application to a previously deployed release. This is essential for recovering from bad deployments, bugs, or breaking changes.
Why Rollback?
Section titled “Why Rollback?”Common reasons to rollback:
- New release has critical bugs
- Performance degradation
- Breaking changes affect users
- Configuration errors
- Security vulnerabilities discovered
Zero-Downtime Rollbacks
Section titled “Zero-Downtime Rollbacks”All rollbacks in brdz are zero-downtime:
- Instant switch to previous release
- No service interruption
- Immediate traffic routing to old version
How to Rollback
Section titled “How to Rollback”Step 1: List Releases
Section titled “Step 1: List Releases”View available releases for your app:
# Ensure correct app contextbrdz ctx:get
# List all releasesbrdz releases:listOutput example:
ID Status Created At52 active 2025-01-18 16:00:00 <- Current (broken)51 inactive 2025-01-18 14:30:00 <- Previous (working)50 inactive 2025-01-17 10:15:0049 inactive 2025-01-16 18:45:00Step 2: Identify Target Release
Section titled “Step 2: Identify Target Release”Find the release ID you want to rollback to (usually the previous active release).
Step 3: Execute Rollback
Section titled “Step 3: Execute Rollback”brdz releases:rollback 51The rollback happens instantly:
- Release 51 becomes active
- Release 52 becomes inactive
- Traffic immediately routes to release 51
- No downtime occurs
Step 4: Verify
Section titled “Step 4: Verify”# Verify the rollbackbrdz releases:list
# Should show:# ID Status Created At# 52 inactive 2025-01-18 16:00:00# 51 active 2025-01-18 14:30:00 <- Now active# ...Test your application to confirm it’s working correctly.
Common Scenarios
Section titled “Common Scenarios”Scenario 1: Immediate Rollback
Section titled “Scenario 1: Immediate Rollback”A new deployment has critical bugs:
# Deploy new versionbrdz releases:create new-version.zip# ID: 42 (now active)
# Bugs discovered immediately# Rollback to previous releasebrdz releases:listbrdz releases:rollback 41
# Users now see the stable versionScenario 2: Partial Rollout Issue
Section titled “Scenario 2: Partial Rollout Issue”Testing reveals issues after partial deployment:
# Initial deployment looks goodbrdz releases:create v2.0.zip
# After monitoring, issues found# Rollback to stable versionbrdz releases:listbrdz releases:rollback 40Scenario 3: Multiple Rollbacks
Section titled “Scenario 3: Multiple Rollbacks”Need to go back several versions:
# Current release: 45 (broken)# Previous: 44 (also broken)# Target: 43 (stable)
brdz releases:listbrdz releases:rollback 43Scenario 4: Rollback and Fix
Section titled “Scenario 4: Rollback and Fix”Rollback, fix issues, then redeploy:
# Rollback to stable versionbrdz releases:rollback 40
# Fix the issues locallynpm run fix-bugs
# Build and testnpm run buildnpm run test
# Deploy fixed versionzip -r release.zip dist/brdz releases:create release.zipBest Practices
Section titled “Best Practices”1. Monitor After Deployment
Section titled “1. Monitor After Deployment”Always monitor new releases:
- Watch error logs
- Monitor performance metrics
- Check user reports
- Review analytics
2. Keep Release History
Section titled “2. Keep Release History”Don’t delete old releases immediately:
- Keep at least 5-10 recent releases
- Maintain stable versions for quick rollback
- Document known-good releases
3. Test Before Production
Section titled “3. Test Before Production”Use staging environments:
# Deploy to staging firstbrdz ctx:use # Select staging appbrdz releases:create release.zip
# Test thoroughly
# Deploy to productionbrdz ctx:use # Select production appbrdz releases:create release.zip4. Document Releases
Section titled “4. Document Releases”Keep notes about releases:
# Create release with version taggit tag v1.2.3npm run buildzip -r release-v1.2.3.zip dist/brdz releases:create release-v1.2.3.zip
# Document in changelogecho "Release 52: v1.2.3 - Added new feature" >> releases.log5. Have a Rollback Plan
Section titled “5. Have a Rollback Plan”Before each deployment:
- Note current release ID
- Verify rollback command
- Set up monitoring
- Define rollback criteria
Example plan:
# Pre-deployment checklistecho "Current release: $(brdz releases:list | grep active | awk '{print $1}')" > rollback-plan.txtecho "Rollback command: brdz releases:rollback 51" >> rollback-plan.txtecho "Monitor: https://monitoring.example.com" >> rollback-plan.txtRollback Strategy
Section titled “Rollback Strategy”Conservative Approach
Section titled “Conservative Approach”Rollback at first sign of trouble:
- Any critical errors
- Performance degradation > 10%
- User complaints increase
- Monitoring alerts trigger
Measured Approach
Section titled “Measured Approach”Investigate before rolling back:
- Assess impact severity
- Check if fixable quickly
- Consider hotfix deployment
- Evaluate rollback timing
Decision Matrix
Section titled “Decision Matrix”| Issue Severity | User Impact | Action |
|---|---|---|
| Critical | High | Immediate rollback |
| High | Medium | Quick investigation, likely rollback |
| Medium | Low | Investigate, monitor, rollback if worsens |
| Low | None | Fix in next release |
Advanced Rollback Patterns
Section titled “Advanced Rollback Patterns”Canary Rollback
Section titled “Canary Rollback”Deploy to subset of users, rollback if issues:
# Deploy to canary appbrdz ctx:use # Select canary appbrdz releases:create release.zip
# Monitor canary users# If issues, rollback canarybrdz releases:rollback 40
# Don't deploy to productionBlue-Green Rollback
Section titled “Blue-Green Rollback”Maintain two environments:
# Green (current production)brdz ctx:use # Select green-app# Currently serving traffic
# Blue (new version)brdz ctx:use # Select blue-appbrdz releases:create new-version.zip
# Test blue environment# If good, switch traffic (DNS, load balancer)# If bad, keep serving from greenFeature Flag Rollback
Section titled “Feature Flag Rollback”Use feature flags to disable problematic features:
# Instead of rollback, disable feature# (Requires feature flags in your app)
# Or rollback to version without featurebrdz releases:rollback 40Troubleshooting
Section titled “Troubleshooting”Rollback Fails
Section titled “Rollback Fails”If rollback command fails:
-
Check permissions:
Terminal window brdz auth:login -
Verify release exists:
Terminal window brdz releases:list -
Check context:
Terminal window brdz ctx:get
Application Still Broken
Section titled “Application Still Broken”If application issues persist after rollback:
-
Verify correct release is active:
Terminal window brdz releases:list | grep active -
Check browser cache:
- Clear browser cache
- Test in incognito mode
- Try different browser
-
Check CDN/cache:
- Purge CDN cache if using one
- Wait for cache TTL
-
Database migrations:
- Check if database changes are incompatible
- May need to rollback database separately
Wrong Release Activated
Section titled “Wrong Release Activated”If you rollback to wrong release:
# Immediately rollback to correct releasebrdz releases:listbrdz releases:rollback <correct-release-id>Post-Rollback Actions
Section titled “Post-Rollback Actions”After rolling back:
-
Investigate root cause
- Review logs and errors
- Identify what went wrong
- Document findings
-
Fix the issue
- Address bugs in code
- Update tests
- Review changes carefully
-
Test thoroughly
- Unit tests
- Integration tests
- Manual testing
- Staging environment
-
Plan redeployment
- Choose deployment window
- Notify team
- Prepare monitoring
-
Deploy fix
Terminal window npm run buildzip -r release-fixed.zip dist/brdz releases:create release-fixed.zip -
Monitor closely
- Watch for same issues
- Compare metrics to pre-issue baseline
- Get user feedback
Rollback Automation
Section titled “Rollback Automation”Example rollback script:
#!/bin/bash# rollback.sh - Emergency rollback script
set -e
# ConfigurationAPP_CONTEXT="production/web-app"
echo "=== Emergency Rollback Script ==="echo "Current releases:"brdz releases:list
echo ""read -p "Enter release ID to rollback to: " RELEASE_ID
echo "Rolling back to release $RELEASE_ID..."brdz releases:rollback $RELEASE_ID
echo ""echo "Rollback complete!"echo "New active release:"brdz releases:list | grep active
echo ""echo "Please verify the application is working correctly."