services:
  mongo:
    image: mongo
    labels:
      komodo.skip: "" # Prevent Komodo from stopping with StopAllContainers
    command: --quiet --wiredTigerCacheSizeGB 0.25
    restart: unless-stopped
    volumes:
      - /data/komodo/db/mongo-data:/data/db
      - /data/komodo/db/mongo-config:/data/configdb
    environment:
      MONGO_INITDB_ROOT_USERNAME: {{ komodo_db_username }}
      MONGO_INITDB_ROOT_PASSWORD: {{ komodo_db_password }}

  komodo-core:
    image: ghcr.io/moghtech/komodo-core:2
    init: true
    container_name: komodo
    restart: unless-stopped
    depends_on:
      - mongo
    ports:
      - "9120:9120"
    environment:
      KOMODO_DATABASE_ADDRESS: mongo:27017
      KOMODO_DATABASE_USERNAME: {{ komodo_db_username }}
      KOMODO_DATABASE_PASSWORD: {{ komodo_db_password }}
      KOMODO_HOST: "https://komodo.{{ domain }}"
      KOMODO_LOCAL_AUTH: true
      KOMODO_INIT_ADMIN_USERNAME: admin
      KOMODO_INIT_ADMIN_PASSWORD: {{ komodo_admin_password }}
      KOMODO_FIRST_SERVER_NAME: "infra-core-1"
      KOMODO_PERIPHERY_PUBLIC_KEY: file:/config/keys/periphery.pub
      KOMODO_WEBHOOK_SECRET: {{ komodo_webhook_secret }}
      KOMODO_JWT_SECRET: {{ komodo_jwt_secret }}
      KOMODO_JWT_TTL: "1-day"
      KOMODO_MONITORING_INTERVAL: "15-sec"
      KOMODO_RESOURCE_POLL_INTERVAL: "1-hr"
      KOMODO_DISABLE_USER_REGISTRATION: true
      KOMODO_ENABLE_NEW_USERS: false
      KOMODO_SSL_ENABLED: false
      KOMODO_TLS_INSECURE_SKIP_VERIFY: true
      TZ: "Europe/Lisbon"
    volumes:
      - /data/komodo/app/keys:/config/keys
      - /data/komodo/app/backups:/backups
      - /var/run/docker.sock:/var/run/docker.sock
