Skip to content

Latest commit

 

History

History
67 lines (48 loc) · 1.63 KB

deploy_a_rails_app_to_heroku.md

File metadata and controls

67 lines (48 loc) · 1.63 KB

How to Deploy a Rails App to Heroku

View a list of new commits. View changed files.

git fetch staging
git log staging/main..main
git diff --stat staging/main

If necessary, add new environment variables.

heroku config:add NEW_VARIABLE=value --remote staging

Deploy to Heroku staging.

git push staging

If necessary, run migrations and restart the dynos.

heroku run rake db:migrate --remote staging
heroku restart --remote staging

Introspect to make sure everything's ok.

watch heroku ps --remote staging

Test the feature in browser.

Deploy to production.

git fetch production
git log production/main..main
git diff --stat production/main
heroku config:add NEW_VARIABLE=value --remote production
git push production
heroku run rake db:migrate --remote production
heroku restart --remote production
watch heroku ps --remote production

Watch logs and metrics dashboards.

Close pull request and comment Merged.

Set Up Production Environment

  • Make sure that your Procfile is set up to run Unicorn.
  • Make sure the PG Backups add-on is enabled.
  • Create a read-only Heroku Follower for your production database. If a Heroku database outage occurs, Heroku can use the follower to get your app back up and running faster.