MariaDB — the community-developed, fully open-source MySQL-compatible database — deployed as a host-networked Nomad service with a persistent Docker volume for its data directory.
Save as values.hcl, edit, then run:
# The name of the Nomad job.
job_name = "mariadb"
# The Nomad namespace to deploy into.
namespace = "default"
# The datacenters to deploy to.
datacenters = ["*"]
# The MariaDB container image.
image = "mariadb:11"
# Host port MariaDB listens on (host networking, so it's reachable at <node-ip>:<port>). Pick a free port on the target node.
port = 3306
# Number of instances (keep at 1 — local-disk storage, no built-in replication).
count = 1
# Initial database created on first boot.
db_name = "app"
# Application user created on first boot (granted rights on db_name).
db_user = "app"
# Password for db_user. CHANGE THIS — it is baked into the job env. Consider a Nomad variable / Vault instead of a default.
db_password = "mariadb"
# Password for the MariaDB root user. CHANGE THIS.
root_password = "mariadb"
# Docker named volume for /var/lib/mysql, so the database survives restarts and reschedules. A fresh volume inherits the image's data-dir ownership (uid 999), so MariaDB can write it.
data_volume = "mariadb_data"
# Placement constraints — e.g. pin to one node so the local volume stays put. On a nomploy cluster: attribute = "$${meta.nomploy_control_plane}", operator = "=", value = "true".
constraints = []
# The task resources.
resources = {
cpu = 500
memory = 512
}
| Name | Type | Default | Description |
|---|---|---|---|
| job_name | string | "mariadb" | The name of the Nomad job. |
| namespace | string | "default" | The Nomad namespace to deploy into. |
| datacenters | list | ["*"] | The datacenters to deploy to. |
| image | string | "mariadb:11" | The MariaDB container image. |
| port | number | 3306 | Host port MariaDB listens on (host networking, so it's reachable at <node-ip>:<port>). Pick a free port on the target node. |
| count | number | 1 | Number of instances (keep at 1 — local-disk storage, no built-in replication). |
| db_name | string | "app" | Initial database created on first boot. |
| db_user | string | "app" | Application user created on first boot (granted rights on db_name). |
| db_password key | string | "mariadb" | Password for db_user. CHANGE THIS — it is baked into the job env. Consider a Nomad variable / Vault instead of a default. |
| root_password key | string | "mariadb" | Password for the MariaDB root user. CHANGE THIS. |
| data_volume | string | "mariadb_data" | Docker named volume for /var/lib/mysql, so the database survives restarts and reschedules. A fresh volume inherits the image's data-dir ownership (uid 999), so MariaDB can write it. |
| constraints | list | [] | Placement constraints — e.g. pin to one node so the local volume stays put. On a nomploy cluster: attribute = "$${meta.nomploy_control_plane}", operator = "=", value = "true". |
| resources | object | {
cpu = 500
memory = 512
} | The task resources. |
No variables match.
MariaDB — the community-developed, fully open-source drop-in replacement for MySQL — as a host-networked Nomad service with a persistent Docker volume. Use it to back apps that expect MySQL/MariaDB (WordPress, Ghost, Matomo, …).
nomad-pack registry add nomploy github.com/Nomploy/nomad-packs
nomad-pack run mariadb --registry nomploy
In nomploy: create a Compose service, type Nomad Pack, pack mariadb, custom registry
github.com/Nomploy/nomad-packs, then Deploy.
Connect at <node-ip>:3306 as db_user / db_password (database db_name), or as
root / root_password.
| Variable | Default | Notes |
|---|---|---|
image |
mariadb:11 |
Pin a tag in production. |
port |
3306 |
Host port. |
db_name / db_user / db_password |
app / app / mariadb |
App database + user created on first boot. Change the password. |
root_password |
mariadb |
Change this. |
data_volume |
mariadb_data |
Persistent /var/lib/mysql. Back it up. |
constraints |
[] |
Pin to a node so the local volume stays put. |
resources |
cpu 500 / mem 512 |
Raise memory for larger workloads. |
count at 1 — storage is a local volume with no built-in
replication. Pin the job with constraints so it lands on the node holding the volume.ALTER USER inside the DB, not just editing the job.data_volume, or run mysqldump / mariadb-dump.