From 0b3f2d38a86d871785b8b96c766ea3805252daf3 Mon Sep 17 00:00:00 2001 From: Will Anderson Date: Wed, 15 Apr 2026 01:41:42 -0500 Subject: [PATCH] =?UTF-8?q?Remove=20standalone=20qbittorrent=20=E2=80=94?= =?UTF-8?q?=20superseded=20by=20fornax=20workers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../legion/k8s/media/gluetun-qbittorrent.yaml | 200 ------------------ 1 file changed, 200 deletions(-) delete mode 100644 servers/legion/k8s/media/gluetun-qbittorrent.yaml diff --git a/servers/legion/k8s/media/gluetun-qbittorrent.yaml b/servers/legion/k8s/media/gluetun-qbittorrent.yaml deleted file mode 100644 index ab37d4e..0000000 --- a/servers/legion/k8s/media/gluetun-qbittorrent.yaml +++ /dev/null @@ -1,200 +0,0 @@ -# gluetun + qBittorrent — all torrent traffic routed through ProtonVPN WireGuard -# Port forwarding via gluetun's native ProtonVPN support (VPN_PORT_FORWARDING=on) -# gluetun writes the assigned port to /tmp/gluetun/forwarded_port (shared emptyDir) -# portforward-helper reads that file and updates qBittorrent's listen port -apiVersion: apps/v1 -kind: Deployment -metadata: - name: qbittorrent - namespace: media - labels: - app: qbittorrent -spec: - replicas: 0 - strategy: - type: Recreate - selector: - matchLabels: - app: qbittorrent - template: - metadata: - labels: - app: qbittorrent - spec: - initContainers: - - name: tun-setup - image: busybox:latest - command: ["sh", "-c", "mkdir -p /dev/net && [ -c /dev/net/tun ] || mknod /dev/net/tun c 10 200 && chmod 666 /dev/net/tun && sysctl -w net.ipv6.conf.all.disable_ipv6=1 || true && ip route flush table 51820 2>/dev/null || true && ip rule del priority 101 2>/dev/null || true && ip rule del table 51820 2>/dev/null || true"] - securityContext: - privileged: true - # Patch qBittorrent config before it starts: set password hash + performance defaults - - name: qbt-config-patch - image: python:3-alpine - command: - - python3 - - -c - - | - import os, re - - CONF = '/config/qBittorrent/qBittorrent.conf' - os.makedirs('/config/qBittorrent', exist_ok=True) - - text = open(CONF).read() if os.path.exists(CONF) else '' - - def set_key(text, section, key, value): - """Set key=value under [section], inserting if missing.""" - key_pat = re.compile(r'^' + re.escape(key) + r'=.*', re.M) - if key_pat.search(text): - return key_pat.sub(key + '=' + value, text) - sec_pat = re.compile(r'^\[' + re.escape(section) + r'\]', re.M) - if sec_pat.search(text): - return sec_pat.sub('[' + section + ']\n' + key + '=' + value, text) - return text + f'\n[{section}]\n{key}={value}\n' - - HASH = '@ByteArray(HqYj1eGsdXlQ4CSy597Y9A==:J9hsJIlU5FYfHb5rY5qQoIpVpTijryS/H+CE07oMtplL/ytneBVFd2tfVJtqGjhdht8tEi4wmqSSlqTgEu444w==)' - - # Preferences - text = set_key(text, 'Preferences', r'WebUI\Password_PBKDF2', f'"{HASH}"') - text = set_key(text, 'Preferences', r'WebUI\LocalhostAuthEnabled', 'false') - - # BitTorrent performance defaults (only applied when key absent — API updates persist) - bt_defaults = { - r'Session\MaxActiveDownloads': '50', - r'Session\MaxActiveTorrents': '100', - r'Session\MaxActiveUploads': '20', - r'Session\MaxConnections': '3000', - r'Session\MaxConnectionsPerTorrent': '300', - r'Session\MaxUploads': '-1', - r'Session\MaxUploadsPerTorrent': '10', - r'Session\GlobalDLSpeedLimit': '0', - r'Session\GlobalUPSpeedLimit': '0', - r'Session\DHTEnabled': 'true', - } - for key, val in bt_defaults.items(): - text = set_key(text, 'BitTorrent', key, val) - - open(CONF, 'w').write(text) - print('qBittorrent config patched.') - volumeMounts: - - name: config - mountPath: /config - containers: - - name: gluetun - image: ghcr.io/qdm12/gluetun:latest - securityContext: - capabilities: - add: ["NET_ADMIN"] - env: - - name: VPN_SERVICE_PROVIDER - value: "protonvpn" - - name: VPN_TYPE - value: "wireguard" - - name: WIREGUARD_PRIVATE_KEY - valueFrom: - secretKeyRef: - name: media-secrets - key: PROTONVPN_PRIVATE_KEY - - name: SERVER_NAMES - value: "US-IL#1" - - name: VPN_PORT_FORWARDING - value: "on" - - name: FIREWALL_OUTBOUND_SUBNETS - value: "10.42.0.0/16,10.43.0.0/16" - volumeMounts: - - name: gluetun-data - mountPath: /tmp/gluetun - ports: - - containerPort: 8888 - resources: - requests: - memory: 128Mi - cpu: 50m - limits: - memory: 512Mi - cpu: 200m - - - name: portforward-helper - image: alpine:latest - command: - - sh - - -c - - | - until apk add -q curl 2>/dev/null; do sleep 5; done - echo "Watching /tmp/gluetun/forwarded_port for assigned port..." - while true; do - if [ -f /tmp/gluetun/forwarded_port ]; then - PORT=$(cat /tmp/gluetun/forwarded_port) - if [ -n "$PORT" ] && [ "$PORT" != "0" ]; then - echo "$(date): Forwarded port: $PORT — updating qBittorrent" - curl -s -c /tmp/qbt.txt -X POST http://localhost:8080/api/v2/auth/login \ - -d "username=admin&password=adminadmin" >/dev/null 2>&1 - curl -s -b /tmp/qbt.txt -X POST http://localhost:8080/api/v2/app/setPreferences \ - -d "json={\"listen_port\":$PORT,\"random_port\":false}" >/dev/null 2>&1 - echo "$(date): qBittorrent listen port set to $PORT" - else - echo "$(date): Port file empty, waiting..." - fi - else - echo "$(date): Waiting for gluetun to write port file..." - fi - sleep 45 - done - volumeMounts: - - name: gluetun-data - mountPath: /tmp/gluetun - resources: - requests: - memory: 32Mi - cpu: 10m - limits: - memory: 96Mi - cpu: 50m - - - name: qbittorrent - image: lscr.io/linuxserver/qbittorrent:latest - env: - - name: PUID - value: "1000" - - name: PGID - value: "1000" - - name: TZ - value: "America/Chicago" - - name: WEBUI_PORT - value: "8080" - ports: - - containerPort: 8080 - volumeMounts: - - name: config - mountPath: /config - - name: media - mountPath: /media - resources: - requests: - memory: 256Mi - cpu: 100m - limits: - memory: 1Gi - cpu: 500m - volumes: - - name: gluetun-data - emptyDir: {} - - name: config - persistentVolumeClaim: - claimName: qbittorrent-config - - name: media - persistentVolumeClaim: - claimName: media-data ---- -apiVersion: v1 -kind: Service -metadata: - name: qbittorrent - namespace: media -spec: - selector: - app: qbittorrent - ports: - - name: webui - port: 8080 - targetPort: 8080 - type: ClusterIP