Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72688f48ac | ||
|
|
ca00f8899d |
No files matched your search
@@ -275,6 +275,61 @@ stash.ginnoir.com {
|
||||
}
|
||||
}
|
||||
|
||||
# BOOKS — chaptarr / CWA / storyteller behind forward_auth; ABS uses native OIDC
|
||||
# (forward_auth would break the mobile app). All internal_only — remote access
|
||||
# is via the tailnet (100.64.0.0/10 is already allowed by internal_only).
|
||||
chaptarr.ginnoir.com {
|
||||
import internal_only
|
||||
route {
|
||||
import authentik_outpost
|
||||
handle /api/* {
|
||||
reverse_proxy chaptarr:8789
|
||||
}
|
||||
handle {
|
||||
import authentik_forward_auth
|
||||
reverse_proxy chaptarr:8789
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
books.ginnoir.com {
|
||||
import internal_only
|
||||
route {
|
||||
import authentik_outpost
|
||||
# OPDS + Kobo sync clients authenticate with CWA's own credentials.
|
||||
handle /opds* {
|
||||
reverse_proxy calibre-web-automated:8083
|
||||
}
|
||||
handle /kobo/* {
|
||||
reverse_proxy calibre-web-automated:8083
|
||||
}
|
||||
handle {
|
||||
import authentik_forward_auth
|
||||
reverse_proxy calibre-web-automated:8083
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
audiobooks.ginnoir.com {
|
||||
import internal_only
|
||||
reverse_proxy audiobookshelf:80
|
||||
}
|
||||
|
||||
storyteller.ginnoir.com {
|
||||
import internal_only
|
||||
route {
|
||||
import authentik_outpost
|
||||
# Storyteller Reader app talks to the API with its own tokens.
|
||||
handle /api/* {
|
||||
reverse_proxy storyteller:8001
|
||||
}
|
||||
handle {
|
||||
import authentik_forward_auth
|
||||
reverse_proxy storyteller:8001
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# =============================================================
|
||||
# GAMES / ROMS — internal only
|
||||
# External access for a trusted friend is via the `share` stack's Tailscale
|
||||
|
||||
@@ -50,6 +50,10 @@
|
||||
<DT><A HREF="https://nzbget.ginnoir.com">nzbget</A>
|
||||
<DT><A HREF="https://whisparr.ginnoir.com">whisparr</A>
|
||||
<DT><A HREF="https://stash.ginnoir.com">stash</A>
|
||||
<DT><A HREF="https://chaptarr.ginnoir.com">chaptarr [internal]</A>
|
||||
<DT><A HREF="https://books.ginnoir.com">books [internal]</A>
|
||||
<DT><A HREF="https://audiobooks.ginnoir.com">audiobooks [internal]</A>
|
||||
<DT><A HREF="https://storyteller.ginnoir.com">storyteller [internal]</A>
|
||||
<DT><A HREF="https://roms.ginnoir.com">roms</A>
|
||||
<DT><A HREF="https://romhacks.ginnoir.com">romhacks</A>
|
||||
<DT><A HREF="https://jd.ginnoir.com">jd [internal]</A>
|
||||
|
||||
@@ -49,6 +49,10 @@
|
||||
<DT><A HREF="http://valhalla:6881">qbittorrent :6881 (TCP/UDP)</A>
|
||||
<DT><A HREF="http://valhalla:6969">whisparr</A>
|
||||
<DT><A HREF="http://valhalla:6971">stash :6971</A>
|
||||
<DT><A HREF="http://valhalla:8789">chaptarr</A>
|
||||
<DT><A HREF="http://valhalla:8083">calibre-web-automated</A>
|
||||
<DT><A HREF="http://valhalla:13378">audiobookshelf :13378</A>
|
||||
<DT><A HREF="http://valhalla:8001">storyteller</A>
|
||||
</DL><p>
|
||||
|
||||
<DT><H3>Monitoring</H3>
|
||||
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# Creates the books-stack Authentik providers/apps (idempotent). Run on valhalla.
|
||||
# Prints the audiobookshelf OIDC client id/secret path on success.
|
||||
set -euo pipefail
|
||||
here="$(cd "$(dirname "$0")" && pwd)"
|
||||
docker cp "$here/setup-books-auth.py" authentik_server:/tmp/setup-books-auth.py
|
||||
docker exec authentik_server ak shell -c "exec(open('/tmp/setup-books-auth.py').read())" 2>&1 | grep -E '^(PROXY|OIDC)|Error|Traceback'
|
||||
docker cp authentik_server:/tmp/books-abs-oidc.env "${1:-./books-abs-oidc.env}"
|
||||
docker exec authentik_server rm -f /tmp/books-abs-oidc.env /tmp/setup-books-auth.py
|
||||
@@ -0,0 +1,80 @@
|
||||
# Authentik objects for the books stack (see stacks/media/BOOKS.md).
|
||||
# Idempotent. Run via scripts/run-books-auth.sh (ak shell inside authentik_server).
|
||||
# - forward_single proxy providers for chaptarr / books (CWA) / storyteller,
|
||||
# cloned from homelab-sonarr and attached to the embedded outpost
|
||||
# - native OIDC provider for audiobookshelf (Pattern A)
|
||||
from authentik.core.models import Application
|
||||
from authentik.crypto.models import CertificateKeyPair
|
||||
from authentik.flows.models import Flow
|
||||
from authentik.outposts.models import Outpost
|
||||
from authentik.providers.oauth2.models import OAuth2Provider
|
||||
from authentik.providers.proxy.models import ProxyMode, ProxyProvider
|
||||
|
||||
AUTH_FLOW = Flow.objects.get(pk="b88daebc-c54d-4e85-ae27-8b47384d5d74")
|
||||
INVALIDATION_FLOW = Flow.objects.get(pk="3259f9c5-7eab-40bf-81cb-2b0ede6eb7b3")
|
||||
SIGNING_KEY = CertificateKeyPair.objects.get(pk="dc7cbd9e-c6d2-4168-b402-e7570bcb59d1")
|
||||
SCOPES = [
|
||||
"718abef2-504c-452c-9ff0-329eda8031c7", # openid
|
||||
"19491dd8-d239-41a4-aa48-030c1471779d", # email
|
||||
"ca45a8da-db62-41ba-b1c4-e669bf3c9a82", # profile
|
||||
]
|
||||
|
||||
template = ProxyProvider.objects.get(name="homelab-sonarr")
|
||||
outpost = Outpost.objects.get(managed="goauthentik.io/outposts/embedded")
|
||||
|
||||
FORWARD = [
|
||||
# (slug, app name, host)
|
||||
("chaptarr", "Chaptarr", "chaptarr.ginnoir.com"),
|
||||
("books", "Calibre-Web Automated", "books.ginnoir.com"),
|
||||
("storyteller", "Storyteller", "storyteller.ginnoir.com"),
|
||||
]
|
||||
|
||||
for slug, app_name, host in FORWARD:
|
||||
p, created = ProxyProvider.objects.get_or_create(
|
||||
name=f"homelab-{slug}",
|
||||
defaults=dict(
|
||||
mode=ProxyMode.FORWARD_SINGLE,
|
||||
external_host=f"https://{host}",
|
||||
authorization_flow=AUTH_FLOW,
|
||||
invalidation_flow=INVALIDATION_FLOW,
|
||||
intercept_header_auth=template.intercept_header_auth,
|
||||
access_token_validity=template.access_token_validity,
|
||||
),
|
||||
)
|
||||
if created:
|
||||
p.property_mappings.set(template.property_mappings.all())
|
||||
outpost.providers.add(p)
|
||||
app, _ = Application.objects.update_or_create(
|
||||
slug=slug,
|
||||
defaults=dict(name=app_name, provider=p, meta_launch_url=f"https://{host}"),
|
||||
)
|
||||
print(f"PROXY {slug}: provider pk={p.pk} created={created} app={app.slug}")
|
||||
|
||||
outpost.save() # nudge the embedded outpost to pick up new providers
|
||||
|
||||
abs_host = "audiobooks.ginnoir.com"
|
||||
abs_p, created = OAuth2Provider.objects.get_or_create(
|
||||
name="homelab-audiobooks",
|
||||
defaults=dict(
|
||||
client_type="confidential",
|
||||
authorization_flow=AUTH_FLOW,
|
||||
invalidation_flow=INVALIDATION_FLOW,
|
||||
sub_mode="hashed_user_id",
|
||||
signing_key=SIGNING_KEY,
|
||||
grant_types=["authorization_code", "refresh_token"],
|
||||
_redirect_uris=[
|
||||
{"url": f"https://{abs_host}/auth/openid/callback", "matching_mode": "strict", "redirect_uri_type": "authorization"},
|
||||
{"url": f"https://{abs_host}/auth/openid/mobile-redirect", "matching_mode": "strict", "redirect_uri_type": "authorization"},
|
||||
{"url": "audiobookshelf://oauth", "matching_mode": "strict", "redirect_uri_type": "authorization"},
|
||||
],
|
||||
),
|
||||
)
|
||||
if created:
|
||||
abs_p.property_mappings.set(SCOPES)
|
||||
Application.objects.update_or_create(
|
||||
slug="audiobooks",
|
||||
defaults=dict(name="Audiobookshelf", provider=abs_p, meta_launch_url=f"https://{abs_host}"),
|
||||
)
|
||||
print(f"OIDC audiobooks: provider pk={abs_p.pk} created={created}")
|
||||
with open("/tmp/books-abs-oidc.env", "w") as f:
|
||||
f.write(f"ABS_OIDC_CLIENT_ID={abs_p.client_id}\nABS_OIDC_CLIENT_SECRET={abs_p.client_secret}\n")
|
||||
@@ -0,0 +1,62 @@
|
||||
# Books stack (chaptarr / CWA / audiobookshelf / storyteller)
|
||||
|
||||
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
|
||||
└─ audiobooks ─► /storage1/Media/Audiobooks ─► audiobookshelf
|
||||
storyteller reads both libraries :ro ─► /storage1/labdata/storyteller (aligned EPUB 3 + media overlays)
|
||||
```
|
||||
|
||||
| Service | Container:port | Host port | URL |
|
||||
|---|---|---|---|
|
||||
| chaptarr | `chaptarr:8789` | 8789 | https://chaptarr.ginnoir.com (forward_auth, `/api/*` bypass) |
|
||||
| calibre-web-automated | `calibre-web-automated:8083` | 8083 | https://books.ginnoir.com (forward_auth, `/opds*` + `/kobo/*` bypass) |
|
||||
| audiobookshelf | `audiobookshelf:80` | 13378 | https://audiobooks.ginnoir.com (native OIDC, LAN + tailnet only) |
|
||||
| storyteller | `storyteller:8001` | 8001 | https://storyteller.ginnoir.com (forward_auth, `/api/*` bypass) |
|
||||
|
||||
## 1. Host prep (before the first deploy) — done 2026-10-18
|
||||
|
||||
Docker creates missing bind dirs as `root:root`, which breaks chaptarr/CWA/ABS (PUID 1000).
|
||||
|
||||
```bash
|
||||
sudo mkdir -p /config/chaptarr /config/calibre-web-automated \
|
||||
/config/audiobookshelf/{config,metadata} \
|
||||
/storage1/Media/Books /storage1/Media/Audiobooks \
|
||||
/storage1/complete/books-ingest /storage1/labdata/storyteller
|
||||
sudo chown -R 1000:1000 /config/chaptarr /config/calibre-web-automated /config/audiobookshelf \
|
||||
/storage1/Media/Books /storage1/Media/Audiobooks \
|
||||
/storage1/complete/books-ingest /storage1/labdata/storyteller
|
||||
```
|
||||
|
||||
## 2. Authentik — providers done 2026-10-18
|
||||
|
||||
`scripts/run-books-auth.sh` creates everything below (idempotent, runs `scripts/setup-books-auth.py` through `ak shell`). **Done on 2026-10-18.**
|
||||
|
||||
- **chaptarr / books / storyteller (Pattern B):** proxy providers `homelab-{chaptarr,books,storyteller}` (pk 43–45). They're `forward_single`, cloned from `homelab-sonarr`, attached to the embedded outpost, and each has an app with the same slug.
|
||||
- **Audiobookshelf (Pattern A):** OIDC provider `homelab-audiobooks` (pk 46) plus app `audiobooks`. Its strict redirect URIs are `https://audiobooks.ginnoir.com/auth/openid/{callback,mobile-redirect}` and `audiobookshelf://oauth`. The client ID and secret are in `stack.env` (`ABS_OIDC_CLIENT_*`).
|
||||
**Still to do in the ABS UI** (it keeps OIDC settings in its own database): go to Settings → Authentication → OpenID Connect.
|
||||
- Issuer URL: `https://auth.ginnoir.com/application/o/audiobooks/`. Click *Auto-populate*, then paste the client ID and secret.
|
||||
- Allowed mobile redirect URIs: `audiobookshelf://oauth`.
|
||||
- Match existing users by username or email. Turn on auto-register if you want it.
|
||||
- **CWA single sign-on (optional).** In Admin → Edit Basic Configuration → Feature Configuration, turn on *Allow Reverse Proxy Authentication* and set the header to `X-Authentik-Username`. The CWA usernames must match the Authentik usernames.
|
||||
|
||||
## 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.
|
||||
- [ ] **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.
|
||||
- [ ] **CWA SMTP / Send-to-Kindle:** Admin → Edit Email Server Settings. Add the sender address to Amazon → *Manage Your Content and Devices* → *Personal Document Settings* → *Approved Personal Document E-mail List*. Set the user's Kindle email in their profile, then send the test book.
|
||||
- [ ] **audiobookshelf:** create the root user and add a library pointed at `/audiobooks`. Scan it, then sign in from the phone app over Tailscale.
|
||||
- [ ] **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.
|
||||
|
||||
## Notes
|
||||
|
||||
- `STORYTELLER_SECRET_KEY` is in `stack.env` (`secrets.token_hex(64)`). If you rotate it, every Storyteller session is logged out.
|
||||
- GPU: the `deploy:` block for the P100s is commented out in compose. When you turn it on, check upstream's GPU Acceleration docs for the CUDA image tag.
|
||||
- Chaptarr is young and runs on `:latest` with Watchtower. If an update breaks it, pin a tag and add `com.centurylabs.watchtower.enable=false`.
|
||||
@@ -196,6 +196,84 @@ services:
|
||||
ports:
|
||||
- "6971:6970"
|
||||
|
||||
# ============================================================ BOOKS
|
||||
# Prowlarr -> chaptarr -> qbittorrent/nzbget (/storage1/complete). Chaptarr
|
||||
# imports ebooks into the CWA ingest folder (CWA owns the Calibre library and
|
||||
# deletes ingested files) and audiobooks straight into the ABS library.
|
||||
# Storyteller reads both libraries read-only and writes aligned EPUBs to its
|
||||
# own /data. Readarr is retired upstream — do not add it.
|
||||
chaptarr:
|
||||
container_name: chaptarr
|
||||
image: chaptarr/chaptarr:latest
|
||||
restart: unless-stopped
|
||||
networks: [media, edge]
|
||||
env_file:
|
||||
- stack.env
|
||||
ulimits:
|
||||
nofile: { soft: 65536, hard: 65536 }
|
||||
environment:
|
||||
- UMASK=002
|
||||
volumes:
|
||||
- /config/chaptarr:/config
|
||||
- /storage1/complete:/downloads
|
||||
- /storage1/complete/books-ingest:/ebooks
|
||||
- /storage1/Media/Audiobooks:/audiobooks
|
||||
ports:
|
||||
- "8789:8789"
|
||||
|
||||
calibre-web-automated:
|
||||
container_name: calibre-web-automated
|
||||
image: crocodilestick/calibre-web-automated:latest
|
||||
restart: unless-stopped
|
||||
networks: [media, edge]
|
||||
env_file:
|
||||
- stack.env
|
||||
environment:
|
||||
- NETWORK_SHARE_MODE=false
|
||||
volumes:
|
||||
- /config/calibre-web-automated:/config
|
||||
- /storage1/complete/books-ingest:/cwa-book-ingest
|
||||
- /storage1/Media/Books:/calibre-library
|
||||
ports:
|
||||
- "8083:8083"
|
||||
|
||||
audiobookshelf:
|
||||
container_name: audiobookshelf
|
||||
image: ghcr.io/advplyr/audiobookshelf:latest
|
||||
restart: unless-stopped
|
||||
networks: [media, edge]
|
||||
env_file:
|
||||
- stack.env
|
||||
volumes:
|
||||
- /config/audiobookshelf/config:/config
|
||||
- /config/audiobookshelf/metadata:/metadata
|
||||
- /storage1/Media/Audiobooks:/audiobooks
|
||||
ports:
|
||||
- "13378:80"
|
||||
|
||||
storyteller:
|
||||
container_name: storyteller
|
||||
image: registry.gitlab.com/storyteller-platform/storyteller:latest
|
||||
restart: unless-stopped
|
||||
networks: [media, edge]
|
||||
env_file:
|
||||
- stack.env # STORYTELLER_SECRET_KEY lives here
|
||||
volumes:
|
||||
- /storage1/labdata/storyteller:/data
|
||||
- /storage1/Media/Books:/libraries/books:ro
|
||||
- /storage1/Media/Audiobooks:/libraries/audiobooks:ro
|
||||
ports:
|
||||
- "8001:8001"
|
||||
# Whisper runs on CPU until the P100s land. Then add (and check upstream's
|
||||
# GPU Acceleration docs for the CUDA image tag):
|
||||
# deploy:
|
||||
# resources:
|
||||
# reservations:
|
||||
# devices:
|
||||
# - driver: nvidia
|
||||
# count: 1
|
||||
# capabilities: [gpu]
|
||||
|
||||
networks:
|
||||
media:
|
||||
name: media
|
||||
|
||||
@@ -4,3 +4,11 @@
|
||||
TZ=America/Chicago
|
||||
PUID=1000
|
||||
PGID=1000
|
||||
|
||||
# storyteller — auth token signing key (secrets.token_hex(64))
|
||||
STORYTELLER_SECRET_KEY=5b41f526eb62c2fbe17527b65a0e71ff06d5927fbeb869541f52e812ba8366d28afe1ed26e9986853484995848e3a91ff2b0321ed583d9612af5d82005df22c9
|
||||
|
||||
# audiobookshelf — Authentik OIDC client (homelab-audiobooks, pk 46). Reference only:
|
||||
# ABS stores OIDC config in its own DB (Settings → Authentication).
|
||||
ABS_OIDC_CLIENT_ID=H617VXaM04KA0URJyWI52ThBpC3crIAZY77UYlzt
|
||||
ABS_OIDC_CLIENT_SECRET=1Tmw0PLw8CP82JX4Vz5nuOfpykh6XKngrU8a4Vspc6ZsIarJn3mG5GwKre1D5DnVqfF7MXbOc5g83lkR7NUcHPjlj3QgPX4BFnbUdl2r09LHrcH9X8CY4gJP0Sl1hdcr
|
||||
Reference in new issue
Block a user