version: '3.7'

services:
  dm:
    hostname: dm
    image: registry.edoc2.com:5000/edoc2v5/dm8:arm-edrms-v6.1.0.0-arm-20230519
    volumes:
      - /home/edoc2/macrowing/edoc2v5/data/dm:/home/dmdba/data
    environment:
      - SYSDBA_DBNAME=edoc2v5
      - SYSDBA_PWD=1qaz2WSX1qaz2WSX
    ports:
      - 5236:5236
    logging:
      driver: "json-file"
      options:
        max-size: "2048k"
        max-file: "10"
    networks:
      - middleware
  mysql:
    hostname: mysql
    image: registry.edoc2.com:5000/edoc2v5/mysql:arm-edrms-v6.1.0.0-arm-20230519
    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: registry.edoc2.com:5000/edoc2v5/redis:arm-edrms-v6.1.0.0-arm-20230519
    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: registry.edoc2.com:5000/edoc2v5/rabbitmq:arm-edrms-v6.1.0.0-arm-20230519
    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: registry.edoc2.com:5000/edoc2v5/elasticsearch:arm-edrms-v6.1.0.0-arm-20230519
    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=-Xmx3g -Xms3g
    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: registry.edoc2.com:5000/edoc2v5/nginx:arm-edrms-v6.1.0.0-arm-20230519
    command: /etc/nginx/proxy.sh
    environment:
      - MIDDLEWARE=standalone
      - PROXY_SERVICES=es,mysql,redis,rabbitmq
    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
