Last updated on December 20, 2021
Ever since I started working with my client, I had to deploy to staging and then production. On staging, even if I deploy a breaking change or I mess up something in during deployment, I have time to fix it, as nobody but me and my client will see the mess I have created.
But production is different - I have to be sure that things are going to work after I deploy. So I decided to create a quick checklist which I can follow every time I deploy my Rails app to production. Take notes.
I will assume that you are doing database migrations.
It is not necessary to do this if you are not doing any database migrations.
But if you are, you don’t want any information to be lost during the deployment process. It is easy to turn maintenance mode on - head over Heroku -> Settings -> Maintenance Mode -> Switch ON.
Go to your production project on Heroku -> Resources -> Postgres database -> Durability -> Create a manual backup -> Download
This will ensure you that you have the latest version of your database after you have turned maintenance mode on. Even if you do something terribly wrong, you can go back and upload the latest stable version of your database. Then you can try again!
First checkout to master
git checkout master
and then merge from develop to master:
git merge develop
Hopefully there won’t be any merge conflicts!
git push heroku master
If you have multiple heroku apps (for example, staging and production), you will need to specify the name of the app using
To get a list of your heroku apps and their names, run:
Now that you have pushed, you can migrate
heroku run rake db:migrate
If you have any tasks that need to be ran, now it is a good opportunity to do so.
heroku run rake my_namespace:task_name
Now that you have pushed your commits, migrated and run your tasks, you can go in your settings panel on Heroku, press
Reveal Config Vars and add any new environment variables that you might have added since your last deployment.
Now that everything is ready, you can go in your settings panel and turn the maintenance mode off in the same way you turned it on.
Everything should be up and running. But I always like to go and test the app is working as expected.
That’s it! You can now push to deployment with confidence!
Articles, guides and interviews about web development and career progression.
Max 1-2x times per month.