feat(media): chaptarr hardlinks + keeps its own ebook copy

Chaptarr had /downloads, /ebooks and /audiobooks as separate bind mounts, so
hardlinks failed with EXDEV and every import was a full copy (each seeding
audiobook stored twice). Mount /storage1 once and symlink the old container
paths into it via an entrypoint wrapper, so nothing in chaptarr's DB changes.

/ebooks now points at /storage1/Media/Ebooks, chaptarr's own ebook folder.
A Custom Script hook hardlinks each new ebook into the CWA ingest folder, so
CWA deleting its ingest copy no longer makes chaptarr think the book is missing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ginnoir (outpost agent)andClaude Opus 5.5 committed 2026-12-03 03:57:34 -06:00
1 parent 417cd3165f
commit 5d70a4e825
4 files changed
+73 -8

No files matched your search

+11 -3
View File
@@ -5,7 +5,7 @@ Lives in the `media` stack. Flow:
```
prowlarr ─► chaptarr ─► qbittorrent / nzbget ─► /storage1/complete
│
├─ ebooks ─► /storage1/complete/books-ingest ─► CWA ─► /storage1/Media/Books (Calibre lib) ─► Send-to-Kindle / OPDS
├─ ebooks ─► /storage1/Media/Ebooks (chaptarr's copy) ─cwa-ingest.sh hardlink─► /storage1/complete/books-ingest ─► CWA ─► /storage1/Media/Books (Calibre lib) ─► Send-to-Kindle / OPDS
└─ audiobooks ─► /storage1/Media/Audiobooks ─► audiobookshelf
storyteller reads both libraries :ro ─► /storage1/labdata/storyteller (aligned EPUB 3 + media overlays)
```
@@ -52,8 +52,8 @@ sudo chown -R 1000:1000 /config/chaptarr /config/calibre-web-automated /config/a
## 3. Post-deploy checklist
- [ ] **chaptarr:** set the admin login on first launch. Add root folders `/ebooks` (ebook) and `/audiobooks` (audiobook).
- [ ] **chaptarr:** turn on *Unmonitor Deleted Books* (Media Management). CWA deletes files from `/ebooks` after ingest, and without this setting chaptarr will try to grab them again.
- [ ] **chaptarr:** set the admin login on first launch. Add root folders `/ebooks` (ebook) and `/audiobooks` (audiobook). These are symlinks into the `/storage1` mount; see *Hardlinks* below.
- [x] ~~**chaptarr:** turn on *Unmonitor Deleted Books*~~. This is obsolete since 2026-12-03: CWA no longer deletes chaptarr's ebooks, because chaptarr keeps its own copy in `/storage1/Media/Ebooks`.
- [ ] **Prowlarr → chaptarr app sync:** in Prowlarr, go to Settings → Apps → add Chaptarr (or Readarr if Chaptarr isn't listed yet). Use `http://prowlarr:9696` and `http://chaptarr:8789`, plus the chaptarr API key. Sync, then confirm the indexers show up in chaptarr.
- [ ] **Download clients in chaptarr:** add `qbittorrent:3232` with category `books`, and `nzbget:6789` with category `books`. Both write under `/downloads` on the same `/storage1/complete` mount, so no remote path mapping is needed. Check that the `books` categories exist in both clients.
- [ ] **CWA:** log in as `admin` / `admin123` and change the password right away. The library path is `/calibre-library`. Drop a test EPUB into `/storage1/complete/books-ingest` and confirm it shows up in the library and leaves the ingest folder.
@@ -62,6 +62,14 @@ sudo chown -R 1000:1000 /config/chaptarr /config/calibre-web-automated /config/a
- [ ] **storyteller:** create an admin and point the import at `/libraries/books` and `/libraries/audiobooks`. Run one test alignment on a short book (whisper runs on CPU, so this is slow). Open the result in the Storyteller Reader app.
- [ ] **uptime-kuma:** add monitors for the four new hosts.
## Hardlinks + chaptarr's ebook copy (2026-12-03)
- Chaptarr mounts `/storage1` **once**. `chaptarr/start.sh` (the entrypoint wrapper) symlinks `/downloads`, `/audiobooks` and `/ebooks` into it. With separate bind mounts, `link()` fails with EXDEV and chaptarr silently copied every import instead, so seeding audiobooks existed twice. The container paths didn't change, so chaptarr's DB needed no migration.
- `/ebooks` → `/storage1/Media/Ebooks` is chaptarr's own ebook folder (it used to be the CWA ingest folder, which CWA empties, so chaptarr thought every ebook was missing).
- Connect → Custom Script **"CWA ingest"** (`/scripts/cwa-ingest.sh`, On Import + On Upgrade) hardlinks each newly imported ebook into `/storage1/complete/books-ingest/<Author>/`. CWA deletes its link after ingest, and chaptarr's file remains.
- Existing Calibre books were backfilled by hardlinking them from `/storage1/Media/Books` into `/storage1/Media/Ebooks/<Author>/` and rescanning.
- Hardlinks share content, so never edit files in `/storage1/Media/Ebooks` in place (e.g. chaptarr metadata writing). That would also change Calibre's copy of a backfilled book.
## Notes
- `STORYTELLER_SECRET_KEY` is in `stack.env` (`secrets.token_hex(64)`). If you rotate it, every Storyteller session is logged out.