version: "3.5"

services:
  web:
    image: ${docker_repo:-zokradonh}/kopano_web
    container_name: web
    restart: always
    ports:
      - "2015:2015"
      - "${HTTP:-80}:80"
      - "${HTTPS:-443}:443"
    environment:
      - EMAIL=${EMAIL:-off}
      - FQDN=${FQDN?err}
    command: wrapper.sh
    cap_drop:
     - ALL
    cap_add:
     - NET_BIND_SERVICE
     - CHOWN
     - SETGID
     - SETUID
    volumes:
      - web:/.kweb
    networks:
      web-net:
        aliases:
         - ${FQDNCLEANED?err}

  kopano_ssl:
    image: ${docker_repo:-zokradonh}/kopano_ssl
    container_name: kopano_ssl
    environment:
      - FQDN=${FQDN}
      - PKI_COUNTRY=NL
    volumes:
      - /etc/kopano/ssl/:/kopano/ssl

  kopano_grapi:
    image: ${docker_repo:-zokradonh}/kopano_core:${CORE_VERSION:-latest}
    container_name: kopano_grapi
    volumes:
      - /run/kopano:/run/kopano
    environment:
      - SERVICE_TO_START=grapi
      - TZ=${TZ}
    networks:
      - kopano-net

  kopano_kapi:
    image: ${docker_repo:-zokradonh}/kopano_core:${CORE_VERSION:-latest}
    container_name: kopano_kapi
    depends_on:
      - kopano_grapi
    volumes:
      - /etc/kopano/ssl:/kopano/ssl
      - /run/kopano:/run/kopano
    environment:
      - SERVICE_TO_START=kapid
      - TZ=${TZ}
      - KCCONF_KAPID_LOG_LEVEL=DEBUG
      - KCCONF_KAPID_OIDC_ISSUER_IDENTIFIER=https://${FQDN}
      - KCCONF_KAPID_INSECURE=${INSECURE}
    networks:
      - kopano-net
      - web-net

  kopano_konnect:
    image: ${docker_repo:-zokradonh}/kopano_konnect:${KONNECT_VERSION:-latest}
    container_name: kopano_konnect
    command: wrapper.sh
    volumes:
      - /etc/kopano/ssl:/kopano/ssl
      - /run/kopano:/run/kopano
    environment:
     - FQDN=${FQDN}
    networks:
     - web-net

  kopano_kwmserver:
    image: ${docker_repo:-zokradonh}/kopano_kwmserver:${KWM_VERSION:-latest}
    container_name: kopano_kwmserver
    command: wrapper.sh
    environment:
     - INSECURE=${INSECURE}
     - oidc_issuer_identifier=https://${FQDN}
    volumes:
      - /etc/kopano/ssl:/kopano/ssl
    networks:
     - web-net

  kopano_meet:
    image: ${docker_repo:-zokradonh}/kopano_meet:${MEET_VERSION:-latest}
    container_name: kopano_meet
    environment:
     - SERVICE_TO_START=meet
     - KCCONF_KWEBD_TLS=no
    depends_on:
     - kopano_kapi
     - kopano_konnect
     - kopano_kwmserver
     - web
    networks:
     - web-net

volumes:
  web:
  kopanossl:

networks:
  web-net:
  kopano-net:
    driver: bridge
