Skip to content

Instantly share code, notes, and snippets.

@mitchellporter
Forked from stevenyap/Heroku_Staging.md
Created September 5, 2016 23:44
Show Gist options
  • Select an option

  • Save mitchellporter/386e33cea54ff6f0b1637055191db65d to your computer and use it in GitHub Desktop.

Select an option

Save mitchellporter/386e33cea54ff6f0b1637055191db65d to your computer and use it in GitHub Desktop.
Staging workflow on Heroku

This describes the workflow to use Heroku as a staging environment. It assumes you already have an existing heroku app in production.

# rename your git remote heroku to something else like production
git remote rename heroku production

# so now you will push as: git push production master

# create the staging app
heroku apps:create staging-appname

# rename the heroku to staging
git remote rename heroku staging

# As heroku only accept master branch to deploy, you have to push your staging branch to heroku's master branch (assuming your local branch for staging is staging)
git push staging staging:master

# Sending heroku commands in multiple app/environment
heroku run rake db:seed --app staging-appnam

# Tired of writing --app all the time?
# note that staging heroku remote refers to the branch, not the app name
git config heroku.remote staging
heroku run rake db:seed # works on staging now!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment