Heroku review apps and how to enable them for devs
Edited at: May 18, 2021
Heroku review app is a seperate heroku app deployed per merge request. Use cases: when you need your feature to be tested in isolation, or you have troubles pushing to staging
To create Heroku review app per merge request:
- add review-app to your commit message
- in gitlab jobs you will see manual pipeline named Review app deploy, you need to trigger that manually or you can ignore it :)
- after deploy is finished your app will appear in heroku dashboard and url will be of the form powr-review-MR_ID.herokuapp.com
- after you close or merge mr heroku review app will be destroyed, or Ben can destroy it.
- If you need to change domain for testing integrations pls go to powr.io/admin/cloudflare-domains
- there you can map your review app to review.powr-staging.io domain
Log bugs to https://powrtrak.atlassian.net/browse/BE-289
Update as of July 23, 2020:
We have updated review apps feature. Now all review apps will be created under your personal accounts (not Ben’s as before), this way you will have full access to it in heroku dashboard (ex: ability to delete it manually). Also your personal 550 hrs of free quota will be used, previously we used Ben’s 1000hrs for all engineers, and we were exceeding limits so that review apps no more could be created at some point. Per heroku's limits you will also have limit of 5 free apps. If you attach credit card to your account, your free quota will increase to 1000hrs and 5 free apps limitation will be removed. Dont worry, you wont be charged unless you manually create some paid plan apps. Review apps are still in free dyno plan.
Also if your account will run out of your free dyno hours and need to deploy review app, you can add use-ben-heroku-key to commit message and your review app will be deployed from Ben's account.
How to enable review apps:
- Go to https://dashboard.heroku.com/account and grab API key from there (copy it somewhere)
- Go to gitlab and grab your username without @ part (it is in top right corner under your name)
- add HEROKUAPI_KEY{gitlab_user_name} to production.yml.enc and assign your API key obtained at first step (If u dont have access to production.yml.enc, ask your eng lead to add key there for you.)
- go to https://gitlab.com/powr/powr/-/settings/ci_cd and under variables add same HEROKUAPI_KEY{gitlab_user_name} variable with same value
- go to application.rb, add your {gitlab_user_name} to config.gitlab_user_names array
- ask your eng lead for an access to powr, powr_staging apps
- create mr and merge it to master Now you should be able to use review apps.
Closing review apps
When you merge your mr, review app will be automatically removed. There is a code that does it
Internal::Heroku::WebhooksController#closed_merge_request
This method is called by gitlab via webhook. Check gitlab webhooks page https://gitlab.com/powr/powr/-/hooks
Keyword stuffing for jotable search: review app heroku-review heroku