gates / gates (push) Successful in 3s
sonarr/radarr: one media bind, declared excluded; first start seeds AuthenticationRequired=Enabled (R-1030); first steps hu+en. qbittorrent/transmission: only their download folder at the same path, /downloads kept for old torrents, default folders moved at start; transmission watch declared optional (R-1019). plex/jellyfin: /media/tv (R-1015). onboarding 2.2 rows (R-1016). Evidence: felhom.eu documentation/audits/media-folder-fix-2026-10-14/.
137 lines
7.8 KiB
YAML
137 lines
7.8 KiB
YAML
# qBittorrent - Torrent kliens webes felülettel
|
|
# Domain: ${SUBDOMAIN}.${DOMAIN}
|
|
# Database: none (its settings and torrent state are files in the config volume)
|
|
# RAM: ~120M idle, more while downloading (mem_limit: 1024M) | Pi-compatible: Yes (amd64, arm64)
|
|
#
|
|
# WHY IT IS HERE: radarr, sonarr and seerr are in this catalog and none of them downloads anything -
|
|
# they decide what to fetch and hand it to a download client. Until this template there was none, and
|
|
# radarr's own prerequisites said "Letöltő kliens szükséges (pl. qBittorrent - külön telepítendő)".
|
|
#
|
|
# FIRST ADMIN (class 1 - generated by us at install, FIRST-ADMIN.md). qBittorrent 5.x with no password
|
|
# in its config prints a TEMPORARY one into the container log at every start - which the household
|
|
# cannot read, and which changes on every restart. So the entrypoint below seeds the config file on
|
|
# FIRST BOOT ONLY with the felhom-generated password, hashed the way qBittorrent hashes it
|
|
# (PBKDF2-HMAC-SHA512, 100000 iterations, 16-byte salt, 64-byte key, stored base64 as
|
|
# "@ByteArray(salt:key)"). qBittorrent REWRITES its config on exit, so this cannot be done after the
|
|
# first start - the gokapi precedent (seed before the server serves) is the one that works.
|
|
# python3 is in the image (3.14); openssl is not.
|
|
#
|
|
# THE PUBLIC NAME: qBittorrent validates the Host header and refuses a reverse proxy's host unless it
|
|
# is listed. WebUI\ServerDomains carries the app's own public name - tighter than turning the
|
|
# validation off. ReverseProxySupport + the trusted range make the ban logic see the real visitor
|
|
# rather than traefik.
|
|
#
|
|
# NO INBOUND PEER PORT, deliberately. The tunnel carries HTTP only and the box opens no port at home
|
|
# (01-topology-and-trust.md §7), so qBittorrent runs outbound-only: it connects to peers, peers do not
|
|
# connect to it. Downloads work; they are slower on poorly seeded torrents, and the app_info says so.
|
|
#
|
|
# AND THAT IS WHY `Session\UseUPnP=false` IS SEEDED. qBittorrent's own default is UPnP/NAT-PMP ON: the
|
|
# app asks the household's ROUTER to forward a port to it. Measured on 9202 2026-10-12, in the app's
|
|
# own log: "UPnP/NAT-PMP support: ON". A box that promises to open no port at home cannot ship an app
|
|
# that opens one behind the household's back.
|
|
#
|
|
# THE HOST LIST carries the local names too, because the CONTROLLER's health probe dials the app by
|
|
# its container name: without them the app answers "Invalid Host header ... Received Host header:
|
|
# 'qbittorrent:8080'" (measured on 9202, same run) and the dashboard's probe reads a refusal.
|
|
# **The list is set through the API, by after_install, not here.** Measured on 9202 2026-10-12:
|
|
# a semicolon list seeded into this file comes back from qBittorrent's own read-write cycle as
|
|
# the public name ALONE, and the container's name is then refused ("Invalid Host header ...
|
|
# 'qbittorrent:8080'"); a comma list refuses everything, the public name included. The same list
|
|
# through /api/v2/app/setPreferences is honoured and both names answer 200. So this file seeds
|
|
# only the public name - which is what the app writes back anyway - and after_install sets the
|
|
# full list the way the app accepts it.
|
|
#
|
|
# UPnP IS TURNED OFF BY after_install, NOT HERE. `Session\UseUPnP=false` in this seeded file is
|
|
# written and then ignored at first start: the app reported "upnp": true with that very line in
|
|
# its config (9202, 2026-10-12). Through its own API the same setting takes and survives a
|
|
# restart ("UPnP/NAT-PMP support: OFF"), so that is the route the template uses. The line stays
|
|
# because it is what the app writes itself once the preference is set, and a restore of this
|
|
# volume must not silently turn port mapping back on.
|
|
#
|
|
# Environment variables:
|
|
# DOMAIN - Your domain (e.g., demo-felhom.eu)
|
|
# SUBDOMAIN - The name this app answers on
|
|
# HDD_PATH - The drive the downloads go to
|
|
# QBT_ADMIN_PASSWORD - generated at install (deploy_fields), seeded on first boot only
|
|
#
|
|
# Folders: the downloads in ${USERDATA_PATH}/media/torrents (the household sees them in the file
|
|
# browser); the settings, the torrent list and the resume data in the named volume qbittorrent_config
|
|
# (NVMe) - small, and it is what a restore must bring back.
|
|
|
|
services:
|
|
qbittorrent:
|
|
image: qbittorrentofficial/qbittorrent-nox:5.2.4-1
|
|
container_name: qbittorrent
|
|
restart: unless-stopped
|
|
environment:
|
|
- TZ=Europe/Budapest
|
|
- PUID=1000
|
|
- PGID=1000
|
|
- UMASK=022
|
|
- QBT_LEGAL_NOTICE=confirm
|
|
- QBT_WEBUI_PORT=8080
|
|
- QBT_TORRENTING_PORT=6881
|
|
- QBT_ADMIN_PASSWORD=${QBT_ADMIN_PASSWORD}
|
|
- QBT_PUBLIC_HOST=${SUBDOMAIN}.${DOMAIN}
|
|
# The download folder, at the SAME path inside the container as on the box (R-1014): Sonarr and Radarr see the
|
|
# file at exactly the path qBittorrent reports, and hardlink it into the library.
|
|
- QBT_SAVE_PATH=${USERDATA_PATH}/media/torrents
|
|
entrypoint:
|
|
- /bin/sh
|
|
- -c
|
|
- |
|
|
CONF=/config/qBittorrent/config/qBittorrent.conf
|
|
if [ ! -f "$$CONF" ]; then
|
|
echo "[felhom] first boot - seeding qBittorrent config and the generated WebUI password"
|
|
mkdir -p /config/qBittorrent/config
|
|
HASH=$$(QBT_PW="$$QBT_ADMIN_PASSWORD" python3 -c "import base64,hashlib,os,sys; s=os.urandom(16); k=hashlib.pbkdf2_hmac('sha512', os.environ['QBT_PW'].encode('utf-8'), s, 100000, 64); sys.stdout.write('@ByteArray(%s:%s)' % (base64.b64encode(s).decode(), base64.b64encode(k).decode()))")
|
|
printf '%s\n' '[BitTorrent]' "Session\\DefaultSavePath=$$QBT_SAVE_PATH" 'Session\UseUPnP=false' "Session\\TempPath=$$QBT_SAVE_PATH/.temp" 'Session\TempPathEnabled=true' 'Session\Port=6881' '[Meta]' 'MigrationVersion=9999' '[Preferences]' 'WebUI\Username=admin' "WebUI\\Password_PBKDF2=\"$$HASH\"" 'WebUI\Port=8080' 'WebUI\Address=*' "WebUI\\ServerDomains=$$QBT_PUBLIC_HOST" 'WebUI\ReverseProxySupportEnabled=true' 'WebUI\TrustedReverseProxiesList=172.16.0.0/12' > "$$CONF"
|
|
else
|
|
# An install from before 2026-10-14 saves to /downloads. Its old torrents keep that path (the bind below
|
|
# keeps it alive); only the DEFAULT for new downloads moves to the same-path folder. Before the app starts,
|
|
# because qBittorrent rewrites this file on exit.
|
|
python3 - "$$CONF" "$$QBT_SAVE_PATH" <<'PY'
|
|
import sys
|
|
p, d = sys.argv[1], sys.argv[2]
|
|
s = open(p).read()
|
|
n = s.replace('SavePath=/downloads\n', 'SavePath=' + d + '\n').replace('TempPath=/downloads/.temp\n', 'TempPath=' + d + '/.temp\n')
|
|
if n != s:
|
|
open(p, 'w').write(n)
|
|
print('[felhom] default save path moved from /downloads to ' + d)
|
|
PY
|
|
fi
|
|
exec /sbin/tini -g -- /entrypoint.sh
|
|
volumes:
|
|
# ONLY the download folder (operator ruling 2026-10-14, D9 = A with a limit): the app can never reach the
|
|
# family's photos, music or books. Same path inside as outside.
|
|
- ${USERDATA_PATH}/media/torrents:${USERDATA_PATH}/media/torrents
|
|
# The SAME folder under its old name, for torrents added before 2026-10-14 (their resume data names /downloads).
|
|
- ${USERDATA_PATH}/media/torrents:/downloads
|
|
- qbittorrent_config:/config
|
|
networks:
|
|
- traefik-public
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 1024M
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-fsS", "-o", "/dev/null", "http://127.0.0.1:8080/"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
start_period: 30s
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.http.routers.qbittorrent.rule=Host(`${SUBDOMAIN}.${DOMAIN}`)"
|
|
- "traefik.http.routers.qbittorrent.entrypoints=websecure"
|
|
- "traefik.http.routers.qbittorrent.tls=true"
|
|
- "traefik.http.routers.qbittorrent.tls.certresolver=letsencrypt"
|
|
- "traefik.http.services.qbittorrent.loadbalancer.server.port=8080"
|
|
|
|
volumes:
|
|
qbittorrent_config:
|
|
|
|
networks:
|
|
traefik-public:
|
|
external: true
|