services:
  mariadb:
    image: mariadb:11.4
    container_name: mariadb-node${MGDB_NODE_NUMBER}
    restart: always
    network_mode: host
    environment:
      - MARIADB_ROOT_PASSWORD=${DB_ROOT_PASSWORD}
      - MARIADB_USER=${DB_ADMIN_USER}
      - MARIADB_PASSWORD=${DB_ADMIN_PASSWORD}
      - MARIADB_DATABASE=initial_db
    volumes:
      - /docker/maria/data:/var/lib/mysql
      - /docker/maria/conf:/etc/mysql/conf.d
    command:
      - --${WS_NEW_CLUSTER}
      - --wsrep-on=ON
      - --wsrep-provider=/usr/lib/galera/libgalera_smm.so
      - --wsrep-cluster-name=${CLUSTER_NAME}
      - --wsrep-cluster-address=gcomm://${CLUSTER_LOCAL_IP},${CLUSTER_REMOTE_IP}
      - --wsrep-node-address=${CLUSTER_KEEPALIVED_IP}
      - --wsrep-node-name=node${MGDB_NODE_NUMBER}
      - --binlog-format=row
      - --default-storage-engine=innodb
      - --innodb-autoinc-lock-mode=2
      - --bind-address=0.0.0.0