kt-template-online-api/docs/refactor-v3/rebuild-runbook.md

953 B

Refactor V3 Rebuild Runbook

Local Dry Run

  1. Create an empty local database dedicated to refactor V3.
  2. Apply sql/refactor-v3/00-full-schema.sql.
  3. Apply sql/refactor-v3/01-seed-core.sql.
  4. Run sql/refactor-v3/99-verify.sql.
  5. Start API against the dry-run database.
  6. Run bash scripts/refactor-v3/local-smoke.sh.

Online Backup

  1. Confirm the exact API image tag and current database name.
  2. Run bash scripts/refactor-v3/db-backup-online.sh --database <name> --output-directory <path>.
  3. Record backup path, timestamp, source database, and restore command.

Online Rebuild

  1. Stop or limit API write traffic.
  2. Apply full schema and seed scripts.
  3. Run verify SQL.
  4. Deploy API/Admin image versions bound to this schema.
  5. Run online smoke bundle.

Rollback

  1. Stop write traffic.
  2. Restore the recorded backup or previous schema bundle.
  3. Roll back API/Admin images.
  4. Re-run smoke for the restored version.