crazy-max / docker-rtorrent-rutorrent

rTorrent and ruTorrent Docker image
MIT License
457 stars 103 forks source link

Ways to retreive Open Port Data #210

Open noideaman opened 1 year ago

noideaman commented 1 year ago

Support guidelines

I've found a bug and checked that ...

Description

Using docker-compose and adding the containers to the same network as a PIA vpn container to route torrent traffic. When PIA gives out an open port for port-forwarding/rtorrent incoming connections we as users of their service do not have control over the opened port. I got to the point the forwarded port works on other services and i can output the data into a plain text file.

How would we go about getting this configured in the rtorrent container? Can I mount the /etc/rtorrent/.rtorrent.rc file into another container and have the file updated by the external one?

Expected behaviour

A way to obtain the opened port and let rtorrent access it, even on changes

Actual behaviour

defaults to default port of 50000

Steps to reproduce

N/A

Docker info

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Docker Buildx (Docker Inc., v0.9.1-docker)
  compose: Docker Compose (Docker Inc., v2.5.1)
  scan: Docker Scan (Docker Inc., v0.23.0)

Server:
 Containers: 36
  Running: 30
  Paused: 0
  Stopped: 6
 Images: 127
 Server Version: 20.10.22
 Storage Driver: overlay2
  Backing Filesystem: xfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 9ba4b250366a5ddde94bb7c9d1def331423aa323
 runc version: v1.1.4-0-g5fd4c4d
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 6.1.4-1.el9.elrepo.x86_64
 Operating System: CentOS Stream 9
 OSType: linux
 Architecture: x86_64
 CPUs: 12
 Total Memory: 30.73GiB
 Name: box
 ID: QJEF:SMKS:U7P6:F4GK:S3MU:BOZX:PUGH:BHSO:U3VH:5S5D:6OHL:DPAG
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: fals

Version

Docker compose

name: yarhar
services:
  rutorrent:
    cap_add:
    - CHOWN
    depends_on:
      vpn:
        condition: service_started
    environment:
      PGID: "971"
      PUID: "974"
      TZ: America/Denver
    image: crazymax/rtorrent-rutorrent
    mem_limit: "1073741824"
    network_mode: service:vpn
    ulimits:
      nofile:
        soft: 32000
        hard: 40000
      nproc: 65535
    volumes:
    - type: bind
      source: /docker2/rutorrent/data
      target: /data
      bind:
        create_host_path: true
    - type: bind
      source: /docker/media/
      target: /media
      bind:
        create_host_path: true
    - type: bind
      source: /docker/media/
      target: /downloads
      bind:
        create_host_path: true
    - type: bind
      source: /docker2/rutorrent/passwd
      target: /passwd
      bind:
        create_host_path: true
  vpn:
    cap_add:
    - NET_ADMIN
    - SYS_MODULE
    devices:
    - /dev/net/tun:/dev/net/tun
    environment:
      LOC: swiss
      NFTABLES: "1"
      PASS: password
      PORT_FORWARDING: "1"
      USER: username
    healthcheck:
      test:
      - CMD-SHELL
      - ping -c 1 www.google.com || exit 1
      timeout: 10s
      interval: 30s
      retries: 3
    image: thrnz/docker-wireguard-pia
    networks:
      default: null
    ports:
    - mode: ingress
      target: 9117
      published: "9118"
      protocol: tcp
    - mode: ingress
      target: 8080
      published: "8113"
      protocol: tcp
    sysctls:
      net.ipv4.conf.all.src_valid_mark: "1"
      net.ipv6.conf.all.disable_ipv6: "1"
      net.ipv6.conf.default.disable_ipv6: "1"
      net.ipv6.conf.lo.disable_ipv6: "1"
    volumes:
    - type: bind
      source: /docker/pia-wg/pia
      target: /pia
      bind:
        create_host_path: true
    - type: bind
      source: /docker/pia-wg/pia-shared
      target: /pia-shared
      bind:
        create_host_path: true
networks:
  default:
    name: yarhar_default

Container logs

N/A

Additional info

No response

stickz commented 1 year ago

A possible option would be to use swizzin if you want wireguard support. It configures your operating system instead of creating a docker container. You can use iptables to allow certain ports to bypass the PIA VPN. I have experience with this concept and have obtained a working configuration. If you have any questions, you can come on discord and ping Vertex.

XFS will have performance issues with rTorrent metadata processing. I recommend EXT4 for significantly higher performance. The torrent metadata is written to the disk in raw format. XFS does handle many small files very well compared to EXT4.