Releases and updates
Cutting a release
Section titled “Cutting a release”- Set
Versioninupdates/updates.goto the new version and merge that to main. - Tag the merge commit and push the tag:
git tag v0.2.0 && git push origin v0.2.0.
.github/workflows/release.yml checks the tag matches updates.Version, pushes the image to GHCR as 0.2.0, 0.2, and latest (and 2 once the major version is above 0), and creates the GitHub release with generated notes. Edit the release afterwards to add anything owners need to know, such as a version they must update through first.
A tag with a suffix, such as v0.2.0-rc.1, publishes a prerelease. It doesn’t move latest, and only installs with TRADEHALL_UPDATE_CHANNEL=prerelease hear about it.
Every push to main still publishes the edge image as main and sha-<short>.
How installs hear about it
Section titled “How installs hear about it”updates:check runs hourly from the scheduler and asks GitHub at most once a day (updates/updates.go). It stores the newest release on the install’s channel under the updates.status setting. Staff holding system.updates see a banner on the dashboard and the release notes under Settings > About and updates. Servers set up by deploy/install.sh, and hosting platforms with a deploy hook, install it from there with one click or automatically; other installs get update steps for how they were installed. See updating.md.
The running version is updates.Version; the image workflows pass the commit and the build kind (release or edge) as build args, which the Dockerfile links into the binary with -ldflags -X. A binary built from a git checkout without them still reports its commit from Go’s embedded build info. Anything else, including docker compose up from a checkout, reports itself as a custom build.
Writing migrations that survive updates
Section titled “Writing migrations that survive updates”The app container runs migrate:safely on every start. It holds a Postgres advisory lock while it migrates, so replicas take turns, and records the version that migrated under system.version. The worker and scheduler run migrate:wait first, so they never run new code against an old schema.
Owners may roll back one release if something goes wrong, so a migration must leave the schema usable by the previous release:
- Add before you remove. Add a column or table in one release, start using it, and drop the old one in a later release.
- New columns are nullable or have a default, so the previous release can still insert rows.
- Don’t rename a column or table in place. Add the new one, copy the data, and drop the old one a release later.
- Backfills that take a while go in a queued job, not the migration, so startup stays quick.
When a release drops support for updating from very old versions (for example, it deletes a compatibility step), raise MinUpgradeFrom in updates/migrations.go and say in the release notes which version to update through first. migrate:safely refuses to start on a database last migrated by an older version.