Heroku Review Apps
Creating a review app
Login to the heroku dashboard
Go to the wazimap pipeline
Click "Create review app" for your pull request
Find the URL to the deployed review app in the pull request or by clicking "View app" in heroku.
Migrations and demodata are only loaded when the app is created. If you need to recreate the database, destroy the app and recreate it.
Connecting a netlify frontend deploy preview to backend review app
Copy link for frontend review app ex:
Add it to the configuration in profiles for the backend review app and save
Go to Ui deploy preview add ?dev-tools=true to enable dev tools and add deploy-preview-542--wazimap-staging.netlify.app to Hostname and backend review app url to Api url https://wazireview.herokuapp.com
Creating staging apps in heroku
This is probably not helpful any more now that real review apps work again, but we're leaving this here for now in case it's needed.
We were creating "review apps" in the staging "stage" of the wazimap pipeline in heroku while heroku review apps were not working due to the exfiltration of github oauth keys.
Create a new app
We name apps according to the pull request number, e.g. wazimap-pr-1234 for PR #1234
Steps for creating an app via CL
In the project directory (to update your project git remotes):
heroku apps:create wazimap-pr-1234 --remote heroku-pr-1234
heroku pipelines:add wazimap --app wazimap-pr-1234 --stage staging
Steps for creating an app via GUI
After opening wazimap pipeline there is an option to add new staging app
Steps for setting up the stack
heroku stack:set container --app wazimap-pr-1234
Adding Addons:
heroku addons:add heroku-postgresql:hobby-dev --app wazimap-pr-1234
Deploying branch
git add and commit everything you want to deploy
git push heroku-pr-1234 BranchName:master
Post-release step
Start Worker dynos
Via CLI:
heroku ps:scale worker=1 --app wazimap-pr-1234
Via GUI:
Go to overview on app in heroku dev center and there will option to see dyno formation
click on configure dyno link on right hand side
Switch on the dyno to run Qcluster (click on edit and turn the toggle on)
heroku run python3 manage.py migrate --app wazimap-pr-1234
heroku run python3 manage.py loaddata demodata.json --app wazimap-pr-1234
Usefull commands
Check configs for review app via cli
heroku config --app wazimap-pr-1234
Define region while creating app
heroku apps:create wazimap-pr-1234 --remote staging --region eu
Connecting backend review app to deploy preview app
Copy link for frontend review app ex:
Add it to the configuration in profiles for the backend review app and save
Go to Ui deploy preview add ?dev-tools=true to enable dev tools and add deploy-preview-542--wazimap-staging.netlify.app to Hostname and backend review app url to Api url https://wazireview.herokuapp.com
Destroy review apps when branches are merged
heroku apps:destroy wazimap-pr-1234