Review Apps

Review apps

Heroku provides us the ability to use review apps. Basically, a review app is linked to a specific development which has its own branch.

Review Apps are mostly used to test a feature in an hosted environment, without having the need to put the code on staging.

How are they created?

When you create a new PR, a new review app will be automatically available for creation. This means that they are not automatically created though, so if you need one for your PR, you’ll need to manually create it in Heroku.

When a review app is available, its name (and URL) is always predictable:

squarehub-pr-<YOUR_PR_NUMBER>

For example, if your PR is the #1000, your review app will be squarehub-pr-1000 and its URL will be: squarehub-pr-1000.herokuapp.com

Notice that if a PR is opened for Staging, a review app will be available for it. You should not need to create one for Staging though, as Staging it already an app on its own.

How are they deployed?

The deployment of already created review apps is automatic. Every time you push to your branch, if a review app already exists, it will trigger a new build/deploy on Heroku.

How are they killed?

  • After 5 days without any new push (you can still re-create it if need be)

  • Manually when you don’t need it anymore (go to the Settings section, scroll down and you’ll see a “Delete Application” button). Be careful with this one, make sure you’re not deleting the production application.

Ok, but concretely…

Concretely, all the magic happens thanks to this file: app.json

This is the config file in our app that tells Heroku how to build new review apps, and when to build them. If you want to know more, I strongly recommend you to check the docs:

What about environment variables?

As you saw in the previous section, all env variables are located in the “Settings” section of each app. If you need to add a new env variable for your review app, this is where you should go.

Should you really though?

Let’s think of an example:

To prevent having to repeat yourself every time, you have access to the “Pipeline Settings”.

It’s similar to any app settings section, and you can directly define env variables there.

Now, every review app you build will inherits from those variables, removing the need to repeat yourself.

Be careful, if your app is already created and that you add the env variable to the pipeline settings, it won’t be accessible in your app as it’s already been created. This time, you’ll also need to add it in the app settings. But next time you create a review app, you won’t have to.


Now, let’s have a deeper look at our staging application:

Last updated