Skip to content

Repository files navigation

GameAP MySQL plugin

MySQL/MariaDB databases for game servers and panel users: provisioning, connection info, a data browser with inline editing, a SQL console, and import/export — all from the GameAP panel.

Plugin id: fmqnme42gg7da (its own compact form, so /api/plugins/fmqnme42gg7da/... and the plugin:fmqnme42gg7da:* ability names stay literal).

Architecture

Panel (Vue)  →  /api/plugins/fmqnme42gg7da/…  →  WASM plugin (Rust)
                                                  │  registry (plugin KV), authz, budget
                                                  ▼
                              nodefs upload (request.json, 0600)  +  nodecmd exec
                                                  ▼
                                       gameap-mysql CLI on the node
                                    (credentials, SQL building, MySQL I/O)
  • The panel stores metadata only — instances, databases, accounts, attachments, jobs, audit. No passwords are ever stored panel-side.
  • The gameap-mysql CLI on each node holds credentials (/var/lib/gameap-mysql/config.json, 0600, outside the daemon work path) and is the only component that builds SQL and talks to MySQL.
  • Long operations (server install, CLI install, restore, dump) run as daemon tasks; the plugin reconciles them from DAEMON_TASK_* events with a polling fallback.

The CLI is specified in docs/CLI-CONTRACT.md; its implementation plan is docs/CLI-IMPLEMENTATION-PLAN.md.

Features

  • Instances — install MariaDB/MySQL on a node, or connect an existing (local or remote) instance; connectivity/version/capability checks.
  • Databases — create for a game server or a panel user, drop with confirmation, adopt databases created outside the panel.
  • Accounts — managed MySQL users with grants, attachment to panel users and game servers, one-shot password display, rotation. System accounts (root@*, mysql.sys, mariadb.sys, …) are protected.
  • Browser — tables, structure, paginated/sorted/filtered rows, inline cell editing, insert and delete by primary key (PK-less tables are read-only).
  • SQL console — one statement per run, capped rows and timeout, per-account execution (run as is shown), local history.
  • Import/export — chunked dump upload → node-side assembly → async restore; dumps exported as downloadable parts or straight into the game server's directory for the panel file manager.
  • Drift report — registry vs live comparison; read-only unless applied.
  • Orphans — databases of deleted game servers are flagged, never dropped automatically.

Permissions

Server abilities (granted per game server in the panel):

Ability Grants
db-view list databases, connection info + password reveal, tables/structure/select
db-manage self-service creation (when enabled on the instance), password rotation
db-sql SQL console, row insert/update/delete, import/export

Personal (user-owned) databases are authorized by ownership, not RBAC. Administrative routes are admin_only and enforced by the panel before the request reaches the plugin.

Requirements

  • A panel build whose plugin host exposes the gameap-authz module (the plugin imports it for per-server permission checks and will not instantiate without it).
  • gameap-mysql CLI on every node that hosts a MySQL instance — installable from the plugin's admin UI.
  • Linux nodes (Windows returns OS_UNSUPPORTED; the OS seam is in place).

Development

make build     # frontend + wasm  → mysql.wasm
make test      # cargo test + vitest
make lint      # clippy (native + wasm32-wasip1), -D warnings

Frontend dev loop:

cd frontend && npm run dev            # watch build into dist/
PLUGIN_PATH="$PWD/dist" npx @gameap/debug   # mock panel on :5174

Sibling checkouts are required for the path dependencies: ../gameap-proto (Rust SDK) and ../gameap-api (web plugin SDK).

Release

Tag a GitHub release; .github/workflows/release.yml bakes the version into Cargo.toml and frontend/src/index.ts, builds, GPG-signs and publishes mysql.wasm to plugins.gameap.dev. Requires the GPG_SIGNING_KEY and GAMEAP_DEPLOY_TOKEN secrets and the GAMEAP_PLUGIN_ID variable.

License

GNU Affero General Public License v3.0 or later (AGPL-3.0-or-later).

About

MySQL Management plugin for GameAP

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages