How to do Rollback releases - 3 different ways

We sometimes have releases where we either messed up the code (or feature), or released the app with a bad configuration. In this scenario, we can either identify the issue early and release a fix, or rollback to a past release where things worked as we want it.

It’s fairly tricky to do a rollback using flyctl, but it’s possible.

I’ll share 3 ways I know you can do a rollback.

1. Git revert to the last stable commit

This approach only requires knowledge of git and finding the commit you want to revert. Once the change is reverted, you can deploy using flyctl as usual, or push the new commits to your remote and let your CI/CD workflow handle the rest.

The draw back here is knowing how to revert the changes without making a mess of your code or git history. If there are multiple commits to revert, it becomes tricky to manage.

2. Using Fly Release Images

When you run fly deploy <args>, Fly keeps track off the images used for that releases. To see a list of releases and associated image, run the command fly releases --image. You should see the list of releases and associated image label. For example, registry.fly.io/silver-hawk@sha256:18aaaaaaaaaaa.

When you find the release you’d like to rollback to, copy the image reference/url and use that to initiate another release. You can deploy a specific image using the following command:

fly deploy -i <image-name>

For example: fly deploy -i registry.fly.io/silver-hawk@sha256:18aaaaaaaaaaa. This will deploy a new release using that image and everything should be fine. Except that this comes with two challenges.

  1. If your team ships very often, it’ll be hard to track which commit is tied to a particular release.
  2. If the problem is the Fly app configuration, that command won’t do much help because it would only update the code and not the configuration.

To workaround the second problem I pointed out, you’d need to have a system of saving the state of your fly.toml for each release. That can get more confusing and you’d have to keep a lot of redundant record.

Let’s look at a third option that makes it very easy to handle.

Using FlyCD Instant Rollback

Using FlyCD makes the rollback process fairly easy, quick, and useful. FlyCD makes it easy to automate git-base continuously deployment for your Fly apps. If you’ve used Heroku or the likes of Vercel, you’re familiar with this deployment workflow.

It can be ironically seen as Fly getting married to Vercel, and giving birth to FlyCD :woman_feeding_baby:t4:

FlyCD keeps track of every deployment through the platform, thus giving your a deployment history page to take action on past deployments/releases.

The image above gives a glimpse into how this page currently looks like. For rollback, you can click the three-dot icon to open up the action menu, then click Rollback to initiate a rollback to the release.

It’s easy to rollback because you can easily see the commit associated with that release.

The rollback releases will also use the fly.toml configuration present in that commit. This way, you can be sure your rollback release matches the previous state (i.e. code + Fly app configuration). This approach only packs a lot of benefit and visibility for you.

If the release you want to rollback to was the most recent one before the current, you can simply use the Instant Rollback button to achieve that.

Clicking that button gives you more info about the current and previous release, before allowing you to continue with the rollback. It also shows the related git commit info.

That’s how simple you can rollback with two button clicks on FlyCD.

Conclusion

Are there any other means you use for rollback? Let me know in the comment. I hope you found this post helpful and you can pick whatever rollback option suits your needs.

4 Likes