Overview
This template provides a production‑ready MariaDB instance as a Monk runnable. You can:- Run it directly to get a managed MariaDB container with sensible defaults
- Inherit it in your own runnable to seamlessly add a relational database to your stack
What this template manages
- MariaDB container (
mariadbimage, configurable tag) - Network service on port 3306
- Persistent volumes for data and configuration
- Optional initialization of database, user, and passwords
Quick start (run directly)
- Load templates
- Run MariaDB with defaults
- Customize credentials (recommended via inheritance)
variables. Secrets added with monk secrets add will not affect this runnable unless you inherit it and reference those secrets.
- Preferred: inherit and replace variables with
secret("...")as shown below. - Alternative: fork/clone and edit the
variablesinmariadb/mariadb.yaml, thenmonk load MANIFESTand run.
localhost:3306 (or the runnable hostname inside Monk networks) using the configured credentials.
Configuration
Key variables you can customize in this template:${monk-volume-path}/mariadb on the host. Custom MySQL config snippets are mounted from ${monk-volume-path}/mariadb-conf:/etc/mysql/conf.d.
Use by inheritance (recommended for apps)
Inherit the MariaDB runnable in your application and declare a connection. Example:Ports and connectivity
- Service:
mariadbon TCP port3306 - From other runnables in the same process group, use
connection-hostname("\<connection-name>")to resolve the DB host.
Persistence and configuration
- Data path:
${monk-volume-path}/mariadb:/var/lib/mysql/ - Config path:
${monk-volume-path}/mariadb-conf:/etc/mysql/conf.d - You can drop additional
.cnffiles into the config path to tune MariaDB.
Related templates
- High‑availability cluster: see the
mariadb-ha/template in this repository for a leader + followers setup.
Troubleshooting
- If you changed
mysql-root-passwordbut the container has existing data, authentication may fail. Either reset the data volume or update the password inside the DB to match. - Ensure the host volumes are writable by the container user.
- Check logs: