HOWTO – Migrate NetBox Database to PostgreSQL HA¶
Migrates the NetBox database from platform/onprem/postgresql-core to a Patroni-managed HA cluster using a three-gate module that quiesces services, dumps the source, restores to the HA target, and validates row counts before releasing control. Migration does not repoint NetBox — connection string cutover is a separate step handled by onprem/netbox-ha-cutover@v1, run only after this module reports state ok. Covers gate confirmation strategy, pg_dump/pg_restore artifact handling, row-count validation, and blueprint integration.
What this covers:
- Three explicit safety gates prevent unintended execution against production data
- NetBox compose services are quiesced before the dump; the database is consistent at restore
- Row-count validation compares source and target counts per table before the module exits