---
# docker-compose file for letsencrypt cert management

# DOCKER_HOST=dkhost01:2376 docker-compose up updates

# DOCKER_HOST=dkhost:2376 docker stack deploy -c docker-compose-update.yml services_letsencrypt

version: '3.4'
services:

  updates:
#    image: "dkregistry.xai-corp.net:5000/letsencrypt:latest"
    image: "blacklabelops/letsencrypt"
    ports:
      - 83:80
#      - 443:443
    volumes:
      - /opt/shared/letsencrypt-2:/etc/letsencrypt
    environment:
      LETSENCRYPT_EMAIL: r_morgan@sympatico.ca
      LETSENCRYPT_HTTPS_ENABLED: "false"
      LETSENCRYPT_TESTCERT: "false"
      LETSENCRYPT_DEBUG: "false"
      LETSENCRYPT_JOB_TIME: "0 5 6 13 * *"
      LETSENCRYPT_DOMAIN1: xai-corp.net
      LETSENCRYPT_DOMAIN2: git.xai-corp.net
      LETSENCRYPT_DOMAIN3: xaibox.xai-corp.net
      LETSENCRYPT_DOMAIN4: dkui.xai-corp.net
      LETSENCRYPT_DOMAIN5: dkregistry.xai-corp.net
      LETSENCRYPT_DOMAIN6: fs.xai-corp.net
      LETSENCRYPT_DOMAIN7: jenkins.xai-corp.net
      LETSENCRYPT_DOMAIN8: sql.xai-corp.net
      LETSENCRYPT_DOMAIN9: office.xai-corp.net
      LETSENCRYPT_DOMAIN10: www.xai-corp.net
      LETSENCRYPT_DOMAIN11: mail.xai-corp.net
      LETSENCRYPT_DOMAIN12: abcapi.xai-corp.net
      LETSENCRYPT_DOMAIN13: metrics.xai-corp.net
    command:
      - jobberd
      - --expand

    deploy:
      mode: replicated
      replicas: 1
      restart_policy:
        condition: any
        delay: "24h"
        max_attempts: 4
      update_config:
        parallelism: 1
        delay: 2s
        order: start-first
      resources:
        limits:
#          cpus: '1.5'
          memory: 64M

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