Skip to content

feat(cmangos-database): nightly logical (mysqldump) backups - #4109

Open
xunholy wants to merge 1 commit into
mainfrom
feat/cmangos-db-logical-backups
Open

feat(cmangos-database): nightly logical (mysqldump) backups#4109
xunholy wants to merge 1 commit into
mainfrom
feat/cmangos-db-logical-backups

Conversation

@xunholy

@xunholy xunholy commented Jun 25, 2026

Copy link
Copy Markdown
Owner

What

Adds restorable SQL-dump backups of the irreplaceable game DBs, complementing the existing hourly crash-consistent RBD snapshot.

Why

The live DBs are mixed-engine (verified on the running instance):

DB InnoDB MyISAM
classiccharacters 79 tables, 452 MB 13 tables, 41 MB
classicrealmd 3 tables 10 tables, ~1 MB

MyISAM tables aren't safe to restore from a raw volume snapshot taken mid-write — a logical dump is. The RBD snapshot stays as the fast-restore tier; these dumps are the correctness tier.

Changes (all in the cmangos-database app)

  • pvc-dumps.yaml — dedicated 10Gi PVC for the dumps.
  • backup-cronjob.yaml — nightly (03:00) mariadb-dump of classicrealmd + classiccharacters, gzipped + timestamped, keep newest 7 per DB. Runs as a non-root user; uses the app user (SELECT is enough for --single-transaction --no-tablespaces).
  • replicationsource-dumps.yaml — VolSync ships the dumps PVC to Kopia at 05:00, reusing the existing repo secret; retain: daily 7 / weekly 4.

classicmangos (world) is intentionally not dumped — reconstructible via init-db + the in-repo migration Jobs. classiclogs is disposable.

Consistency note

--single-transaction gives a consistent snapshot of the InnoDB bulk (all player rows) with no write-blocking; the few small MyISAM tables are best-effort. Upgrade path: a privileged backup user + --lock-all-tables once live root is rotated (after the PTR DB split decouples the on-main db-init from root=password).

Validation

  • Live privilege test: ran the exact dump command as the app user against the running DB — classicrealmd dumped 425 KB gzipped of real data; classiccharacters schema dumped exit 0. So SELECT suffices.
  • kustomize build app dir → CronJob + dumps PVC + dumps ReplicationSource render
  • Flux $$-escaping de-escaped and bash -n-checked → valid runtime script
  • yamllint + full pre-commit suite → passed

https://claude.ai/code/session_01T37E9UJr2ymcGhQoV8Yq93

Adds restorable SQL-dump backups of the irreplaceable game DBs to complement
the existing crash-consistent RBD snapshot. The live DBs are mixed-engine
(classiccharacters: 79 InnoDB + 13 MyISAM; classicrealmd: mostly small
MyISAM), and MyISAM isn't safe to restore from a raw volume snapshot taken
mid-write — a logical dump is.

- pvc-dumps.yaml: dedicated 10Gi PVC for the dumps
- backup-cronjob.yaml: nightly (03:00) mariadb-dump of classicrealmd +
  classiccharacters, gzipped + timestamped, keep newest 7 per DB. Uses the
  app user (SELECT is enough for --single-transaction --no-tablespaces;
  verified against the live DB). classicmangos (world) is omitted — it's
  reconstructible via init-db + the in-repo migrations; classiclogs is
  disposable.
- replicationsource-dumps.yaml: VolSync ships the dumps PVC to Kopia at
  05:00, reusing the existing repo secret; retain daily:7 weekly:4.

--single-transaction is consistent for the InnoDB bulk (all player rows)
with no write-blocking; the few small MyISAM tables are best-effort. Upgrade
to a privileged backup user + --lock-all-tables once live root is rotated
(after the PTR DB split lands and decouples the on-main db-init from root).
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
k8s-gitops 33e463a Commit Preview URL

Branch Preview URL
Jun 25 2026, 04:07 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant