Horn making noise! Something wrong happened in production! Taking a look in the logs it seems to be some bad data in the database making the app misbehave, just a internal API which wasn’t being carefully handling exceptions with unexpected data.
First thought was: probably the last code we deployed to STAGING is good enough and can better handle the exception.
How to make sure of that? It is a rails app so I want to deploy new code to the server and migrate the DB schema to the last one. How can I be sure I wont waste my time deploying the new version and it gonna work with the DB with the current state?
Heroku helped me a lot on that, these are the steps I took:
- Backing up the PROD DB
1 2 3
- Instantiate a new postgresql instance for your staging app
1 2 3 4
- New deploy and migration We do have in this project a rake task that handles deployment steps for me including db migration so I run:
or if you don’t have similar thing:
1 2 3 4
Smoke tests Check if everything looks good
Production deploy Now you know if a new deploy will make any damage to your production server, in case we are good:
… which does similar steps as above, but for production app instead!