secrets:
  komodo_passkey:
    file: ${SECRETSDIR}/komodo/komodo_passkey
  komodo_webhook_secret:
    file: ${SECRETSDIR}/komodo/komodo_webhook_secret
  komodo_jwt_secret:
    file: ${SECRETSDIR}/komodo/komodo_jwt_secret
  komodo_oidc_client_id:
    file: ${SECRETSDIR}/komodo/komodo_oidc_client_id
  komodo_oidc_client_secret:
    file: ${SECRETSDIR}/komodo/komodo_oidc_client_secret
services:
  core:
    container_name: ${KOMODO_CORE_CONTAINER_NAME}
    image: ${KOMODO_CORE_IMAGE}:${COMPOSE_KOMODO_IMAGE_TAG:-latest}
    restart: ${KOMODO_RESTART_POLICY}
    secrets:      
      - komodo_passkey
      - komodo_webhook_secret
      - komodo_jwt_secret
      - komodo_oidc_client_id
      - komodo_oidc_client_secret
    labels:                
      - "komodo.skip=" # Prevent Komodo from stopping with StopAllContainers            
      - "traefik.enable=true"
      ## HTTP Routers
      - "traefik.http.routers.${KOMODO_HOSTNAME}-rtr.entrypoints=https"
      - "traefik.http.routers.${KOMODO_HOSTNAME}-rtr.rule=Host(`${KOMODO_HOSTNAME}.${DOMAINNAME1}`)"
      ## Middlewares
      - "traefik.http.routers.${KOMODO_HOSTNAME}-rtr.middlewares=chain-no-auth@file"
      ## HTTP Services
      - "traefik.http.routers.${KOMODO_HOSTNAME}-rtr.service=${KOMODO_HOSTNAME}-svc"
      - "traefik.http.services.${KOMODO_HOSTNAME}-svc.loadbalancer.server.port=9120"
    depends_on:
      - ferretdb
    logging:
      driver: ${COMPOSE_LOGGING_DRIVER:-local}
    networks:
      - ${KOMODO_NETWORk_ID}
      - komodo      
#    ports:
#      - 9120:9120
    env_file: ../env/komodo.env
    environment:
      KOMODO_DATABASE_URI: mongodb://${KOMODO_DB_USERNAME}:${KOMODO_DB_PASSWORD}@ferretdb:27017/${KOMODO_DATABASE_DB_NAME:-komodo}?authMechanism=PLAIN      
    volumes:
      ## Core cache for repos for latest commit hash / contents
      - repo-cache:/repo-cache
      ## Store sync files on server
      # - /path/to/syncs:/syncs
      ## Optionally mount a custom core.config.toml
      # - /path/to/core.config.toml:/config/config.toml
    ## Allows for systemd Periphery connection at 
    ## "http://host.docker.internal:8120"
    # extra_hosts:
    #   - host.docker.internal:host-gateway
volumes:
  # Core
  repo-cache:
