Creating a staging environment on Heroku

If you’re hosting your app on Heroku (possibly even if you aren’t) it is a good idea to create a staging environment also. Heroku has docs on this but the short version for a new app is:

  • heroku create staging-app-name --stack cedar --remote staging(if the app is already on Heroku, just add the remote: git remote add staging git-url-on-heroku)
  • git push staging master
  • heroku rake db:migrate --remote staging
  • heroku rake db:seed --remote staging

Hopefully you have a staging environment set in config/environments/staging.rb so:

  • heroku config:add RAKE_ENV=staging --remote staging
  • heroku config:add RAILS_ENV=staging --remote staging

If you want to push a different branch to staging such as develop:

  • git push staging develop:master

Once staging is set, create the production app in the same way:

  • heroku create app-name --stack cedar --remote production
  • git push production master
  • heroku rake db:migrate --remote production
  • heroku rake db:seed --remote production

2 thoughts on “Creating a staging environment on Heroku

Leave a Reply