-
Notifications
You must be signed in to change notification settings - Fork 0
Heroku Deployment Process
Frama-99 edited this page Oct 16, 2020
·
2 revisions
A review app is created for every pull request made. The URL for each review app is tutv-dev-pr-#.herokuapp.com, where # is the PR number.
- A PR is opened to merge a feature branch to master.
- The code is pass through Travis CI, which runs a build on the branch and a build on the result of the merge. It references the file
.travis.yml
. - If all tests pass, a review app is created on Heroku and the code is deployed
- Note: app creation is not the same as deployment. When the PR is first opened, the app is created and the latest commit is deployed. When you push more commits to the PR, the new commits are deployed to the already created app.
- Heroku looks at
app.json
and installs the specified addons (e.g. PostgreSQL), buildpacks (e.g. nodejs or python), and environmental variables (e.g. SECRET_KEY).- There is also the option to put more sensitive environmental variables in Heroku settings, under "Config Vars".
-
app.json
can also contain scripts to be run at different phases of the deployment. For example, a script with the keypostdeploy
will be run "once, after the app is created and not on subsequent deploys to the app" (the naming of the key is confusing). For example, this could be a command to apply fixtures to the database.
- On every deployment to the app, the release command in the
Procfile
is run. For example, this could be a command to apply migrations to the database. There are scenarios other than a deployment that triggers the release command. - On every startup of the app, the web command in the
Procfile
is run. For example, this could be a command to start the web server.
- When the PR is merged, the master branch is deployed to a staging app on Heroku. The URL for this is tutv-staging.herokuapp.com.
- For the staging app, rather than looking at app.json, Heroku looks for Addon/Buildpack/Env Vars configurations in the app settings on the Heroku portal.
- Same as steps 5 and 6 above.
- .travis.yml - For any Travis CI build
- app.json - For review apps
- Heroku app settings - For staging and production apps
- Procfile - For every app deployment/startup
- On app creation:
scripts.postdeploy
inapp.json
- On app deployment:
release
in Procfile - On app startup:
web
in Procfile