What we were doing before now:
We had a script saved in our project’s Github wiki from which copied the commands. It did things like adding the production remote, removing it, running all specs, etc, which isn’t required anymore.
But that’s the past!
What we are doing now:
When we have to push to production, the developer simply goes to the particular build in Semaphore CI, clicks on “deploy manually,” and then selects the “target server” and hits “deploy”.
The target server contains the script which runs on Semaphore CI and does the application deploy.
Our current script looks as below (this may vary depending on the requirement):
heroku maintenance:on heroku ps:scale web=0 worker=0 heroku pg:backups capture git push heroku master heroku run rake db:migrate heroku pg:backups capture heroku ps:scale web=2 worker=0 heroku maintenance:off
This is how it looks in Semaphore:
What do we gain with latter ?
- Avoid the inconvenience of copy pasting the Heroku commands to terminal, and possible human errors.
- The above also saves significant time and effort.
- Avoid running the specs again. You won’t deploy a failing build I trust!
- You get readable production push logs.
- Get to know how much time each command takes to run.
- Comprehensive and consistent history of all production deploys.