version: "3.6"

volumes:
  traefik_data:
  navidrome_data:

services:

  traefik:
    container_name: "traefik"
    image: traefik:2.9
    restart: unless-stopped
    read_only: true
    command:
      - "--log.level=ERROR"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.websecure.address=:443"
      - "--certificatesresolvers.tc.acme.tlschallenge=true"
      #- "--certificatesresolvers.tc.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
      - "--certificatesresolvers.tc.acme.email=foo@foo.com"
      - "--certificatesresolvers.tc.acme.storage=/letsencrypt/acme.json"
    ports:
      - "443:443"
    volumes:
      - "traefik_data:/letsencrypt"
      #- "/var/run/docker.sock:/var/run/docker.sock:ro"

  navidrome:
    container_name: "navidrome"
    image: deluan/navidrome:latest
    restart: unless-stopped
    read_only: true
    # user: 1000:1000
    ports:
      - "4533:4533"
    environment:
      ND_SCANINTERVAL: 6h
      ND_LOGLEVEL: info
      ND_SESSIONTIMEOUT: 168h
      ND_BASEURL: ""
    volumes:
      - "navidrome_data:/data"
      #- "/mnt/music:/music:ro"
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.navidrome.rule=Host(`foo.com`)"
      - "traefik.http.routers.navidrome.entrypoints=websecure"
      - "traefik.http.routers.navidrome.tls=true"
      - "traefik.http.routers.navidrome.tls.certresolver=tc"
      - "traefik.http.services.navidrome.loadbalancer.server.port=4533"
