Service: MariaDB - EyevinnOSC/community GitHub Wiki

MariaDB

MariaDB (serviceId linuxserver-docker-mariadb) is a community developed fork of the MySQL server, packaged by LinuxServer.io. In Eyevinn Open Source Cloud (OSC) it is a long-running service instance with up to 10 GiB of storage per instance. License: GPL-3.0. This page also covers MariaDB Backup to S3.

What it can do

  • Run a MySQL-compatible SQL database server, reachable over TCP with any MySQL/MariaDB client.
  • Create an initial database and user on first start.
  • Serve as the database for other OSC services, for example FreeScout.
  • Be backed up with the MariaDB Backup to S3 job or with Database Backuper.

Creating an instance

Create the instance with create-service-instance using serviceId: "linuxserver-docker-mariadb". The name must be alphanumeric and at most 20 characters. MariaDB has no dependencies on other OSC services. Store the root password first with create-service-secret (serviceId linuxserver-docker-mariadb).

{
  "name": "dbserver",
  "RootPassword": "{{secrets.rootpassword}}",
  "Database": "mydb",
  "User": "myuser",
  "Password": "{{secrets.dbpassword}}"
}

Wait with wait-for-service-ready, then use describe-service-instance to obtain the IP and port.

Options

Option Required Type Meaning
name Yes string Name of the database server. Letters, digits and underscore only, at most 20 characters.
RootPassword Yes string, sensitive Administrator password. Minimum 4 characters; non-alphanumeric passwords must be properly escaped. Valid only for the first run: changing it after initial setup has no effect.
Database No string Name of a database to create during initial setup (MYSQL_DATABASE). First run only. Must be set together with User and Password; all three or none.
User No string User created with superuser access to the database named in Database (MYSQL_USER). Do not use root. First run only. Must be set together with Database and Password.
Password No string, sensitive Password of User (MYSQL_PASSWORD). Minimum 4 characters; non-alphanumeric passwords must be properly escaped. First run only. Must be set together with Database and User.

RootPassword and Password are sensitive: store them as service secrets and reference them as {{secrets.NAME}}, which only works as the entire field value. The credential options only take effect on the first run, so changing a secret later does not change the password of an existing database.

Using the instance

Connect with the mysql client using the IP and port from describe-service-instance:

% mysql -h <ip> -P <port> -p
Enter password: <root password>
Welcome to the MySQL monitor.  Commands end with ; or \g.

For other services that need a database URL, use mysql://<user>:<password>@<ip>:<port>/<database>.

MariaDB Backup to S3 options

MariaDB Backup to S3 (serviceId birme-mariadb-backup-s3, license MIT) is a job that takes a backup of a MariaDB database directly to an S3 bucket and exits. Create it with create-service-instance (the destination goes in cmdLineArgs, for example s3://<s3-bucket-for-backup>/) and read results with get-logs-for-instance. Store credentials as secrets. OSC CLI form: osc create birme-mariadb-backup-s3 mybackup -o MariaDbUrl="{{secrets.mariadburl}}" -o cmdLineArgs="s3://<bucket>/" -o awsAccessKeyId="{{secrets.awsaccesskeyid}}" -o awsSecretAccessKey="{{secrets.awssecretaccesskey}}" -o awsRegion="eu-north-1".

Option Required Type Meaning
name Yes string Name of the job. Letters, digits and underscore only, at most 20 characters.
MariaDbUrl Yes string, sensitive Connection URL of the database, for example mariadb://root:<rootpwd>@<ip>:<port>/<database> (DB_URL).
cmdLineArgs Yes string Command line argument to the backup tool: the destination s3://<s3-bucket-for-backup>/.
awsAccessKeyId No string, sensitive S3 access key id (AWS_ACCESS_KEY_ID).
awsSecretAccessKey No string, sensitive S3 secret access key (AWS_SECRET_ACCESS_KEY).
awsSessionToken No string, sensitive Session token for temporary AWS credentials (AWS_SESSION_TOKEN, standard AWS convention; not shown in the project README).
awsRegion No string S3 region, for example eu-north-1 (AWS_REGION).

See also MariaDB Backup to S3.

Limitations

  • Storage is limited to 10 GiB per instance.
  • Root via localhost inside the container does not require a password (upstream behavior).

Resources

⚠️ **GitHub.com Fallback** ⚠️