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:
- Create app on Heroku per support docs. Be sure to get your database up and running too.
- From Heroku dashboard, click
New -> Create new pipeline
- On the Production app (far right), add your app.
- 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
- Inside your pipeline, you'll see 3 columns: Review Apps, Staging, and Production. You've already added your production app from the steps above.
- 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.
- Make a change to your local repo and
git add
,git commit
andgit push
to a remote branch. - Back in your pipeline, under Review Apps, select
+ New App
and the branch you just pushed up. ClickCreate
and watch your app build. - Select the
Open App
button on your review app build to see what it looks like on Heroku. - 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:
Top comments (1)
Thanks for this.. the old Review Apps was so much better.