Skip to content

Instantly share code, notes, and snippets.

@stevenyap
Last active June 11, 2019 16:09
Show Gist options
  • Save stevenyap/11453726 to your computer and use it in GitHub Desktop.
Save stevenyap/11453726 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!
@PhatDang
Copy link

Thanks so much !! It's Helpful...

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