feat(cmangos-ptr): dedicated MariaDB for PTR [DO NOT MERGE — gated]#4108
Draft
xunholy wants to merge 1 commit into
Draft
feat(cmangos-ptr): dedicated MariaDB for PTR [DO NOT MERGE — gated]#4108xunholy wants to merge 1 commit into
xunholy wants to merge 1 commit into
Conversation
Splits PTR's world/characters/logs onto a dedicated MariaDB
(cmangos-ptr-database), leaving the shared cmangos-database hosting only
the auth DB (classicrealmd) + live's game DBs. This removes the
connection/buffer contention that OOM-killed the shared instance and
broke live logins on 2026-06-18. realmlist + accounts stay shared, so
the single-auth / both-realms UX is unchanged.
GATED on two external prerequisites — DO NOT MERGE until both are done:
1. Image: add MANGOS_REALMD_DBHOST support to the entrypoint in the
fork xunholy/cmangos-classic (login DB on a different host than
world/char/logs), build + pin the PTR image. Without it, PTR login
lookups hit the new instance (no classicrealmd) and all PTR logins
fail.
2. 1Password: add a DB_ROOT_PASSWORD field to the `cmangos` item. The
new cmangos-ptr-database-creds ExternalSecret needs it for first-init
root. Scoped to a dedicated secret so a missing key can't disrupt
live auth (shared cmangos-database-creds is untouched).
Changes:
- new cmangos-ptr-database app (HelmRelease, PVC, dedicated ExternalSecret,
ks) + ArtifactGenerator source + overlay registration. No VolSync: PTR
data is reconstructible via the db-init Job.
- cmangos-ptr: MANGOS_DBHOST -> cmangos-ptr-database, add
MANGOS_REALMD_DBHOST=cmangos-database, wait-db waits for both instances,
dependsOn cmangos-ptr-database (owns the creds secret the Job uses).
- db-init Job is now a cross-instance clone: read live as the app user,
create/grant/restore on the new instance as root; *_db_version rows
copied via single-table dumps instead of cross-instance INSERT...SELECT.
Cutover + rollback steps are in the PR description.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
k8s-gitops | 39999f1 | Commit Preview URL Branch Preview URL |
Jun 24 2026, 11:25 PM |
Contributor
--- kubernetes/apps/overlays/cluster-00 Kustomization: flux-system/cluster ArtifactGenerator: flux-system/k8s-gitops
+++ kubernetes/apps/overlays/cluster-00 Kustomization: flux-system/cluster ArtifactGenerator: flux-system/k8s-gitops
@@ -72,12 +72,17 @@
- copy:
- from: '@repo/apps/base/game-servers/cmangos-ptr/app/'
to: '@artifact/apps/base/game-servers/cmangos-ptr/app/'
name: cmangos-ptr
originRevision: '@repo'
- copy:
+ - from: '@repo/apps/base/game-servers/cmangos-ptr-database/app/'
+ to: '@artifact/apps/base/game-servers/cmangos-ptr-database/app/'
+ name: cmangos-ptr-database
+ originRevision: '@repo'
+ - copy:
- from: '@repo/apps/base/game-servers/cmangos-realmd/app/'
to: '@artifact/apps/base/game-servers/cmangos-realmd/app/'
name: cmangos-realmd
originRevision: '@repo'
- copy:
- from: '@repo/apps/base/crossplane-system/crossplane/providers/'
--- kubernetes/apps/overlays/cluster-00 Kustomization: flux-system/cluster Kustomization: game-servers/cmangos-ptr
+++ kubernetes/apps/overlays/cluster-00 Kustomization: flux-system/cluster Kustomization: game-servers/cmangos-ptr
@@ -8,12 +8,15 @@
kustomize.toolkit.fluxcd.io/namespace: flux-system
name: cmangos-ptr
namespace: game-servers
spec:
decryption:
provider: sops
+ dependsOn:
+ - name: cmangos-ptr-database
+ namespace: game-servers
interval: 30m
path: ./apps/base/game-servers/cmangos-ptr/app
prune: true
retryInterval: 1m
sourceRef:
kind: ExternalArtifact
--- kubernetes/apps/overlays/cluster-00 Kustomization: flux-system/cluster Kustomization: game-servers/cmangos-ptr-database
+++ kubernetes/apps/overlays/cluster-00 Kustomization: flux-system/cluster Kustomization: game-servers/cmangos-ptr-database
@@ -0,0 +1,30 @@
+---
+apiVersion: kustomize.toolkit.fluxcd.io/v1
+kind: Kustomization
+metadata:
+ labels:
+ gitops.owncloud.ai/defaults: disabled
+ kustomize.toolkit.fluxcd.io/name: cluster
+ kustomize.toolkit.fluxcd.io/namespace: flux-system
+ name: cmangos-ptr-database
+ namespace: game-servers
+spec:
+ decryption:
+ provider: sops
+ dependsOn:
+ - name: onepassword
+ namespace: external-secrets
+ - name: rook-ceph-cluster
+ namespace: rook-ceph
+ interval: 30m
+ path: ./apps/base/game-servers/cmangos-ptr-database/app
+ prune: true
+ retryInterval: 1m
+ sourceRef:
+ kind: ExternalArtifact
+ name: cmangos-ptr-database
+ namespace: flux-system
+ targetNamespace: game-servers
+ timeout: 10m
+ wait: true
+ |
xunholy
added a commit
to xunholy/cmangos-classic
that referenced
this pull request
Jun 26, 2026
…HOST) (#28) The runner entrypoint composed all four mangosd *DatabaseInfo lines from a single MANGOS_DBHOST, so a world server could not keep its game DBs on one MariaDB while validating sessions against the shared auth (classicrealmd) DB on another. Add MANGOS_REALMD_DBHOST: the login DB host for mangosd's LoginDatabaseInfo (and realmd's, which only uses the login DB). It defaults to MANGOS_DBHOST in init_runner, so any deployment that doesn't set it — including realmd, which always runs on the auth instance — renders byte for byte identical config. Enables the k8s-gitops cmangos-ptr split onto a dedicated MariaDB (xunholy/k8s-gitops#4108): PTR world/characters/logs move off the shared instance while login stays shared. Verified by composing mangosd.conf/realmd.conf against mock env: with the var set, LoginDatabaseInfo uses the auth host and world/char/logs use the game host; with it unset, all four resolve to MANGOS_DBHOST as before. shellcheck clean (no new findings).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Caution
DO NOT MERGE. Gated on two external prerequisites (below). Kept as a draft so it can't merge accidentally. Merging without these breaks all PTR logins and/or PTR DB init.
What
Moves PTR's
ptrmangos/ptrcharacters/ptrlogsonto a dedicated MariaDB (cmangos-ptr-database). The sharedcmangos-databasekeeps only the auth DB (classicrealmd) + live's game DBs. This removes the world/character connection + buffer-pool contention that OOM-killed the shared instance and broke live logins on 2026-06-18.classicrealmd(realmlist + accounts + session keys) stays shared, so single-auth / both-realms-visible / GM-flags-carry-over is unchanged. PTR's mangosd becomes the only cross-instance client (login → shared, world/char/logs → its own box).⛔ Prerequisites (do both before un-drafting)
MANGOS_REALMD_DBHOSTto the entrypoint inxunholy/cmangos-classicso the login DB can be on a different host than world/char/logs, defaulting toMANGOS_DBHOST(so live/realmd are unaffected). Build + pin the PTR image. Without it, PTR login lookups hit the new instance, find noclassicrealmd, and every PTR login fails.DB_ROOT_PASSWORDfield to thecmangositem. The newcmangos-ptr-database-credsExternalSecret needs it for first-init root. Scoped to a dedicated secret so a missing key can't disrupt live auth.Changes
cmangos-ptr-databaseapp: HelmRelease (mariadb:12.2), PVC (10Gi), dedicatedExternalSecret,ks.yaml; registered in the ArtifactGenerator + cluster-00 overlay. No VolSync — PTR data is reconstructible via the db-init Job.cmangos-ptr:MANGOS_DBHOST→cmangos-ptr-database; addMANGOS_REALMD_DBHOST=cmangos-database;wait-dbwaits for both instances;dependsOn: cmangos-ptr-database(it owns the creds secret the Job uses).db-initJob → cross-instance clone: read live as the app user, create/grant/restore on the new instance as root;*_db_versionrows copied via single-table dumps (cross-instanceINSERT…SELECTcan't work anymore).cmangos-database-creds/externalsecret-database.yamluntouched.Cutover (once prerequisites are met)
DB_ROOT_PASSWORDto 1Password (prereq 2).cmangos-ptr-databasecomes up;db-initclonesptr*onto it; PTR mangosd rolls onto the new instance.DROP DATABASE ptrmangos/ptrcharacters/ptrlogson the sharedcmangos-database— this is what actually relieves the shared instance.Rollback before step 5: revert the
cmangos-ptrenv change (points back atcmangos-database, oldptr*still there). Instant, no data loss.Validation done
kustomize buildnew app dir → ExternalSecret + HelmRelease + PVC renderkustomize build --load-restrictor LoadRestrictionsNone overlays/cluster-00→ 153 docsrealm-row-migrationstill writes sharedclassicrealmd; db-init admins new instance / reads livehttps://claude.ai/code/session_01T37E9UJr2ymcGhQoV8Yq93