Project: Lagoon (App Definition and Development / Application Definition & Image Build)
File: mariadb.md

MariaDB is the open source successor to MySQL. The . Based on the official packages and provided by the the upstream Alpine image. This Dockerfile is intended to be used to set up a standalone MariaDB database server. 10.4 (Alpine 3.12 Support until May 2022) - `uselagoon/mariadb-10.4` 10.5 (Alpine 3.14 Support until May 2023) - `uselagoon/mariadb-10.5` 10.6 (Alpine 3.16 Support until May 2024) - `uselagoon/mariadb-10.6` 10.11 (Alpine 3.18 Support until May 2025) - `uselagoon/mariadb-10.11` !!! Info As these images are not built from the upstream MariaDB images, their support follows a different cycle - and will only receive updates as long as the underlying Alpine images receive support - see for more information. In practice, most MariaDB users will only be running these containers locally - the production instances will use the Managed Cloud Databases provided by the DBaaS Operator The default exposed port of MariaDB containers is port `3306`. To allow Lagoon to select the best way to run the MariaDB container, use `lagoon.type: mariadb` - this allows the DBaaS operator to provision a cloud database if available in the cluster. Use `lagoon.type: mariadb-single` to specifically request MariaDB in a container. Persistent storage is always provisioned for MariaDB containers at `/var/lib/mysql`. This image is prepared to be used on Lagoon. There are therefore some things already done: Folder permissions are automatically adapted with , so this image will work with a random user. `readiness-probe.sh` script to check when MariaDB container is ready. ```yaml title="docker-compose.yml" mariadb: image: uselagoon/mariadb-10.6-drupal:latest labels: lagoon.type: mariadb ports: "3306" volumes: db:/var/lib/mysql ``` - Perl script useful for database parameter tuning. - Script for automating the daily MySQL backups on development environment. - Utility to generate random and complex passwords. The image ships a default MariaDB configuration file, optimized to work on Lagoon. Some options are configurable via [environment variables](../concepts-advanced/environment-variables.md). | Environment Variable | Default | Description | | :-- | :-- | : | | MARIADB_DATABASE | lagoon | Database name created at startup. | | MARIADB_USER | lagoon | Default user created at startup. | | MARIADB_PASSWORD | lagoon | Password of default user created at startup. | | MARIADBROOTPASSWORD | Lag00n | MariaDB root user's password. | | MARIADB_CHARSET | utf8mb4 | Set the server charset. | | MARIADBCOLLATION | utf8mb4bin | Set server collation. | | MARIADBMAXALLOWEDPACKET | 64M | Set the `maxallowed_packet` size. | | MARIADBINNODBBUFFERPOOLSIZE | 256M | Set the MariaDB InnoDB buffer pool size. | | MARIADBINNODBBUFFERPOOLINSTANCES | 1 | Number of InnoDB buffer pool instances. | | MARIADBINNODBLOGFILESIZE | 64M | Size of InnoDB log file. | | MARIADBLOGSLOW | (not set) | Variable to control the save of slow queries. | | MARIADBLOGQUERIES | (not set) | Variable to control the save of ALL queries. | | BACKUPS_DIR | /var/lib/mysql/backup | Default path for databases backups. | | MARIADBDATADIR | /var/lib/mysql | Path of the MariaDB data dir, be careful, changing this can occur data loss! | | MARIADBCOPYDATADIRSOURCE | (not set) | Path which the entrypoint script of mariadb will use to copy into the defined `MARIADBDATADIR`, this can be used for prepopulating the MariaDB with a database. The scripts expects actual MariaDB data files and not a sql file! Plus it only copies data if the destination does not already have a mysql datadir in it. | If the `LAGOONENVIRONMENTTYPE` variable is set to `production`, performances are set accordingly by using `MARIADBINNODBBUFFERPOOLSIZE=1024` and `MARIADBINNODBLOGFILESIZE=256`.