Upgrade steps and rollback
A safe, repeatable procedure: back up, replace the binary, check, migrate, verify. And how to roll back.
Procedure
- Back up. Database and media (see Backups).
- Replace the binary. Re-run
install.shor the Windows installer, or pull the new image tag. - Preview the change with
hydro upgrade check. - Apply migrations with
hydro migrate. - Verify with
hydro doctor, then start the server.
hydro backup sqlite --destination backups/ --media-dir data/media # 1. back up (or pg_dump / mysqldump)
# 2. replace the hydro binary
hydro upgrade check --config config.yaml # 3. what will change
hydro migrate --config config.yaml # 4. apply migrations
hydro doctor --config config.yaml # 5. verify the install
hydro serve --config config.yamlPin a version in automation instead of taking whatever is newest:
HYDRO_VERSION=v0.2.0 sh install.sh
# or the matching image tag
docker pull ghcr.io/hydrohq/hydrogo:v0.2.0Rolling back
hydro rollback restores a pre-migration SQLite database snapshot (whereas hydro upgrade rollback restores the previous .prev Go binary). hydro migrate takes a snapshot of a SQLite database before it applies anything. If the upgrade misbehaves, restore it:
hydro rollback --snapshot PATH --confirm --config config.yaml- Reinstall the previous binary version first, then run the rollback.
- For PostgreSQL and MySQL, restore the backup you took in step 1; the snapshot mechanism is for SQLite.
- Never reverse a migration by deleting tables or editing the migration ledger.
Zero-downtime notes
- Run
hydro migrateas a separate step before starting new instances, then roll instances one at a time behind your load balancer using/readyz. - Keep the previous image tag so you can switch back quickly if the new release's schema migrations remain backwards-compatible (migrations are forward-only; see Docker deployment for snapshot restores).
- Because HydroGo is stateless apart from the database and media, a blue/green switch is a proxy change.
Signed self-update (hydro upgrade)
For standalone VPS and CGI deployments, HydroGo supports Ed25519-signed, SHA256-verified binary updates inside the Admin panel (System → System Updates, first tab) as well as a Dashboard update banner when a newer release is available. Every check enforces:
- Signature & checksum verification: Manifest payloads are verified against the compiled-in Ed25519 public key (
HYDRO_UPDATE_PUBLIC_KEY) before any download URL is trusted, and downloaded binaries must matchsha256byte-for-byte. - Edition lock (`edition`): Custom builds (different
HYDRO_EDITIONthan the manifest) block self-update cleanly so custom admin overlays cannot be overwritten accidentally. - Stepping-stone & SDK bounds:
min_upgrade_fromblocks skipping required intermediate releases (ErrUpgradePathBlocked), whilemin_sdk_version/max_sdk_versionguard API compatibility. Releases can also setauto_update: falseto require manual confirmation. - Container safety: Inside Docker (
/.dockerenvorHYDRO_CONTAINER=1), in-place replacement is disabled and the panel displays the new version notice instead.
hydro upgrade status --json
hydro upgrade apply --yes
hydro upgrade rollback --yes # restores .prev binary if neededSafe opt-in auto-updates & health watchdog
Unattended updates are off by default (channel: off) and can be enabled per-instance from System → System Updates → Automatic Updates (or locked via HYDRO_AUTO_UPDATE=off|patch|minor):
- Channels:
off(manual only),patch(0.7.x → 0.7.y, recommended for production), orminor(0.7.x → 0.8.x). Major version bumps (0.x → 1.x) and releases markedauto_update: falseor blocked bymin_upgrade_fromare never auto-applied. - Maintenance window & jitter: Applies only inside the configured local hour window (default
03:00–05:00) with a random 0–15 minute startup jitter. - Pre-update backup & 60s health watchdog: Before restarting, HydroGo takes a consistent SQLite snapshot (
SnapshotSQLiteFile), keeps a.prevbinary copy, runshydro migrate, and writespending_update.json. On restart, a startup watchdog polls database & migration readiness every 3s for 60s (and checks listener bind errors). If readiness fails, HydroGo automatically rolls back to.prevand triggers a 6-hour failure backoff for that version.
# Admin API endpoints
GET /api/v1/admin/system/updates # check status & changelog (?refresh=1 bypasses 10m cache)
POST /api/v1/admin/system/updates/apply # verify, migrate, & trigger graceful re-exec
GET /api/v1/admin/system/updates/policy # read auto-update channel & maintenance window
POST /api/v1/admin/system/updates/policy # save channel (off | patch | minor) & hours (0-23)Private update gateways & domain locking
Commercial hydro-modules builds (-tags hydromodules) distribute updates through a private gateway (HYDRO_UPDATE_MANIFEST_URL) authenticated with a Bearer token (HYDRO_UPDATE_TOKEN) and optional X-Hydro-Site (HYDRO_SITE_HOST) + edge IP pinning (token=domain@ip). Contact [email protected] for private distribution access.
Related commands
| Command | Purpose |
|---|---|
hydro upgrade check | Show pending migrations and database compatibility. |
hydro upgrade status | Check a signed release manifest for newer compatible versions. |
hydro upgrade apply --yes | Verify Ed25519 signature + SHA256, back up .prev, and atomically swap the binary. |
hydro upgrade rollback --yes | Restore the .prev binary created by apply. |
go run ./tools/release-manifest | Sign hydro-update.json with --min-upgrade-from, --no-auto-update, and --requires-migration. |
hydro db diff | Compare the database with the expected schema. |
hydro db reindex | Rebuild database indexes (maintenance). |
hydro schema diff --baseline A --current B --public-key KEY | Compare signed release migration ledgers. |
hydro migration create --id YYYYMMDDHHMM_name --module MODULE --out migrations | Scaffold a migration (contributors). |