Upgrades and rollback
Two routes: rebuild from source, or let the box follow GitHub releases with a verified binary. Both end with the same health check, and both deserve a backup first.
What an upgrade does to the database
On boot the server runs every migration it has not seen yet, in order, before it accepts a request. Migrations are numbered and never edited once applied, so an upgrade is additive: columns and tables appear. Nothing is dropped. A failed migration stops the boot rather than serving a half-migrated database, which is why /api/v1/health is the only check you need.
There is no down-migration. Rolling back the binary against a newer schema is not supported; restore the file.
From source
cd Yap
git pull
cd deploy
YAP_DOMAIN=chat.example.com docker compose up -d --build
The image is rebuilt first and the container is replaced after, so a build failure leaves the running server alone. Downtime is the restart, a couple of seconds; the first build after a big change takes minutes on a small ARM box.
Following releases automatically
deploy/autoupdate.sh plus yap-autoupdate.timer was laid down by the first push.ps1 deploy. The timer runs two minutes after boot and then once every 24 hours, and each run:
- asks GitHub for the latest release tag and compares it with
/opt/yap/deployed-tag; - downloads
yap-server-linux-aarch64and the release'sSHA256SUMS, and refuses to install a binary whose hash is not listed; - builds a runtime image from that binary through
Dockerfile.binaryanddocker-compose.prebuilt.yml, so nothing compiles; - polls
/api/v1/healthfor up to a minute, restoresdeploy/bin/yap-server.prevand restarts if it never answers, and only records the tag once the server is serving.
Useful commands:
sudo /opt/yap/src/deploy/autoupdate.sh --check # what is deployed vs what is published
sudo /opt/yap/src/deploy/autoupdate.sh --force # rebuild the same tag anyway
systemctl list-timers yap-autoupdate.timer # when it runs next
systemctl disable --now yap-autoupdate.timer # stop checking
Two things worth knowing: the check tells GitHub this box's IP address once a day, and the release asset is arm64 only because that is the free-tier shape — YAP_ASSET overrides the name elsewhere. Put GITHUB_TOKEN in /etc/yap-autoupdate.env if the anonymous API limit ever matters.
Rolling back
docker compose down. Do not delete theyap-datavolume.- Restore the database file from before the upgrade (see backups), replacing
yap.db,yap.db-walandyap.db-shmtogether. - Check out the previous tag, or copy
deploy/bin/yap-server.previnto place, anddocker compose up -d. - Write the old tag back into
/opt/yap/deployed-tagif the box follows releases, or the next timer run will upgrade it again. curl -sS https://HOST/api/v1/health—okmeans the schema and the binary agree.
Publishing a release
One tag, and the workspace version in Cargo.toml has to match it: git tag v0.2.0 && git push origin v0.2.0. The release workflow builds linux x86_64, linux arm64 and windows x86_64, proves each binary starts, and publishes them with SHA256SUMS. It refuses a tag that does not match the workspace version, so a box following releases can never record a tag that is not a real release.
Updated . Part of hosting and self-hosting.