Files
homelabstack/docs/superpowers/plans/2026-10-18-cross-seed-autobrr.md
T
2026-10-18 19:32:29 -05:00

238 lines
15 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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/<id>/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=<CROSS_SEED_API_KEY> --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).
- **v6 gotcha:** `action: "save"` is rejected when `linkDirs` is set, so the dry run runs with
`linkDirs: []` and `seasonFromEpisodes: null`; restore both when flipping to `inject`.
- `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.
## Status (2026-10-18)
- **Phase 1 done:** qbit on port 43817 (forwarded, externally reachable; UPnP off), `/storage1` mount,
`cross-seed` category, completion hook. qbit WebUI auth is **on** (the conf's
`AuthenticationEnabled=false` is misleading); cross-seed uses Sonarr's qbit login via
`QBIT_USER`/`QBIT_PASS`.
- **Phase 2 live in inject mode.** Dry run: 6 matches in the first 29 of 3320 searchees, all 100 %
of video bytes (AT S7 partial: 25/75 files = only nfo/srt extras missing, auto-resumed). Injected
6/6 + 1 live; 95 files all link-count 2 with library inodes; `df` unchanged. Links land in
`/storage1/cross-seed-links/<Tracker>/<release>`, ATM off, save path set per torrent.
- **Share limits:** qbit WebAPI 2.15 ignores share limits on `editCategory` → set
`ratio/seeding/inactive = -1` directly in `categories.json` (qbit stopped; backup
`categories.json.bak-2026-10-18`). Injected torrents carry `-2` (inherit), which should resolve to
the category's `-1` on qBittorrent 5.x; the first 7 were also set to `-1` per torrent
(`setShareLimits` needs `shareLimitAction` or it 400s). **Check in ~10 days** that new
cross-seeds aren't stopped at ratio 1 / 10 d (global action = Stop).
- **Phase 3 deployed (2026-10-18):** autobrr v1.88.0, Authentik provider `homelab-autobrr` (pk 48,
app slug `autobrr`, ginnoir-only user binding), built-in login disabled (OIDC only; onboarding is
skipped when OIDC is on). Caddy `autobrr.ginnoir.com` internal_only. Scripted-ops API key =
`AUTOBRR_API_KEY` (inserted straight into the `api_key` table; header `X-API-Token`). API routes:
`/api/downloaders` (not download_clients); filter POSTs need every array field as `[]` or SQLite
NOT NULL fails.
- Download client 1 = qbit (same login), rules: 3 active max, ignore slow when maxed.
- qbit category `autobrr` → `/storage1/complete/autobrr`, ratio 2 **or** 14 d →
**RemoveWithContent** (cross-seeded copies survive via their own hardlinks).
- Filter 1 **TL freeleech** (prio 10): freeleech, 1–20 GB, 1080p/2160p, 5/day → qbit + cross-seed
announce webhook. Filter 2 **cross-seed announce (all)** (prio 0) → webhook only. Both created
**disabled with no indexer**; they need TL attached.
- Uptime Kuma monitor 82 (`/api/healthz/liveness`). No cross-seed monitor yet: the MCP
`createMonitor` can't set `docker_container`.
- **TL attached + live (2026-10-18 17:03).** autobrr IRC wedged after API network restarts
(no IDENTIFY/JOIN); a plain `docker restart autobrr` fixed it. Don't loop reconnects (TL bans join/quit).
- **Race filter added (symmetric gigabit):** Filter 3 **TL race (non-FL)** (prio 5): `TV :: Episodes HD`,
1080p WEB/WEB-DL, groups FLUX/NTb/EDITH/ETHEL/BLOOM/SuccessfulCrab/APEX, 1–5 GB, 3/day → qbit
`autobrr` + cross-seed webhook. (Indexers only attach via PUT with every array field present.)
qbit tuned for racing + large cross-seed counts: unlimited upload slots and active
torrents/uploads, 5 active downloads with slow ones not counted, 1000 connections (200 per torrent).
- **Usenet imports → cross-seed (2026-10-18):** Sonarr + Radarr each have a Custom Script connection
"cross-seed" (id 4, On Import + On Upgrade) running host-managed `/config/{sonarr,radarr}/scripts/cross-seed-import.sh`
(`/config/scripts/...` in the container). It maps `/tv`, `/anime`, `/movies` → `/storage1/{TV,Anime,Movies}` and
POSTs `path=` to cross-seed's `/api/webhook` with `includeSingleEpisodes=true`. Multi-file Sonarr imports
also post the season folder (packs). Key comes from `CROSS_SEED_API_KEY` (shared stack.env). Tested:
204, and cross-seed resolves IDs and searches immediately.
- **Freeleech widened (2026-10-18):** filter 1 is now 1–30 GB, any resolution, 12/day. autobrr client rule
is 8 active downloads (ignore slow when maxed); qbit max_active_downloads 10 (slow not counted). Worst
case ~5 TB live in `autobrr` (12 × 30 GB × 14 d); in practice far less, since ratio 2 removes early. The
client is updated with `PUT /api/downloaders` (not `/downloaders/{id}`) and must resend the password.
- **Review ~2026-10-25:** ratio on `autobrr`-category torrents grabbed by the race filter. If it's
above 1.0, widen (more per day, movies, bigger sizes). Below ~0.7, disable the filter.