version: '3.4' services: # seed: # 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.*.* # networks: # - galera_network # command: seed # deploy: # placement: # # Services must run only on workers with one service per container # constraints: # - node.labels.node1 == true # - node.role == worker # volumes: # - /var/lib/mysql:/var/lib/mysql # secrets: # - xtrabackup_password # - mysql_password # - mysql_root_password anode: image: colinmollenhour/mariadb-galera-swarm # hostname: environment: - XTRABACKUP_PASSWORD_FILE=/run/secrets/xtrabackup_password - NODE_ADDRESS=^10.0.*.* - HEALTHY_WHILE_BOOTING=1 networks: - galera_network command: node tasks.anode,tasks.bnode volumes: - /var/lib/mysql:/var/lib/mysql deploy: # Replicated mode mode: replicated replicas: 1 # restart_policy: # delay: 10s # max_attempts: 10 # window: 60s 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 bnode: image: colinmollenhour/mariadb-galera-swarm #hostname: bnode environment: - XTRABACKUP_PASSWORD_FILE=/run/secrets/xtrabackup_password - NODE_ADDRESS=^10.0.*.* - HEALTHY_WHILE_BOOTING=1 - MASTER_ADDR networks: - galera_network command: node $MASTER_ADDR,tasks.bnode volumes: - /var/lib/mysql:/var/lib/mysql deploy: # Replicated mode mode: replicated replicas: 0 # restart_policy: # delay: 10s # max_attempts: 10 # window: 60s 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: galera_network: secrets: xtrabackup_password: file: .secrets/xtrabackup_password mysql_password: file: .secrets/mysql_password mysql_root_password: file: .secrets/mysql_root_password