Wonderfall / docker-rtorrent-flood

75 stars 45 forks source link

Use /RPC2 for external services #19

Closed FlorentLM closed 4 years ago

FlorentLM commented 4 years ago

Hey,

any plan on including the ability to expose the unix socket to /RPC2 so that services like sonarr or radarr can connect?

Thanks

Wonderfall commented 4 years ago

I'm using an external container for this. Feel free to use my configuration as an example! :)

  rtorrent-nginx:
    image: nginx:1.19-alpine
    container_name: rtorrent-nginx
    restart: unless-stopped
    networks:
      - http_network
      - rtorrent_network
    depends_on:
       - rtorrent
    labels:
      - traefik.enable=true
      - traefik.http.routers.rtorrent-nginx.entrypoints=http
      - traefik.http.routers.rtorrent-nginx.rule=Host(`box.domain.tld`) && PathPrefix(`/RPC2`)
      - traefik.http.routers.rtorrent-nginx.middlewares=https-redirect@file
      - traefik.http.routers.rtorrent-nginx-secure.entrypoints=https
      - traefik.http.routers.rtorrent-nginx-secure.rule=Host(`box.domain.tld`) && PathPrefix(`/RPC2`)
      - traefik.http.routers.rtorrent-nginx-secure.tls=true
      - traefik.http.routers.rtorrent-nginx-secure.tls.certresolver=http
      - traefik.http.routers.rtorrent-nginx-secure.middlewares=hsts-headers@file,secure-headers@file,admins-auth@file
      - traefik.http.routers.rtorrent-nginx-secure.service=rtorrent-nginx
      - traefik.http.services.rtorrent-nginx.loadbalancer.server.port=80
      - traefik.docker.network=http_network
    volumes:
      - /home/docker/rtorrent/nginx/rtorrent.conf:/etc/nginx/conf.d/rtorrent.conf
server {
  listen         80 default_server;
  server_name    box.domain.tld;

 # Traefik -> nginx -> rtorrent RPC
  location /RPC2 {
    scgi_pass   rtorrent:5000;
    include     scgi_params;
  }
}

Don't forget to put /RPC2 behind a basic authentication, that's the reason my middleware admins-users@file (traefik) is here for.

FlorentLM commented 4 years ago

Amazing, thanks for the super detailed response! I will try that :)

FlorentLM commented 4 years ago

I eventually did it with nginx in the end, but the idea is the same. Thanks!