version: "3.9"
services:
  komga:
    image: ghcr.io/gotson/komga:1.11.1
    container_name: komga
    volumes:
      - ${APP_DATA_DIR}/data/config:/config
      - ${APP_DATA_DIR}/data/data:/data
    environment:
      - TZ=${TZ}
    ports:
      - ${APP_PORT}:25600
    networks:
      - tipi_main_network
    restart: unless-stopped
    labels:
      # Main
      traefik.enable: true
      traefik.http.middlewares.komga-web-redirect.redirectscheme.scheme: https
      traefik.http.services.komga.loadbalancer.server.port: 25600
      # Web
      traefik.http.routers.komga-insecure.rule: Host(`${APP_DOMAIN}`)
      traefik.http.routers.komga-insecure.entrypoints: web
      traefik.http.routers.komga-insecure.service: komga
      traefik.http.routers.komga-insecure.middlewares: komga-web-redirect
      # Websecure
      traefik.http.routers.komga.rule: Host(`${APP_DOMAIN}`)
      traefik.http.routers.komga.entrypoints: websecure
      traefik.http.routers.komga.service: komga
      traefik.http.routers.komga.tls.certresolver: myresolver
      # Local domain
      traefik.http.routers.komga-local-insecure.rule: Host(`komga.${LOCAL_DOMAIN}`)
      traefik.http.routers.komga-local-insecure.entrypoints: web
      traefik.http.routers.komga-local-insecure.service: komga
      traefik.http.routers.komga-local-insecure.middlewares: komga-web-redirect
      # Local domain secure
      traefik.http.routers.komga-local.rule: Host(`komga.${LOCAL_DOMAIN}`)
      traefik.http.routers.komga-local.entrypoints: websecure
      traefik.http.routers.komga-local.service: komga
      traefik.http.routers.komga-local.tls: true