Roll Back Faulty Deployment
Rolling back a deployed app that is faulty involves a series of steps to revert to a previous stable state.
1. Identify the Problem
Monitoring & Logs: Check monitoring systems and logs to confirm the issue with the deployed app (performance issues, crashes, etc.).
Error Tracing: Ensure that the issue is related to the deployment, not external factors.
2. Trigger Rollback
Blue/Green Deployment or Canary Release: If you're using blue/green or canary deployment strategies, switching back to the previous version is often a matter of rerouting traffic to the healthy environment or stable nodes.
Automated Rollback: In many continuous delivery pipelines, you can automate the rollback if tests fail or issues are detected. CI/CD tools like Jenkins, GitLab CI, or AWS CodeDeploy offer rollback features.
Depending on the deployment strategy, the rollback mechanism can vary:
a. Kubernetes Rollback (if using Kubernetes):
Use
kubectl rollout undo deployment <deployment-name>
to revert to the last working version.Kubernetes keeps track of deployment revisions, so it allows you to roll back to a specific revision if necessary.
b. Version Control System (VCS) Based Rollback:
Revert to the previous commit in the source code, and re-trigger the deployment pipeline.
Push the reverted changes, and redeploy using the CI/CD pipeline.
c. Container-based Rollback (if using Docker):
If using a containerized setup (e.g., Docker):
Roll back to a previous container version by pulling and deploying an older, stable image version.
Example: Change the image tag in your deployment manifest to the previous version and redeploy.
d. Cloud Service Rollback (AWS, Azure, GCP):
For cloud-native apps, services like AWS Elastic Beanstalk, Azure App Services, and Google Cloud Platform (GCP) provide rollback options.
On AWS Elastic Beanstalk, for example, you can redeploy a previous version with a single click in the management console.
3. Rollback Verification
Test: After rolling back, perform tests to ensure the previous version is functioning correctly.
Monitor: Keep an eye on performance metrics and logs to ensure stability.
4. Post-Rollback Actions
Root Cause Analysis: Investigate the root cause of the issue in the faulty deployment and fix the code/configuration that caused the failure.
Improve Rollback Process: Document the rollback process and refine your deployment pipeline to handle such situations more efficiently in the future.
By implementing effective rollback strategies, such as blue/green deployments, canary releases, or Kubernetes-managed rollouts, teams can mitigate risks of faulty deployments and maintain application uptime.
Subscribe to my newsletter
Read articles from Sowkhya directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Sowkhya
Sowkhya
Highly Enthusiastic and Motivated Sofware Engineer with Hands on Experience/Knowledge in requirement gathering ,developing, testing an application and automating, optimizing, streamlining deployment and release processes.