Skip to content

deploy in swarm with portainer #4

Open
@devMls

Description

@devMls

Hi

at first, this is just the thing that i was looking for, amazing work.

i am trying to deploy with portainer in a 3 nodes docker swarm this solution, i edit the yaml file but i have some errors, i can fix the depends_on but with the external files, i don't know where to push it. i am using deploy stack option.

i have this error:

open /data/compose/24/nginx-galera.conf: no such file or directory

and three questions:

  • can i configure all mysql params with the enviroment variables? or i need others files?
  • why do you choose nginx over proxysql or maxscale solutions?
  • how can i configure mysql backups?
version: "3.8"
services:
  db01:
    image: ustcweizhou/mariadb-cluster:latest
    hostname: db01
    networks:
        overlay-db:
    volumes:
      - ${DATA_DIR}/$PROJECT/db01:/var/lib/mysql
    healthcheck:
        test: ["CMD", "mysqladmin", "-uroot", "-pcloudstack", "ping"]
        interval: 10s
        timeout: 10s
        retries: 60
        start_period: 10s
    environment:
      - NODE_NAME=db01
      - CLUSTER_ADDRESS=gcomm://db01,db02,db03
      - DB_ROOT_PASSWORD=cloudstack
      - DB_MARIABACKUP_PASSWORD=cloudstack
    deploy:
      placement:
        constraints:
          - "node.labels.node==docker1"
  db02:
    image: ustcweizhou/mariadb-cluster:latest
    hostname: db02
    depends_on:
      - db01
    networks:
        overlay-db:
    volumes:
      - ${DATA_DIR}/$PROJECT/db02:/var/lib/mysql
    healthcheck:
        test: ["CMD", "mysqladmin", "-uroot", "-pcloudstack", "ping"]
        interval: 10s
        timeout: 10s
        retries: 60
        start_period: 10s
    environment:
      - NODE_NAME=db02
      - CLUSTER_ADDRESS=gcomm://db01,db02,db03
      - DB_ROOT_PASSWORD=cloudstack
      - DB_MARIABACKUP_PASSWORD=cloudstack
    deploy:
      placement:
        constraints:
          - "node.labels.node==docker2"    
  db03:
    image: ustcweizhou/mariadb-cluster:latest
    hostname: db03
    depends_on:
      - db01 
      - db02
    networks:
        overlay-db:
    volumes:
      - ${DATA_DIR}/$PROJECT/db03:/var/lib/mysql
    environment:
      - NODE_NAME=db03
      - CLUSTER_ADDRESS=gcomm://db01,db02,db03
      - DB_ROOT_PASSWORD=cloudstack
      - DB_MARIABACKUP_PASSWORD=cloudstack
    deploy:
      placement:
        constraints:
          - "node.labels.node==docker3"
  dbvip:
    image: nginx
    hostname: dbvip
    networks:
        overlay-db:
    ports:
        - "13306:3306"
    deploy:
      restart_policy:
        condition: on-failure
    configs:
        - source: nginx-galera
          target: /etc/nginx/nginx.conf
    depends_on:
      - db01

configs:
    nginx-galera:
        file: ./nginx-galera.conf
        
networks:
    overlay-db:
        driver: overlay
        attachable: true
        ipam:
            driver: default
            config:
                - subnet: 192.168.10.0/24

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions