version: '3.7'

services:
### SVC:mysql:>>>
  mysql:
    hostname: mysql
    image: 192.168.251.78/edoc2v5/mysql:v8.0.17.18
    volumes:
      - /home/edoc2/macrowing/edoc2v5/data/mysql:/var/lib/mysql
      - /home/edoc2/macrowing/edoc2v5/data/dbbackup:/dbbackup
    init: true
    environment:
      - DBBACKUP=true
      - TASKS=10 0 * * *
      - DAYS=15
      - MODE=standalone
    networks:
      - middleware
    deploy:
      placement:
        constraints:
          - node.labels.nodelabels == Middleware
      replicas: 1
      restart_policy:
        condition: on-failure
    logging:
      driver: "json-file"
      options:
        max-size: "2048k"
        max-file: "10"
### SVC:mysql:<<<

  redis:
    hostname: redis
    image: 192.168.251.78/edoc2v5/redis:v6.2.12-01
    volumes:
      - /home/edoc2/macrowing/edoc2v5/data/redis:/data
    networks:
      - middleware
    deploy:
      replicas: 1
      placement:
        constraints:
          - node.labels.nodelabels == Middleware
      endpoint_mode: dnsrr
      restart_policy:
        condition: on-failure
    logging:
      driver: "json-file"
      options:
        max-size: "2048k"
        max-file: "10"

  rabbitmq:
    hostname: rabbitmq
    image: 192.168.251.78/edoc2v5/rabbitmq:v3.7.17.2
    volumes:
      - /home/edoc2/macrowing/edoc2v5/data/rabbitmq:/var/lib/rabbitmq
    networks:
      - middleware
    deploy:
      placement:
        constraints:
          - node.labels.nodelabels == Middleware
      replicas: 1
      restart_policy:
        condition: on-failure
    logging:
      driver: "json-file"
      options:
        max-size: "2048k"
        max-file: "10"

  es:
    image: 192.168.251.78/edoc2v5/elasticsearch:v6.7.1.15-0629
    hostname: es
    volumes:
      - /home/edoc2/macrowing/edoc2v5/data/es:/esdata
      - /home/edoc2/macrowing/edoc2v5/data/esbackup:/esbackup
    networks:
      - middleware
    environment:
      - node.name=es
      - ES_JAVA_OPTS=-Xmx8g -Xms8g
    deploy:
      replicas: 1
      placement:
        constraints:
          - node.labels.nodelabels == Middleware
      restart_policy:
        condition: on-failure
    logging:
      driver: "json-file"
      options:
        max-size: "2048k"
        max-file: "10"

  proxy:
    hostname: proxy
    image: 192.168.251.78/edoc2v5/nginx:202311231138
    command: /etc/nginx/proxy.sh
    environment:
      - MIDDLEWARE=standalone
      - PROXY_SERVICES=es,mysql,rabbitmq,redis
    ports:
      - "30001:30001"    #mysql
      - "30003:30003"    #es
      - "30004:30004"    #rabbitmq
      - "30005:30005"    #redis
      - "5201:5201"      #iperf3
    deploy:
      replicas: 1
      placement:
        constraints:
          - node.labels.nodelabels == Middleware
      restart_policy:
        condition: on-failure
    networks:
      - middleware
    logging:
      driver: "json-file"
      options:
        max-size: "2000k"
        max-file: "10"

networks:
  middleware:
    external: true
    name: macrowing
