AdrienPoupa / docker-compose-nas

Simple Docker Compose NAS featuring Sonarr, Radarr, Prowlarr, Jellyfin, qBittorrent, PIA VPN and Traefik with SSL support
891 stars 117 forks source link

Guide for adding other docker services with traefik #41

Closed wrapper closed 6 months ago

wrapper commented 7 months ago

Hey

Love the script and the documentation makes it pretty straightforward to set up.

I'm trying to add other containers such as syncthing, pigallery. I got syncthing working easily enough but not sure how to get it to have the same URL structure (nas.domain.com/syncthing). pigallery requires nginx and those ports (80,443) are taken so again, I'm not sure how to configure that.

Would be awesome if there was documentation for adding other generic docker containers to the existing set up.

AdrienPoupa commented 6 months ago

Hi there,

As a rule of thumb, I start by checking if the application supports running in a subfolder. It is much easier when it does (Sonarr, Radarr), otherwise I need to tinker with Traefik config to make it work (qBittorrent) and it can get really ugly (Jellyseerr).

The benefit of using a reverse proxy such as Traefik is that you don't need to share ports to your host for new services, as only Traefik will need to connect to the services (User -> Traefik on ports 80/443 -> Pigallery).

Syncthing has this documentation that could serve as a base to start the implementation. Based on this, maybe this would work:

  syncthing:
    image: syncthing/syncthing
    container_name: syncthing
    environment:
      - PUID=${USER_ID}
      - PGID=${GROUP_ID}
    volumes:
      - ./syncthing:/var/syncthing
    ports:
      - "22000:22000"
      - "21027:21027/udp"
    restart: unless-stopped
    labels:
      - traefik.enable=true
      - traefik.http.routers.syncthing.rule=(Host(`${HOSTNAME}`) && PathPrefix(`/syncthing`))
      - traefik.http.routers.syncthing.tls=true
      - traefik.http.routers.syncthing.tls.certresolver=myresolver
      - traefik.http.services.syncthing.loadbalancer.server.port=8384
wrapper commented 6 months ago

Thanks for looking at this. Unfortunately I get 404 error on nas.domain.com/syncthing with the above