Rollbacks and Disaster Recovery
Design and implement effective rollback procedures and disaster recovery plans within your CI/CD pipelines.
Rollbacks and Disaster Recovery is a free DevOps Bootcamp lesson on CoddyKit — lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the DevOps Bootcamp learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Unexpected Issues Happen!
Software development isn't always smooth. Sometimes, new deployments introduce bugs or break existing features. This is where rollbacks and disaster recovery come in.
They are crucial for maintaining system stability and user trust.
Understanding Rollbacks
A rollback is the process of reverting a system or application to a previous, stable state after a problematic deployment. It's like an "undo" button for your recent changes.
Rollbacks are typically triggered quickly to minimize the impact of a faulty release and restore normal operations.
Common Rollback Approaches
There are a few ways to perform a rollback, depending on your deployment strategy:
- Revert Code: Deploying the previous, known-good version of your application code.
- Traffic Shifting: Redirecting user traffic away from the faulty new version back to the old one.
- Database Rollback: Reverting database schema or data changes, often the most complex part.
Automating Rollbacks with Actions
GitHub Actions can automate rollback procedures. You can create workflows that trigger on specific events (like a manual dispatch) to redeploy a previous, stable release or revert infrastructure changes.
This ensures a fast, consistent, and less error-prone rollback process, reducing human error during stressful situations.
Workflow for a Manual Rollback
Here's how you might set up a manual trigger to deploy a specific previous version (e.g., a tag or commit hash). This workflow takes a version input from the user.
name: Manual Rollback Deployment
on:
workflow_dispatch:
inputs:
version:
description: 'Tag or commit hash to deploy'
required: true
default: 'main'
jobs:
rollback:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.version }}
- name: Deploy previous version
run: |
echo "Deploying version: ${{ github.event.inputs.version }}"
# Add your specific deployment commands here
# e.g., helm upgrade, kubectl apply, etc.
Beyond Rollbacks: Disaster Recovery
Disaster Recovery (DR) is a broader strategy to recover your systems and data after a catastrophic event. This could be a data center outage, natural disaster, or major cyberattack.
Unlike a rollback, which fixes a bad deployment, DR aims to restore full service after a total system failure or loss of a primary environment.
DR Planning in CI/CD
When planning for DR in your CI/CD pipelines, consider:
- Backups: Regularly backing up data, configurations, and artifacts.
- Redundancy: Deploying across multiple regions or availability zones.
- Recovery Workflows: Dedicated workflows to restore services from backups or deploy to new infrastructure.
- Testing: Periodically testing your DR plan to ensure it works when needed.
Storing Build Artifacts for Recovery
GitHub Actions can store build artifacts, which are crucial for DR. These might include compiled binaries, Docker images, or deployment manifests. You can upload them during a successful build.
These artifacts can then be downloaded and deployed as part of a DR workflow to a new environment.
name: Build and Archive Artifacts
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build application
run: |
echo "Building app..."
mkdir -p build_output
echo "App version 1.0.0" > build_output/app.txt
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: application-build
path: build_output/
Rollback vs. DR Check
A new feature deployment caused a critical bug, making your application inaccessible. Which strategy is primarily used to quickly fix this specific issue and restore service?
Rollbacks & DR: Key Takeaways
In this lesson, we explored the critical concepts of rollbacks and disaster recovery. We learned that rollbacks quickly revert bad deployments, while Disaster Recovery is about restoring systems after major failures.
GitHub Actions can be instrumental in automating both processes, ensuring your applications remain resilient and your users experience minimal disruption.
Frequently asked questions
Is the “Rollbacks and Disaster Recovery” lesson free?
Yes — the full text of “Rollbacks and Disaster Recovery” is free to read here on the web, and the DevOps Bootcamp course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the DevOps Bootcamp course, upgrade to CoddyKit PRO.
What will I learn in “Rollbacks and Disaster Recovery”?
Design and implement effective rollback procedures and disaster recovery plans within your CI/CD pipelines. You practise DevOps Bootcamp with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start DevOps Bootcamp?
No prior experience is required. DevOps Bootcamp on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Rollbacks and Disaster Recovery” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this DevOps Bootcamp lesson?
Yes. Every DevOps Bootcamp lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Blue/Green Deployments
- Canary Releases with Actions
- Rollbacks and Disaster Recovery
- Feature Flags and Progressive Rollouts