---
# DOCKER_HOST=192.168.4.41:2376 docker-compose up -d
# docker login dkregistry.xai-corp.net:5000
# docker-compose build && docker push dkregistry.xai-corp.net:5000/sslproxy:2.1
# DOCKER_HOST=dkhost:2376 docker stack deploy --with-registry-auth -c docker-compose-prod.yml sslproxy
# DOCKER_HOST=dkhost:2376 docker stack ps sslproxy

version: '3.4'
volumes:
  cache:

services:
  app:
    image: ${REMOTE_IMAGE}
    volumes:
      - /opt/shared/letsencrypt-2:/etc/letsencrypt:ro
      - cache:/data/nginx/cache
    ports:
      - "443:443"
      - "80:80" # required for letsencrypt

#    healthcheck:
#      test: ["CMD", "wget", "--spider", "--no-check-certificate", "--header", "Host: dkui.xai-corp.net", "https://localhost/"]
#      interval: 10s
#      timeout: 2s
#      retries: 3
#      start_period: 5s

    logging:
      driver: fluentd
      options:
        fluentd-address: "logs.xai-corp.net:24224"
        fluentd-async-connect: 'true'
        tag: sslproxy

    deploy:
      mode: replicated
      replicas: 1
      restart_policy:
        condition: any
        delay: 10s
        max_attempts: 12
      update_config:
        parallelism: 1
        delay: 5s
        order: start-first
      resources:
        limits:
          cpus: '0.1'
          memory: 16M

      labels:
        net.xai-corp.sslproxy.description:  proxy ssl calls to non ssl containers

    networks:
      - prod_ui
      - prod_tasks

networks:
  prod_ui:
    external:
      name: prod_ui
  prod_tasks:
    external:
      name: prod_tasks
