Updates and backups
How releases work
Section titled “How releases work”Every AlphOne release is a git tag (v0.1.0, v0.2.0, …) that
publishes a container image to
ghcr.io/gopherium/alphone under three tags:
- the version, e.g.
:0.1.0 - the exact commit, e.g.
:sha-5495093 :latest, republished on every release
Migrations run automatically on container start, so updating is pulling a newer image and recreating the container.
Updating by hand
Section titled “Updating by hand”cd /srv/alphonedocker compose pull alphonedocker compose up -d alphoneUpdating automatically
Section titled “Updating automatically”Any watcher that reacts to a republished :latest digest works. The
compose file in Install already carries labels
for What’s Up Docker (WUD):
wud.watch: "true"withwud.watch.digest: "true"onalphonewatches the:latestdigest and picks up each release.wud.watch: "false"onpostgresmakes sure the database is never auto-updated. A major PostgreSQL jump breaks its data directory.
On the WUD side, configure a ghcr registry (a public image needs no
token) and a trigger whose scope includes the alphone container. Start
with a notification-only trigger if you want to review updates before
they apply, then switch to auto once you trust the flow.
Rolling back
Section titled “Rolling back”Pin the previous version and re-up:
image: ghcr.io/gopherium/alphone:0.1.0 labels: wud.watch: "false" # pause auto-updates while pinneddocker compose up -d alphoneOne caution: rolling the app back does not roll the database back. Migrations only move forward, so if the newer version already migrated the schema, restore the matching backup instead of just pinning the older image.
Backup scenario
Section titled “Backup scenario”A nightly pg_dump covers a single-server install. Save this as
/srv/alphone/backup.sh and make it executable:
#!/bin/sh# Dump the AlphOne database and prune dumps older than 14 days.set -eu
here="$(cd "$(dirname "$0")" && pwd)"dir="$here/backups"mkdir -p "$dir"
docker compose -f "$here/compose.yaml" exec -T postgres \ pg_dump -U alphone alphone | gzip >"$dir/alphone-$(date +%F-%H%M).sql.gz"
find "$dir" -name '*.sql.gz' -mtime +14 -deleteSchedule it daily:
( crontab -l 2>/dev/null; echo '0 3 * * * /srv/alphone/backup.sh' ) | crontab -Copy the backups/ directory somewhere off the server on your own
schedule. A backup that lives only next to the database it protects is
half a backup.
Restoring
Section titled “Restoring”Stop the app, recreate the database, replay the dump, start the app:
cd /srv/alphonedocker compose stop alphonedocker compose exec -T postgres psql -U alphone -d postgres \ -c 'DROP DATABASE alphone' -c 'CREATE DATABASE alphone OWNER alphone'gunzip -c backups/alphone-<date>.sql.gz | \ docker compose exec -T postgres psql -U alphone alphonedocker compose start alphone