Upgrading
club follows semantic versioning. Pending database migrations are applied automatically on every startup, so upgrading is typically as simple as pulling a new image and restarting: there are no manual migration commands.
Before You Upgrade
-
Read the release notes for the version you are upgrading to. Check for breaking changes or special migration instructions.
-
Back up your data. See Backup & Restore for instructions. At minimum, back up the metadata store (database).
-
Test in a staging environment if possible, especially for major version upgrades.
Upgrade Steps
-
Back up your data:
Terminal window # SQLitesqlite3 /data/db/club.db ".backup /backups/club-pre-upgrade.db"# Filesystem blobs (tarballs + screenshots + blob-mode dartdoc)tar -czf /backups/blobs-pre-upgrade.tar.gz -C /data blobs/ -
Pull the new image:
Terminal window docker pull club:latest# Or pin to a specific version:docker pull club:1.2.0 -
Stop the current container:
Terminal window docker compose down -
Start with the new image:
Terminal window docker compose up -d -
Verify the upgrade:
Terminal window # Check healthcurl https://packages.example.com/api/v1/health# Check version in responsecurl -s https://packages.example.com/api/v1/health | jq .version# Tail logs for any errors during schema applicationdocker compose logs club --tail 50
If using a specific version tag in your docker-compose.yml, update it:
services: club: image: club:1.2.0 # Update version here-
Back up your data (same as Docker).
-
Pull the latest code:
Terminal window cd /opt/clubgit pull origin main# Or checkout a specific tag:git checkout v1.2.0 -
Update dependencies and regenerate models:
Terminal window dart pub getcd packages/club_coredart run build_runner build --delete-conflicting-outputscd ../.. -
Rebuild the frontend:
Terminal window cd packages/club_webnpm installnpm run buildcd ../.. -
Build and restart:
Terminal window # Build with dart build cli (NOT dart compile exe)dart build cli -t packages/club_server/bin/server.dart -o build/server# The binary is at build/server/bundle/bin/serversudo cp build/server/bundle/bin/server /usr/local/bin/club# Restartsystemctl restart club -
Verify the upgrade:
Terminal window curl https://packages.example.com/api/v1/healthjournalctl -u club --since "5 minutes ago"
Schema Behavior
Versioned Migrations
club tracks the SQLite schema version in a club_schema metadata table and applies a gap-free chain of numbered migrations on startup:
- A fresh database has the canonical schema applied (
CREATE TABLE,CREATE VIRTUAL TABLE ... USING fts5(...), etc.) and is then stamped directly at the current schema version. - An existing database is read for its stamped version and stepped forward through each pending
SchemaMigration(typicallyALTER TABLE ... ADD COLUMNstatements) until it reaches the current version.
The whole operation runs inside a single BEGIN IMMEDIATE transaction, so a crash or statement failure rolls the database back to its previous version cleanly, and two replicas starting concurrently can’t race the same step.
What This Means for Upgrades
| Scenario | Behavior |
|---|---|
| Fresh install | Canonical schema applied, then stamped at the current version |
| Existing database behind by one or more versions | Pending migrations applied in order on first boot of the new binary |
| New columns added in a new version | Added via an ALTER TABLE migration step |
| Column renames or drops | Shipped as explicit migration statements — see release notes |
| Unchanged schema (already at current version) | No-op; nothing runs |
You do not run a “migrate” command before or after upgrading. The server applies pending migrations during boot, before it starts accepting requests.
Rollback Procedure
If an upgrade causes issues, you can roll back to the previous version.
-
Stop the server:
Terminal window docker compose down# or: systemctl stop club -
Restore the database from backup:
Terminal window # SQLitecp /backups/club-pre-upgrade.db /data/db/club.db# PostgreSQLpg_restore -h db.example.com -U club -d club /backups/club-pre-upgrade.dump -
Restore blob storage if needed:
Terminal window tar -xzf /backups/packages-pre-upgrade.tar.gz -C /data -
Switch back to the previous version:
Terminal window # Docker# Edit docker-compose.yml to use the previous image tagdocker compose up -d# From sourcegit checkout v1.1.0dart build cli -t packages/club_server/bin/server.dart -o build/serversudo cp build/server/bundle/bin/server /usr/local/bin/clubsystemctl start club -
Verify the rollback:
Terminal window curl https://packages.example.com/api/v1/health
Any packages published or tokens created after the upgrade are lost with the database restore. This is why backing up before upgrading is critical.
Version Pinning
For production deployments, always pin to a specific version rather than using latest:
services: club: image: club:1.2.0 # Pin to specific versionThis prevents accidental upgrades and ensures reproducible deployments. Update the version tag deliberately after testing.