MariaDB-10.4_Master

Introduction

This image is suitable for deploying mariadb-10.4_master managed by supervisord. This image includes a Python script, activate_mariadb.py automates the creation of database objects like users, databases and the associated user privileges by loading the required parameters from a yaml file. Supervisor jobs conf files can be kept in the supervisor folder, in the root of the project.

Stack Code

mariadb-10.4_master - To be mentioned in build.image_template in appz.yml.

Pre-requisites

Before deploying Mariadb-Master, make sure the Vault application is deployed.

Sample Project

MariaDB-Master - Use this sample project to deploy MariaDB Master database.

Sample AppZ YAML

Name: appz.yml. To be placed in the root of your git repo.

app:
    name: mariadb Master
    code: mariadbmaster
    notify: appzdev@cloudbourne.co

build:
    version: 10.4
    env: DEV
    build_file: none
    output_files: output/*.zip
    image_template: mariadb_master-10.4

deploy:
    context: alpha/DEV
    type: statefulset
    replicas: 1
    port:
    - 3306

volumes:
  - claim: mariadb-master-data
    mount: /appz/data
    name: data
    size: 5Gi
  - claim: mariadb-master-backup
    mount: /appz/backup
    name: backup
    size: 5Gi

properties:
    MYSQL_REPLICATION_USER: replication
    MYSQL_REPLICATION_PASSWORD:
      vault: MYSQL_REPLICATION_PASSWORD
    MYSQL_WORDPRESS_PASSWORD:
      vault: MYSQL_WORDPRESS_PASSWORD
    MYSQL_ROOT_PASSWORD:
      vault: MYSQL_ROOT_PASSWORD_KEY
    revision : 25

See below the explanation of appz.yml which user can customize.

Sample Setup YAML

We are passing the User, Database and Privileges details through setup.yaml similar to appz.yaml. There are three sections in the setup.yaml file, users database and acl.A sample setup.yaml is given below.

  • In the users section, name of each user to be created with the corresponding password.

  • In the databases section, details of each database to be created should be given.

  • In the acl section, details of the privileges to be set on each database with the corresponding user should be given.

---
users:
  - name: wordpress
    password: $MYSQL_WORDPRESS_PASSWORD

databases:
  - name: wordpress

acl:
  - database: wordpress
    user: wordpress
    access: ALL


Properties

The image is vault enabled so secrets can be pulled from vault. These are placed under properties in appz.yml. Please check each one below, with its actual purpose.

  • MYSQL_WORDPRESS_PASSWORD - Password of the MariaDB user 'wordpress'.
  • MYSQL_ROOT_PASSWORD - Password of the MariaDB user 'root'.
  • MYSQL_REPLICATION_USER - The user 'replication' for the MariaDB master/slave replication.
  • MYSQL_REPLICATION_PASSWORD - Password of the MariaDB user 'replication'.

Volumes

It is not mandatory to create volumes unless applications need them, these are optional.

Standard AppZ Volumes are enabled.

Database Change Deployment

To be added soon