diff --git a/docs/superpowers/plans/2026-10-18-cross-seed-autobrr.md b/docs/superpowers/plans/2026-10-18-cross-seed-autobrr.md new file mode 100644 index 0000000..49cddd3 --- /dev/null +++ b/docs/superpowers/plans/2026-10-18-cross-seed-autobrr.md @@ -0,0 +1,185 @@ +# cross-seed + autobrr in the media stack — plan + +**Goal:** build tracker standing (seed volume, ratio, buffer) on TorrentLeech now — and on every +private tracker joined later — without spending disk or ratio, so the BTN/PTP-tier recruitment +requirements come for free. + +- **cross-seed** matches files already on disk against tracker uploads and injects them into + qBittorrent via hardlinks → instant seeding, zero new downloads, zero new disk. +- **autobrr** watches tracker IRC announce channels and grabs freeleech uploads in the first minutes + (when peers are hungry) → ratio buffer without risking ratio. + +## What's there today (checked 2026-10-18) + +| Thing | State | Consequence | +|---|---|---| +| qBittorrent | 3 torrents total; library is ~all usenet (dognzb / nzb.life / altHUB) | cross-seed's value is **data-mode** (library → trackers), not torrent-mode | +| qBittorrent port | `6881`, UPnP off | 6881–6889 is **banned on many private trackers**; must move + forward on OPNsense | +| qBittorrent share limits | global ratio 1 / 14400 min (10 d) | fine for TL's H&R rule, but would stop cross-seeds that cost nothing to keep seeding | +| Mounts | qbit `/storage1/complete:/downloads`; library at `/storage1/{TV,Movies,Anime}` (`/storage1/Media/*` are symlinks to these) | hardlinks work on the virtiofs `/storage1` (verified), but **not across two bind mounts** (`EXDEV`) — link source and target must be under ONE container mount | +| Prowlarr | TL = indexer **id 8** (only private torrent indexer); nyaa/sukebei disabled | cross-seed gets TL's Torznab via Prowlarr; new trackers get added there first | +| Free space | `/storage1` 15 T free (85 %), no redundancy | autobrr must be size- and count-capped | + +## Design + +``` + IRC announce (TL #tlannounces, later others) + │ + autobrr ──(freeleech filter)──► qBittorrent [cat: autobrr] + │ │ on-complete hook + └──(announce webhook)──┐ ▼ + ▼ cross-seed daemon :2468 + /storage1/{TV,Movies,Anime} ──(dataDirs scan)──► │ ──Torznab──► prowlarr:9696//api + └─ hardlink into /storage1/cross-seed-links + + inject into qBittorrent [cat: cross-seed] +``` + +- Both qbit and cross-seed mount **`/storage1:/storage1`** (same path inside and out). qbit keeps its + existing `/downloads` mount too, so Sonarr/Radarr's download-client paths don't change. +- Link dir: **`/storage1/cross-seed-links`** — a sibling of `complete/`, so nzbget/Sonarr never see it. +- New autobrr grabs save to `/storage1/complete/autobrr` (absolute path, under the `/storage1` mount) + so cross-seed can hardlink from them too. The 3 legacy `/downloads/...` torrents are left out + (linking from them would cross mounts) — not worth migrating. +- cross-seed has no web UI → `media` net only, no Caddy. autobrr has a UI → `edge` + Caddy + + Authentik **Pattern A** (autobrr has native OIDC). +- Secrets go in `stacks/media/stack.env` (repo convention). cross-seed's `config.js` is plain JS, so + it reads them via `process.env.*` — no secrets in the host-managed config file. + +## Phase 0 — prerequisites (ginnoir, manual) + +1. Torrent port chosen: **43817** (6881–6889 / 51413 are banned on many trackers). +2. OPNsense → Firewall → NAT → Port Forward: TCP+UDP `43817` → `192.168.1.69:43817` (GUI, never + hand-edit `config.xml`). +3. TL IRC: register a nick on TL's IRC network and note the announce channel + the IRC/announce key + from your TL profile (autobrr's TL preset lists exactly which fields it needs). +4. Decide: autobrr disk budget (suggest max **1 TB** live in the `autobrr` category) and whether your + upload bandwidth is good enough to race (≥ 100 Mbit up is comfortable; below that, keep filters tight). + +## Phase 1 — qBittorrent prep (`stacks/media/docker-compose.yml`) + +- `qbittorrent`: `TORRENTING_PORT=43817`, ports `43817:43817` tcp+udp (drop 6881), add volume + `/storage1:/storage1`. +- After redeploy, in qBittorrent (WebUI or API): + - category `cross-seed` → save path `/storage1/cross-seed-links`, share limits **unlimited**. + - category `autobrr` → save path `/storage1/complete/autobrr`, share limit e.g. ratio 3 **or** + 21 d, then *remove torrent (keep files only if cross-seeded)* — pick the stricter of TL's H&R rules. + - global limit: leave ratio 1 / 10 d for `tv`/`movies` (Sonarr grabs). Confirm what the + current limit *action* is (pause vs remove) before changing anything. + - Options → Downloads → "Run external program on torrent finished": + `curl -s -XPOST http://cross-seed:2468/api/webhook?apikey= --data-urlencode "infoHash=%I" --data-urlencode "includeSingleEpisodes=true"` +- Verify: TL profile shows **Connectable: yes** on the new port. + +## Phase 2 — cross-seed + +Compose: + +```yaml + cross-seed: + image: ghcr.io/cross-seed/cross-seed:6 # pin the major; verify current major on deploy + container_name: cross-seed + restart: unless-stopped + networks: [media] + user: 1000:1000 # match PUID/PGID so links keep ownership + env_file: + - stack.env + command: daemon + volumes: + - /config/cross-seed:/config + - /storage1:/storage1 +``` + +`/config/cross-seed/config.js` (host-managed; bootstrap with `docker run … gen-config`): + +- `torznab`: `[\`http://prowlarr:9696/8/api?apikey=${process.env.PROWLARR_API_KEY}\`]` — one entry + per **private torrent** indexer in Prowlarr; never public ones. +- `torrentClients`: `[\`qbittorrent:http://${user}:${pass}@qbittorrent:3232\`]` from env. +- `dataDirs`: `/storage1/TV`, `/storage1/Movies`, `/storage1/Anime` (real paths, not the + `/storage1/Media` symlinks); `linkDirs`: `["/storage1/cross-seed-links"]`; `linkType: "hardlink"`. +- `useClientTorrents: true`, `matchMode: "partial"`, `maxDataDepth: 3`, `includeSingleEpisodes: false` + (searching every episode floods TL; the qbit hook passes `includeSingleEpisodes=true` per call). +- `action: "save"` **first** (dry run → `.torrent` files in `/config/output`), flip to `"inject"` + once matches look right; `linkCategory: "cross-seed"`, `duplicateCategories: false`. +- Rate limits — be gentle with TL's API: `delay: 30`, `searchCadence: "1 day"`, `searchLimit: 400`, + `excludeOlder: "2 weeks"` (relative to an item's *first* search), `excludeRecentSearch: "3 days"`. +- `notificationWebhookUrl` → ntfy topic. +- `apiKey: process.env.CROSS_SEED_API_KEY`. + +`stack.env` additions: `CROSS_SEED_API_KEY`, `PROWLARR_API_KEY`, `SONARR_API_KEY`, `RADARR_API_KEY` +(Sonarr/Radarr give ID lookups so renamed library files still match). qbit WebUI auth is disabled +(`WebUI\AuthenticationEnabled=false`), so `torrentClients` has no credentials. + +At 400 searches/day the first pass over the library takes weeks — that's intended. + +## Phase 3 — autobrr + +Compose: + +```yaml + autobrr: + image: ghcr.io/autobrr/autobrr:latest + container_name: autobrr + restart: unless-stopped + networks: [media, edge] + user: 1000:1000 + env_file: + - stack.env + volumes: + - /config/autobrr:/config + ports: + - "7474:7474" +``` + +- **Authentik (Pattern A):** provider `homelab-autobrr` + application `autobrr` with the standard + IDs from CLAUDE.md (explicit `grant_types` + `signing_key`). Confirm autobrr's current OIDC env + var names and callback path from its docs at deploy time (expected + `https://autobrr.ginnoir.com/api/auth/oidc/callback`); add `AUTOBRR__OIDC_*` to `stack.env`. +- **Caddyfile:** `autobrr.ginnoir.com { import internal_gate … reverse_proxy autobrr:7474 }` + (no forward_auth — native OIDC), then `./scripts/gen-bookmarks.ps1`. +- In autobrr UI: + - IRC network: TL preset (nick + IRC key from Phase 0). + - Download client: qBittorrent `http://qbittorrent:3232`, category `autobrr`, rules: max active + downloads 3, ignore slow torrents. + - Filter **TL-freeleech**: freeleech only, size 1–40 GB, resolutions 1080p/2160p, max 10 + downloads/day; exclude what Sonarr/Radarr already handle if you want pure buffer. + - Second action on every filter: **Webhook** → `http://cross-seed:2468/api/announce` (cross-seed's + announce endpoint) so new releases on *other* trackers race against data we already have. + - Notifications → ntfy. + +## Phase 4 — monitoring + +- Uptime Kuma: HTTP monitor `http://autobrr:7474/api/healthz/liveness`; HTTP monitor + `http://cross-seed:2468/api/ping`. +- Weekly reaper for dead links: torrents removed from qbit leave hardlinks behind in + `/storage1/cross-seed-links`. Add a host timer (or qbit_manage later) that deletes files there with + link count 1 and no owning torrent. **Deferred** until the first month shows how much accumulates. + +## Phase 5 — rollout order & verification + +1. Phase 0 manual steps → confirm Connectable on TL. +2. Push Phase 1 compose change → wait for Portainer redeploy → set categories/hook. +3. Push cross-seed in `action: save` → check `/config/output` and logs after ~1 h for sane matches + (correct release names, sizes, no partial-junk). +4. Flip to `inject` → spot-check 3 injected torrents: 100 % complete on recheck, seeding, files in + `cross-seed-links` share an inode with the library file (`stat -c %i`). +5. Push autobrr + Caddy + Authentik → log in via SSO → enable the TL filter → watch the first grab + land in category `autobrr` and its webhook reach cross-seed. +6. After a week: TL seed size / bonus points up, no H&R warnings, free space drop ≤ autobrr budget. + +## When a new tracker is joined + +1. Add it in Prowlarr (it syncs to Sonarr/Radarr). +2. Append its Torznab URL to cross-seed's `torznab` list → restart cross-seed → it backfills. +3. Add its IRC preset + a freeleech filter in autobrr. +4. Set a per-tracker share limit in qBittorrent matching its H&R rule. + +## Docs / memory + +- CLAUDE.md layout line for `media/`: mention cross-seed + autobrr. +- New memory + Obsidian note: cross-seed hardlink layout (`/storage1:/storage1` both sides, `EXDEV` + across bind mounts), port-change reason, TL Prowlarr id 8. + +## Out of scope (noted) + +- Sonarr/Radarr import as **copies** today (download and library are separate bind mounts). A + TRaSH-style single `/storage1` mount across *arrs + clients would make imports hardlinks too; worth + its own plan. diff --git a/stacks/media/docker-compose.yml b/stacks/media/docker-compose.yml index 75b3758..80ad52b 100644 --- a/stacks/media/docker-compose.yml +++ b/stacks/media/docker-compose.yml @@ -129,14 +129,34 @@ services: - stack.env environment: - WEBUI_PORT=3232 - - TORRENTING_PORT=6881 + # 6881-6889 is banned on many private trackers; 43817 is forwarded on OPNsense. + - TORRENTING_PORT=43817 volumes: - /config/qbittorrent:/config - /storage1/complete:/downloads + # Same-path /storage1 mount so cross-seed's hardlinks (which must live on the + # same container mount as their source) resolve identically in both containers. + - /storage1:/storage1 ports: - "3232:3232" - - "6881:6881" - - "6881:6881/udp" + - "43817:43817" + - "43817:43817/udp" + + # cross-seed: matches library files against private-tracker uploads and injects + # them into qbittorrent as hardlinks under /storage1/cross-seed-links. No web UI; + # config is host-managed at /config/cross-seed/config.js (secrets via process.env). + cross-seed: + image: ghcr.io/cross-seed/cross-seed:6 + container_name: cross-seed + restart: unless-stopped + networks: [media] + user: 1000:1000 + env_file: + - stack.env + command: daemon + volumes: + - /config/cross-seed:/config + - /storage1:/storage1 whisparr: container_name: whisparr diff --git a/stacks/media/stack.env b/stacks/media/stack.env index 1c24590..8ff242b 100644 --- a/stacks/media/stack.env +++ b/stacks/media/stack.env @@ -17,3 +17,9 @@ ABS_OIDC_CLIENT_SECRET=1Tmw0PLw8CP82JX4Vz5nuOfpykh6XKngrU8a4Vspc6ZsIarJn3mG5GwKr # chaptarr stores OIDC config in its own DB (Settings → General → Authentication). CHAPTARR_OIDC_CLIENT_ID=BlQNRexLVkgUuH8j0ybmFSiD93dw1mBUF6tsjG6b CHAPTARR_OIDC_CLIENT_SECRET=THoqN0qLbPuni9cg0vqeid200VsgXKs1WihOSYV8NqciIcp6eCTmvYeRHKYWxF7jOiCBUdL3kP6e4e06SeQr0vwzFSz8rLYYCRomQqizv1iWfRGv0HjfDgkNj49rwrz6 + +# cross-seed (config.js reads these via process.env) +CROSS_SEED_API_KEY=41ac9aabd275b7c9efd763cb52562d91d90515ccb78761d1 +PROWLARR_API_KEY=a02364e8ce5b4a3aa7396d41b189e9f8 +SONARR_API_KEY=383c9489253e445baf8514013a4e37a4 +RADARR_API_KEY=94159a19beef48f185bd3e330f8dde3a