main

mattermost/focalboard

Last updated at: 29/12/2023 09:38

docker-compose-mariadb.yml

TLDR

This file is a Docker Compose configuration file that sets up and defines two services: mariadb and start_dependencies. The mariadb service sets up a MariaDB database container with specific environment variables, health checks, and port mappings. The start_dependencies service waits for the mariadb service to be ready before starting.

Services

mariadb

The mariadb service in this Docker Compose file sets up a MariaDB database container. It uses the "mariadb:10.9.3" image and ensures that the container restarts always. The service defines the following environment variables:

  • MARIADB_ROOT_HOST: The root host for MariaDB. It is set to "%", allowing connections from any host.
  • MARIADB_ROOT_PASSWORD: The root password for MariaDB, which is set to "mostest".
  • MARIADB_PASSWORD: The password for the non-root user, set to "mostest".
  • MARIADB_USER: The non-root user for MariaDB, set to "mmuser".

The service also defines a health check for the container. It will periodically execute the command mariadb-admin ping -h localhost -u mmuser -pmostest to check the health of MariaDB. The health check has an interval of 5 seconds, a timeout of 10 seconds, and will retry 3 times. The /var/lib/mariadb directory is mounted as a tmpfs.

The service exposes port 3306 on the host as port 44445.

start_dependencies

The start_dependencies service uses the mattermost/mattermost-wait-for-dep:latest image. It depends on the mariadb service, meaning it will wait for the mariadb service to be ready before starting. The service runs the command mariadb:3306.

version: '2.4'
services:
  mariadb:
    image: "mariadb:10.9.3"
    restart: always
    environment:
      MARIADB_ROOT_HOST: "%"
      MARIADB_ROOT_PASSWORD: mostest
      MARIADB_PASSWORD: mostest
      MARIADB_USER: mmuser
    healthcheck:
      test: ["CMD", "mariadb-admin", "ping", "-h", "localhost", "-u", "mmuser", "-pmostest"]
      interval: 5s
      timeout: 10s
      retries: 3
    tmpfs: /var/lib/mariadb
    ports:
      - 44445:3306

  start_dependencies:
    image: mattermost/mattermost-wait-for-dep:latest
    depends_on:
      - mariadb
    command: mariadb:3306