Deploying
sudo reportlog deploy # the followed branch (below); at first DEPLOY_REF (main)
sudo reportlog deploy v1.2.0 # or any branch, tag or commit
Each release records the branch it came from in releases/<id>/BRANCH
(none for a bare commit that is no branch's tip); reportlog releases and
the Updates screen show it. A commit older than the database is refused
before anything is unpacked: one whose apps/api/migrations/ lacks a
migration the database has already applied would run older code than its
database. Going back to older code is a rollback (below), never a deploy.
What happens, in this order. Everything that can fail happens before the running release is touched:
- The commit is fetched and unpacked into a new
releases/<id>directory. - Dependencies are installed and the website is built, as the
reportloguser (so no package's install script runs as root). The build tools are then removed, and the release is handed to root and made read-only. - Migrations run against the live database, while the old release is still serving.
- The release's systemd units and Caddyfile are installed. A release that
adds or removes a timer installs or removes it here.
currentis switched and the API restarted. - If the API does not answer
/api/healthwithin 30 seconds,currentis switched back and the old release restarted.
| If this fails | Then |
|---|---|
| fetch or build | Nothing changed. The release directory is kept as <id>.failed to look at. |
| a migration | current is not switched; the old release keeps running. The failing migration's transaction rolled back. Any migrations before it in the same deploy stay applied (see below). |
| the new release's start | It is switched back automatically. Its migrations stay applied. |
The deploy ends by running the doctor.