version: '3.5'

services:
  edoc2:
    hostname: edoc2
    image: registry.edoc2.com:5000/edoc2v5/edoc2:edrms-v5.15.0.0-beta
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /home/edoc2/macrowing/edoc2v5/data/edoc2Docs:/edoc2Docs
    labels:
      "type": "1"
    environment:
      - LOGGER_ISDEBUG=false
      - LOGGER_MINCALLTIMESPAN=1000
      - PUBLISH_EXTERNAL_ADDRESS=http://localhost/
      - PRODUCTION=EDRMS
    env_file:
      ./envfile.env
    networks:
      - edoc2
    deploy:
      placement:
        constraints:
          - node.labels.nodetype == InDrive
      mode: global
      endpoint_mode: dnsrr
      restart_policy:
        condition: on-failure
    logging:
      driver: "json-file"
      options:
        max-size: "2000k"
        max-file: "10"

  edrmscore:
    hostname: edrmscore
    image: registry.edoc2.com:5000/edoc2v5/edrmscore:edrms-v5.15.0.0-beta
    environment:
      - edoc2_ifPoc=false
    ports:
      - "8002:80"
    deploy:
      placement:
        constraints:
          - node.labels.nodetype == InDrive
      replicas: 1
      restart_policy:
        condition: on-failure
    networks:
      - edoc2
    volumes:
      - /home/edoc2/macrowing/edoc2v5/data/edrmscore:/root

  transport:
    hostname: transport
    image: registry.edoc2.com:5000/edoc2v5/transport:edrms-v5.15.0.0-beta
#    ports:
#      - target: 6261
#        published: 6261
#        mode: host
    volumes:
      - /home/edoc2/macrowing/edoc2v5/data/edoc2Docs:/edoc2Docs
    env_file:
      ./envfile.env
    networks:
      - edoc2
    deploy:
      placement:
        constraints:
          - node.labels.nodetype == InDrive
      replicas: 1
      endpoint_mode: dnsrr
      restart_policy:
        condition: any

  wf:
    image: registry.edoc2.com:5000/edoc2v5/wf:edrms-v5.15.0.0-beta
    labels:
      "type": "2"
    networks:
      - edoc2
    env_file:
      ./envfile.env
    deploy:
      replicas: 1
      placement:
        constraints:
          - node.labels.nodetype == InDrive
      restart_policy:
        condition: on-failure
    healthcheck:
      test: curl -L -k -i http://edoc2/api/values|grep "200 OK"
      interval: 10s
      timeout: 3s
      retries: 3
    logging:
      driver: "json-file"
      options:
        max-size: "2000k"
        max-file: "10"

  orgsync:
    hostname: orgsync
    image: registry.edoc2.com:5000/edoc2v5/orgsync:edrms-v5.15.0.0-beta
    labels:
      "type": "1"
    networks:
      - edoc2
    environment:
      - ISTITLE=0
    env_file:
      ./envfile.env
    deploy:
      placement:
        constraints:
          - node.labels.nodetype == InDrive
      replicas: 1
      restart_policy:
        condition: on-failure

  content:
    image: registry.edoc2.com:5000/edoc2v5/content:edrms-v5.15.0.0-beta
    volumes:
      - /home/edoc2/macrowing/edoc2v5/data/edoc2Docs:/edoc2Docs
    environment:
      - IndexPushMQQueueName=index_erms_queue
      - IndexPushMQFolderCode=edrmsFolderCode
      - InWiseIndexQueueName=index_erms_queue
    labels:
      "type": "1"
    networks:
      - edoc2
    deploy:
      placement:
        constraints:
          - node.labels.nodetype == InDrive
      mode: global
      endpoint_mode: dnsrr
      restart_policy:
        condition: on-failure
      resources:
        limits:
          cpus: '4'
          memory: 8G
    env_file:
      ./envfile.env

  nginx:
    hostname: nginx
    image: registry.edoc2.com:5000/edoc2v5/nginx:edrms-v5.15.0.0-beta
    ports:
      - target: 80
        published: 80
        mode: host
    environment:
      - WORDTEMPLATE=true
      - WF=true
      - EDRMSCORE=true
      - SEARCHENGINE=true
#      - UDCMGT=true
#      - WEBOFFICE=true
#      - SSL=true
#      - DOMAIN_NAME=ab.edoc2.com
    labels:
      "type": "0"
#    volumes:
#      - /home/edoc2/macrowing/edoc2v5/data:/etc/nginx/cert      
    deploy:
      placement:
        constraints:
          - node.labels.nodetype == InDrive
      mode: global
      restart_policy:
        condition: on-failure
    networks:
      - edoc2
    healthcheck:
      test: curl -L -k -i http://localhost/api/values|grep "200 OK"
      interval: 20s
      timeout: 10s
      retries: 3
    logging:
      driver: "json-file"
      options:
        max-size: "2000k"
        max-file: "10"

  wordtemplate:
    hostname: wordtemplate
    image: registry.edoc2.com:5000/edoc2v5/wordtemplate:edrms-v5.15.0.0-beta
    ports:
      - "8003:80"
    deploy:
      placement:
        constraints:
          - node.labels.nodetype == InDrive
      replicas: 1
      restart_policy:
        condition: on-failure
    networks:
      - edoc2

  searchengine:
    hostname: searchengine
    image: registry.edoc2.com:5000/edoc2v5/searchengine:edrms-v5.15.0.0-beta
    labels:
      "type": "2"
    environment:
      - ASPNETCORE_ENVIRONMENT=Production
    networks:
      - edoc2
    deploy:
      replicas: 1
      restart_policy:
        condition: on-failure

networks:
  edoc2:
    external: true
    name: macrowing