Skip to main content
HydroGo
UpgradingUpgrade steps and rollback

Upgrade steps and rollback

A safe, repeatable procedure: back up, replace the binary, check, migrate, verify. And how to roll back.

Procedure

  1. Back up. Database and media (see Backups).
  2. Replace the binary. Re-run install.sh or the Windows installer, or pull the new image tag.
  3. Preview the change with hydro upgrade check.
  4. Apply migrations with hydro migrate.
  5. Verify with hydro doctor, then start the server.
BASH
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.yaml

Pin a version in automation instead of taking whatever is newest:

BASH
HYDRO_VERSION=v0.2.0 sh install.sh
# or the matching image tag
docker pull ghcr.io/hydrohq/hydrogo:v0.2.0

Rolling 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:

BASH
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.
Rolling back the database discards content written after the snapshot. Put the site in maintenance mode (Site settings, Maintenance) while you upgrade a busy site.

Zero-downtime notes

  • Run hydro migrate as 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 match sha256 byte-for-byte.
  • Edition lock (`edition`): Custom builds (different HYDRO_EDITION than the manifest) block self-update cleanly so custom admin overlays cannot be overwritten accidentally.
  • Stepping-stone & SDK bounds: min_upgrade_from blocks skipping required intermediate releases (ErrUpgradePathBlocked), while min_sdk_version / max_sdk_version guard API compatibility. Releases can also set auto_update: false to require manual confirmation.
  • Container safety: Inside Docker (/.dockerenv or HYDRO_CONTAINER=1), in-place replacement is disabled and the panel displays the new version notice instead.
BASH
hydro upgrade status --json
hydro upgrade apply --yes
hydro upgrade rollback --yes   # restores .prev binary if needed

Safe 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), or minor (0.7.x → 0.8.x). Major version bumps (0.x → 1.x) and releases marked auto_update: false or blocked by min_upgrade_from are 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 .prev binary copy, runs hydro migrate, and writes pending_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 .prev and triggers a 6-hour failure backoff for that version.
BASH
# 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.

CommandPurpose
hydro upgrade checkShow pending migrations and database compatibility.
hydro upgrade statusCheck a signed release manifest for newer compatible versions.
hydro upgrade apply --yesVerify Ed25519 signature + SHA256, back up .prev, and atomically swap the binary.
hydro upgrade rollback --yesRestore the .prev binary created by apply.
go run ./tools/release-manifestSign hydro-update.json with --min-upgrade-from, --no-auto-update, and --requires-migration.
hydro db diffCompare the database with the expected schema.
hydro db reindexRebuild database indexes (maintenance).
hydro schema diff --baseline A --current B --public-key KEYCompare signed release migration ledgers.
hydro migration create --id YYYYMMDDHHMM_name --module MODULE --out migrationsScaffold a migration (contributors).