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
Thanks for the great post. It really helped. I had a problem with staging env as: Heroku was precompiling assets in production mode even when it was set as staging. I needed to enable user-env-compile so that it precompiled in staging. i enabled it using https://devcenter.heroku.com/articles/labs-user-env-compile
What is RAKE_ENV? Do you also want to set RACK_ENV?