services:
  # slskd - Soulseek client with REST API
  slskd:
    image: slskd/slskd:latest
    container_name: slskd
    restart: unless-stopped
    environment:
      - SLSKD_REMOTE_CONFIGURATION=true
      - SLSKD_SHARED_DIR=/shared
      - SLSKD_DOWNLOADS_DIR=/downloads
      - SLSKD_NO_HTTPS=true
      - TZ=Europe/Berlin
    volumes:
      - ./config/slskd:/app
      - ./downloads:/downloads
      # Share some of your music library back (important - avoid bans!)
      - /mnt/hetzner-media/media/music:/shared:ro
      # Transfer folder - completed downloads move here for import
      - ./transfer:/transfer
    ports:
      - "50300:50300"      # Soulseek listen port
      - "50300:50300/udp"
    networks:
      - soulsync-network
      - traefik-public
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.slskd.rule=Host(`soulseek.jefflix.lol`) || Host(`slskd.jefflix.lol`)"
      - "traefik.http.routers.slskd.entrypoints=web"
      - "traefik.http.services.slskd.loadbalancer.server.port=5030"
      - "traefik.docker.network=traefik-public"

  # SoulSync - Spotify/Tidal to Soulseek sync
  soulsync:
    image: boulderbadgedad/soulsync:latest
    container_name: soulsync
    restart: unless-stopped
    environment:
      - TZ=Europe/Berlin
      - PUID=1000
      - PGID=1000
      - PYTHONPATH=/app
      - FLASK_ENV=production
    volumes:
      - ./config/soulsync:/app/data
      - ./config/soulsync/logs:/app/logs
      - ./config/soulsync/config:/app/config
      - ./config/soulsync/storage:/app/storage
      # Access to existing music library for comparison
      - /mnt/hetzner-media/media/music:/music:ro
      # Downloads from slskd
      - ./downloads:/downloads
      # Transfer folder for completed/processed files
      - ./transfer:/transfer
    depends_on:
      - slskd
    networks:
      - soulsync-network
      - traefik-public
      - media-network
    extra_hosts:
      - "host.docker.internal:host-gateway"
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.soulsync.rule=Host(`soulsync.jefflix.lol`)"
      - "traefik.http.routers.soulsync.entrypoints=web"
      - "traefik.http.services.soulsync.loadbalancer.server.port=8008"
      - "traefik.docker.network=traefik-public"

networks:
  soulsync-network:
    driver: bridge
  traefik-public:
    external: true
  media-network:
    external: true
