Index

Because things can and will go wrong eventually, we need to have the right way of recovering from it.

When we push to production, and the application fails, the first thing we need to do is roll back to the previous working version so we can debug the problem relaxed and in the warm place of $HOME.

https://media.giphy.com/media/cT5gKT412jHqw/giphy.gif

Given we're using Heroku, it makes it very easy to go back and recover fast, let's document which will be the steps to be back online without any hassles.

Rollback from web

First things first, we'll go to our Activity view on Heroku. Usually, the URL is <https://dashboard.heroku.com/apps/<app-production>/activity.> We'll detect the previous working version and click the rollback button (screenshot). The only thing to take into account is that when we change or set a new Heroku config variable, that will trigger a Dyno restart too, so we have to keep in mind where to roll back. It will be almost always previous to our current deploy.

https://user-images.githubusercontent.com/488556/70787849-e48a0200-1d8f-11ea-817a-9d6067e3b701.png

Rollback from terminal

We could also do this using the terminal. you can check the configuration from the GitHub page

We can get the releases.

heroku releases --app myapp

Or get more info from a particular release.

heroku releases:info v145 --app myapp

And when we're sure to roll back to that version.

heroku rollback v145 --app myapp

Rollback DB

Sometimes we're going to have migrations on a release, so we'll need to check which migrations were added and roll back themmanually, since Heroku doesn't know how to do it. First, we see which migrations are applied.