version: '3.5'

services:
  edoc2:
    hostname: edoc2
    image: registry.edoc2.com:5000/edoc2v5/edoc2:ecm-HUAWEI-v5.16.0.15
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /home/edoc2/autodeploy:/edoc2Docs
    labels:
      "type": "1"
    environment:
      - PRODUCTION=edoc2
    env_file:
      ./envfile.env
    networks: 
      - edoc2
    stop_signal: SIGKILL
    # healthcheck:
    #   test: /bin/bash /opt/edoc2_check.sh
    #   interval: 15s
    #   timeout: 10s
    #   retries: 3
    deploy:
      placement:
        constraints:
          - node.labels.nodetype == InDrive
      replicas: 1
      endpoint_mode: dnsrr
      restart_policy:
        condition: on-failure
    logging:
      driver: "json-file"
      options:
        max-size: "2000k"
        max-file: "10"
#    logging:
#      driver: syslog
#      options:
#        syslog-address: "udp://logserver:55514"
#        syslog-format: "rfc3164"
#        tag: "edoc2"

  transport:
    hostname: transport
    image: registry.edoc2.com:5000/edoc2v5/transport:ecm-HUAWEI-v5.16.0.15
#    ports:
#      - target: 6261
#        published: 6261
#        mode: host
    volumes:
      - /home/edoc2/autodeploy:/edoc2Docs
    env_file:
      ./envfile.env
    networks: 
      - edoc2
    deploy:
      placement:
        constraints:
          - node.labels.nodetype == InDrive
      replicas: 1
      endpoint_mode: dnsrr
      restart_policy:
        condition: any
        
  nginx: 
    hostname: nginx
    image: registry.edoc2.com:5000/edoc2v5/nginx:ecm-HUAWEI-v5.16.0.15
    ports:
      - target: 80
        published: 30001
        mode: host
    labels:
      "type": "0"
    environment:
      - WF=false

      # - SEARCHENGINE=true
    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"

  content:
    image: registry.edoc2.com:5000/edoc2v5/content:ecm-HUAWEI-v5.16.0.15
    labels:
      "type": "1"
    volumes:
      - /home/edoc2/autodeploy:/edoc2Docs
    networks: 
      - edoc2
    deploy:
      placement:
        constraints:
          - node.labels.nodetype == InDrive
      mode: global
      restart_policy:
        condition: on-failure
      resources:
        limits:
          cpus: '4'
          memory: 8G
    environment:
      - ESURL=http://es:9200
    env_file:
      ./envfile.env

volumes:
  rabbitmq:
networks:
    edoc2:
