loading...

How to Setup Heroku Review App for Rails

apostalice profile image @postalice ・2 min read

Problem: You have a Rails app deploying successfully to Heroku, but as you make changes you don't want to deploy directly to your production app. You want to see your hard-earned edits running remotely first!

Solution: Review Apps

App and Pipeline Setup:

  1. Create app on Heroku per support docs. Be sure to get your database up and running too.
  2. From Heroku dashboard, click New -> Create new pipeline
  3. On the Production app (far right), add your app.
  4. Enable automatic deploys on the production app with Configure Automatic Deploys from the dropdown of your production app. You will be required to connect your GitHub account to Heroku so that Heroku knows which repo to deploy from.

Make a review app

  1. Inside your pipeline, you'll see 3 columns: Review Apps, Staging, and Production. You've already added your production app from the steps above.
  2. Match your pipeline Config Vars with your Production App's.
    • Your config vars are stored under the settings for both the production app and the pipeline. The easiest way to get the Review app up and running is to make sure these match.
  3. Make a change to your local repo and git add, git commit and git push to a remote branch.
  4. Back in your pipeline, under Review Apps, select + New App and the branch you just pushed up. Click Create and watch your app build.
  5. Select the Open App button on your review app build to see what it looks like on Heroku.
  6. Now you can merge your pull request on GitHub into your master branch which will trigger the automatic deploys to your production app.

Notes:
The main difference to the Heroku Pipeline per their documentation on the New Review Apps - as of November 2019 is the ability to create review apps without having to make pull requests - you can make a review app straight from a branch.

Before the November 2019 changes, Heroku had a way of spinning up a custom app.json file to help with automatic deployments from pull requests. They don't automatically make one for you anymore, but they have provided app.json Schema Docs for you to create your own.

Heroku Docs:

Posted on by:

apostalice profile

@postalice

@apostalice

I ride bikes and I code. Back-end focused using mainly Ruby on Rails and Postgres. Learning is my jam.

Discussion

markdown guide
 

Thanks for this.. the old Review Apps was so much better.