services:
  mariadb1:
    image: docker.mariadb.com/enterprise-server:10.6
    environment:
      MARIADB_ROOT_PASSWORD: 'DevPassword123!'
      MARIADB_ROOT_HOST: '%'
    command: 
      - "--server-id=1"
      - "--log-bin=mariadb-bin"
      - "--binlog-format=ROW"
      - "--gtid-strict-mode=1"
    ports:
      - "3301:3306"

  mariadb2:
    image: docker.mariadb.com/enterprise-server:10.6
    environment:
      MARIADB_ROOT_PASSWORD: 'DevPassword123!'
      MARIADB_ROOT_HOST: '%'
    command: 
      - "--server-id=2"
      - "--log-bin=mariadb-bin"
      - "--binlog-format=ROW"
      - "--gtid-strict-mode=1"
    ports:
      - "3302:3306"

  mariadb3:
    image: docker.mariadb.com/enterprise-server:10.6
    environment:
      MARIADB_ROOT_PASSWORD: 'DevPassword123!'
      MARIADB_ROOT_HOST: '%'
    command: 
      - "--server-id=3"
      - "--log-bin=mariadb-bin"
      - "--binlog-format=ROW"
      - "--gtid-strict-mode=1"
    ports:
      - "3303:3306"

  mariadb4:
    image: docker.mariadb.com/enterprise-server:10.6
    environment:
      MARIADB_ROOT_PASSWORD: 'DevPassword123!'
      MARIADB_ROOT_HOST: '%'
    command: 
      - "--server-id=4"
      - "--log-bin=mariadb-bin"
      - "--binlog-format=ROW"
      - "--gtid-strict-mode=1"
    ports:
      - "3304:3306"


  maxscale:
    image: docker.mariadb.com/maxscale:25.10
    depends_on:
      - mariadb1
      - mariadb2
      - mariadb3
      - mariadb4
    ports:
      - "4000:4000"
      - "8989:8989"
    volumes:
      - ./maxscale.cnf:/etc/maxscale.cnf:ro
