From the history. Commands and status describe their original context; follow the linked current guide before making changes.
MedTracker blue cutover procedure
Historical procedure from the consolidation. Its database reset was specific to that work and must not be repeated as maintenance. This archived text is not evidence of current deployment health or renewed approval to discard data. Use the current database guide first.
Original procedure #
The HelmRelease and operations/setup-job.yaml use the same immutable 0.6.5
image, which supports the PostgreSQL connection fields supplied by CNPG Secrets.
This procedure discards all live MedTracker data and accounts, as approved by
the owner. It retains the original cluster, volumes and backup archive. Run it
through the delivery controller during a maintenance window, using explicit
--context ironstone on every Kubernetes command. Do not recreate the cluster
or its volumes. No additional production app or database is needed.
- Before merging the consolidation, suspend the
med-trackerFlux Kustomization and HelmRelease. Scale the existing web, worker and scheduler Deployments to zero and wait until their Pods have terminated. Keep them stopped until installation succeeds; otherwise queued jobs could write to the old database. Keep the existing Helm release andmed-tracker-appServiceAccount: the migration hook uses that retained ServiceAccount before upgrading the release. - Populate the canonical 1Password fields above. Disable automatic retention on
med-tracker-rustfs-storebefore resetting anything, and confirm the retained backup and WAL. Leave the original backup credentials unchanged. - Merge the consolidation through the delivery controller. Reconcile
med-tracker-dband wait for its ExternalSecrets to be Ready. Before setup, wait for every role declared incluster.yamlto appear instatus.managedRolesStatus.byStatus.reconciledon themed-trackerCluster, with no entries instatus.managedRolesStatus.cannotReconcile. The application HelmRelease in Git is deliberately suspended. The removed blue Kustomization may prune its Secrets and backup schedule; its Cluster has pruning disabled and must be deleted explicitly only after the replacement works. - Pause
med-tracker-dbreconciliation. Remove themed-tracker-appDatabase resource temporarily, leaving its PostgreSQL database retained. Confirm the oldmed-tracker-cache,med-tracker-queueandmed-tracker-cableDatabase resources have been pruned. Removing the old Database resources does not drop their PostgreSQL databases: CNPG’s default reclaim policy isretain. -
Open an administrator
psqlsession to the current primary of clustermed-tracker, connected to maintenance databasepostgres. Use local peer authentication in the database Pod; do not print or pass passwords in command arguments. SetON_ERROR_STOPand checkpg_databasebefore executing:DROP DATABASE "med-tracker" WITH (FORCE); DROP DATABASE IF EXISTS medtracker_production_cache WITH (FORCE); DROP DATABASE IF EXISTS medtracker_production_queue WITH (FORCE); DROP DATABASE IF EXISTS medtracker_production_cable WITH (FORCE); CREATE DATABASE "med-tracker" OWNER "med-tracker";This is explicit operator database administration, not an application migration or an automatic Helm hook. Run no destructive Loco migration commands. If any statement fails, stop and inspect the database state.
- Apply
operations/setup-job.yamlonce and wait for successful completion. It runs the released nativedatabase-setuptask against the empty database, installing the schema and restricted logins. Inspect its result; do not repeatedly delete and rerun a failed Job without diagnosing the failure. - Resume
med-tracker-dbreconciliation and wait for the managed Database to report Ready. After setup succeeds, removespec.suspend: truefrom the application HelmRelease through the delivery controller. Resume the app Flux Kustomization and HelmRelease. The existing release’s migration Job, web, worker and scheduler must all use the same immutable 0.6.5 image. - Verify startup, sign-up/sign-in, household creation, queue processing and scheduler operation, and allowed and denied database access. Confirm the Service and both existing hostnames route to the replacement. Confirm a new database backup and continuous WAL archiving succeed. HTTP readiness alone does not establish acceptance.
- Delete the unused
med-tracker-blueCluster explicitly, then inspect and remove only its PVCs if they remain. Never select the retainedmed-trackerPVCs. Remove orphaned blue Kubernetes Secrets and the completed setup Job. Keep the original backup until the owner accepts the replacement; backup removal is a separate decision.
After the reset, rollback means recovering the retained original backup. There is no supported way to run Rails against the Rust schema, and restoring the old backup does not preserve data written by the replacement.