Skip to content

Instantly share code, notes, and snippets.

@croaky
Created April 3, 2012 18:35
Show Gist options
  • Save croaky/2294515 to your computer and use it in GitHub Desktop.
Save croaky/2294515 to your computer and use it in GitHub Desktop.
Heroku staging deployment process with additional Github staging remote

Periodically use pgbackups to pull latest production data.

Merge master into staging

git checkout master
git reset --hard origin/master
git pull
git checkout staging
git reset --hard origin/staging
git log staging..master
git diff --stat staging master
git merge master
git push origin staging

Enable maintenance mode if required by database changes

heroku maintenance:on --app <app>

Deploy staging to Heroku

git push <app> staging:master

Run new migrations if necessary

heroku rake db:migrate --app <app>

Restart the dynos if migrations were run

heroku restart --app <app>

Disable maintenance mode if it's on

heroku maintenance:off --app <app>

Introspect to make sure everything's ok

watch heroku ps --app <app>

Rollback code if there was a problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment