What is MariaDB Galera?
MySQL-family high availability got harder to ship in 2025 when Broadcom paywalled the Bitnami images everyone’s tutorials used. The good news, verified by actually running clusters: the OFFICIAL mariadb image carries the Galera library, and a 3-node multi-primary cluster forms from pure command-line flags plus one env var.
Galera is synchronous: every node accepts writes, every commit lands on the quorum, and a node loss costs availability nothing. The traps are operational, and this template handles each one found in testing - the bootstrap flag fires only on a genuinely first boot (a permanent flag crash-loops on restart), stop_grace_period is 2 minutes (the 10-second default SIGKILLs mariadbd and poisons cluster state), and the cold-start recovery procedure is documented rather than discovered at 3am.
An app database and user replicate to all nodes at bootstrap. Apps connect to any node - list all three for driver-level failover.
What you get
- Synchronous multi-primary: write to any node, lose any node
- Official mariadb:11.8 LTS image - no forks, no paywalled registries
- Flag-driven clustering; bootstrap-once wrapper (tested) on node 1
- stop_grace_period and recovery runbook handled, not hand-waved
- App database/user replicated cluster-wide at bootstrap
- Per-node volumes; healthchecks via the image’s --galera_online
How it runs on Lyngbak
| Service | Role | Public |
|---|---|---|
galera-1 | node + bootstrap-once wrapper (:3306) | no |
galera-2, galera-3 | nodes (join via SST/IST) | no |
Before you deploy
MARIADB_ROOT_PASSWORDroot on all nodes
MARIADB_APP_PASSWORDthe replicated app user/database
Sizing and billing
Nodes idle near 135 MiB with default buffer pools - 1 GiB each leaves real working-set room. Three nodes is the quorum minimum; scale by adding blocks to the gcomm list.
A resource is a flat monthly price, with RAM and disk add-ons when the stack needs a little more than a tier, and room for your own apps on a larger one. On Usage Billing each service takes the smallest size that fits it and is billed by the second it runs, so a stopped stack stops costing CPU and RAM. Its 14.65 GiB of volumes cost $0.15 per GiB a month ($2.20/mo) for as long as they exist. One workspace can use both. See pricing
Run it locally first
The same compose file runs with plain Docker Compose. Clone the template source, copy .env.example to .env, and run docker compose up -d.
Questions
Why not the managed MySQL?
The managed MySQL is the right default for a single instance. This template exists for the HA case - synchronous multi-primary across three nodes - which managed single-instance offerings do not provide. Different reliability class, same project network.
What happened to the Bitnami images everyone used?
Broadcom moved Bitnami to paid “Secure Images” in late 2025; the free mariadb-galera images are frozen without security updates. This template needs none of that: the official mariadb image has shipped the Galera library all along, configured via flags.
What does the bootstrap wrapper actually solve?
Galera’s classic foot-gun: --wsrep-new-cluster must run exactly once, on the first node’s first boot. Left in the command permanently, the safe_to_bootstrap guard crash-loops the node on every restart - verified by testing. The wrapper checks for grastate.dat and adds the flag only when the datadir is genuinely new.
What if the whole cluster stops uncleanly?
Galera refuses to guess which node has the newest data - by design. The README gives the two-step recovery (pick the highest-seqno node, flip safe_to_bootstrap, start it first). It is a documented 2-minute procedure, not an outage mystery.