version: '3.8'
services:
  spoolman:
    container_name: spoolman
    image: ghcr.io/donkie/spoolman:0.17.0
    restart: unless-stopped
    volumes:
      - ${APP_DATA_DIR}/data:/home/app/.local/share/spoolman 
    ports:
      - ${APP_PORT}:8000
    environment:
      - TZ=${TZ}
      - PUID=0
      - PGID=0
    networks:
      - tipi_main_network
    labels:
      traefik.enable: true
      traefik.http.middlewares.spoolman-web-redirect.redirectscheme.scheme: https
      traefik.http.services.spoolman.loadbalancer.server.port: 8000
      # Web
      traefik.http.routers.spoolman-insecure.rule: Host(`${APP_DOMAIN}`)
      traefik.http.routers.spoolman-insecure.entrypoints: web
      traefik.http.routers.spoolman-insecure.service: spoolman
      traefik.http.routers.spoolman-insecure.middlewares: spoolman-web-redirect
      # Websecure
      traefik.http.routers.spoolman.rule: Host(`${APP_DOMAIN}`)
      traefik.http.routers.spoolman.entrypoints: websecure
      traefik.http.routers.spoolman.service: spoolman
      traefik.http.routers.spoolman.tls.certresolver: myresolver
      # Local domain
      traefik.http.routers.spoolman-local-insecure.rule: Host(`spoolman.${LOCAL_DOMAIN}`)
      traefik.http.routers.spoolman-local-insecure.entrypoints: web
      traefik.http.routers.spoolman-local-insecure.service: spoolman
      traefik.http.routers.spoolman-local-insecure.middlewares: spoolman-web-redirect
      # Local domain secure
      traefik.http.routers.spoolman-local.rule: Host(`spoolman.${LOCAL_DOMAIN}`)
      traefik.http.routers.spoolman-local.entrypoints: websecure
      traefik.http.routers.spoolman-local.service: spoolman
      traefik.http.routers.spoolman-local.tls: true