Overview
How the upgrade works
The upgrade runs blue/green. Blue is the system you run today; green is a fresh install of the new version. Your live data is copied out of blue, rebuilt on green in a private staging area, and promoted to live only at the very end — so nothing your users depend on changes until you're ready.
What moves between the two systems
--backup
signed bundle
--restore
green_* databases
--run-transforms
promoted & live
The bundle is GPG-signed and carries every datastore — databases, search indices, certificates, secrets and Kafka topics — plus a full Velero safety copy of the cluster.
Before you begin
What you need
- Free disk space — roughly 3× your data size on the working path (for example
/home/blinq/upgrades). - A bundle destination both machines can reach — a remote host over SSH (
blinq@host:/backups/) or a mounted path (/mnt/external/). - Passwordless SSH to that host, if remote — set up once with
sudo ssh-copy-id blinq@<host>. - The new NetLiNQ version installed on the green machine before you restore (Phase 2).
- Root access — every command runs under
sudo.
Phase 1 · on the blue machine
Back up the current system
Capture every datastore into one signed bundle and push it to your destination. Your live system keeps running throughout — this step only reads it.
$ sudo ./scripts/upgrade-onprem/upgrade.sh --backup \ -b /home/blinq/upgrades --dest blinq@192.168.5.125:/backups/ -y
Variations
# Push to a mounted local path instead of a remote host $ sudo ./scripts/upgrade-onprem/upgrade.sh --backup -b /home/blinq/upgrades --dest /mnt/external/ -y
# Check prerequisites only — capture nothing $ sudo ./scripts/upgrade-onprem/upgrade.sh --backup -b /home/blinq/upgrades --dry-run -y
.tar.gz bundle, its .sig signature, and the public key. The Velero safety copy is the longest part — tens of minutes on a large system.Phase 2 · on the green machine
Restore into staging
Fetch the bundle and rebuild every dataset into an isolated staging copy. Green's live databases are not modified in this step.
$ sudo ./scripts/upgrade-onprem/upgrade.sh --restore \ -b /home/blinq/upgrades --dest blinq@192.168.5.125:/backups/ --skip-certs -y
# Restore from a bundle already on this machine — no fetch $ sudo ./scripts/upgrade-onprem/upgrade.sh --restore \ -b /home/blinq/upgrades --source /home/blinq/upgrades/netlinq-upgrade-backup-*.tar.gz --skip-certs -y
--skip-certs keeps green's own certificates (the safe default), or --restore-certs adopts the blue-side certificates. Pick one.green_* databases, a temporary search index, and so on. The run ends with a summary of what was staged.Phase 3 · on the green machine
Promote staging to live
Promote your staged data into the live databases with a single standalone command — no bundle or destination needed, since the staged data is already on the green cluster from Phase 2. This is the one and only step that writes to the live system.
$ sudo ./scripts/upgrade-onprem/upgrade.sh --run-transforms -y
Clean up the staging index
To also remove the temporary Elasticsearch staging index once the promotion succeeds, add --cleanup-staging-es:
$ sudo ./scripts/upgrade-onprem/upgrade.sh --run-transforms --cleanup-staging-es -y
Confirm
Check that it worked
Phase 3 runs an automatic health check — including a data-transfer count check that compares document/row counts live-vs-staging, flags any mismatch, and fails the run if data did not land (an index/table empty on live while staging held data) — so a partial migration cannot pass silently. To confirm by hand, every pod should be Running or Completed:
$ sudo kubectl get pods -n netlinq # all Running / Completed
Then log in to the application and spot-check your dashboards, sites, and users. The full run log is saved next to the bundle as netlinq-restore-*.log.
Recovery
If something goes wrong
Your live system stays safe: Phases 1–2 never touch it, and Phase 3 always restores your services to normal on success or failure. Until Phase 3 promotes the data, nothing on live has changed — you can simply stop. The Velero backup from Phase 1 is your full-cluster safety net.
--restartStart completely fresh, ignoring saved progress.--redo-phase <name>Re-run one specific phase, e.g. --redo-phase 4.3-elasticsearch.--skip-veleroBackup too slow? Skip the safety copy — only if you already have another backup.Recovery
Rolling back to the previous version
To revert green (or a rebuilt box) to the previous version, use the bundle you already captured. Both methods freeze writers, snapshot current live first (so the rollback is itself reversible), restore, scale back up, and verify.
Option A — Velero (full cluster; recommended for a rebuilt box)
$ sudo ./scripts/upgrade-onprem/upgrade.sh --rollback --velero --source <bundle.tar.gz> -y
Restores every namespace, database and workload to the bundle's version. Requires the backup to have included Velero (not --skip-velero), loaded into the box's MinIO.
Option B — Database dumps (PostgreSQL + MongoDB + /storage + secrets)
# Reinstall the previous version first, then: $ sudo ./scripts/upgrade-onprem/upgrade.sh --rollback --dbs --source <bundle.tar.gz> -y
Restores the raw dumps straight into the live databases. Elasticsearch is not reverted by --dbs — use --velero for a run that includes it. On a different / rebuilt box, fetch the bundle with --dest <ssh|path> instead of --source.
rollback-preserve-* archive first, but keep the bundle and the Velero backup until you've confirmed the rollback is healthy.Reference
Command reference
--backup / --restoreWhich phase to run.-b <path>Local working directory for the bundle.--dest <ssh|path>Where the bundle is pushed (backup) or fetched from (restore).--source <file>Restore from a bundle already on disk — skip the fetch.--run-transformsPromote staging to live (Phase 3). A standalone mode — needs no --dest, --source or -b.--skip-certs / --restore-certsAnswer the restore's certificate prompt for a hands-off run (Phase 2).--cleanup-staging-esRemove the temporary search index after a good promotion.--skip-elasticsearch / --skip-kafka / --skip-veleroSkip a data phase.--dry-runBackup: check prerequisites only, capture nothing.-yNon-interactive — still choose a certificate flag above.Full technical reference: scripts/upgrade-onprem/README.md. Flow diagrams: BACKUP-FLOW.md and RESTORE-FLOW.md.
Quality
Testing & validation
The upgrade tooling ships with an automated test suite that runs on every change. Each destructive path — the live database cutover, storage restore, Velero pruning, secret handling — is exercised against mocked infrastructure so failures are caught before they reach a real system.
bash -n syntax checks and shellcheck static analysis on every script.What the suite covers
test_arg_parsing, test_vars_loader.test_bundle_validation, test_backup_helpers, test_secrets, test_kafka, test_velero./storage — test_pg_restore, test_staging_jobs, test_discovery, test_resolvers, test_spc_storage.test_transforms_flow, test_transforms_verify, test_values_render.test_rollback, test_resume, test_cleanup.Release validation
Before this guide's commands were published, the packaging behind them was validated end to end:
--run-transforms mode.helm lint.