version: '3.8' services: anode: image: colinmollenhour/mariadb-galera-swarm environment: - XTRABACKUP_PASSWORD_FILE=/run/secrets/xtrabackup_password - MYSQL_USER=user - MYSQL_PASSWORD_FILE=/run/secrets/mysql_password - MYSQL_DATABASE=database - MYSQL_ROOT_PASSWORD_FILE=/run/secrets/mysql_root_password - NODE_ADDRESS=^10.0.10.* - HEALTHY_WHILE_BOOTING=1 networks: - mariadb ports: - mode: host target: 4567 published: 4567 command: node tasks.anode,tasks.bnode volumes: - /var/lib/mysql:/var/lib/mysql deploy: resources: limits: cpus: '0.75' memory: 250M reservations: cpus: '0.5' memory: 100M # Replicated mode mode: replicated replicas: 1 placement: # Services must run only on workers with one service per container max_replicas_per_node: 1 constraints: - node.labels.node1 == true - node.role == worker secrets: - xtrabackup_password - mysql_password - mysql_root_password bnode: image: colinmollenhour/mariadb-galera-swarm environment: - XTRABACKUP_PASSWORD_FILE=/run/secrets/xtrabackup_password - NODE_ADDRESS=^10.0.10.* - HEALTHY_WHILE_BOOTING=1 - MASTER_ADDR networks: - mariadb command: node $MASTER_ADDR,tasks.bnode # command: node tasks.anode,tasks.bnode volumes: - /var/lib/mysql:/var/lib/mysql deploy: resources: limits: cpus: '0.75' memory: 250M reservations: cpus: '0.5' memory: 100M # Replicated mode mode: replicated replicas: 1 placement: # Services must run only on workers with one service per container max_replicas_per_node: 1 constraints: - node.labels.node2 == true - node.role == worker depends_on: - bnode secrets: - xtrabackup_password #volumes: # mysql-data: # name: '{{.Service.Name}}-{{.Task.Slot}}-data' # driver: local networks: mariadb: external: name: mariadb secrets: xtrabackup_password: file: .secrets/xtrabackup_password mysql_password: file: .secrets/mysql_password mysql_root_password: file: .secrets/mysql_root_password