Compare commits
53
Commits
a2813d3dc2
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
417cd3165f | ||
|
|
d51bad2277 | ||
|
|
977199b591 | ||
|
|
f433e40670 | ||
|
|
2a2b725145 | ||
|
|
be95108ed7 | ||
|
|
87800f8553 | ||
|
|
385e103dde | ||
|
|
d4ed52b29a | ||
|
|
fe0ff4a9d8 | ||
|
|
38f49fdc6b | ||
|
|
09ce938f6e | ||
|
|
4aea57a7d7 | ||
|
|
ca257000c8 | ||
|
|
4140fd49c8 | ||
|
|
62751a3b89 | ||
|
|
5c8b108f2b | ||
|
|
39b26e68d1 | ||
|
|
f0ce040ed2 | ||
|
|
57c9a22464 | ||
|
|
9a45d53048 | ||
|
|
a50849b766 | ||
|
|
247276af25 | ||
|
|
c76d24ac5b | ||
|
|
c53052daee | ||
|
|
1f77238e35 | ||
|
|
a09f7f6d52 | ||
|
|
17743dfdcf | ||
|
|
f51cc9c7e8 | ||
|
|
a7c34a7be4 | ||
|
|
032185e258 | ||
|
|
a92c417f03 | ||
|
|
6e9f75220a | ||
|
|
460ea266e5 | ||
|
|
cf0343c2f4 | ||
|
|
a510504c7f | ||
|
|
ac367cc707 | ||
|
|
6d8d34d996 | ||
|
|
e1fd7acce9 | ||
|
|
f92cad4d66 | ||
|
|
e0240d8e10 | ||
|
|
72688f48ac | ||
|
|
ca00f8899d | ||
|
|
601a9d8545 | ||
|
|
40b19c49f9 | ||
|
|
985a6ddc43 | ||
|
|
abf17cbf24 | ||
|
|
981c7a65b5 | ||
|
|
b78a8d51ad | ||
|
|
d6a331465e | ||
|
|
e8c311a452 | ||
|
|
73255da5fb | ||
|
|
22c861a228 |
No files matched your search
@@ -31,7 +31,7 @@ The first `Bash` of a session is gated by a GateGuard hook — state the user re
|
||||
| `notify` | `ntfy`, `freshrss`, `vigilant` |
|
||||
| `monitoring` | `uptime_kuma`, `homarr` |
|
||||
| `remote` | `hbbr`, `hbbs` |
|
||||
| `dev` | `gitea`, `code_server`, `bookstack`, `mariadb_bookstack`, `dbx`, `registry`, `postgres_gitea`, `postgres_plane`, `redis_plane`, `plane_minio`, `plane_api`, `plane_web`, `plane_worker`, `plane_beat`, `plane_create_bucket` |
|
||||
| `dev` | `gitea`, `code_server`, `bookstack`, `mariadb_bookstack`, `dbx`, `registry`, `postgres_gitea` |
|
||||
| management plane (raw compose at `~/valhalla-lab/portainer-compose.yml`, project name `valhalla-lab`) | `portainer`, `vault`, `github_runner`, `watchtower` |
|
||||
|
||||
## Common ops by container name
|
||||
|
||||
@@ -31,7 +31,7 @@ The first `Bash` of a session is gated by a GateGuard hook — state the user re
|
||||
| `notify` | `ntfy`, `freshrss`, `vigilant` |
|
||||
| `monitoring` | `uptime_kuma`, `homarr` |
|
||||
| `remote` | `hbbr`, `hbbs` |
|
||||
| `dev` | `gitea`, `code_server`, `bookstack`, `mariadb_bookstack`, `dbx`, `registry`, `postgres_gitea`, `postgres_plane`, `redis_plane`, `plane_minio`, `plane_api`, `plane_web`, `plane_worker`, `plane_beat`, `plane_create_bucket` |
|
||||
| `dev` | `gitea`, `code_server`, `bookstack`, `mariadb_bookstack`, `dbx`, `registry`, `postgres_gitea` |
|
||||
| management plane (raw compose at `~/valhalla-lab/portainer-compose.yml`, project name `valhalla-lab`) | `portainer`, `vault`, `github_runner`, `watchtower` |
|
||||
|
||||
## Common ops by container name
|
||||
|
||||
@@ -127,13 +127,6 @@ CODE_SERVER_PASSWORD=c0de_s3rver_pass
|
||||
BOOKSTACK_DB_PASSWORD=bookstack_d3v_pass
|
||||
BOOKSTACK_DB_ROOT_PASSWORD=bookstack_r00t_pass
|
||||
|
||||
# Plane project management
|
||||
# Rotate with: openssl rand -hex 32
|
||||
PLANE_SECRET_KEY=60gp0byfz2dvffa45cxl20p1scy9xbpf6d8c5y0geejgkyp1b52
|
||||
PLANE_DB_PASSWORD=plane_d3v_p4ss_8x3m
|
||||
PLANE_MINIO_USER=planeadmin
|
||||
PLANE_MINIO_PASSWORD=plane_minio_p4ss
|
||||
|
||||
# Vault unseal keys + root token (generated 2026-06-04 during init)
|
||||
# Need any 3 of 5 keys to unseal after a restart.
|
||||
# Re-unseal with: apply-compose.ps1 -VaultUnseal (or manually via SSH)
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
name: Build mcp-gateway image
|
||||
|
||||
# mcp-proxy + every homelab MCP server baked in at pinned versions (see
|
||||
# stacks/mcp/gateway/Dockerfile). Portainer only pulls, never builds, so the
|
||||
# image is built here and pushed to the self-hosted registry, same as the
|
||||
# romhacks orchestrator and urbackup. Compose (stacks/mcp) pulls :latest.
|
||||
#
|
||||
# Bump a server: edit its pin in the Dockerfile (or servers.json) and push.
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- stacks/mcp/gateway/**
|
||||
- .gitea/workflows/build-mcp-gateway.yml
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: build-mcp-gateway
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Ensure docker CLI + buildx
|
||||
run: |
|
||||
# See build-romhacks-orchestrator.yml: Debian's docker.io has no buildx plugin.
|
||||
if docker buildx version >/dev/null 2>&1; then
|
||||
docker version
|
||||
docker buildx version
|
||||
exit 0
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
apt-get update -qq
|
||||
apt-get install -y -qq ca-certificates curl gnupg
|
||||
install -m 0755 -d /etc/apt/keyrings
|
||||
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
|
||||
chmod a+r /etc/apt/keyrings/docker.asc
|
||||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" \
|
||||
> /etc/apt/sources.list.d/docker.list
|
||||
apt-get update -qq
|
||||
apt-get install -y -qq docker-ce-cli docker-buildx-plugin
|
||||
docker version
|
||||
docker buildx version
|
||||
|
||||
- name: Login to registry
|
||||
run: |
|
||||
# Only the two REGISTRY_PUSH_* keys from the committed .env (it also holds
|
||||
# vault unseal keys); password goes via stdin, never argv or the log.
|
||||
eval "$(grep -E '^REGISTRY_PUSH_(USERNAME|PASSWORD)=' ./.env | sed 's/^/export /')"
|
||||
if [ -z "${REGISTRY_PUSH_USERNAME:-}" ] || [ -z "${REGISTRY_PUSH_PASSWORD:-}" ]; then
|
||||
echo "REGISTRY_PUSH_USERNAME/PASSWORD missing from .env" >&2
|
||||
exit 1
|
||||
fi
|
||||
printf '%s' "$REGISTRY_PUSH_PASSWORD" | docker login registry.ginnoir.com \
|
||||
--username "$REGISTRY_PUSH_USERNAME" \
|
||||
--password-stdin
|
||||
|
||||
- name: Set up buildx
|
||||
run: |
|
||||
docker buildx create --name mcp-gateway-builder --use 2>/dev/null || docker buildx use mcp-gateway-builder
|
||||
docker buildx inspect --bootstrap
|
||||
|
||||
- name: Build and push image
|
||||
env:
|
||||
IMAGE: registry.ginnoir.com/ginnoir/mcp-gateway
|
||||
CACHE: registry.ginnoir.com/ginnoir/mcp-gateway:buildcache
|
||||
run: |
|
||||
SHA_TAG="sha-$(printf '%s' "$GITHUB_SHA" | cut -c1-7)"
|
||||
docker buildx build \
|
||||
--push \
|
||||
--tag "${IMAGE}:latest" \
|
||||
--tag "${IMAGE}:${SHA_TAG}" \
|
||||
--cache-from "type=registry,ref=${CACHE}" \
|
||||
--cache-to "type=registry,ref=${CACHE},mode=max" \
|
||||
stacks/mcp/gateway
|
||||
@@ -16,7 +16,7 @@ Deployment configuration for a **live, single-host Docker homelab** running on a
|
||||
.
|
||||
├── stacks/ # one directory per Portainer-managed application stack
|
||||
│ ├── proxy/ # caddy
|
||||
│ ├── media/ # *arr stack, deluge, qbittorrent, stash, ...
|
||||
│ ├── media/ # *arr stack, qbittorrent, cross-seed, autobrr, stash, ...
|
||||
│ ├── foundry/ # foundry, foundry2 (5etools is Caddy static files)
|
||||
│ ├── owncloud/ # owncloud + its mariadb + redis
|
||||
│ ├── resume/ # reactive-resume + its postgres + minio + chrome
|
||||
@@ -25,7 +25,9 @@ Deployment configuration for a **live, single-host Docker homelab** running on a
|
||||
│ ├── notify/ # ntfy, freshrss, vigilant
|
||||
│ ├── monitoring/ # uptime-kuma, homarr
|
||||
│ ├── remote/ # rustdesk hbbr + hbbs
|
||||
│ └── dev/ # code-server, bookstack, dbx, plane
|
||||
│ ├── dev/ # code-server, bookstack, dbx
|
||||
│ ├── cameras/ # neolink (Reolink E1 Baichuan→RTSP), frigate, frigate-notify
|
||||
│ └── mcp/ # mcp-gateway: all homelab MCP servers at mcp.ginnoir.com/servers/<name>/mcp (see its README)
|
||||
├── portainer-compose.yml # management plane (raw compose, not a Portainer stack)
|
||||
├── vault.hcl # vault config (deployed alongside portainer-compose.yml)
|
||||
├── Caddyfile # caddy config (deployed via Gitea Actions or -Caddy)
|
||||
@@ -196,7 +198,7 @@ These run on valhalla but are managed outside of Portainer/Docker.
|
||||
- `Caddyfile` proxies `matrix.ginnoir.com → localhost:8008`, but there is **no Matrix/Synapse service in compose** — it's external/legacy. Likewise `dev.ginnoir.com → 192.168.1.74:3000` points at a different LAN host.
|
||||
- `watchtower` auto-updates `:latest` images, so a running image can drift ahead of what the last `apply` pulled. **Infra images** (Postgres, MariaDB, Redis, MinIO, CouchDB, Caddy, Vault) are **version-pinned** in compose with `com.centurylabs.watchtower.enable=false`; bump tags manually every few months.
|
||||
- Line endings: `.gitattributes` forces **LF** so files stay Unix-clean. Pushing CRLF (especially `stack.env`) to the Linux host appends stray `\r` to values and breaks things.
|
||||
- **Caddyfile reloads** are handled by `.gitea/workflows/deploy-caddy.yml` (Gitea Actions, `valhalla-management-runner`). If Gitea Actions doesn't trigger, fall back to `apply-compose.ps1 -Caddy`. The GitHub workflow (`.github/workflows/deploy.yml`) is disabled.
|
||||
- **Caddyfile reloads** are handled by `.gitea/workflows/deploy-caddy.yml` (Gitea Actions). Either runner container can take the job: `gitea_runner` (registered in Gitea as `valhalla-dev-runner`; the `GITEA_RUNNER_NAME` env is only read at first registration) or `gitea_runner_ci` (`valhalla-ci-runner-2`), so check both containers' logs, or better, the run list in Gitea. A deploy takes ~25s from the **push** (Gitea activity feed), not from the commit time. If Gitea Actions doesn't trigger, fall back to `apply-compose.ps1 -Caddy`. The GitHub workflow (`.github/workflows/deploy.yml`) is disabled.
|
||||
- **famapp images** are built by Gitea Actions on `v*` tags and pushed to `registry.ginnoir.com/ginnoir/famapp`. Portainer pulls from the self-hosted registry (registered in Portainer as "Valhalla Registry").
|
||||
- **Portainer app stacks must have empty UI environment variables.** All stack config comes from `stack.env` via `env_file`. Run `scripts/check-portainer-stack-env.ps1` to verify before pushing.
|
||||
|
||||
|
||||
@@ -139,6 +139,10 @@ jellyfin.ginnoir.com {
|
||||
reverse_proxy jellyfin:8096
|
||||
}
|
||||
|
||||
jellyseerr.ginnoir.com {
|
||||
reverse_proxy jellyseerr:5055
|
||||
}
|
||||
|
||||
wizarr.ginnoir.com {
|
||||
reverse_proxy wizarr:5690
|
||||
}
|
||||
@@ -161,6 +165,24 @@ sonarr.ginnoir.com {
|
||||
}
|
||||
}
|
||||
|
||||
courarr.ginnoir.com {
|
||||
route {
|
||||
import internal_gate
|
||||
import authentik_outpost
|
||||
# API (X-Api-Key) and feeds (read by Sonarr) skip SSO; Courarr gates /api itself.
|
||||
handle /api/* {
|
||||
reverse_proxy courarr:6161
|
||||
}
|
||||
handle /feed/* {
|
||||
reverse_proxy courarr:6161
|
||||
}
|
||||
handle {
|
||||
import authentik_forward_auth
|
||||
reverse_proxy courarr:6161
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
radarr.ginnoir.com {
|
||||
route {
|
||||
import internal_gate
|
||||
@@ -275,6 +297,58 @@ stash.ginnoir.com {
|
||||
}
|
||||
}
|
||||
|
||||
# BOOKS — CWA / storyteller behind forward_auth; chaptarr + ABS use native OIDC
|
||||
# (forward_auth would break the ABS 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
|
||||
reverse_proxy chaptarr:8789
|
||||
}
|
||||
|
||||
# autobrr — native OIDC (Authentik homelab-autobrr), so no forward_auth.
|
||||
autobrr.ginnoir.com {
|
||||
import internal_only
|
||||
reverse_proxy autobrr:7474
|
||||
}
|
||||
|
||||
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
|
||||
@@ -417,6 +491,29 @@ uptime.ginnoir.com {
|
||||
}
|
||||
}
|
||||
|
||||
# Frigate (cameras stack): Reolink E1 live view + detection snapshots.
|
||||
# Frigate's own auth is off; it trusts X-Authentik-Username from forward_auth.
|
||||
# /ptz/ = static pan/tilt page (stacks/cameras/ptz → /config/caddy/site/cam-ptz);
|
||||
# /mqtt = its MQTT-over-websockets bus (mosquitto:8083, ACL-limited to PTZ topics).
|
||||
cam.ginnoir.com {
|
||||
import internal_only
|
||||
route {
|
||||
import authentik_outpost
|
||||
import authentik_forward_auth
|
||||
redir /ptz /ptz/
|
||||
handle_path /ptz/* {
|
||||
root * /srv/cam-ptz
|
||||
file_server
|
||||
}
|
||||
handle /mqtt {
|
||||
reverse_proxy mosquitto:8083
|
||||
}
|
||||
handle {
|
||||
reverse_proxy frigate:8971
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
homarr.ginnoir.com {
|
||||
import internal_only
|
||||
reverse_proxy homarr:7575
|
||||
@@ -561,32 +658,13 @@ docs.ginnoir.com {
|
||||
reverse_proxy bookstack:80
|
||||
}
|
||||
|
||||
plane.ginnoir.com {
|
||||
route {
|
||||
import authentik_outpost
|
||||
@plane_api {
|
||||
path /api/*
|
||||
header X-API-Key *
|
||||
}
|
||||
handle @plane_api {
|
||||
reverse_proxy plane_api:8000
|
||||
}
|
||||
handle /api/* {
|
||||
import authentik_forward_auth
|
||||
reverse_proxy plane_api:8000
|
||||
}
|
||||
handle /auth/* {
|
||||
import authentik_forward_auth
|
||||
reverse_proxy plane_api:8000
|
||||
}
|
||||
handle /god-mode/* {
|
||||
import authentik_forward_auth
|
||||
reverse_proxy plane_admin:3000
|
||||
}
|
||||
handle {
|
||||
import authentik_forward_auth
|
||||
reverse_proxy plane_web:3000
|
||||
}
|
||||
# MCP gateway (stacks/mcp). Bearer-token auth is enforced by mcp-proxy itself
|
||||
# (MCP_PROXY_AUTH_TOKEN); no Authentik — agents can't do a browser login.
|
||||
# flush_interval -1 so SSE / streamable-HTTP responses aren't buffered.
|
||||
mcp.ginnoir.com {
|
||||
import internal_only
|
||||
reverse_proxy mcp-gateway:8096 {
|
||||
flush_interval -1
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,12 +31,14 @@
|
||||
<DT><H3>STREAMING — public (replaces Plex's own remote access) (public)</H3>
|
||||
<DL><p>
|
||||
<DT><A HREF="https://jellyfin.ginnoir.com">jellyfin</A>
|
||||
<DT><A HREF="https://jellyseerr.ginnoir.com">jellyseerr</A>
|
||||
<DT><A HREF="https://wizarr.ginnoir.com">wizarr</A>
|
||||
</DL><p>
|
||||
|
||||
<DT><H3>MEDIA MANAGEMENT (public)</H3>
|
||||
<DL><p>
|
||||
<DT><A HREF="https://sonarr.ginnoir.com">sonarr</A>
|
||||
<DT><A HREF="https://courarr.ginnoir.com">courarr</A>
|
||||
<DT><A HREF="https://radarr.ginnoir.com">radarr</A>
|
||||
<DT><A HREF="https://bazarr.ginnoir.com">bazarr</A>
|
||||
<DT><A HREF="https://prowlarr.ginnoir.com">prowlarr</A>
|
||||
@@ -50,6 +52,11 @@
|
||||
<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://autobrr.ginnoir.com">autobrr [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>
|
||||
@@ -86,6 +93,7 @@
|
||||
<DL><p>
|
||||
<DT><A HREF="https://portainer.ginnoir.com">portainer</A>
|
||||
<DT><A HREF="https://uptime.ginnoir.com">uptime</A>
|
||||
<DT><A HREF="https://cam.ginnoir.com">cam [internal]</A>
|
||||
<DT><A HREF="https://homarr.ginnoir.com">homarr [internal]</A>
|
||||
<DT><A HREF="https://hermes.ginnoir.com">hermes</A>
|
||||
<DT><A HREF="https://webui.ginnoir.com">webui [internal]</A>
|
||||
@@ -104,7 +112,7 @@
|
||||
<DT><A HREF="https://dbx.ginnoir.com">dbx</A>
|
||||
<DT><A HREF="https://vault.ginnoir.com">vault</A>
|
||||
<DT><A HREF="https://docs.ginnoir.com">docs [internal]</A>
|
||||
<DT><A HREF="https://plane.ginnoir.com">plane</A>
|
||||
<DT><A HREF="https://mcp.ginnoir.com">mcp [internal]</A>
|
||||
<DT><A HREF="https://nextcloud.ginnoir.com">nextcloud [internal]</A>
|
||||
<DT><A HREF="https://office.ginnoir.com">office [internal]</A>
|
||||
</DL><p>
|
||||
|
||||
@@ -46,9 +46,15 @@
|
||||
<DT><A HREF="http://valhalla:5055">seerr</A>
|
||||
<DT><A HREF="http://valhalla:8181">tautulli</A>
|
||||
<DT><A HREF="http://valhalla:3232">qbittorrent :3232</A>
|
||||
<DT><A HREF="http://valhalla:6881">qbittorrent :6881 (TCP/UDP)</A>
|
||||
<DT><A HREF="http://valhalla:43817">qbittorrent :43817 (TCP/UDP)</A>
|
||||
<DT><A HREF="http://valhalla:7474">autobrr</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>
|
||||
<DT><A HREF="http://valhalla:6161">courarr</A>
|
||||
</DL><p>
|
||||
|
||||
<DT><H3>Monitoring</H3>
|
||||
@@ -113,6 +119,7 @@
|
||||
<DT><A HREF="http://valhalla:8096">jellyfin</A>
|
||||
<DT><A HREF="http://valhalla:3009">jellystat :3009</A>
|
||||
<DT><A HREF="http://valhalla:5690">wizarr</A>
|
||||
<DT><A HREF="http://valhalla:5056">jellyseerr :5056</A>
|
||||
</DL><p>
|
||||
|
||||
</DL><p>
|
||||
|
||||
@@ -0,0 +1,237 @@
|
||||
# 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.
|
||||
@@ -149,3 +149,48 @@ cam.ginnoir.com {
|
||||
5. An Uptime Kuma monitor exists and is green.
|
||||
6. `scripts/gen-bookmarks.ps1` regenerated, and the Portainer stack registered with empty
|
||||
UI env vars (`scripts/check-portainer-stack-env.ps1`).
|
||||
|
||||
---
|
||||
|
||||
## Addendum (2026-10-08): pan/tilt control page
|
||||
|
||||
Frigate's PTZ UI needs ONVIF, which the E1 lacks. Neolink exposes PTZ over MQTT, so:
|
||||
|
||||
```
|
||||
browser cam.ginnoir.com/ptz/ (static page, Authentik-gated)
|
||||
├─ video: go2rtc <video-stream> → wss://cam.ginnoir.com/live/mse/api/ws?src=e1 (Frigate)
|
||||
└─ MQTT over wss://cam.ginnoir.com/mqtt → mosquitto:8083 (websockets)
|
||||
│
|
||||
neolink (now `mqtt-rtsp`) ◄── mosquitto:1883 ────┘ topics neolink/e1/control/ptz[/preset]
|
||||
```
|
||||
|
||||
- **`mosquitto`**
|
||||
- `eclipse-mosquitto:2.0.22`, pinned, on the `cameras` + `edge` networks.
|
||||
- `per_listener_settings true`.
|
||||
- **:1883 (neolink):** password auth, user `neolink`.
|
||||
- **:8083 (websockets, browser via Caddy):** anonymous, but the ACL restricts anonymous
|
||||
clients to:
|
||||
- publish: `neolink/e1/control/ptz`, `neolink/e1/control/ptz/preset`,
|
||||
`neolink/e1/query/ptz/preset`
|
||||
- read: `neolink/e1/status`, `neolink/e1/status/ptz`, `neolink/status` (not `status/#`: preview flood)
|
||||
- **not** `neolink/config`, which echoes the camera password and can rewrite the live
|
||||
config.
|
||||
- Authentik forward_auth on the `/mqtt` path is the browser-side gate.
|
||||
- **neolink**
|
||||
- Command → `mqtt-rtsp`.
|
||||
- Preview, motion, and light MQTT features are disabled (preview would push a base64 JPEG
|
||||
every 2 s).
|
||||
- **Page**
|
||||
- `stacks/cameras/ptz/` (`index.html` + vendored `mqtt.min.js` 5.15.2 + go2rtc 1.9.10
|
||||
`video-rtc.js`/`video-stream.js`). Seeded to `/config/caddy/site/cam-ptz/`, which Caddy
|
||||
serves as `/srv/cam-ptz`.
|
||||
- Arrow pad (press-and-hold sends repeated moves), zoom in/out, a speed slider, a preset
|
||||
list (from `/query/ptz/preset`), and "save current as preset".
|
||||
- **Caddy** (inside the existing `cam.ginnoir.com` forward_auth route):
|
||||
- `handle_path /ptz/*` → file_server
|
||||
- `handle /mqtt` → `reverse_proxy mosquitto:8083`
|
||||
- everything else → frigate
|
||||
- **Verify:**
|
||||
- A `mosquitto_pub` of `left` from inside the network visibly pans the camera.
|
||||
- The page loads, video plays, and the arrows move the camera.
|
||||
- An anonymous subscribe to `neolink/config` is denied.
|
||||
@@ -1,6 +1,6 @@
|
||||
# TB-018 — Is Plane worth it?
|
||||
|
||||
**Status:** dropped
|
||||
**Status:** dropped — stack removed from repo + host 2026-10-26 (final dump in ~/plane-final-20261026 on valhalla)
|
||||
**Your call:** _(unset — talk first)_
|
||||
|
||||
---
|
||||
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# Creates the books-stack Authentik providers/apps (idempotent). Run on valhalla.
|
||||
# Copies the OIDC client ids/secrets out 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-oidc.env "${1:-./books-oidc.env}"
|
||||
docker exec authentik_server rm -f /tmp/books-oidc.env /tmp/setup-books-auth.py
|
||||
@@ -0,0 +1,131 @@
|
||||
# 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 books (CWA) / storyteller, cloned from
|
||||
# homelab-sonarr and attached to the embedded outpost (Pattern B)
|
||||
# - native OIDC providers for chaptarr + audiobookshelf (Pattern A)
|
||||
# Writes the OIDC client ids/secrets to /tmp/books-oidc.env in the container.
|
||||
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)
|
||||
("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}")
|
||||
|
||||
# chaptarr started on forward_auth; it has native OIDC, so drop the proxy provider.
|
||||
old = ProxyProvider.objects.filter(name="homelab-chaptarr").first()
|
||||
if old:
|
||||
outpost.providers.remove(old)
|
||||
old.delete()
|
||||
print("PROXY chaptarr: removed old forward_auth provider")
|
||||
|
||||
outpost.save() # nudge the embedded outpost to pick up provider changes
|
||||
|
||||
|
||||
def redirect(url):
|
||||
return {"url": url, "matching_mode": "strict", "redirect_uri_type": "authorization"}
|
||||
|
||||
|
||||
OIDC = [
|
||||
# (slug, app name, host, env prefix, redirect URIs)
|
||||
("chaptarr", "Chaptarr", "chaptarr.ginnoir.com", "CHAPTARR_OIDC", [
|
||||
redirect("https://chaptarr.ginnoir.com/signin-oidc"),
|
||||
]),
|
||||
("audiobooks", "Audiobookshelf", "audiobooks.ginnoir.com", "ABS_OIDC", [
|
||||
# ABS 2.2x+ serves under /audiobookshelf; keep the unprefixed pair too.
|
||||
redirect("https://audiobooks.ginnoir.com/audiobookshelf/auth/openid/callback"),
|
||||
redirect("https://audiobooks.ginnoir.com/audiobookshelf/auth/openid/mobile-redirect"),
|
||||
redirect("https://audiobooks.ginnoir.com/auth/openid/callback"),
|
||||
redirect("https://audiobooks.ginnoir.com/auth/openid/mobile-redirect"),
|
||||
redirect("audiobookshelf://oauth"),
|
||||
]),
|
||||
]
|
||||
|
||||
lines = []
|
||||
for slug, app_name, host, prefix, uris in OIDC:
|
||||
p, created = OAuth2Provider.objects.get_or_create(
|
||||
name=f"homelab-{slug}",
|
||||
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=uris,
|
||||
),
|
||||
)
|
||||
if created:
|
||||
p.property_mappings.set(SCOPES)
|
||||
if p._redirect_uris != uris:
|
||||
p._redirect_uris = uris
|
||||
p.save()
|
||||
print(f"OIDC {slug}: redirect URIs updated")
|
||||
Application.objects.update_or_create(
|
||||
slug=slug,
|
||||
defaults=dict(name=app_name, provider=p, meta_launch_url=f"https://{host}"),
|
||||
)
|
||||
print(f"OIDC {slug}: provider pk={p.pk} created={created}")
|
||||
lines += [f"{prefix}_CLIENT_ID={p.client_id}", f"{prefix}_CLIENT_SECRET={p.client_secret}"]
|
||||
|
||||
# chaptarr insists on email_verified=true, but authentik's default email
|
||||
# mapping hardcodes False. Give chaptarr its own email mapping, and bind the
|
||||
# app to ginnoir only so nobody can match the allowlist by editing their email.
|
||||
from authentik.core.models import User
|
||||
from authentik.policies.models import PolicyBinding
|
||||
from authentik.providers.oauth2.models import ScopeMapping
|
||||
|
||||
verified, _ = ScopeMapping.objects.update_or_create(
|
||||
name="homelab: OpenID 'email' (verified)",
|
||||
defaults=dict(
|
||||
scope_name="email",
|
||||
description="Email address (marked verified)",
|
||||
expression='return {"email": request.user.email, "email_verified": True}',
|
||||
),
|
||||
)
|
||||
ch = OAuth2Provider.objects.get(name="homelab-chaptarr")
|
||||
ch.property_mappings.set([SCOPES[0], SCOPES[2], verified.pk])
|
||||
ch_app = Application.objects.get(slug="chaptarr")
|
||||
PolicyBinding.objects.get_or_create(target=ch_app, user=User.objects.get(username="ginnoir"), defaults=dict(order=0))
|
||||
print(f"OIDC chaptarr: verified-email mapping + ginnoir-only binding")
|
||||
|
||||
with open("/tmp/books-oidc.env", "w") as f:
|
||||
f.write("\n".join(lines) + "\n")
|
||||
@@ -1,353 +0,0 @@
|
||||
# yaml-language-server: $schema=https://goauthentik.io/blueprints/schema.json
|
||||
# TB-006 batch 1 — forward-auth proxy providers for admin *.ginnoir.com sites.
|
||||
version: 1
|
||||
metadata:
|
||||
name: Homelab forward auth — admin batch 1
|
||||
labels:
|
||||
blueprints.goauthentik.io/instantiate: "true"
|
||||
|
||||
entries:
|
||||
- model: authentik_providers_proxy.proxyprovider
|
||||
state: present
|
||||
identifiers:
|
||||
name: homelab-portainer
|
||||
attrs:
|
||||
name: homelab-portainer
|
||||
mode: forward_single
|
||||
external_host: https://portainer.ginnoir.com
|
||||
access_token_validity: hours=24
|
||||
token_validity: hours=24
|
||||
refresh_token_validity: days=30
|
||||
intercept_header_auth: true
|
||||
internal_host_ssl_validation: true
|
||||
authorization_flow: !Find [authentik_flows.flow, [slug, default-provider-authorization-implicit-consent]]
|
||||
invalidation_flow: !Find [authentik_flows.flow, [slug, default-provider-invalidation-flow]]
|
||||
|
||||
- model: authentik_core.application
|
||||
state: present
|
||||
identifiers:
|
||||
slug: portainer
|
||||
attrs:
|
||||
name: Portainer
|
||||
slug: portainer
|
||||
meta_launch_url: https://portainer.ginnoir.com
|
||||
policy_engine_mode: any
|
||||
provider: !Find [authentik_providers_proxy.proxyprovider, [name, homelab-portainer]]
|
||||
|
||||
- model: authentik_providers_proxy.proxyprovider
|
||||
state: present
|
||||
identifiers:
|
||||
name: homelab-code
|
||||
attrs:
|
||||
name: homelab-code
|
||||
mode: forward_single
|
||||
external_host: https://code.ginnoir.com
|
||||
access_token_validity: hours=24
|
||||
token_validity: hours=24
|
||||
refresh_token_validity: days=30
|
||||
intercept_header_auth: true
|
||||
internal_host_ssl_validation: true
|
||||
authorization_flow: !Find [authentik_flows.flow, [slug, default-provider-authorization-implicit-consent]]
|
||||
invalidation_flow: !Find [authentik_flows.flow, [slug, default-provider-invalidation-flow]]
|
||||
|
||||
- model: authentik_core.application
|
||||
state: present
|
||||
identifiers:
|
||||
slug: code
|
||||
attrs:
|
||||
name: code-server
|
||||
slug: code
|
||||
meta_launch_url: https://code.ginnoir.com
|
||||
policy_engine_mode: any
|
||||
provider: !Find [authentik_providers_proxy.proxyprovider, [name, homelab-code]]
|
||||
|
||||
- model: authentik_providers_proxy.proxyprovider
|
||||
state: present
|
||||
identifiers:
|
||||
name: homelab-registry-ui
|
||||
attrs:
|
||||
name: homelab-registry-ui
|
||||
mode: forward_single
|
||||
external_host: https://registry-ui.ginnoir.com
|
||||
access_token_validity: hours=24
|
||||
token_validity: hours=24
|
||||
refresh_token_validity: days=30
|
||||
intercept_header_auth: true
|
||||
internal_host_ssl_validation: true
|
||||
authorization_flow: !Find [authentik_flows.flow, [slug, default-provider-authorization-implicit-consent]]
|
||||
invalidation_flow: !Find [authentik_flows.flow, [slug, default-provider-invalidation-flow]]
|
||||
|
||||
- model: authentik_core.application
|
||||
state: present
|
||||
identifiers:
|
||||
slug: registry-ui
|
||||
attrs:
|
||||
name: Registry UI
|
||||
slug: registry-ui
|
||||
meta_launch_url: https://registry-ui.ginnoir.com
|
||||
policy_engine_mode: any
|
||||
provider: !Find [authentik_providers_proxy.proxyprovider, [name, homelab-registry-ui]]
|
||||
|
||||
- model: authentik_providers_proxy.proxyprovider
|
||||
state: present
|
||||
identifiers:
|
||||
name: homelab-vault
|
||||
attrs:
|
||||
name: homelab-vault
|
||||
mode: forward_single
|
||||
external_host: https://vault.ginnoir.com
|
||||
access_token_validity: hours=24
|
||||
token_validity: hours=24
|
||||
refresh_token_validity: days=30
|
||||
intercept_header_auth: true
|
||||
internal_host_ssl_validation: true
|
||||
authorization_flow: !Find [authentik_flows.flow, [slug, default-provider-authorization-implicit-consent]]
|
||||
invalidation_flow: !Find [authentik_flows.flow, [slug, default-provider-invalidation-flow]]
|
||||
|
||||
- model: authentik_core.application
|
||||
state: present
|
||||
identifiers:
|
||||
slug: vault
|
||||
attrs:
|
||||
name: Vault
|
||||
slug: vault
|
||||
meta_launch_url: https://vault.ginnoir.com
|
||||
policy_engine_mode: any
|
||||
provider: !Find [authentik_providers_proxy.proxyprovider, [name, homelab-vault]]
|
||||
|
||||
- model: authentik_providers_proxy.proxyprovider
|
||||
state: present
|
||||
identifiers:
|
||||
name: homelab-minio
|
||||
attrs:
|
||||
name: homelab-minio
|
||||
mode: forward_single
|
||||
external_host: https://minio.ginnoir.com
|
||||
access_token_validity: hours=24
|
||||
token_validity: hours=24
|
||||
refresh_token_validity: days=30
|
||||
intercept_header_auth: true
|
||||
internal_host_ssl_validation: true
|
||||
authorization_flow: !Find [authentik_flows.flow, [slug, default-provider-authorization-implicit-consent]]
|
||||
invalidation_flow: !Find [authentik_flows.flow, [slug, default-provider-invalidation-flow]]
|
||||
|
||||
- model: authentik_core.application
|
||||
state: present
|
||||
identifiers:
|
||||
slug: minio
|
||||
attrs:
|
||||
name: MinIO Console
|
||||
slug: minio
|
||||
meta_launch_url: https://minio.ginnoir.com
|
||||
policy_engine_mode: any
|
||||
provider: !Find [authentik_providers_proxy.proxyprovider, [name, homelab-minio]]
|
||||
|
||||
- model: authentik_providers_proxy.proxyprovider
|
||||
state: present
|
||||
identifiers:
|
||||
name: homelab-homarr
|
||||
attrs:
|
||||
name: homelab-homarr
|
||||
mode: forward_single
|
||||
external_host: https://homarr.ginnoir.com
|
||||
access_token_validity: hours=24
|
||||
token_validity: hours=24
|
||||
refresh_token_validity: days=30
|
||||
intercept_header_auth: true
|
||||
internal_host_ssl_validation: true
|
||||
authorization_flow: !Find [authentik_flows.flow, [slug, default-provider-authorization-implicit-consent]]
|
||||
invalidation_flow: !Find [authentik_flows.flow, [slug, default-provider-invalidation-flow]]
|
||||
|
||||
- model: authentik_core.application
|
||||
state: present
|
||||
identifiers:
|
||||
slug: homarr
|
||||
attrs:
|
||||
name: Homarr
|
||||
slug: homarr
|
||||
meta_launch_url: https://homarr.ginnoir.com
|
||||
policy_engine_mode: any
|
||||
provider: !Find [authentik_providers_proxy.proxyprovider, [name, homelab-homarr]]
|
||||
|
||||
- model: authentik_providers_proxy.proxyprovider
|
||||
state: present
|
||||
identifiers:
|
||||
name: homelab-uptime
|
||||
attrs:
|
||||
name: homelab-uptime
|
||||
mode: forward_single
|
||||
external_host: https://uptime.ginnoir.com
|
||||
access_token_validity: hours=24
|
||||
token_validity: hours=24
|
||||
refresh_token_validity: days=30
|
||||
intercept_header_auth: true
|
||||
internal_host_ssl_validation: true
|
||||
authorization_flow: !Find [authentik_flows.flow, [slug, default-provider-authorization-implicit-consent]]
|
||||
invalidation_flow: !Find [authentik_flows.flow, [slug, default-provider-invalidation-flow]]
|
||||
|
||||
- model: authentik_core.application
|
||||
state: present
|
||||
identifiers:
|
||||
slug: uptime
|
||||
attrs:
|
||||
name: Uptime Kuma
|
||||
slug: uptime
|
||||
meta_launch_url: https://uptime.ginnoir.com
|
||||
policy_engine_mode: any
|
||||
provider: !Find [authentik_providers_proxy.proxyprovider, [name, homelab-uptime]]
|
||||
|
||||
- model: authentik_providers_proxy.proxyprovider
|
||||
state: present
|
||||
identifiers:
|
||||
name: homelab-backup
|
||||
attrs:
|
||||
name: homelab-backup
|
||||
mode: forward_single
|
||||
external_host: https://backup.ginnoir.com
|
||||
access_token_validity: hours=24
|
||||
token_validity: hours=24
|
||||
refresh_token_validity: days=30
|
||||
intercept_header_auth: true
|
||||
internal_host_ssl_validation: true
|
||||
authorization_flow: !Find [authentik_flows.flow, [slug, default-provider-authorization-implicit-consent]]
|
||||
invalidation_flow: !Find [authentik_flows.flow, [slug, default-provider-invalidation-flow]]
|
||||
|
||||
- model: authentik_core.application
|
||||
state: present
|
||||
identifiers:
|
||||
slug: backup
|
||||
attrs:
|
||||
name: Kopia
|
||||
slug: backup
|
||||
meta_launch_url: https://backup.ginnoir.com
|
||||
policy_engine_mode: any
|
||||
provider: !Find [authentik_providers_proxy.proxyprovider, [name, homelab-backup]]
|
||||
|
||||
- model: authentik_providers_proxy.proxyprovider
|
||||
state: present
|
||||
identifiers:
|
||||
name: homelab-gitea
|
||||
attrs:
|
||||
name: homelab-gitea
|
||||
mode: forward_single
|
||||
external_host: https://gitea.ginnoir.com
|
||||
access_token_validity: hours=24
|
||||
token_validity: hours=24
|
||||
refresh_token_validity: days=30
|
||||
intercept_header_auth: true
|
||||
internal_host_ssl_validation: true
|
||||
authorization_flow: !Find [authentik_flows.flow, [slug, default-provider-authorization-implicit-consent]]
|
||||
invalidation_flow: !Find [authentik_flows.flow, [slug, default-provider-invalidation-flow]]
|
||||
|
||||
- model: authentik_core.application
|
||||
state: present
|
||||
identifiers:
|
||||
slug: gitea
|
||||
attrs:
|
||||
name: Gitea
|
||||
slug: gitea
|
||||
meta_launch_url: https://gitea.ginnoir.com
|
||||
policy_engine_mode: any
|
||||
provider: !Find [authentik_providers_proxy.proxyprovider, [name, homelab-gitea]]
|
||||
|
||||
- model: authentik_providers_proxy.proxyprovider
|
||||
state: present
|
||||
identifiers:
|
||||
name: homelab-dbx
|
||||
attrs:
|
||||
name: homelab-dbx
|
||||
mode: forward_single
|
||||
external_host: https://dbx.ginnoir.com
|
||||
access_token_validity: hours=24
|
||||
token_validity: hours=24
|
||||
refresh_token_validity: days=30
|
||||
intercept_header_auth: true
|
||||
internal_host_ssl_validation: true
|
||||
authorization_flow: !Find [authentik_flows.flow, [slug, default-provider-authorization-implicit-consent]]
|
||||
invalidation_flow: !Find [authentik_flows.flow, [slug, default-provider-invalidation-flow]]
|
||||
|
||||
- model: authentik_core.application
|
||||
state: present
|
||||
identifiers:
|
||||
slug: dbx
|
||||
attrs:
|
||||
name: DBX
|
||||
slug: dbx
|
||||
meta_launch_url: https://dbx.ginnoir.com
|
||||
policy_engine_mode: any
|
||||
provider: !Find [authentik_providers_proxy.proxyprovider, [name, homelab-dbx]]
|
||||
|
||||
- model: authentik_providers_proxy.proxyprovider
|
||||
state: present
|
||||
identifiers:
|
||||
name: homelab-bookstack
|
||||
attrs:
|
||||
name: homelab-bookstack
|
||||
mode: forward_single
|
||||
external_host: https://docs.ginnoir.com
|
||||
access_token_validity: hours=24
|
||||
token_validity: hours=24
|
||||
refresh_token_validity: days=30
|
||||
intercept_header_auth: true
|
||||
internal_host_ssl_validation: true
|
||||
authorization_flow: !Find [authentik_flows.flow, [slug, default-provider-authorization-implicit-consent]]
|
||||
invalidation_flow: !Find [authentik_flows.flow, [slug, default-provider-invalidation-flow]]
|
||||
|
||||
- model: authentik_core.application
|
||||
state: present
|
||||
identifiers:
|
||||
slug: bookstack
|
||||
attrs:
|
||||
name: BookStack
|
||||
slug: bookstack
|
||||
meta_launch_url: https://docs.ginnoir.com
|
||||
policy_engine_mode: any
|
||||
provider: !Find [authentik_providers_proxy.proxyprovider, [name, homelab-bookstack]]
|
||||
|
||||
- model: authentik_providers_proxy.proxyprovider
|
||||
state: present
|
||||
identifiers:
|
||||
name: homelab-plane
|
||||
attrs:
|
||||
name: homelab-plane
|
||||
mode: forward_single
|
||||
external_host: https://plane.ginnoir.com
|
||||
access_token_validity: hours=24
|
||||
token_validity: hours=24
|
||||
refresh_token_validity: days=30
|
||||
intercept_header_auth: true
|
||||
internal_host_ssl_validation: true
|
||||
authorization_flow: !Find [authentik_flows.flow, [slug, default-provider-authorization-implicit-consent]]
|
||||
invalidation_flow: !Find [authentik_flows.flow, [slug, default-provider-invalidation-flow]]
|
||||
|
||||
- model: authentik_core.application
|
||||
state: present
|
||||
identifiers:
|
||||
slug: plane
|
||||
attrs:
|
||||
name: Plane
|
||||
slug: plane
|
||||
meta_launch_url: https://plane.ginnoir.com
|
||||
policy_engine_mode: any
|
||||
provider: !Find [authentik_providers_proxy.proxyprovider, [name, homelab-plane]]
|
||||
|
||||
- model: authentik_outposts.outpost
|
||||
state: present
|
||||
identifiers:
|
||||
name: authentik Embedded Outpost
|
||||
attrs:
|
||||
name: authentik Embedded Outpost
|
||||
type: proxy
|
||||
providers:
|
||||
- !Find [authentik_providers_proxy.proxyprovider, [name, homelab-portainer]]
|
||||
- !Find [authentik_providers_proxy.proxyprovider, [name, homelab-code]]
|
||||
- !Find [authentik_providers_proxy.proxyprovider, [name, homelab-registry-ui]]
|
||||
- !Find [authentik_providers_proxy.proxyprovider, [name, homelab-vault]]
|
||||
- !Find [authentik_providers_proxy.proxyprovider, [name, homelab-minio]]
|
||||
- !Find [authentik_providers_proxy.proxyprovider, [name, homelab-homarr]]
|
||||
- !Find [authentik_providers_proxy.proxyprovider, [name, homelab-uptime]]
|
||||
- !Find [authentik_providers_proxy.proxyprovider, [name, homelab-backup]]
|
||||
- !Find [authentik_providers_proxy.proxyprovider, [name, homelab-gitea]]
|
||||
- !Find [authentik_providers_proxy.proxyprovider, [name, homelab-dbx]]
|
||||
- !Find [authentik_providers_proxy.proxyprovider, [name, homelab-bookstack]]
|
||||
- !Find [authentik_providers_proxy.proxyprovider, [name, homelab-plane]]
|
||||
@@ -19,8 +19,10 @@ services:
|
||||
AUTHENTIK_REDIS__HOST: authentik-redis
|
||||
AUTHENTIK_POSTGRESQL__HOST: authentik-db
|
||||
AUTHENTIK_ERROR_REPORTING__ENABLED: "false"
|
||||
volumes:
|
||||
- ./blueprints:/blueprints/custom:ro
|
||||
# No custom blueprints: providers/apps are managed via the Authentik API and
|
||||
# the DB is the source of truth. The old ./blueprints mount resolved to
|
||||
# Portainer's internal /data/compose/17/... (empty on the host), and the
|
||||
# June snapshot it held would have stripped the embedded outpost to 11 providers.
|
||||
ports:
|
||||
- "9200:9000"
|
||||
logging:
|
||||
|
||||
@@ -28,7 +28,6 @@ SITES = [
|
||||
("homelab-uptime", "uptime", "Uptime Kuma", "https://uptime.ginnoir.com", "http://uptime-kuma:3001", UPTIME_UNAUTH),
|
||||
("homelab-backup", "backup", "Kopia", "https://backup.ginnoir.com", None, None),
|
||||
("homelab-dbx", "dbx", "DBX", "https://dbx.ginnoir.com", None, None),
|
||||
("homelab-plane", "plane", "Plane", "https://plane.ginnoir.com", None, None),
|
||||
# Batch 2 — media *arr stack (internal_only + forward_auth at Caddy)
|
||||
("homelab-sonarr", "sonarr", "Sonarr", "https://sonarr.ginnoir.com", None, None),
|
||||
("homelab-radarr", "radarr", "Radarr", "https://radarr.ginnoir.com", None, None),
|
||||
|
||||
@@ -24,7 +24,6 @@ SITES = [
|
||||
("homelab-uptime", "uptime", "Uptime Kuma", "https://uptime.ginnoir.com", "http://uptime-kuma:3001", UPTIME_UNAUTH),
|
||||
("homelab-backup", "backup", "Kopia", "https://backup.ginnoir.com", None, None),
|
||||
("homelab-dbx", "dbx", "DBX", "https://dbx.ginnoir.com", None, None),
|
||||
("homelab-plane", "plane", "Plane", "https://plane.ginnoir.com", None, None),
|
||||
# Batch 2 — media
|
||||
("homelab-sonarr", "sonarr", "Sonarr", "https://sonarr.ginnoir.com", None, None),
|
||||
("homelab-radarr", "radarr", "Radarr", "https://radarr.ginnoir.com", None, None),
|
||||
|
||||
+13
-2
@@ -32,8 +32,19 @@ Kopia → Backblaze B2. Backs up `/config`, **selected** `labdata` paths (see `S
|
||||
|
||||
| Time | What |
|
||||
|------|------|
|
||||
| 02:50 | `backup-dump-databases.sh` — SQL dumps |
|
||||
| 03:00 | Kopia snapshots (paths in `snapshot-paths.txt`) |
|
||||
| 02:50 | `backup-dump-databases.sh` — SQL dumps (`backup_scheduler` cron) |
|
||||
| 03:00 | Kopia snapshots — kopia server's own policy schedule (paths in `snapshot-paths.txt`) |
|
||||
| hh:15 | `backup-check-freshness.sh` — pushes to Uptime Kuma monitor **Backups fresh** |
|
||||
|
||||
## Alerting
|
||||
|
||||
`backup-check-freshness.sh` runs hourly and pushes UP/DOWN to the Uptime Kuma push monitor
|
||||
"Backups fresh (kopia + SQL dumps)" (`KUMA_PUSH_URL` in `stack.env`). DOWN when any Kopia source
|
||||
or the newest SQL dump is older than 26h, or a dump file is a near-empty stub. Kuma also goes
|
||||
DOWN if no push arrives for 2h (scheduler dead, kopia crash-looping), and notifies via ntfy.
|
||||
|
||||
`backup-run-snapshots.sh` is for manual runs only — cron'ing it would duplicate the server's
|
||||
scheduled uploads.
|
||||
|
||||
## If B2 creds are empty
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ Legacy pre-RomM tree (EmuDeck, ES-DE, 13T `roms/`, symlinks). **Not backed up of
|
||||
| Path | Why |
|
||||
|------|-----|
|
||||
| `gitea/repositories`, `gitea/lfs` | Git + LFS |
|
||||
| `famapp/minio`, `resume/minio`, `plane/minio` | User uploads |
|
||||
| `famapp/minio`, `resume/minio` | User uploads |
|
||||
| `romhacks/metadata`, `romhacks/library` | Catalog work + guides/spreadsheets |
|
||||
| `romm/assets` | Saves (see RomM above) |
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# min hour day month weekday command
|
||||
# Kopia snapshots run on the kopia server's own policy schedule (03:00, see init-kopia.sh);
|
||||
# backup-run-snapshots.sh is kept for manual runs only — cron'ing it duplicates those uploads.
|
||||
50 2 * * * /bin/sh /scripts/backup-dump-databases.sh
|
||||
0 3 * * * /bin/sh /scripts/backup-run-snapshots.sh
|
||||
15 * * * * /bin/sh /scripts/backup-check-freshness.sh
|
||||
@@ -32,7 +32,6 @@ services:
|
||||
- /storage1/labdata/gitea/lfs:/backup/labdata/gitea/lfs:ro
|
||||
- /storage1/labdata/famapp/minio:/backup/labdata/famapp/minio:ro
|
||||
- /storage1/labdata/resume/minio:/backup/labdata/resume/minio:ro
|
||||
- /storage1/labdata/plane/minio:/backup/labdata/plane/minio:ro
|
||||
- /storage1/labdata/romhacks/metadata:/backup/labdata/romhacks/metadata:ro
|
||||
- /storage1/labdata/romhacks/library:/backup/labdata/romhacks/library:ro
|
||||
- /storage1/labdata/romm/assets:/backup/labdata/romm/assets:ro
|
||||
@@ -48,7 +47,7 @@ services:
|
||||
container_name: backup_scheduler
|
||||
image: alpine:3.20
|
||||
restart: unless-stopped
|
||||
networks: [backup]
|
||||
networks: [backup, edge] # edge: push heartbeats to uptime_kuma:3001
|
||||
env_file:
|
||||
- stack.env
|
||||
volumes:
|
||||
@@ -56,14 +55,19 @@ services:
|
||||
- /config/backup/dumps:/dumps
|
||||
- /config/backup/scripts/backup-dump-databases.sh:/scripts/backup-dump-databases.sh:ro
|
||||
- /config/backup/scripts/backup-run-snapshots.sh:/scripts/backup-run-snapshots.sh:ro
|
||||
- /config/backup/scripts/backup-check-freshness.sh:/scripts/backup-check-freshness.sh:ro
|
||||
- /config/backup/snapshot-paths.txt:/snapshot-paths.txt:ro
|
||||
- /config/backup/crontab:/etc/crontab:ro
|
||||
# busybox crond reads <dir>/<user> and SILENTLY skips a crontab not owned by root;
|
||||
# the host file is ginnoir-owned, so it's copied in root-owned at startup (below)
|
||||
- /config/backup/crontab:/crontab.src:ro
|
||||
entrypoint: ["/bin/sh", "-c"]
|
||||
command:
|
||||
- |
|
||||
apk add --no-cache docker-cli curl tzdata >/dev/null
|
||||
printenv | grep -E '^(NTFY_|TZ=)' > /etc/backup.env || true
|
||||
crond -f -l 8 -c /etc
|
||||
apk add --no-cache docker-cli curl jq tzdata >/dev/null
|
||||
# crond jobs get a bare env; scripts source this instead
|
||||
printenv | grep -E '^(NTFY_|KUMA_|KOPIA_REPOSITORY_PASSWORD=|TZ=)' | sed "s/=\(.*\)/='\1'/" > /etc/backup.env || true
|
||||
install -o root -g root -m 600 /crontab.src /etc/crontabs/root
|
||||
crond -f -l 8 -c /etc/crontabs
|
||||
depends_on:
|
||||
- kopia
|
||||
|
||||
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
#!/bin/sh
|
||||
# Hourly dead-man check: every Kopia source in snapshot-paths.txt and the newest
|
||||
# SQL dump must be younger than MAX_AGE_HOURS. Pushes UP/DOWN to the Uptime Kuma
|
||||
# push monitor "Backups fresh"; Kuma also alerts (via ntfy) if no push arrives
|
||||
# for 2h, so a dead scheduler or crash-looping kopia is caught too.
|
||||
# Runs inside backup_scheduler; needs docker.sock + jq.
|
||||
set -u
|
||||
|
||||
[ -f /etc/backup.env ] && . /etc/backup.env
|
||||
|
||||
MAX_AGE_HOURS="${MAX_AGE_HOURS:-26}"
|
||||
KOPIA_PASSWORD="${KOPIA_REPOSITORY_PASSWORD:-}"
|
||||
PROBLEMS=""
|
||||
|
||||
problem() { PROBLEMS="${PROBLEMS:+${PROBLEMS}; }$*"; }
|
||||
|
||||
push() {
|
||||
status="$1"
|
||||
msg=$(printf '%s' "$2" | jq -sRr @uri)
|
||||
curl -sf -m 20 "${KUMA_PUSH_URL}?status=${status}&msg=${msg}" >/dev/null 2>&1 || echo "kuma push failed"
|
||||
}
|
||||
|
||||
# --- Kopia snapshots ---------------------------------------------------------
|
||||
if ! SNAPS=$(docker exec -e KOPIA_PASSWORD="${KOPIA_PASSWORD}" -e KOPIA_CONFIG_PATH=/app/config/repository.config \
|
||||
kopia kopia snapshot list --all --json 2>/dev/null); then
|
||||
problem "kopia: cannot list snapshots (container down or repo unreadable)"
|
||||
else
|
||||
while IFS= read -r path || [ -n "${path}" ]; do
|
||||
case "${path}" in ''|\#*) continue ;; esac
|
||||
age=$(printf '%s' "${SNAPS}" | jq -r --arg p "${path}" '
|
||||
[.[] | select(.source.path == $p) | .startTime | sub("\\.[0-9]+"; "") | fromdateiso8601]
|
||||
| if length == 0 then "none" else ((now - max) / 3600 | floor) end')
|
||||
if [ "${age}" = "none" ]; then
|
||||
problem "kopia ${path}: no snapshots"
|
||||
elif [ "${age}" -ge "${MAX_AGE_HOURS}" ]; then
|
||||
problem "kopia ${path}: ${age}h old"
|
||||
fi
|
||||
done < /snapshot-paths.txt
|
||||
fi
|
||||
|
||||
# --- SQL dumps ---------------------------------------------------------------
|
||||
NEWEST=$(find /dumps -mindepth 1 -maxdepth 1 -type d -name '2*' | sort | tail -1)
|
||||
if [ -z "${NEWEST}" ]; then
|
||||
problem "dumps: none found"
|
||||
else
|
||||
age=$(( ($(date +%s) - $(stat -c %Y "${NEWEST}")) / 3600 ))
|
||||
[ "${age}" -ge "${MAX_AGE_HOURS}" ] && problem "dumps: newest is ${age}h old"
|
||||
# pg_dump/mariadb-dump failures still leave a gzip stub (no pipefail in sh)
|
||||
tiny=$(find "${NEWEST}" -name '*.sql.gz' -size -1k -exec basename {} \; | tr '\n' ' ')
|
||||
[ -n "${tiny}" ] && problem "dumps: suspiciously small: ${tiny}"
|
||||
fi
|
||||
|
||||
if [ -z "${PROBLEMS}" ]; then
|
||||
echo "backup-check: OK"
|
||||
push up "OK"
|
||||
else
|
||||
echo "backup-check: ${PROBLEMS}"
|
||||
push down "${PROBLEMS}"
|
||||
exit 1
|
||||
fi
|
||||
@@ -23,16 +23,21 @@ dump_postgres() {
|
||||
}
|
||||
|
||||
# user: root (default) or app account (e.g. bookstack — root password may not match env)
|
||||
# pwvar: optional name of the container env var holding that user's password
|
||||
dump_mariadb() {
|
||||
name="$1"
|
||||
db="$2"
|
||||
user="${3:-root}"
|
||||
pwvar="${4:-}"
|
||||
if ! docker ps --format '{{.Names}}' | grep -qx "${name}"; then
|
||||
log "skip ${name} (not running)"
|
||||
return 0
|
||||
fi
|
||||
log "dump ${name} → ${db} (as ${user})"
|
||||
if [ "${user}" = "root" ]; then
|
||||
if [ -n "${pwvar}" ]; then
|
||||
docker exec "${name}" sh -c "mariadb-dump -u \"${user}\" -p\"\${${pwvar}}\" \"${db}\"" \
|
||||
| gzip -c > "${DIR}/${name}.sql.gz"
|
||||
elif [ "${user}" = "root" ]; then
|
||||
docker exec "${name}" sh -c "mariadb-dump -u root -p\"\${MARIADB_ROOT_PASSWORD:-\$MYSQL_ROOT_PASSWORD}\" \"${db}\"" \
|
||||
| gzip -c > "${DIR}/${name}.sql.gz"
|
||||
else
|
||||
@@ -44,12 +49,13 @@ dump_mariadb() {
|
||||
log "starting database dumps → ${DIR}"
|
||||
|
||||
dump_postgres postgres_gitea gitea gitea
|
||||
dump_postgres postgres_plane plane plane
|
||||
dump_postgres postgres_authentik authentik authentik
|
||||
dump_postgres postgres_famapp famapp famapp
|
||||
dump_postgres postgres_resume postgres postgres
|
||||
dump_postgres immich-postgres immich immich
|
||||
dump_postgres nextcloud-postgres nextcloud nextcloud
|
||||
|
||||
dump_mariadb mariadb_bookstack bookstack bookstack
|
||||
dump_mariadb mariadb_bookstack bookstack bookstack BOOKSTACK_DB_PASSWORD
|
||||
dump_mariadb owncloud_mariadb owncloud
|
||||
dump_mariadb romm-db romm
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
/backup/labdata/gitea/lfs
|
||||
/backup/labdata/famapp/minio
|
||||
/backup/labdata/resume/minio
|
||||
/backup/labdata/plane/minio
|
||||
/backup/labdata/romhacks/metadata
|
||||
/backup/labdata/romhacks/library
|
||||
/backup/labdata/romm/assets
|
||||
@@ -13,3 +13,6 @@ B2_ENDPOINT=s3.us-west-004.backblazeb2.com
|
||||
# ntfy alerts (same pattern as watchtower)
|
||||
NTFY_URL=https://ntfy.ginnoir.com/backup
|
||||
NTFY_TITLE=ValhallaBackup
|
||||
|
||||
# Uptime Kuma push monitor "Backups fresh" (id 73) — backup-check-freshness.sh
|
||||
KUMA_PUSH_URL=http://uptime_kuma:3001/api/push/GTUcqAMJs5k5AfPq940NkEdM
|
||||
@@ -1,4 +1,4 @@
|
||||
# cameras stack — Reolink E1 live view + detection snapshots.
|
||||
# cameras stack — Reolink E1 live view + PTZ page.
|
||||
#
|
||||
# The E1 (192.168.1.99) has NO RTSP/RTMP/ONVIF: only Reolink's Baichuan protocol on its
|
||||
# media port (9001 — set in the Reolink app; neolink breaks if it changes). neolink logs
|
||||
@@ -6,14 +6,32 @@
|
||||
# cameras net (unauthenticated, so it is never on edge). frigate's built-in go2rtc is the
|
||||
# only neolink client; the browser gets MSE through Caddy (cam.ginnoir.com).
|
||||
#
|
||||
# Recording is OFF — snapshots only (/storage1/labdata/frigate). Detection is OpenVINO on
|
||||
# CPU, deliberately not the P100 (llama-swap owns its VRAM; CDI breaks after reboots).
|
||||
# Recording, snapshots and detection are OFF since 2026-10-26 (live view only). The
|
||||
# detector is still declared as OpenVINO on CPU, deliberately not the P100 (llama-swap owns
|
||||
# its VRAM; CDI breaks after reboots), and only runs if detect is re-enabled.
|
||||
#
|
||||
# Configs are host-managed at /config/<svc>/ (Portainer's checkout won't materialize a
|
||||
# relative repo-file bind). The copies under stacks/cameras/*/ are canonical; on change,
|
||||
# copy them to valhalla (see homelab-apply). All images pinned out of Watchtower:
|
||||
# frigate's config schema breaks between minor releases.
|
||||
#
|
||||
# PTZ: the E1 has no ONVIF, so Frigate can't drive it. neolink runs `mqtt-rtsp` and takes
|
||||
# pan/tilt/zoom/preset commands on mosquitto (neolink/e1/control/ptz...). The static page
|
||||
# cam.ginnoir.com/ptz/ (stacks/cameras/ptz, served by Caddy from /config/caddy/site/cam-ptz)
|
||||
# publishes them over MQTT-websockets at cam.ginnoir.com/mqtt -> mosquitto:8083.
|
||||
services:
|
||||
mosquitto:
|
||||
image: eclipse-mosquitto:2.0.22
|
||||
container_name: mosquitto
|
||||
restart: unless-stopped
|
||||
labels:
|
||||
- "com.centurylabs.watchtower.enable=false"
|
||||
env_file: stack.env
|
||||
# cameras -> neolink on :1883; edge -> Caddy proxies /mqtt to :8083 (websockets)
|
||||
networks: [cameras, edge]
|
||||
volumes:
|
||||
- /config/mosquitto:/mosquitto/config:ro
|
||||
|
||||
neolink:
|
||||
image: quantumentangledandy/neolink:v0.6.2
|
||||
container_name: neolink
|
||||
@@ -21,9 +39,32 @@ services:
|
||||
labels:
|
||||
- "com.centurylabs.watchtower.enable=false"
|
||||
env_file: stack.env
|
||||
command: ["/usr/local/bin/neolink", "mqtt-rtsp", "--config", "/etc/neolink.toml"]
|
||||
depends_on: [mosquitto]
|
||||
networks: [cameras]
|
||||
volumes:
|
||||
- /config/neolink/neolink.toml:/etc/neolink.toml:ro
|
||||
# neolink can wedge without exiting ("Remaining: 0 of 100 message space"): RTSP stays
|
||||
# up but serves no frames, so Frigate shows the stream offline forever (2026-10-08).
|
||||
# A stalled stream still bursts ~30 buffered packets on connect, so 30 was a false pass
|
||||
# for an hour (2026-10-09). Probe: pull 300 RTP buffers off the main stream (~4 s when
|
||||
# healthy, ~80 pkt/s). After 3 straight failures, SIGKILL
|
||||
# neolink; the image's sh PID 1 then exits and `restart: unless-stopped` brings it back.
|
||||
healthcheck:
|
||||
test:
|
||||
- CMD-SHELL
|
||||
- >-
|
||||
f=/tmp/hc-fails;
|
||||
if timeout 20 gst-launch-1.0 -q rtspsrc location=rtsp://127.0.0.1:8554/e1/mainStream protocols=tcp
|
||||
! identity eos-after=300 ! fakesink >/dev/null 2>&1; then echo 0 > $$f; exit 0; fi;
|
||||
n=$$(( $$(cat $$f 2>/dev/null || echo 0) + 1 )); echo $$n > $$f;
|
||||
if [ $$n -ge 3 ]; then echo 0 > $$f;
|
||||
for p in /proc/[0-9]*; do [ "$$(cat $$p/comm 2>/dev/null)" = neolink ] && kill -9 $${p#/proc/}; done; fi;
|
||||
exit 1
|
||||
interval: 60s
|
||||
timeout: 30s
|
||||
start_period: 60s
|
||||
retries: 3
|
||||
|
||||
frigate:
|
||||
image: ghcr.io/blakeblackshear/frigate:0.17.2
|
||||
@@ -32,6 +73,10 @@ services:
|
||||
labels:
|
||||
- "com.centurylabs.watchtower.enable=false"
|
||||
env_file: stack.env
|
||||
# OpenVINO (CPU) spawns one worker per visible CPU and busy-spins them: with all 52
|
||||
# threads visible the detector alone burned ~6.5 cores. Pinned to 6 threads it's
|
||||
# ~1.2 cores total (incl. 24/7 recording) at ~23 ms inference. Measured 2026-10-08.
|
||||
cpuset: "0-5"
|
||||
shm_size: "256mb"
|
||||
depends_on: [neolink]
|
||||
networks: [edge, cameras]
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
# Seeded to /config/frigate-notify/config.yml on valhalla. frigate-notify v0.5.4.
|
||||
# mode MUST be events: the default (reviews) reads Frigate review items, which Frigate
|
||||
# only creates when recording is on — and recording is off here.
|
||||
app:
|
||||
mode: events
|
||||
|
||||
frigate:
|
||||
server: http://frigate:5000
|
||||
public_url: https://cam.ginnoir.com
|
||||
|
||||
@@ -29,21 +29,23 @@ model:
|
||||
path: /openvino-model/ssdlite_mobilenet_v2.xml
|
||||
labelmap_path: /openvino-model/coco_91cl_bkgr.txt
|
||||
|
||||
# neolink delivers the E1's audio as raw PCM (L16/16000/2). Browser MSE only plays AAC or
|
||||
# PCMA/PCMU, so the live player stalled and Frigate fell back to the low-res view until a
|
||||
# manual "refresh stream". go2rtc's ffmpeg copies the video and transcodes audio to AAC.
|
||||
go2rtc:
|
||||
streams:
|
||||
e1:
|
||||
- rtsp://neolink:8554/e1/mainStream
|
||||
- "ffmpeg:rtsp://neolink:8554/e1/mainStream#video=copy#audio=aac"
|
||||
e1_sub:
|
||||
- rtsp://neolink:8554/e1/subStream
|
||||
- "ffmpeg:rtsp://neolink:8554/e1/subStream#video=copy#audio=aac"
|
||||
|
||||
# Recording, snapshots and detection turned off 2026-10-26 at ginnoir's request: the
|
||||
# camera is live-view only now. Existing recordings/clips were deleted.
|
||||
record:
|
||||
enabled: false
|
||||
|
||||
snapshots:
|
||||
enabled: true
|
||||
bounding_box: true
|
||||
retain:
|
||||
default: 30
|
||||
enabled: false
|
||||
|
||||
objects:
|
||||
track: [person, dog, cat]
|
||||
@@ -55,7 +57,16 @@ cameras:
|
||||
- path: rtsp://127.0.0.1:8554/e1_sub
|
||||
input_args: preset-rtsp-restream
|
||||
roles: [detect]
|
||||
# Record full res. The e1 restream already carries AAC (see go2rtc above) → copy it.
|
||||
- path: rtsp://127.0.0.1:8554/e1
|
||||
input_args: preset-rtsp-restream
|
||||
roles: [record]
|
||||
output_args:
|
||||
record: preset-record-generic-audio-copy
|
||||
detect:
|
||||
# Off on purpose (live view only). Frigate >=0.14 defaults this to false anyway;
|
||||
# set true to bring detection back.
|
||||
enabled: false
|
||||
width: 640
|
||||
height: 360
|
||||
fps: 5
|
||||
@@ -63,3 +74,4 @@ cameras:
|
||||
streams:
|
||||
Main: e1
|
||||
Sub: e1_sub
|
||||
version: 0.17-0
|
||||
@@ -0,0 +1,14 @@
|
||||
# Seeded to /config/mosquitto/acl on valhalla.
|
||||
# Lines before the first `user` apply to anonymous clients (the browser PTZ page).
|
||||
# Never grant anonymous neolink/config — it echoes the camera password and rewrites
|
||||
# neolink's live config. No status/# either: status/preview is a base64 JPEG flood.
|
||||
topic readwrite neolink/e1/control/ptz
|
||||
topic write neolink/e1/control/ptz/preset
|
||||
topic write neolink/e1/control/ptz/assign
|
||||
topic write neolink/e1/query/ptz/preset
|
||||
topic read neolink/e1/status
|
||||
topic read neolink/e1/status/ptz
|
||||
topic read neolink/status
|
||||
|
||||
user neolink
|
||||
topic readwrite neolink/#
|
||||
@@ -0,0 +1,21 @@
|
||||
# Seeded to /config/mosquitto/mosquitto.conf on valhalla. MQTT bus for neolink PTZ.
|
||||
# :1883 neolink (password auth) — cameras net only
|
||||
# :8083 browser PTZ page over websockets — reached via Caddy /mqtt behind Authentik;
|
||||
# anonymous, but the ACL limits anonymous clients to PTZ control + status topics
|
||||
# (never neolink/config, which echoes the camera password).
|
||||
per_listener_settings true
|
||||
persistence false
|
||||
log_dest stdout
|
||||
log_type error
|
||||
log_type warning
|
||||
log_type notice
|
||||
|
||||
listener 1883
|
||||
allow_anonymous false
|
||||
password_file /mosquitto/config/passwd
|
||||
acl_file /mosquitto/config/acl
|
||||
|
||||
listener 8083
|
||||
protocol websockets
|
||||
allow_anonymous true
|
||||
acl_file /mosquitto/config/acl
|
||||
@@ -0,0 +1 @@
|
||||
neolink:$7$101$CLamJlgRV+OeCa6e$+VjFMJCEyML03zXQZDIWE6W4J4f8seui/5ZQsIN/7FDEJ5L5oUNqO2r4dmcTr+59H2v+h+dmqCyjxmlSqjD3Bg==
|
||||
@@ -2,9 +2,22 @@
|
||||
# E1 media port is 9001 (Reolink app → Network → Advanced → Server Settings).
|
||||
bind = "0.0.0.0"
|
||||
|
||||
# PTZ control bus (neolink runs `mqtt-rtsp`). Password must match the hash in
|
||||
# /config/mosquitto/passwd (stacks/cameras/mosquitto/passwd).
|
||||
[mqtt]
|
||||
broker_addr = "mosquitto"
|
||||
port = 1883
|
||||
credentials = ["neolink", "kAWs6GZIx0NgTHuzdUFMDuuJCD9t4el3"]
|
||||
|
||||
[[cameras]]
|
||||
name = "e1"
|
||||
username = "admin"
|
||||
password = "GRUNT-pin-echo-control"
|
||||
address = "192.168.1.99:9001"
|
||||
stream = "both"
|
||||
|
||||
[cameras.mqtt]
|
||||
enable_motion = false
|
||||
enable_light = false
|
||||
enable_battery = false
|
||||
enable_preview = false
|
||||
@@ -0,0 +1,209 @@
|
||||
<!doctype html>
|
||||
<!-- Seeded to /config/caddy/site/cam-ptz/ on valhalla; served at cam.ginnoir.com/ptz/
|
||||
behind Authentik. Video = Frigate's go2rtc MSE websocket; PTZ = MQTT over
|
||||
wss://cam.ginnoir.com/mqtt -> mosquitto -> neolink -> E1 (Baichuan). -->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
||||
<title>E1 Pan/Tilt</title>
|
||||
<style>
|
||||
:root {
|
||||
--bg: #f4f4f5; --panel: #ffffff; --text: #18181b; --muted: #71717a;
|
||||
--btn: #e4e4e7; --btn-active: #2563eb; --btn-active-text: #fff; --border: #d4d4d8;
|
||||
--ok: #16a34a; --bad: #dc2626;
|
||||
}
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root:not([data-theme="light"]) {
|
||||
--bg: #09090b; --panel: #18181b; --text: #f4f4f5; --muted: #a1a1aa;
|
||||
--btn: #27272a; --btn-active: #3b82f6; --btn-active-text: #fff; --border: #3f3f46;
|
||||
}
|
||||
}
|
||||
* { box-sizing: border-box; }
|
||||
body {
|
||||
margin: 0; background: var(--bg); color: var(--text);
|
||||
font: 15px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
|
||||
-webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
|
||||
}
|
||||
main { max-width: 1100px; margin: 0 auto; padding: 12px 16px 24px; }
|
||||
header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
|
||||
h1 { font-size: 17px; margin: 0; }
|
||||
header a { color: var(--muted); font-size: 13px; }
|
||||
.status { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
|
||||
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--bad); }
|
||||
.dot.on { background: var(--ok); }
|
||||
.layout { display: grid; gap: 14px; grid-template-columns: 1fr; }
|
||||
@media (min-width: 860px) { .layout { grid-template-columns: 1fr 280px; } }
|
||||
.video { background: #000; border-radius: 10px; overflow: hidden; aspect-ratio: 16 / 9; }
|
||||
.video video { width: 100%; height: 100%; display: block; object-fit: contain; }
|
||||
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 14px; display: grid; gap: 16px; align-content: start; }
|
||||
.pad { display: grid; grid-template-columns: repeat(3, 64px); grid-template-rows: repeat(3, 64px); gap: 8px; justify-content: center; }
|
||||
button {
|
||||
font: inherit; color: var(--text); background: var(--btn); border: 1px solid var(--border);
|
||||
border-radius: 10px; cursor: pointer; touch-action: none;
|
||||
}
|
||||
button:active, button.held { background: var(--btn-active); color: var(--btn-active-text); border-color: var(--btn-active); }
|
||||
.pad button { font-size: 22px; }
|
||||
label { font-size: 13px; color: var(--muted); display: grid; gap: 6px; }
|
||||
input[type=range] { width: 100%; }
|
||||
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 8px; }
|
||||
.presets { display: flex; flex-wrap: wrap; gap: 8px; }
|
||||
.presets button { padding: 8px 12px; }
|
||||
.presets .empty { color: var(--muted); font-size: 13px; }
|
||||
.save { display: flex; gap: 8px; margin-top: 10px; }
|
||||
.save input { flex: 1; min-width: 0; font: inherit; padding: 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); -webkit-user-select: text; user-select: text; }
|
||||
.save button { padding: 8px 12px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<header>
|
||||
<h1>E1 Pan/Tilt</h1>
|
||||
<div class="status"><span class="dot" id="dot"></span><span id="state">connecting…</span></div>
|
||||
<a href="/">Frigate</a>
|
||||
</header>
|
||||
<div class="layout">
|
||||
<div class="video"><cam-video id="video"></cam-video></div>
|
||||
<div class="panel">
|
||||
<div class="pad" aria-label="Pan and tilt">
|
||||
<span></span><button data-dir="up" aria-label="Tilt up">▲</button><span></span>
|
||||
<button data-dir="left" aria-label="Pan left">◀</button><span></span><button data-dir="right" aria-label="Pan right">▶</button>
|
||||
<span></span><button data-dir="down" aria-label="Tilt down">▼</button><span></span>
|
||||
</div>
|
||||
<label>Step size <span id="stepLabel"></span><input type="range" id="step" min="4" max="32" step="2" value="10"></label>
|
||||
<section>
|
||||
<h2>Presets</h2>
|
||||
<div class="presets" id="presets"><span class="empty">loading…</span></div>
|
||||
<div class="save">
|
||||
<input id="presetName" placeholder="Save current view as…" maxlength="31">
|
||||
<button id="saveBtn">Save</button>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<script src="mqtt.min.js"></script>
|
||||
<script type="module">
|
||||
import {VideoRTC} from './video-rtc.js';
|
||||
|
||||
// --- Video: Frigate's go2rtc restream over MSE (WebRTC needs :8555 ICE, not exposed) ---
|
||||
class CamVideo extends VideoRTC {}
|
||||
customElements.define('cam-video', CamVideo);
|
||||
const video = document.getElementById('video');
|
||||
video.mode = 'mse';
|
||||
video.background = true;
|
||||
video.src = `wss://${location.host}/live/mse/api/ws?src=e1`;
|
||||
|
||||
// --- MQTT ---
|
||||
const BASE = 'neolink/e1';
|
||||
const dot = document.getElementById('dot');
|
||||
const state = document.getElementById('state');
|
||||
const client = mqtt.connect(`wss://${location.host}/mqtt`, {reconnectPeriod: 2000, clean: true});
|
||||
let camOnline = false;
|
||||
|
||||
function setStatus() {
|
||||
const ok = client.connected && camOnline;
|
||||
dot.classList.toggle('on', ok);
|
||||
state.textContent = !client.connected ? 'broker offline' : camOnline ? 'ready' : 'camera offline';
|
||||
}
|
||||
client.on('connect', () => {
|
||||
// Not status/# — neolink 0.6.2 floods status/preview with base64 JPEGs.
|
||||
client.subscribe([`neolink/status`, `${BASE}/status`, `${BASE}/status/ptz`, `${BASE}/control/ptz`]);
|
||||
client.publish(`${BASE}/query/ptz/preset`, '');
|
||||
setStatus();
|
||||
});
|
||||
client.on('close', setStatus);
|
||||
client.on('message', (topic, payload) => {
|
||||
const msg = payload.toString();
|
||||
if (topic === 'neolink/status' || topic === `${BASE}/status`) {
|
||||
camOnline = msg.trim() !== 'offline' && msg.trim() !== 'disconnected';
|
||||
setStatus();
|
||||
} else if (topic === `${BASE}/status/ptz`) {
|
||||
renderPresets(msg);
|
||||
} else if (topic === `${BASE}/control/ptz` && (msg === 'OK' || msg === 'FAIL')) {
|
||||
// neolink echoes our command on this topic too; only replies settle the step
|
||||
if (pendingReply) { pendingReply(); pendingReply = null; }
|
||||
}
|
||||
});
|
||||
|
||||
// --- Move ---
|
||||
// neolink 0.6.2: payload "<dir> <amount>" moves at fixed speed 32 for amount/32 seconds,
|
||||
// then sends stop. Commands queue camera-side, so never send the next step until the
|
||||
// previous one replied OK/FAIL — otherwise the camera keeps moving after release.
|
||||
// (in/out are todo!() in 0.6.2 and would panic neolink; the E1 has no zoom anyway.)
|
||||
const step = document.getElementById('step');
|
||||
const stepLabel = document.getElementById('stepLabel');
|
||||
const showStep = () => stepLabel.textContent = `(${(step.value / 32).toFixed(2)} s)`;
|
||||
step.addEventListener('input', showStep); showStep();
|
||||
let pendingReply = null, busy = false;
|
||||
function moveOnce(dir) {
|
||||
if (!client.connected || busy) return Promise.resolve();
|
||||
busy = true;
|
||||
return new Promise(resolve => {
|
||||
const done = () => { busy = false; resolve(); };
|
||||
pendingReply = done;
|
||||
setTimeout(() => { if (pendingReply === done) { pendingReply = null; done(); } }, 3000);
|
||||
client.publish(`${BASE}/control/ptz`, `${dir} ${step.value}`);
|
||||
});
|
||||
}
|
||||
document.querySelectorAll('button[data-dir]').forEach(btn => {
|
||||
let held = false;
|
||||
const release = () => { held = false; btn.classList.remove('held'); };
|
||||
btn.addEventListener('pointerdown', async e => {
|
||||
e.preventDefault();
|
||||
btn.setPointerCapture(e.pointerId);
|
||||
held = true; btn.classList.add('held');
|
||||
do { await moveOnce(btn.dataset.dir); } while (held);
|
||||
});
|
||||
['pointerup', 'pointercancel', 'lostpointercapture'].forEach(ev => btn.addEventListener(ev, release));
|
||||
});
|
||||
const keys = {ArrowUp: 'up', ArrowDown: 'down', ArrowLeft: 'left', ArrowRight: 'right'};
|
||||
document.addEventListener('keydown', e => {
|
||||
if (e.target.tagName === 'INPUT' || e.repeat) return;
|
||||
if (keys[e.key]) { e.preventDefault(); moveOnce(keys[e.key]); }
|
||||
});
|
||||
|
||||
// --- Presets (neolink returns the camera's XML preset list) ---
|
||||
const presetsEl = document.getElementById('presets');
|
||||
let presets = [];
|
||||
function renderPresets(xml) {
|
||||
const doc = new DOMParser().parseFromString(xml, 'application/xml');
|
||||
presets = [...doc.getElementsByTagName('preset')]
|
||||
.map(p => ({
|
||||
id: p.getElementsByTagName('id')[0]?.textContent,
|
||||
name: p.getElementsByTagName('name')[0]?.textContent,
|
||||
enable: p.getElementsByTagName('enable')[0]?.textContent,
|
||||
}))
|
||||
.filter(p => p.id != null && p.name && p.enable !== '0');
|
||||
presetsEl.replaceChildren();
|
||||
if (!presets.length) {
|
||||
const s = document.createElement('span');
|
||||
s.className = 'empty';
|
||||
s.textContent = 'No presets yet';
|
||||
presetsEl.append(s);
|
||||
return;
|
||||
}
|
||||
for (const p of presets) {
|
||||
const b = document.createElement('button');
|
||||
b.textContent = p.name;
|
||||
b.addEventListener('click', () => client.publish(`${BASE}/control/ptz/preset`, p.id));
|
||||
presetsEl.append(b);
|
||||
}
|
||||
}
|
||||
setTimeout(() => { if (presetsEl.querySelector('.empty')?.textContent === 'loading…') renderPresets('<x/>'); }, 8000);
|
||||
|
||||
document.getElementById('saveBtn').addEventListener('click', () => {
|
||||
const input = document.getElementById('presetName');
|
||||
const name = input.value.trim().replace(/\s+/g, '_');
|
||||
if (!name) return;
|
||||
const used = new Set(presets.map(p => Number(p.id)));
|
||||
let id = 0;
|
||||
while (used.has(id)) id++;
|
||||
client.publish(`${BASE}/control/ptz/assign`, `${id} ${name}`);
|
||||
input.value = '';
|
||||
setTimeout(() => client.publish(`${BASE}/query/ptz/preset`, ''), 1500);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
"use strict";var mqtt=(()=>{var as=Object.defineProperty;var Yb=Object.getOwnPropertyDescriptor;var Jb=Object.getOwnPropertyNames;var Xb=Object.prototype.hasOwnProperty;var ze=(t,e)=>()=>(t&&(e=t(t=0)),e);var j=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Kr=(t,e)=>{for(var r in e)as(t,r,{get:e[r],enumerable:!0})},Zb=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Jb(e))!Xb.call(t,i)&&i!==r&&as(t,i,{get:()=>e[i],enumerable:!(n=Yb(e,i))||n.enumerable});return t};var me=t=>Zb(as({},"__esModule",{value:!0}),t);var A=ze(()=>{});var N={};Kr(N,{_debugEnd:()=>Qc,_debugProcess:()=>Kc,_events:()=>hf,_eventsCount:()=>df,_exiting:()=>Oc,_fatalExceptions:()=>Hc,_getActiveHandles:()=>Bc,_getActiveRequests:()=>Cc,_kill:()=>Nc,_linkedBinding:()=>Tc,_maxListeners:()=>ff,_preload_modules:()=>uf,_rawDebug:()=>Ic,_startProfilerIdleNotifier:()=>Yc,_stopProfilerIdleNotifier:()=>Jc,_tickCallback:()=>zc,abort:()=>tf,addListener:()=>pf,allowedNodeEnvironmentFlags:()=>Fc,arch:()=>fc,argv:()=>pc,argv0:()=>af,assert:()=>Wc,binding:()=>mc,browser:()=>Ac,chdir:()=>Sc,config:()=>Rc,cpuUsage:()=>Ri,cwd:()=>vc,debugPort:()=>sf,default:()=>Ef,dlopen:()=>kc,domain:()=>Pc,emit:()=>mf,emitWarning:()=>wc,env:()=>dc,execArgv:()=>yc,execPath:()=>of,exit:()=>Dc,features:()=>$c,hasUncaughtExceptionCaptureCallback:()=>Gc,hrtime:()=>Oi,kill:()=>Uc,listeners:()=>Sf,memoryUsage:()=>Lc,moduleLoadList:()=>xc,nextTick:()=>uc,off:()=>gf,on:()=>Nt,once:()=>yf,openStdin:()=>jc,pid:()=>rf,platform:()=>hc,ppid:()=>nf,prependListener:()=>_f,prependOnceListener:()=>vf,reallyExit:()=>Mc,release:()=>Ec,removeAllListeners:()=>wf,removeListener:()=>bf,resourceUsage:()=>qc,setSourceMapsEnabled:()=>lf,setUncaughtExceptionCaptureCallback:()=>Vc,stderr:()=>Zc,stdin:()=>ef,stdout:()=>Xc,title:()=>cc,umask:()=>_c,uptime:()=>cf,version:()=>gc,versions:()=>bc});function cs(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function ew(){!Qr||!wr||(Qr=!1,wr.length?Mt=wr.concat(Mt):Pi=-1,Mt.length&&ac())}function ac(){if(!Qr){var t=setTimeout(ew,0);Qr=!0;for(var e=Mt.length;e;){for(wr=Mt,Mt=[];++Pi<e;)wr&&wr[Pi].run();Pi=-1,e=Mt.length}wr=null,Qr=!1,clearTimeout(t)}}function uc(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];Mt.push(new lc(t,e)),Mt.length===1&&!Qr&&setTimeout(ac,0)}function lc(t,e){this.fun=t,this.array=e}function Ue(){}function Tc(t){cs("_linkedBinding")}function kc(t){cs("dlopen")}function Cc(){return[]}function Bc(){return[]}function Wc(t,e){if(!t)throw new Error(e||"assertion error")}function Gc(){return!1}function cf(){return Jt.now()/1e3}function Oi(t){var e=Math.floor((Date.now()-Jt.now())*.001),r=Jt.now()*.001,n=Math.floor(r)+e,i=Math.floor(r%1*1e9);return t&&(n=n-t[0],i=i-t[1],i<0&&(n--,i+=ls)),[n,i]}function Nt(){return Ef}function Sf(t){return[]}var Mt,Qr,wr,Pi,cc,fc,hc,dc,pc,yc,gc,bc,wc,mc,_c,vc,Sc,Ec,Ac,Ic,xc,Pc,Oc,Rc,Mc,Nc,Ri,qc,Lc,Uc,Dc,jc,Fc,$c,Hc,Vc,zc,Kc,Qc,Yc,Jc,Xc,Zc,ef,tf,rf,nf,of,sf,af,uf,lf,Jt,us,ls,ff,hf,df,pf,yf,gf,bf,wf,mf,_f,vf,Ef,Af=ze(()=>{A();x();I();Mt=[],Qr=!1,Pi=-1;lc.prototype.run=function(){this.fun.apply(null,this.array)};cc="browser",fc="x64",hc="browser",dc={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},pc=["/usr/bin/node"],yc=[],gc="v16.8.0",bc={},wc=function(t,e){console.warn((e?e+": ":"")+t)},mc=function(t){cs("binding")},_c=function(t){return 0},vc=function(){return"/"},Sc=function(t){},Ec={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};Ac=!0,Ic=Ue,xc=[];Pc={},Oc=!1,Rc={};Mc=Ue,Nc=Ue,Ri=function(){return{}},qc=Ri,Lc=Ri,Uc=Ue,Dc=Ue,jc=Ue,Fc={};$c={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Hc=Ue,Vc=Ue;zc=Ue,Kc=Ue,Qc=Ue,Yc=Ue,Jc=Ue,Xc=void 0,Zc=void 0,ef=void 0,tf=Ue,rf=2,nf=1,of="/bin/usr/node",sf=9229,af="node",uf=[],lf=Ue,Jt={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};Jt.now===void 0&&(us=Date.now(),Jt.timing&&Jt.timing.navigationStart&&(us=Jt.timing.navigationStart),Jt.now=()=>Date.now()-us);ls=1e9;Oi.bigint=function(t){var e=Oi(t);return typeof BigInt>"u"?e[0]*ls+e[1]:BigInt(e[0]*ls)+BigInt(e[1])};ff=10,hf={},df=0;pf=Nt,yf=Nt,gf=Nt,bf=Nt,wf=Nt,mf=Ue,_f=Nt,vf=Nt;Ef={version:gc,versions:bc,arch:fc,platform:hc,browser:Ac,release:Ec,_rawDebug:Ic,moduleLoadList:xc,binding:mc,_linkedBinding:Tc,_events:hf,_eventsCount:df,_maxListeners:ff,on:Nt,addListener:pf,once:yf,off:gf,removeListener:bf,removeAllListeners:wf,emit:mf,prependListener:_f,prependOnceListener:vf,listeners:Sf,domain:Pc,_exiting:Oc,config:Rc,dlopen:kc,uptime:cf,_getActiveRequests:Cc,_getActiveHandles:Bc,reallyExit:Mc,_kill:Nc,cpuUsage:Ri,resourceUsage:qc,memoryUsage:Lc,kill:Uc,exit:Dc,openStdin:jc,allowedNodeEnvironmentFlags:Fc,assert:Wc,features:$c,_fatalExceptions:Hc,setUncaughtExceptionCaptureCallback:Vc,hasUncLine truncated
|
||||
`;super(r),this.name="AggregateError",this.errors=e}};Rf.exports={AggregateError:fs,ArrayIsArray(t){return Array.isArray(t)},ArrayPrototypeIncludes(t,e){return t.includes(e)},ArrayPrototypeIndexOf(t,e){return t.indexOf(e)},ArrayPrototypeJoin(t,e){return t.join(e)},ArrayPrototypeMap(t,e){return t.map(e)},ArrayPrototypePop(t,e){return t.pop(e)},ArrayPrototypePush(t,e){return t.push(e)},ArrayPrototypeSlice(t,e,r){return t.slice(e,r)},Error,FunctionPrototypeCall(t,e,...r){return t.call(e,...r)},FunctionPrototypeSymbolHasInstance(t,e){return Function.prototype[Symbol.hasInstance].call(t,e)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(t,e){return Object.defineProperties(t,e)},ObjectDefineProperty(t,e,r){return Object.defineProperty(t,e,r)},ObjectGetOwnPropertyDescriptor(t,e){return Object.getOwnPropertyDescriptor(t,e)},ObjectKeys(t){return Object.keys(t)},ObjectSetPrototypeOf(t,e){return Object.setPrototypeOf(t,e)},Promise,PromisePrototypeCatch(t,e){return t.catch(e)},PromisePrototypeThen(t,e,r){return t.then(e,r)},PromiseReject(t){return Promise.reject(t)},PromiseResolve(t){return Promise.resolve(t)},ReflectApply:Reflect.apply,RegExpPrototypeTest(t,e){return t.test(e)},SafeSet:Set,String,StringPrototypeSlice(t,e,r){return t.slice(e,r)},StringPrototypeToLowerCase(t){return t.toLowerCase()},StringPrototypeToUpperCase(t){return t.toUpperCase()},StringPrototypeTrim(t){return t.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet(t,e,r){return t.set(e,r)},Boolean,Uint8Array}});var hs=j((BP,kf)=>{"use strict";A();x();I();kf.exports={format(t,...e){return t.replace(/%([sdifj])/g,function(...[r,n]){let i=e.shift();return n==="f"?i.toFixed(6):n==="j"?JSON.stringify(i):n==="s"&&typeof i=="object"?`${i.constructor!==Object?i.constructor.name:""} {}`.trim():i.toString()})},inspect(t){switch(typeof t){case"string":if(t.includes("'"))if(t.includes('"')){if(!t.includes("`")&&!t.includes("${"))return`\`${t}\``}else return`"${t}"`;return`'${t}'`;case"number":return isNaN(t)?"NaN":Object.is(t,-0)?String(t):t;case"bigint":return`${String(t)}n`;case"boolean":case"undefined":return String(t);case"object":return"{}"}}}});var De=j((jP,Mf)=>{"use strict";A();x();I();var{format:ow,inspect:Ci}=hs(),{AggregateError:sw}=Ee(),aw=globalThis.AggregateError||sw,uw=Symbol("kIsNodeError"),lw=["string","function","number","object","Function","Object","boolean","bigint","symbol"],cw=/^([A-Z][a-z0-9]*)+$/,fw="__node_internal_",Bi={};function _r(t,e){if(!t)throw new Bi.ERR_INTERNAL_ASSERTION(e)}function Cf(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function hw(t,e,r){if(typeof e=="function")return _r(e.length<=r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${e.length}).`),e(...r);let n=(e.match(/%[dfijoOs]/g)||[]).length;return _r(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:ow(e,...r)}function Le(t,e,r){r||(r=Error);class n extends r{constructor(...s){super(hw(t,e,s))}toString(){return`${this.name} [${t}]: ${this.message}`}}Object.defineProperties(n.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${t}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),n.prototype.code=t,n.prototype[uw]=!0,Bi[t]=n}function Bf(t){let e=fw+t.name;return Object.defineProperty(t,"name",{value:e}),t}function dw(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new aw([e,t],e.message);return r.code=e.code,r}return t||e}var ds=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new Bi.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};Le("ERR_ASSERTION","%s",Error);Le("ERR_INVALID_ARG_TYPE",(t,e,r)=>{_r(typeof t=="string","'name' must be a string"),Array.isArray(e)||(e=[e]);let n="The ";t.endsWith(" argument")?n+=`${t} `:n+=`"${t}" ${t.includes(".")?"property":"argument"} `,n+="must be ";let i=[],s=[],o=[];for(let c of e)_r(typeof c=="string","All expected entries have to be of type string"),lw.includes(c)?i.push(c.toLowerCase()):cw.test(c)?s.push(c):(_r(c!=="object",'The value "object" should be written as "Object"'),o.push(c));if(s.length>0){let c=i.indexOf("object");c!==-1&&(i.splice(i,c,1),s.push("Object"))}if(i.length>0){switch(i.length){case 1:n+=`of type ${i[0]}`;break;case 2:n+=`one of type ${i[0]} or ${i[1]}`;break;default:{leLine truncated
|
||||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}si.exports=cA,si.exports.__esModule=!0,si.exports.default=si.exports});var lg=j((ED,ai)=>{A();x();I();var fA=ng(),hA=ig(),dA=ag(),pA=ug();function yA(t,e){return fA(t)||hA(t,e)||dA(t,e)||pA()}ai.exports=yA,ai.exports.__esModule=!0,ai.exports.default=ai.exports});var fg=j((RD,ui)=>{A();x();I();function cg(t,e,r,n,i,s,o){try{var a=t[s](o),c=a.value}catch(f){return void r(f)}a.done?e(c):Promise.resolve(c).then(n,i)}function gA(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(c){cg(s,n,i,o,a,"next",c)}function a(c){cg(s,n,i,o,a,"throw",c)}o(void 0)})}}ui.exports=gA,ui.exports.__esModule=!0,ui.exports.default=ui.exports});var Ru=j((LD,li)=>{A();x();I();function bA(t,e){this.v=t,this.k=e}li.exports=bA,li.exports.__esModule=!0,li.exports.default=li.exports});var ku=j((HD,$t)=>{A();x();I();function Wo(t,e,r,n){var i=Object.defineProperty;try{i({},"",{})}catch{i=0}$t.exports=Wo=function(o,a,c,f){function h(d,m){Wo(o,d,function(g){return this._invoke(d,m,g)})}a?i?i(o,a,{value:c,enumerable:!f,configurable:!f,writable:!f}):o[a]=c:(h("next",0),h("throw",1),h("return",2))},$t.exports.__esModule=!0,$t.exports.default=$t.exports,Wo(t,e,r,n)}$t.exports=Wo,$t.exports.__esModule=!0,$t.exports.default=$t.exports});var Cu=j((JD,Ht)=>{A();x();I();var Rt=ku();function hg(){var t,e,r=typeof Symbol=="function"?Symbol:{},n=r.iterator||"@@iterator",i=r.toStringTag||"@@toStringTag";function s(g,P,S,b){var w=P&&P.prototype instanceof a?P:a,_=Object.create(w.prototype);return Rt(_,"_invoke",(function(R,T,y){var O,v,M,F=0,U=y||[],Q=!1,W={p:0,n:0,v:t,a:H,f:H.bind(t,4),d:function(J,ee){return O=J,v=0,M=t,W.n=ee,o}};function H(z,J){for(v=z,M=J,e=0;!Q&&F&&!ee&&e<U.length;e++){var ee,G=U[e],V=W.p,te=G[2];z>3?(ee=te===J)&&(M=G[(v=G[4])?5:(v=3,3)],G[4]=G[5]=t):G[0]<=V&&((ee=z<2&&V<G[1])?(v=0,W.v=J,W.n=G[1]):V<te&&(ee=z<3||G[0]>J||J>te)&&(G[4]=z,G[5]=J,W.n=te,v=0))}if(ee||z>1)return o;throw Q=!0,J}return function(z,J,ee){if(F>1)throw TypeError("Generator is already running");for(Q&&J===1&&H(J,ee),v=J,M=ee;(e=v<2?t:M)||!Q;){O||(v?v<3?(v>1&&(W.n=-1),H(v,M)):W.n=M:W.v=M);try{if(F=2,O){if(v||(z="next"),e=O[z]){if(!(e=e.call(O,M)))throw TypeError("iterator result is not an object");if(!e.done)return e;M=e.value,v<2&&(v=0)}else v===1&&(e=O.return)&&e.call(O),v<2&&(M=TypeError("The iterator does not provide a '"+z+"' method"),v=1);O=t}else if((e=(Q=W.n<0)?M:R.call(T,W))!==o)break}catch(G){O=t,v=1,M=G}finally{F=1}}return{value:e,done:Q}}})(g,S,b),!0),_}var o={};function a(){}function c(){}function f(){}e=Object.getPrototypeOf;var h=[][n]?e(e([][n]())):(Rt(e={},n,function(){return this}),e),d=f.prototype=a.prototype=Object.create(h);function m(g){return Object.setPrototypeOf?Object.setPrototypeOf(g,f):(g.__proto__=f,Rt(g,i,"GeneratorFunction")),g.prototype=Object.create(d),g}return c.prototype=f,Rt(d,"constructor",f),Rt(f,"constructor",c),c.displayName="GeneratorFunction",Rt(f,i,"GeneratorFunction"),Rt(d),Rt(d,i,"Generator"),Rt(d,n,function(){return this}),Rt(d,"toString",function(){return"[object Generator]"}),(Ht.exports=hg=function(){return{w:s,m}},Ht.exports.__esModule=!0,Ht.exports.default=Ht.exports)()}Ht.exports=hg,Ht.exports.__esModule=!0,Ht.exports.default=Ht.exports});var Nu=j((i3,ci)=>{A();x();I();var wA=Ru(),Bu=ku();function Mu(t,e){function r(i,s,o,a){try{var c=t[i](s),f=c.value;return f instanceof wA?e.resolve(f.v).then(function(h){r("next",h,o,a)},function(h){r("throw",h,o,a)}):e.resolve(f).then(function(h){c.value=h,o(c)},function(h){return r("throw",h,o,a)})}catch(h){a(h)}}var n;this.next||(Bu(Mu.prototype),Bu(Mu.prototype,typeof Symbol=="function"&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),Bu(this,"_invoke",function(i,s,o){function a(){return new e(function(c,f){r(i,o,c,f)})}return n=n?n.then(a,a):a()},!0)}ci.exports=Mu,ci.exports.__esModule=!0,ci.exports.default=ci.exports});var qu=j((f3,fi)=>{A();x();I();var mA=Cu(),_A=Nu();function vA(t,e,r,n,i){return new _A(mA().w(t,e,r,n),i||Promise)}fi.exports=vA,fi.exports.__esModule=!0,fi.exports.default=fi.exports});var dg=j((w3,hi)=>{A();x();I();var SA=qu();function EA(t,e,r,n,i){var s=SA(t,e,r,n,i);return s.next().then(function(o){return o.done?o.value:s.next()})}hi.exports=EA,hi.exports.__esModule=!0,hi.exports.default=hi.exports});var pg=j((I3,di)=>{A();x();I();function AA(t){var e=Object(t),r=[];for(var n in e)r.unshift(n);return function i(){for(;r.length;)if((n=r.pop())in e)return i.value=n,i.done=!1,i;return i.done=!0,i}}di.exports=AA,di.exports.__esModule=!0,di.exports.default=di.exports});var yg=j((C3,pi)=>{A();x();I();var IA=Xn().default;function xA(t){if(t!=null){var e=t[typeof Symbol=="function"&&Symbol.iterator||"@@iterator"],r=0;if(e)return e.call(t);if(typeof t.next=="function")return t;if(!isNaN(t.length))return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}}}throw new TypeError(IA(t
Line truncated
|
||||
`)>=0)return!1;return!0}function C(k,B){var re;if(k.indent===" ")re=" ";else if(typeof k.indent=="number"&&k.indent>0)re=M.call(Array(k.indent+1)," ");else return null;return{base:re,prev:M.call(Array(B+1),re)}}function q(k,B){if(k.length===0)return"";var re=`
|
||||
`+B.prev+B.base;return re+M.call(k,","+re)+`
|
||||
`+B.prev}function $(k,B){var re=ne(k),ie=[];if(re){ie.length=k.length;for(var oe=0;oe<k.length;oe++)ie[oe]=Re(k,oe)?B(k[oe],k):""}var fe=typeof W=="function"?W(k):[],Qt;if(z){Qt={};for(var br=0;br<fe.length;br++)Qt["$"+fe[br]]=fe[br]}for(var Ye in k)Re(k,Ye)&&(re&&String(Number(Ye))===Ye&&Ye<k.length||z&&Qt["$"+Ye]instanceof Symbol||(O.call(/[^\w$]/,Ye)?ie.push(B(Ye,k)+": "+B(k[Ye],k)):ie.push(Ye+": "+B(k[Ye],k))));if(typeof W=="function")for(var Yt=0;Yt<fe.length;Yt++)ee.call(k,fe[Yt])&&ie.push("["+B(fe[Yt])+"]: "+B(k[fe[Yt]],k));return ie}return Al}function Ox(){if(gb)return xl;gb=!0;var t=Wr(),e=lb(),r=Px(),n=Sn(),i=t("%WeakMap%",!0),s=t("%Map%",!0),o=e("WeakMap.prototype.get",!0),a=e("WeakMap.prototype.set",!0),c=e("WeakMap.prototype.has",!0),f=e("Map.prototype.get",!0),h=e("Map.prototype.set",!0),d=e("Map.prototype.has",!0),m=function(b,w){for(var _=b,R;(R=_.next)!==null;_=R)if(R.key===w)return _.next=R.next,R.next=b.next,b.next=R,R},g=function(b,w){var _=m(b,w);return _&&_.value},P=function(b,w,_){var R=m(b,w);R?R.value=_:b.next={key:w,next:b.next,value:_}},S=function(b,w){return!!m(b,w)};return xl=function(){var w,_,R,T={assert:function(y){if(!T.has(y))throw new n("Side channel does not contain "+r(y))},get:function(y){if(i&&y&&(typeof y=="object"||typeof y=="function")){if(w)return o(w,y)}else if(s){if(_)return f(_,y)}else if(R)return g(R,y)},has:function(y){if(i&&y&&(typeof y=="object"||typeof y=="function")){if(w)return c(w,y)}else if(s){if(_)return d(_,y)}else if(R)return S(R,y);return!1},set:function(y,O){i&&y&&(typeof y=="object"||typeof y=="function")?(w||(w=new i),a(w,y,O)):s?(_||(_=new s),h(_,y,O)):(R||(R={key:{},next:null}),P(R,y,O))}};return T},xl}function Bl(){if(bb)return Tl;bb=!0;var t=String.prototype.replace,e=/%20/g,r={RFC1738:"RFC1738",RFC3986:"RFC3986"};return Tl={default:r.RFC3986,formatters:{RFC1738:function(n){return t.call(n,e,"+")},RFC3986:function(n){return String(n)}},RFC1738:r.RFC1738,RFC3986:r.RFC3986},Tl}function Eb(){if(wb)return Pl;wb=!0;var t=Bl(),e=Object.prototype.hasOwnProperty,r=Array.isArray,n=(function(){for(var b=[],w=0;w<256;++w)b.push("%"+((w<16?"0":"")+w.toString(16)).toUpperCase());return b})(),i=function(w){for(;w.length>1;){var _=w.pop(),R=_.obj[_.prop];if(r(R)){for(var T=[],y=0;y<R.length;++y)typeof R[y]<"u"&&T.push(R[y]);_.obj[_.prop]=T}}},s=function(w,_){for(var R=_&&_.plainObjects?Object.create(null):{},T=0;T<w.length;++T)typeof w[T]<"u"&&(R[T]=w[T]);return R},o=function b(w,_,R){if(!_)return w;if(typeof _!="object"){if(r(w))w.push(_);else if(w&&typeof w=="object")(R&&(R.plainObjects||R.allowPrototypes)||!e.call(Object.prototype,_))&&(w[_]=!0);else return[w,_];return w}if(!w||typeof w!="object")return[w].concat(_);var T=w;return r(w)&&!r(_)&&(T=s(w,R)),r(w)&&r(_)?(_.forEach(function(y,O){if(e.call(w,O)){var v=w[O];v&&typeof v=="object"&&y&&typeof y=="object"?w[O]=b(v,y,R):w.push(y)}else w[O]=y}),w):Object.keys(_).reduce(function(y,O){var v=_[O];return e.call(y,O)?y[O]=b(y[O],v,R):y[O]=v,y},T)},a=function(w,_){return Object.keys(_).reduce(function(R,T){return R[T]=_[T],R},w)},c=function(b,w,_){var R=b.replace(/\+/g," ");if(_==="iso-8859-1")return R.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(R)}catch{return R}},f=1024,h=function(w,_,R,T,y){if(w.length===0)return w;var O=w;if(typeof w=="symbol"?O=Symbol.prototype.toString.call(w):typeof w!="string"&&(O=String(w)),R==="iso-8859-1")return escape(O).replace(/%u[0-9a-f]{4}/gi,function(H){return"%26%23"+parseInt(H.slice(2),16)+"%3B"});for(var v="",M=0;M<O.length;M+=f){for(var F=O.length>=f?O.slice(M,M+f):O,U=[],Q=0;Q<F.length;++Q){var W=F.charCodeAt(Q);if(W===45||W===46||W===95||W===126||W>=48&&W<=57||W>=65&&W<=90||W>=97&&W<=122||y===t.RFC1738&&(W===40||W===41)){U[U.length]=F.charAt(Q);continue}if(W<128){U[U.length]=n[W];continue}if(W<2048){U[U.length]=n[192|W>>6]+n[128|W&63];continue}if(W<55296||W>=57344){U[U.length]=n[224|W>>12]+n[128|W>>6&63]+n[128|W&63];continue}Q+=1,W=65536+((W&1023)<<10|F.charCodeAt(Q)&1023),U[U.length]=n[240|W>>18]+n[128|W>>12&63]+n[128|W>>6&63]+n[128|W&63]}v+=U.join("")}return v},d=function(w){for(var _=[{obj:{o:w},prop:"o"}],R=[],T=0;T<_.length;++T)for(var y=_[T],O=y.obj[y.prop],v=Object.keys(O),M=0;M<v.length;++M){var F=v[M],U=O[F];typeof U=="object"&&U!==null&&R.indexOf(U)===-1&&(_.push({obj:O,prop:F}),R.push(U))}return i(_),w},m=function(w){return Object.prototype.toString.call(w)==="[object RegExp]"},g=function(w){return!w||typeof w!="object"?!1:!!(w.constructor&&w.constructor.isBuffer&&w.constructor.isBuffer(w))},P=function(w,_){return[].concat(w,_)},S=function(w,_){if(r(w)){for(var R=[],T=0;T<w.length;T+=1)R.push(_(w[T]));return R}return _(w)};return Pl={arrayToObject:s,assign:a,combine:P,compact:d,decode:c,encode:h,isBuffer:g,isRegExp:m,maybeMap:S,merge:o},Pl}function Rx(){if(mb)return Ol;mb=!0;var t=Ox(),e=Eb(),r=Bl(),n=Object.prototype.hasOwnProperty,i={brackets:function(b){return b+"[]"},comma:"comma",indices:function(b,w){return b+"["+w+"]"},repeat:fu
Line truncated
|
||||
`," "],o=["{","}","|","\\","^","`"].concat(s),a=["'"].concat(o),c=["%","/","?",";","#"].concat(a),f=["/","?","#"],h=255,d=/^[+a-z0-9A-Z_-]{0,63}$/,m=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,g={javascript:!0,"javascript:":!0},P={javascript:!0,"javascript:":!0},S={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},b=Cx();function w(y,O,v){if(y&&typeof y=="object"&&y instanceof e)return y;var M=new e;return M.parse(y,O,v),M}e.prototype.parse=function(y,O,v){if(typeof y!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof y);var M=y.indexOf("?"),F=M!==-1&&M<y.indexOf("#")?"?":"#",U=y.split(F),Q=/\\/g;U[0]=U[0].replace(Q,"/"),y=U.join(F);var W=y;if(W=W.trim(),!v&&y.split("#").length===1){var H=i.exec(W);if(H)return this.path=W,this.href=W,this.pathname=H[1],H[2]?(this.search=H[2],O?this.query=b.parse(this.search.substr(1)):this.query=this.search.substr(1)):O&&(this.search="",this.query={}),this}var z=r.exec(W);if(z){z=z[0];var J=z.toLowerCase();this.protocol=J,W=W.substr(z.length)}if(v||z||W.match(/^\/\/[^@/]+@[^@/]+/)){var ee=W.substr(0,2)==="//";ee&&!(z&&P[z])&&(W=W.substr(2),this.slashes=!0)}if(!P[z]&&(ee||z&&!S[z])){for(var G=-1,V=0;V<f.length;V++){var te=W.indexOf(f[V]);te!==-1&&(G===-1||te<G)&&(G=te)}var Y,X;G===-1?X=W.lastIndexOf("@"):X=W.lastIndexOf("@",G),X!==-1&&(Y=W.slice(0,X),W=W.slice(X+1),this.auth=decodeURIComponent(Y)),G=-1;for(var V=0;V<c.length;V++){var te=W.indexOf(c[V]);te!==-1&&(G===-1||te<G)&&(G=te)}G===-1&&(G=W.length),this.host=W.slice(0,G),W=W.slice(G),this.parseHost(),this.hostname=this.hostname||"";var ce=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!ce)for(var Z=this.hostname.split(/\./),V=0,ne=Z.length;V<ne;V++){var he=Z[V];if(he&&!he.match(d)){for(var be="",ye=0,Ae=he.length;ye<Ae;ye++)he.charCodeAt(ye)>127?be+="x":be+=he[ye];if(!be.match(d)){var _e=Z.slice(0,V),ve=Z.slice(V+1),Oe=he.match(m);Oe&&(_e.push(Oe[1]),ve.unshift(Oe[2])),ve.length&&(W="/"+ve.join(".")+W),this.hostname=_e.join(".");break}}}this.hostname.length>h?this.hostname="":this.hostname=this.hostname.toLowerCase(),ce||(this.hostname=t.toASCII(this.hostname));var xe=this.port?":"+this.port:"",st=this.hostname||"";this.host=st+xe,this.href+=this.host,ce&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),W[0]!=="/"&&(W="/"+W))}if(!g[J])for(var V=0,ne=a.length;V<ne;V++){var Re=a[V];if(W.indexOf(Re)!==-1){var Ne=encodeURIComponent(Re);Ne===Re&&(Ne=escape(Re)),W=W.split(Re).join(Ne)}}var Ct=W.indexOf("#");Ct!==-1&&(this.hash=W.substr(Ct),W=W.slice(0,Ct));var Bt=W.indexOf("?");if(Bt!==-1?(this.search=W.substr(Bt),this.query=W.substr(Bt+1),O&&(this.query=b.parse(this.query)),W=W.slice(0,Bt)):O&&(this.search="",this.query={}),W&&(this.pathname=W),S[J]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var xe=this.pathname||"",xn=this.search||"";this.path=xe+xn}return this.href=this.format(),this};function _(y){return typeof y=="string"&&(y=w(y)),y instanceof e?y.format():e.prototype.format.call(y)}e.prototype.format=function(){var y=this.auth||"";y&&(y=encodeURIComponent(y),y=y.replace(/%3A/i,":"),y+="@");var O=this.protocol||"",v=this.pathname||"",M=this.hash||"",F=!1,U="";this.host?F=y+this.host:this.hostname&&(F=y+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(F+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(U=b.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var Q=this.search||U&&"?"+U||"";return O&&O.substr(-1)!==":"&&(O+=":"),this.slashes||(!O||S[O])&&F!==!1?(F="//"+(F||""),v&&v.charAt(0)!=="/"&&(v="/"+v)):F||(F=""),M&&M.charAt(0)!=="#"&&(M="#"+M),Q&&Q.charAt(0)!=="?"&&(Q="?"+Q),v=v.replace(/[?#]/g,function(W){return encodeURIComponent(W)}),Q=Q.replace("#","%23"),O+F+v+Q+M};function R(y,O){return w(y,!1,!0).resolve(O)}e.prototype.resolve=function(y){return this.resolveObject(w(y,!1,!0)).format()};function T(y,O){return y?w(y,!1,!0).resolveObject(O):O}return e.prototype.resolveObject=function(y){if(typeof y=="string"){var O=new e;O.parse(y,!1,!0),y=O}for(var v=new e,M=Object.keys(this),F=0;F<M.length;F++){var U=M[F];v[U]=this[U]}if(v.hash=y.hash,y.href==="")return v.href=v.format(),v;if(y.slashes&&!y.protocol){for(var Q=Object.keys(y),W=0;W<Q.length;W++){var H=Q[W];H!=="protocol"&&(v[H]=y[H])}return S[v.protocol]&&v.hostname&&!v.pathname&&(v.pathname="/",v.path=v.pathname),v.href=v.format(),v}if(y.protocol&&y.protocol!==v.protocol){if(!S[y.protocol]){for(var z=Object.keys(y),J=0;J<z.length;J++){var ee=z[J];v[ee]=y[ee]}return v.href=v.format(),v}if(v.protocol=y.protocol,!y.host&&!P[y.protocol]){for(var ne=(y.pathname||"").split("/");ne.length&&!(y.host=ne.shift()););y.host||(y.host=""),y.hostname||(y.hostname=""),ne[0]!==""&&ne.unshift(""),ne.length<2&&ne.unshift(""),v.pathname=ne.join("/")}else v.pathname=y.pathname;if(v.search=y.search,v.query=y.query,v.host=y.host||"",v.auth=y.auth,v.hostname=y.ho
Line truncated
|
||||
`)&&(e=e.replace(Kx,"%0A")),e.includes("\r")&&(e=e.replace(Qx,"%0D")),e.includes(" ")&&(e=e.replace(Yx,"%09")),n.pathname=e,n}var Tx,Al,yb,Il,xl,gb,Tl,bb,Pl,wb,Ol,mb,Rl,_b,kl,vb,Hr,Sb,Ge,Mx,Nx,qx,Lx,Ux,Dx,jx,Fx,Wx,$x,Hx,Cl,Vx,Gx,zx,Kx,Qx,Yx,Tb=ze(()=>{A();x();I();Dg();cb();pb();vl();Tx=Object.freeze(Object.create(null)),Al={},yb=!1,Il=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;xl={},gb=!1;Tl={},bb=!1;Pl={},wb=!1;Ol={},mb=!1;Rl={},_b=!1;kl={},vb=!1;Hr={},Sb=!1;Ge=Bx();Ge.parse;Ge.resolve;Ge.resolveObject;Ge.format;Ge.Url;Mx=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;Ge.URL=typeof URL<"u"?URL:null;Ge.pathToFileURL=Ib;Ge.fileURLToPath=Ab;Nx=Ge.Url,qx=Ge.format,Lx=Ge.resolve,Ux=Ge.resolveObject,Dx=Ge.parse,jx=Ge.URL,Fx=92,Wx=47,$x=97,Hx=122,Cl=Mx==="win32",Vx=/\//g,Gx=/%/g,zx=/\\/g,Kx=/\n/g,Qx=/\r/g,Yx=/\t/g});var Ob=j(($F,Pb)=>{"use strict";A();x();I();Pb.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var Qo=j(mi=>{"use strict";A();x();I();Object.defineProperty(mi,"__esModule",{value:!0});mi.BufferedDuplex=void 0;mi.writev=kb;var Zx=or(),Rb=(ke(),me(qe));function kb(t,e){let r=new Array(t.length);for(let n=0;n<t.length;n++)typeof t[n].chunk=="string"?r[n]=Rb.Buffer.from(t[n].chunk,"utf8"):r[n]=t[n].chunk;this._write(Rb.Buffer.concat(r),"binary",e)}var Ml=class extends Zx.Duplex{socket;proxy;isSocketOpen;writeQueue;constructor(e,r,n){super({objectMode:!0}),this.proxy=r,this.socket=n,this.writeQueue=[],e.objectMode||(this._writev=kb.bind(this)),this.isSocketOpen=!1,this.proxy.on("data",i=>{!this.destroyed&&this.readable&&this.push(i)})}_read(e){this.proxy.read(e)}_write(e,r,n){this.isSocketOpen?this.writeToProxy(e,r,n):this.writeQueue.push({chunk:e,encoding:r,cb:n})}_final(e){this.writeQueue=[],this.proxy.end(e)}_destroy(e,r){this.writeQueue=[],this.proxy.destroy(),r(e)}socketReady(){this.emit("connect"),this.isSocketOpen=!0,this.processWriteQueue()}writeToProxy(e,r,n){this.proxy.write(e,r)===!1?this.proxy.once("drain",n):n()}processWriteQueue(){for(;this.writeQueue.length>0;){let{chunk:e,encoding:r,cb:n}=this.writeQueue.shift();this.writeToProxy(e,r,n)}}};mi.BufferedDuplex=Ml});var _i=j(gr=>{"use strict";A();x();I();var ql=gr&&gr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(gr,"__esModule",{value:!0});gr.streamBuilder=gr.browserStreamBuilder=void 0;var Yo=(ke(),me(qe)),Cb=ql(Ob()),eT=ql(At()),tT=or(),rT=ql(yi()),Nl=Qo(),yr=(0,eT.default)("mqttjs:ws"),nT=["rejectUnauthorized","ca","cert","key","pfx","passphrase"];function Bb(t,e){let r=`${t.protocol}://${t.hostname}:${t.port}${t.path}`;return typeof t.transformWsUrl=="function"&&(r=t.transformWsUrl(r,t,e)),r}function Mb(t){let e=t;return t.port||(t.protocol==="wss"?e.port=443:e.port=80),t.path||(e.path="/"),t.wsOptions||(e.wsOptions={}),!rT.default&&!t.forceNativeWebSocket&&t.protocol==="wss"&&nT.forEach(r=>{Object.prototype.hasOwnProperty.call(t,r)&&!Object.prototype.hasOwnProperty.call(t.wsOptions,r)&&(e.wsOptions[r]=t[r])}),e}function iT(t){let e=Mb(t);if(e.hostname||(e.hostname=e.host),!e.hostname){if(typeof document>"u")throw new Error("Could not determine host. Specify host manually.");let r=new URL(document.URL);e.hostname=r.hostname,e.port||(e.port=Number(r.port))}return e.objectMode===void 0&&(e.objectMode=!(e.binary===!0||e.binary===void 0)),e}function oT(t,e,r){yr("createWebSocket"),yr(`protocol: ${r.protocolId} ${r.protocolVersion}`);let n=r.protocolId==="MQIsdp"&&r.protocolVersion===3?"mqttv3.1":"mqtt";yr(`creating new Websocket for url: ${e} and protocol: ${n}`);let i;return r.createWebsocket?i=r.createWebsocket(e,[n],r):i=new Cb.default(e,[n],r.wsOptions),i}function sT(t,e){let r=e.protocolId==="MQIsdp"&&e.protocolVersion===3?"mqttv3.1":"mqtt",n=Bb(e,t),i;return e.createWebsocket?i=e.createWebsocket(n,[r],e):i=new WebSocket(n,[r]),i.binaryType="arraybuffer",i}var aT=(t,e)=>{yr("streamBuilder");let r=Mb(e);r.hostname=r.hostname||r.host||"localhost";let n=Bb(r,t),i=oT(t,n,r),s=Cb.default.createWebSocketStream(i,r.wsOptions);return s.url=n,i.on("close",()=>{s.destroy()}),s};gr.streamBuilder=aT;var uT=(t,e)=>{yr("browserStreamBuilder");let r,i=iT(e).browserBufferSize||1024*512,s=e.browserBufferTimeout||1e3,o=!e.objectMode,a=sT(t,e),c=h(e,S,b);e.objectMode||(c._writev=Nl.writev.bind(c)),c.on("close",()=>{a.close()});let f=typeof a.addEventListener<"u";a.readyState===a.OPEN?(r=c,r.socket=a):(r=new Nl.BufferedDuplex(e,c,a),f?a.addEventListener("open",d):a.onopen=d),f?(a.addEventListener("close",m),a.addEventListener("error",g),a.addEventListener("message",P)):(a.onclose=m,a.onerror=g,a.onmessage=P);function h(w,_,R){let T=new tT.Transform({objectMode:w.objectMode});return T._write=_,T._flush=R,T}function d(){yr("WebSocket onOpen"),r instanceof Nl.BufferedDuplex&&r.socketReady()}function m(w){yr("WebSocket onClose",w),r.end(),r.destroy()}function g(w){yr("WebSocket onError",w);let _=new
Line truncated
|
||||
/*! Bundled license information:
|
||||
|
||||
@jspm/core/nodelibs/browser/chunk-DtuTasat.js:
|
||||
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
||||
|
||||
safe-buffer/index.js:
|
||||
(*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
||||
|
||||
@babel/runtime/helpers/regenerator.js:
|
||||
(*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE *)
|
||||
*/
|
||||
@@ -0,0 +1,676 @@
|
||||
/**
|
||||
* VideoRTC v1.6.0 - Video player for go2rtc streaming application.
|
||||
*
|
||||
* All modern web technologies are supported in almost any browser except Apple Safari.
|
||||
*
|
||||
* Support:
|
||||
* - ECMAScript 2017 (ES8) = ES6 + async
|
||||
* - RTCPeerConnection for Safari iOS 11.0+
|
||||
* - IntersectionObserver for Safari iOS 12.2+
|
||||
* - ManagedMediaSource for Safari 17+
|
||||
*
|
||||
* Doesn't support:
|
||||
* - MediaSource for Safari iOS
|
||||
* - Customized built-in elements (extends HTMLVideoElement) because Safari
|
||||
* - Autoplay for WebRTC in Safari
|
||||
*/
|
||||
export class VideoRTC extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.DISCONNECT_TIMEOUT = 5000;
|
||||
this.RECONNECT_TIMEOUT = 15000;
|
||||
|
||||
this.CODECS = [
|
||||
'avc1.640029', // H.264 high 4.1 (Chromecast 1st and 2nd Gen)
|
||||
'avc1.64002A', // H.264 high 4.2 (Chromecast 3rd Gen)
|
||||
'avc1.640033', // H.264 high 5.1 (Chromecast with Google TV)
|
||||
'hvc1.1.6.L153.B0', // H.265 main 5.1 (Chromecast Ultra)
|
||||
'mp4a.40.2', // AAC LC
|
||||
'mp4a.40.5', // AAC HE
|
||||
'flac', // FLAC (PCM compatible)
|
||||
'opus', // OPUS Chrome, Firefox
|
||||
];
|
||||
|
||||
/**
|
||||
* [config] Supported modes (webrtc, webrtc/tcp, mse, hls, mp4, mjpeg).
|
||||
* @type {string}
|
||||
*/
|
||||
this.mode = 'webrtc,mse,hls,mjpeg';
|
||||
|
||||
/**
|
||||
* [Config] Requested medias (video, audio, microphone).
|
||||
* @type {string}
|
||||
*/
|
||||
this.media = 'video,audio';
|
||||
|
||||
/**
|
||||
* [config] Run stream when not displayed on the screen. Default `false`.
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.background = false;
|
||||
|
||||
/**
|
||||
* [config] Run stream only when player in the viewport. Stop when user scroll out player.
|
||||
* Value is percentage of visibility from `0` (not visible) to `1` (full visible).
|
||||
* Default `0` - disable;
|
||||
* @type {number}
|
||||
*/
|
||||
this.visibilityThreshold = 0;
|
||||
|
||||
/**
|
||||
* [config] Run stream only when browser page on the screen. Stop when user change browser
|
||||
* tab or minimise browser windows.
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.visibilityCheck = true;
|
||||
|
||||
/**
|
||||
* [config] WebRTC configuration
|
||||
* @type {RTCConfiguration}
|
||||
*/
|
||||
this.pcConfig = {
|
||||
bundlePolicy: 'max-bundle',
|
||||
iceServers: [{urls: 'stun:stun.l.google.com:19302'}],
|
||||
sdpSemantics: 'unified-plan', // important for Chromecast 1
|
||||
};
|
||||
|
||||
/**
|
||||
* [info] WebSocket connection state. Values: CONNECTING, OPEN, CLOSED
|
||||
* @type {number}
|
||||
*/
|
||||
this.wsState = WebSocket.CLOSED;
|
||||
|
||||
/**
|
||||
* [info] WebRTC connection state.
|
||||
* @type {number}
|
||||
*/
|
||||
this.pcState = WebSocket.CLOSED;
|
||||
|
||||
/**
|
||||
* @type {HTMLVideoElement}
|
||||
*/
|
||||
this.video = null;
|
||||
|
||||
/**
|
||||
* @type {WebSocket}
|
||||
*/
|
||||
this.ws = null;
|
||||
|
||||
/**
|
||||
* @type {string|URL}
|
||||
*/
|
||||
this.wsURL = '';
|
||||
|
||||
/**
|
||||
* @type {RTCPeerConnection}
|
||||
*/
|
||||
this.pc = null;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
this.connectTS = 0;
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
this.mseCodecs = '';
|
||||
|
||||
/**
|
||||
* [internal] Disconnect TimeoutID.
|
||||
* @type {number}
|
||||
*/
|
||||
this.disconnectTID = 0;
|
||||
|
||||
/**
|
||||
* [internal] Reconnect TimeoutID.
|
||||
* @type {number}
|
||||
*/
|
||||
this.reconnectTID = 0;
|
||||
|
||||
/**
|
||||
* [internal] Handler for receiving Binary from WebSocket.
|
||||
* @type {Function}
|
||||
*/
|
||||
this.ondata = null;
|
||||
|
||||
/**
|
||||
* [internal] Handlers list for receiving JSON from WebSocket.
|
||||
* @type {Object.<string,Function>}
|
||||
*/
|
||||
this.onmessage = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set video source (WebSocket URL). Support relative path.
|
||||
* @param {string|URL} value
|
||||
*/
|
||||
set src(value) {
|
||||
if (typeof value !== 'string') value = value.toString();
|
||||
if (value.startsWith('http')) {
|
||||
value = 'ws' + value.substring(4);
|
||||
} else if (value.startsWith('/')) {
|
||||
value = 'ws' + location.origin.substring(4) + value;
|
||||
}
|
||||
|
||||
this.wsURL = value;
|
||||
|
||||
this.onconnect();
|
||||
}
|
||||
|
||||
/**
|
||||
* Play video. Support automute when autoplay blocked.
|
||||
* https://developer.chrome.com/blog/autoplay/
|
||||
*/
|
||||
play() {
|
||||
this.video.play().catch(() => {
|
||||
if (!this.video.muted) {
|
||||
this.video.muted = true;
|
||||
this.video.play().catch(er => {
|
||||
console.warn(er);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Send message to server via WebSocket
|
||||
* @param {Object} value
|
||||
*/
|
||||
send(value) {
|
||||
if (this.ws) this.ws.send(JSON.stringify(value));
|
||||
}
|
||||
|
||||
/** @param {Function} isSupported */
|
||||
codecs(isSupported) {
|
||||
return this.CODECS
|
||||
.filter(codec => this.media.indexOf(codec.indexOf('vc1') > 0 ? 'video' : 'audio') >= 0)
|
||||
.filter(codec => isSupported(`video/mp4; codecs="${codec}"`)).join();
|
||||
}
|
||||
|
||||
/**
|
||||
* `CustomElement`. Invoked each time the custom element is appended into a
|
||||
* document-connected element.
|
||||
*/
|
||||
connectedCallback() {
|
||||
if (this.disconnectTID) {
|
||||
clearTimeout(this.disconnectTID);
|
||||
this.disconnectTID = 0;
|
||||
}
|
||||
|
||||
// because video autopause on disconnected from DOM
|
||||
if (this.video) {
|
||||
const seek = this.video.seekable;
|
||||
if (seek.length > 0) {
|
||||
this.video.currentTime = seek.end(seek.length - 1);
|
||||
}
|
||||
this.play();
|
||||
} else {
|
||||
this.oninit();
|
||||
}
|
||||
|
||||
this.onconnect();
|
||||
}
|
||||
|
||||
/**
|
||||
* `CustomElement`. Invoked each time the custom element is disconnected from the
|
||||
* document's DOM.
|
||||
*/
|
||||
disconnectedCallback() {
|
||||
if (this.background || this.disconnectTID) return;
|
||||
if (this.wsState === WebSocket.CLOSED && this.pcState === WebSocket.CLOSED) return;
|
||||
|
||||
this.disconnectTID = setTimeout(() => {
|
||||
if (this.reconnectTID) {
|
||||
clearTimeout(this.reconnectTID);
|
||||
this.reconnectTID = 0;
|
||||
}
|
||||
|
||||
this.disconnectTID = 0;
|
||||
|
||||
this.ondisconnect();
|
||||
}, this.DISCONNECT_TIMEOUT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates child DOM elements. Called automatically once on `connectedCallback`.
|
||||
*/
|
||||
oninit() {
|
||||
this.video = document.createElement('video');
|
||||
this.video.controls = true;
|
||||
this.video.playsInline = true;
|
||||
this.video.preload = 'auto';
|
||||
|
||||
this.video.style.display = 'block'; // fix bottom margin 4px
|
||||
this.video.style.width = '100%';
|
||||
this.video.style.height = '100%';
|
||||
|
||||
this.appendChild(this.video);
|
||||
|
||||
this.video.addEventListener('error', ev => {
|
||||
console.warn(ev);
|
||||
if (this.ws) this.ws.close(); // run reconnect for broken MSE stream
|
||||
});
|
||||
|
||||
// all Safari lies about supported audio codecs
|
||||
const m = window.navigator.userAgent.match(/Version\/(\d+).+Safari/);
|
||||
if (m) {
|
||||
// AAC from v13, FLAC from v14, OPUS - unsupported
|
||||
const skip = m[1] < '13' ? 'mp4a.40.2' : m[1] < '14' ? 'flac' : 'opus';
|
||||
this.CODECS.splice(this.CODECS.indexOf(skip));
|
||||
}
|
||||
|
||||
if (this.background) return;
|
||||
|
||||
if ('hidden' in document && this.visibilityCheck) {
|
||||
document.addEventListener('visibilitychange', () => {
|
||||
if (document.hidden) {
|
||||
this.disconnectedCallback();
|
||||
} else if (this.isConnected) {
|
||||
this.connectedCallback();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if ('IntersectionObserver' in window && this.visibilityThreshold) {
|
||||
const observer = new IntersectionObserver(entries => {
|
||||
entries.forEach(entry => {
|
||||
if (!entry.isIntersecting) {
|
||||
this.disconnectedCallback();
|
||||
} else if (this.isConnected) {
|
||||
this.connectedCallback();
|
||||
}
|
||||
});
|
||||
}, {threshold: this.visibilityThreshold});
|
||||
observer.observe(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect to WebSocket. Called automatically on `connectedCallback`.
|
||||
* @return {boolean} true if the connection has started.
|
||||
*/
|
||||
onconnect() {
|
||||
if (!this.isConnected || !this.wsURL || this.ws || this.pc) return false;
|
||||
|
||||
// CLOSED or CONNECTING => CONNECTING
|
||||
this.wsState = WebSocket.CONNECTING;
|
||||
|
||||
this.connectTS = Date.now();
|
||||
|
||||
this.ws = new WebSocket(this.wsURL);
|
||||
this.ws.binaryType = 'arraybuffer';
|
||||
this.ws.addEventListener('open', () => this.onopen());
|
||||
this.ws.addEventListener('close', () => this.onclose());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
ondisconnect() {
|
||||
this.wsState = WebSocket.CLOSED;
|
||||
if (this.ws) {
|
||||
this.ws.close();
|
||||
this.ws = null;
|
||||
}
|
||||
|
||||
this.pcState = WebSocket.CLOSED;
|
||||
if (this.pc) {
|
||||
this.pc.getSenders().forEach(sender => {
|
||||
if (sender.track) sender.track.stop();
|
||||
});
|
||||
this.pc.close();
|
||||
this.pc = null;
|
||||
}
|
||||
|
||||
this.video.src = '';
|
||||
this.video.srcObject = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Array.<string>} of modes (mse, webrtc, etc.)
|
||||
*/
|
||||
onopen() {
|
||||
// CONNECTING => OPEN
|
||||
this.wsState = WebSocket.OPEN;
|
||||
|
||||
this.ws.addEventListener('message', ev => {
|
||||
if (typeof ev.data === 'string') {
|
||||
const msg = JSON.parse(ev.data);
|
||||
for (const mode in this.onmessage) {
|
||||
this.onmessage[mode](msg);
|
||||
}
|
||||
} else {
|
||||
this.ondata(ev.data);
|
||||
}
|
||||
});
|
||||
|
||||
this.ondata = null;
|
||||
this.onmessage = {};
|
||||
|
||||
const modes = [];
|
||||
|
||||
if (this.mode.indexOf('mse') >= 0 && ('MediaSource' in window || 'ManagedMediaSource' in window)) {
|
||||
modes.push('mse');
|
||||
this.onmse();
|
||||
} else if (this.mode.indexOf('hls') >= 0 && this.video.canPlayType('application/vnd.apple.mpegurl')) {
|
||||
modes.push('hls');
|
||||
this.onhls();
|
||||
} else if (this.mode.indexOf('mp4') >= 0) {
|
||||
modes.push('mp4');
|
||||
this.onmp4();
|
||||
}
|
||||
|
||||
if (this.mode.indexOf('webrtc') >= 0 && 'RTCPeerConnection' in window) {
|
||||
modes.push('webrtc');
|
||||
this.onwebrtc();
|
||||
}
|
||||
|
||||
if (this.mode.indexOf('mjpeg') >= 0) {
|
||||
if (modes.length) {
|
||||
this.onmessage['mjpeg'] = msg => {
|
||||
if (msg.type !== 'error' || msg.value.indexOf(modes[0]) !== 0) return;
|
||||
this.onmjpeg();
|
||||
};
|
||||
} else {
|
||||
modes.push('mjpeg');
|
||||
this.onmjpeg();
|
||||
}
|
||||
}
|
||||
|
||||
return modes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {boolean} true if reconnection has started.
|
||||
*/
|
||||
onclose() {
|
||||
if (this.wsState === WebSocket.CLOSED) return false;
|
||||
|
||||
// CONNECTING, OPEN => CONNECTING
|
||||
this.wsState = WebSocket.CONNECTING;
|
||||
this.ws = null;
|
||||
|
||||
// reconnect no more than once every X seconds
|
||||
const delay = Math.max(this.RECONNECT_TIMEOUT - (Date.now() - this.connectTS), 0);
|
||||
|
||||
this.reconnectTID = setTimeout(() => {
|
||||
this.reconnectTID = 0;
|
||||
this.onconnect();
|
||||
}, delay);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
onmse() {
|
||||
/** @type {MediaSource} */
|
||||
let ms;
|
||||
|
||||
if ('ManagedMediaSource' in window) {
|
||||
const MediaSource = window.ManagedMediaSource;
|
||||
|
||||
ms = new MediaSource();
|
||||
ms.addEventListener('sourceopen', () => {
|
||||
this.send({type: 'mse', value: this.codecs(MediaSource.isTypeSupported)});
|
||||
}, {once: true});
|
||||
|
||||
this.video.disableRemotePlayback = true;
|
||||
this.video.srcObject = ms;
|
||||
} else {
|
||||
ms = new MediaSource();
|
||||
ms.addEventListener('sourceopen', () => {
|
||||
URL.revokeObjectURL(this.video.src);
|
||||
this.send({type: 'mse', value: this.codecs(MediaSource.isTypeSupported)});
|
||||
}, {once: true});
|
||||
|
||||
this.video.src = URL.createObjectURL(ms);
|
||||
this.video.srcObject = null;
|
||||
}
|
||||
|
||||
this.play();
|
||||
|
||||
this.mseCodecs = '';
|
||||
|
||||
this.onmessage['mse'] = msg => {
|
||||
if (msg.type !== 'mse') return;
|
||||
|
||||
this.mseCodecs = msg.value;
|
||||
|
||||
const sb = ms.addSourceBuffer(msg.value);
|
||||
sb.mode = 'segments'; // segments or sequence
|
||||
sb.addEventListener('updateend', () => {
|
||||
if (!sb.updating && bufLen > 0) {
|
||||
try {
|
||||
const data = buf.slice(0, bufLen);
|
||||
sb.appendBuffer(data);
|
||||
bufLen = 0;
|
||||
} catch (e) {
|
||||
// console.debug(e);
|
||||
}
|
||||
}
|
||||
|
||||
if (!sb.updating && sb.buffered && sb.buffered.length) {
|
||||
const end = sb.buffered.end(sb.buffered.length - 1);
|
||||
const start = end - 5;
|
||||
const start0 = sb.buffered.start(0);
|
||||
if (start > start0) {
|
||||
sb.remove(start0, start);
|
||||
ms.setLiveSeekableRange(start, end);
|
||||
}
|
||||
if (this.video.currentTime < start) {
|
||||
this.video.currentTime = start;
|
||||
}
|
||||
const gap = end - this.video.currentTime;
|
||||
this.video.playbackRate = gap > 0.1 ? gap : 0.1;
|
||||
// console.debug('VideoRTC.buffered', gap, this.video.playbackRate, this.video.readyState);
|
||||
}
|
||||
});
|
||||
|
||||
const buf = new Uint8Array(2 * 1024 * 1024);
|
||||
let bufLen = 0;
|
||||
|
||||
this.ondata = data => {
|
||||
if (sb.updating || bufLen > 0) {
|
||||
const b = new Uint8Array(data);
|
||||
buf.set(b, bufLen);
|
||||
bufLen += b.byteLength;
|
||||
// console.debug('VideoRTC.buffer', b.byteLength, bufLen);
|
||||
} else {
|
||||
try {
|
||||
sb.appendBuffer(data);
|
||||
} catch (e) {
|
||||
// console.debug(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
onwebrtc() {
|
||||
const pc = new RTCPeerConnection(this.pcConfig);
|
||||
|
||||
pc.addEventListener('icecandidate', ev => {
|
||||
if (ev.candidate && this.mode.indexOf('webrtc/tcp') >= 0 && ev.candidate.protocol === 'udp') return;
|
||||
|
||||
const candidate = ev.candidate ? ev.candidate.toJSON().candidate : '';
|
||||
this.send({type: 'webrtc/candidate', value: candidate});
|
||||
});
|
||||
|
||||
pc.addEventListener('connectionstatechange', () => {
|
||||
if (pc.connectionState === 'connected') {
|
||||
const tracks = pc.getTransceivers()
|
||||
.filter(tr => tr.currentDirection === 'recvonly') // skip inactive
|
||||
.map(tr => tr.receiver.track);
|
||||
/** @type {HTMLVideoElement} */
|
||||
const video2 = document.createElement('video');
|
||||
video2.addEventListener('loadeddata', () => this.onpcvideo(video2), {once: true});
|
||||
video2.srcObject = new MediaStream(tracks);
|
||||
} else if (pc.connectionState === 'failed' || pc.connectionState === 'disconnected') {
|
||||
pc.close(); // stop next events
|
||||
|
||||
this.pcState = WebSocket.CLOSED;
|
||||
this.pc = null;
|
||||
|
||||
this.onconnect();
|
||||
}
|
||||
});
|
||||
|
||||
this.onmessage['webrtc'] = msg => {
|
||||
switch (msg.type) {
|
||||
case 'webrtc/candidate':
|
||||
if (this.mode.indexOf('webrtc/tcp') >= 0 && msg.value.indexOf(' udp ') > 0) return;
|
||||
|
||||
pc.addIceCandidate({candidate: msg.value, sdpMid: '0'}).catch(er => {
|
||||
console.warn(er);
|
||||
});
|
||||
break;
|
||||
case 'webrtc/answer':
|
||||
pc.setRemoteDescription({type: 'answer', sdp: msg.value}).catch(er => {
|
||||
console.warn(er);
|
||||
});
|
||||
break;
|
||||
case 'error':
|
||||
if (msg.value.indexOf('webrtc/offer') < 0) return;
|
||||
pc.close();
|
||||
}
|
||||
};
|
||||
|
||||
this.createOffer(pc).then(offer => {
|
||||
this.send({type: 'webrtc/offer', value: offer.sdp});
|
||||
});
|
||||
|
||||
this.pcState = WebSocket.CONNECTING;
|
||||
this.pc = pc;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param pc {RTCPeerConnection}
|
||||
* @return {Promise<RTCSessionDescriptionInit>}
|
||||
*/
|
||||
async createOffer(pc) {
|
||||
try {
|
||||
if (this.media.indexOf('microphone') >= 0) {
|
||||
const media = await navigator.mediaDevices.getUserMedia({audio: true});
|
||||
media.getTracks().forEach(track => {
|
||||
pc.addTransceiver(track, {direction: 'sendonly'});
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn(e);
|
||||
}
|
||||
|
||||
for (const kind of ['video', 'audio']) {
|
||||
if (this.media.indexOf(kind) >= 0) {
|
||||
pc.addTransceiver(kind, {direction: 'recvonly'});
|
||||
}
|
||||
}
|
||||
|
||||
const offer = await pc.createOffer();
|
||||
await pc.setLocalDescription(offer);
|
||||
return offer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param video2 {HTMLVideoElement}
|
||||
*/
|
||||
onpcvideo(video2) {
|
||||
if (this.pc) {
|
||||
// Video+Audio > Video, H265 > H264, Video > Audio, WebRTC > MSE
|
||||
let rtcPriority = 0, msePriority = 0;
|
||||
|
||||
/** @type {MediaStream} */
|
||||
const stream = video2.srcObject;
|
||||
if (stream.getVideoTracks().length > 0) rtcPriority += 0x220;
|
||||
if (stream.getAudioTracks().length > 0) rtcPriority += 0x102;
|
||||
|
||||
if (this.mseCodecs.indexOf('hvc1.') >= 0) msePriority += 0x230;
|
||||
if (this.mseCodecs.indexOf('avc1.') >= 0) msePriority += 0x210;
|
||||
if (this.mseCodecs.indexOf('mp4a.') >= 0) msePriority += 0x101;
|
||||
|
||||
if (rtcPriority >= msePriority) {
|
||||
this.video.srcObject = stream;
|
||||
this.play();
|
||||
|
||||
this.pcState = WebSocket.OPEN;
|
||||
|
||||
this.wsState = WebSocket.CLOSED;
|
||||
if (this.ws) {
|
||||
this.ws.close();
|
||||
this.ws = null;
|
||||
}
|
||||
} else {
|
||||
this.pcState = WebSocket.CLOSED;
|
||||
if (this.pc) {
|
||||
this.pc.close();
|
||||
this.pc = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
video2.srcObject = null;
|
||||
}
|
||||
|
||||
onmjpeg() {
|
||||
this.ondata = data => {
|
||||
this.video.controls = false;
|
||||
this.video.poster = 'data:image/jpeg;base64,' + VideoRTC.btoa(data);
|
||||
};
|
||||
|
||||
this.send({type: 'mjpeg'});
|
||||
}
|
||||
|
||||
onhls() {
|
||||
this.onmessage['hls'] = msg => {
|
||||
if (msg.type !== 'hls') return;
|
||||
|
||||
const url = 'http' + this.wsURL.substring(2, this.wsURL.indexOf('/ws')) + '/hls/';
|
||||
const playlist = msg.value.replace('hls/', url);
|
||||
this.video.src = 'data:application/vnd.apple.mpegurl;base64,' + btoa(playlist);
|
||||
this.play();
|
||||
};
|
||||
|
||||
this.send({type: 'hls', value: this.codecs(type => this.video.canPlayType(type))});
|
||||
}
|
||||
|
||||
onmp4() {
|
||||
/** @type {HTMLCanvasElement} **/
|
||||
const canvas = document.createElement('canvas');
|
||||
/** @type {CanvasRenderingContext2D} */
|
||||
let context;
|
||||
|
||||
/** @type {HTMLVideoElement} */
|
||||
const video2 = document.createElement('video');
|
||||
video2.autoplay = true;
|
||||
video2.playsInline = true;
|
||||
video2.muted = true;
|
||||
|
||||
video2.addEventListener('loadeddata', () => {
|
||||
if (!context) {
|
||||
canvas.width = video2.videoWidth;
|
||||
canvas.height = video2.videoHeight;
|
||||
context = canvas.getContext('2d');
|
||||
}
|
||||
|
||||
context.drawImage(video2, 0, 0, canvas.width, canvas.height);
|
||||
|
||||
this.video.controls = false;
|
||||
this.video.poster = canvas.toDataURL('image/jpeg');
|
||||
});
|
||||
|
||||
this.ondata = data => {
|
||||
video2.src = 'data:video/mp4;base64,' + VideoRTC.btoa(data);
|
||||
};
|
||||
|
||||
this.send({type: 'mp4', value: this.codecs(this.video.canPlayType)});
|
||||
}
|
||||
|
||||
static btoa(buffer) {
|
||||
const bytes = new Uint8Array(buffer);
|
||||
const len = bytes.byteLength;
|
||||
let binary = '';
|
||||
for (let i = 0; i < len; i++) {
|
||||
binary += String.fromCharCode(bytes[i]);
|
||||
}
|
||||
return window.btoa(binary);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,9 @@
|
||||
# dev stack — developer tooling: code-server, DBX, BookStack, Plane.
|
||||
# dev stack — developer tooling: code-server, DBX, BookStack.
|
||||
# (Gitea, gitea-runner, postgres_gitea, registry, and registry-ui moved to the
|
||||
# management plane in portainer-compose.yml.)
|
||||
# management plane in portainer-compose.yml. Plane was removed 2026-10-26.)
|
||||
#
|
||||
# Volume -> bind-mount conversions:
|
||||
# dbx data -> /config/dbx (SSD)
|
||||
# plane db -> /config/plane/postgres (SSD)
|
||||
# plane redis -> /config/plane/redis (SSD)
|
||||
# plane minio -> /storage1/labdata/plane/minio (ZFS; attachments)
|
||||
|
||||
services:
|
||||
# ============================================================ CODE-SERVER
|
||||
@@ -20,7 +17,6 @@ services:
|
||||
environment:
|
||||
- PUID=1000
|
||||
- PGID=1000
|
||||
- TZ
|
||||
- DEFAULT_WORKSPACE=/workspace
|
||||
# Authentik forward_auth at the edge — local password auth disabled via config mount.
|
||||
volumes:
|
||||
@@ -54,16 +50,13 @@ services:
|
||||
environment:
|
||||
- PUID=1000
|
||||
- PGID=1000
|
||||
- TZ
|
||||
- APP_URL=https://docs.ginnoir.com
|
||||
- APP_KEY
|
||||
# stack.env leaks Plane's DATABASE_URL; Laravel prioritizes it over DB_* and
|
||||
# would connect BookStack to postgres_plane. Pin it to BookStack's own MariaDB.
|
||||
# Laravel prioritizes DATABASE_URL over DB_*; pin it to BookStack's own MariaDB
|
||||
# so a stray DATABASE_URL in stack.env can never redirect it.
|
||||
- DATABASE_URL=mysql://bookstack:bookstack_d3v_pass@mariadb_bookstack:3306/bookstack
|
||||
- DB_HOST=mariadb_bookstack
|
||||
- DB_PORT=3306
|
||||
- DB_USER=bookstack
|
||||
- DB_PASS
|
||||
- DB_DATABASE=bookstack
|
||||
- AUTH_METHOD=oidc
|
||||
- AUTH_AUTO_INITIATE=false
|
||||
@@ -91,11 +84,8 @@ services:
|
||||
environment:
|
||||
- PUID=1000
|
||||
- PGID=1000
|
||||
- TZ
|
||||
- MYSQL_ROOT_PASSWORD
|
||||
- MYSQL_DATABASE=bookstack
|
||||
- MYSQL_USER=bookstack
|
||||
- MYSQL_PASSWORD
|
||||
volumes:
|
||||
- /config/bookstack-db:/config
|
||||
healthcheck:
|
||||
@@ -104,214 +94,6 @@ services:
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
# ============================================================ PLANE
|
||||
plane-web:
|
||||
container_name: plane_web
|
||||
image: makeplane/plane-frontend:latest
|
||||
restart: unless-stopped
|
||||
networks: [dev, edge]
|
||||
command: node web/server.js
|
||||
env_file:
|
||||
- stack.env
|
||||
environment:
|
||||
- NEXT_PUBLIC_API_BASE_URL=https://plane.ginnoir.com
|
||||
- HOSTNAME=0.0.0.0
|
||||
|
||||
plane-admin:
|
||||
container_name: plane_admin
|
||||
image: makeplane/plane-admin:v0.23.1
|
||||
restart: unless-stopped
|
||||
networks: [dev, edge]
|
||||
command: node admin/server.js
|
||||
env_file:
|
||||
- stack.env
|
||||
environment:
|
||||
- NEXT_PUBLIC_API_BASE_URL=https://plane.ginnoir.com
|
||||
- HOSTNAME=0.0.0.0
|
||||
depends_on:
|
||||
plane-api:
|
||||
condition: service_started
|
||||
plane-web:
|
||||
condition: service_started
|
||||
|
||||
plane-api:
|
||||
container_name: plane_api
|
||||
image: makeplane/plane-backend:latest
|
||||
restart: unless-stopped
|
||||
networks: [dev, edge]
|
||||
command: ./bin/docker-entrypoint-api.sh
|
||||
env_file:
|
||||
- stack.env
|
||||
environment:
|
||||
- SECRET_KEY
|
||||
- DEBUG=0
|
||||
- DATABASE_URL
|
||||
- REDIS_URL=redis://redis_plane:6379/
|
||||
- CELERY_BROKER_URL=redis://redis_plane:6379/0
|
||||
- USE_MINIO=1
|
||||
- AWS_REGION=us-east-1
|
||||
- AWS_ACCESS_KEY_ID
|
||||
- AWS_SECRET_ACCESS_KEY
|
||||
- AWS_S3_ENDPOINT_URL=http://plane_minio:9000
|
||||
- AWS_S3_BUCKET_NAME=uploads
|
||||
- WEB_URL=https://plane.ginnoir.com
|
||||
- CORS_ALLOWED_ORIGINS=https://plane.ginnoir.com
|
||||
- GUNICORN_WORKERS=2
|
||||
depends_on:
|
||||
postgres_plane:
|
||||
condition: service_healthy
|
||||
redis_plane:
|
||||
condition: service_healthy
|
||||
plane-migrator:
|
||||
condition: service_completed_successfully
|
||||
|
||||
plane-worker:
|
||||
container_name: plane_worker
|
||||
image: makeplane/plane-backend:latest
|
||||
restart: unless-stopped
|
||||
networks: [dev]
|
||||
command: ./bin/docker-entrypoint-worker.sh
|
||||
env_file:
|
||||
- stack.env
|
||||
environment:
|
||||
- SECRET_KEY
|
||||
- DEBUG=0
|
||||
- DATABASE_URL
|
||||
- REDIS_URL=redis://redis_plane:6379/
|
||||
- CELERY_BROKER_URL=redis://redis_plane:6379/0
|
||||
- USE_MINIO=1
|
||||
- AWS_REGION=us-east-1
|
||||
- AWS_ACCESS_KEY_ID
|
||||
- AWS_SECRET_ACCESS_KEY
|
||||
- AWS_S3_ENDPOINT_URL=http://plane_minio:9000
|
||||
- AWS_S3_BUCKET_NAME=uploads
|
||||
depends_on:
|
||||
postgres_plane:
|
||||
condition: service_healthy
|
||||
redis_plane:
|
||||
condition: service_healthy
|
||||
plane-migrator:
|
||||
condition: service_completed_successfully
|
||||
|
||||
plane-beat:
|
||||
container_name: plane_beat
|
||||
image: makeplane/plane-backend:latest
|
||||
restart: unless-stopped
|
||||
networks: [dev]
|
||||
command: ./bin/docker-entrypoint-beat.sh
|
||||
env_file:
|
||||
- stack.env
|
||||
environment:
|
||||
- SECRET_KEY
|
||||
- DEBUG=0
|
||||
- DATABASE_URL
|
||||
- REDIS_URL=redis://redis_plane:6379/
|
||||
- CELERY_BROKER_URL=redis://redis_plane:6379/0
|
||||
depends_on:
|
||||
postgres_plane:
|
||||
condition: service_healthy
|
||||
redis_plane:
|
||||
condition: service_healthy
|
||||
plane-migrator:
|
||||
condition: service_completed_successfully
|
||||
|
||||
plane-migrator:
|
||||
container_name: plane_migrator
|
||||
image: makeplane/plane-backend:latest
|
||||
restart: "no"
|
||||
networks: [dev]
|
||||
command: ./bin/docker-entrypoint-migrator.sh
|
||||
env_file:
|
||||
- stack.env
|
||||
environment:
|
||||
- SECRET_KEY
|
||||
- DATABASE_URL
|
||||
- REDIS_URL=redis://redis_plane:6379/
|
||||
depends_on:
|
||||
postgres_plane:
|
||||
condition: service_healthy
|
||||
redis_plane:
|
||||
condition: service_healthy
|
||||
|
||||
plane-create-bucket:
|
||||
container_name: plane_create_bucket
|
||||
image: minio/mc:latest
|
||||
restart: "no"
|
||||
networks: [dev]
|
||||
depends_on:
|
||||
plane-minio:
|
||||
condition: service_healthy
|
||||
entrypoint: >
|
||||
/bin/sh -c "
|
||||
until /usr/bin/mc alias set plane_minio http://plane_minio:9000 $$MINIO_USER $$MINIO_PASSWORD; do sleep 1; done;
|
||||
/usr/bin/mc mb plane_minio/uploads --ignore-existing;
|
||||
exit 0;
|
||||
"
|
||||
env_file:
|
||||
- stack.env
|
||||
environment:
|
||||
- MINIO_USER
|
||||
- MINIO_PASSWORD
|
||||
|
||||
postgres_plane:
|
||||
container_name: postgres_plane
|
||||
image: postgres:16-alpine
|
||||
restart: unless-stopped
|
||||
labels:
|
||||
- "com.centurylabs.watchtower.enable=false"
|
||||
networks: [dev]
|
||||
env_file:
|
||||
- stack.env
|
||||
environment:
|
||||
- POSTGRES_USER=plane
|
||||
- POSTGRES_PASSWORD
|
||||
- POSTGRES_DB=plane
|
||||
volumes:
|
||||
- /config/plane/postgres:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U plane -d plane"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
redis_plane:
|
||||
container_name: redis_plane
|
||||
image: redis:7-alpine
|
||||
restart: unless-stopped
|
||||
labels:
|
||||
- "com.centurylabs.watchtower.enable=false"
|
||||
networks: [dev]
|
||||
command: --save 60 1 --loglevel warning
|
||||
volumes:
|
||||
- /config/plane/redis:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
plane-minio:
|
||||
container_name: plane_minio
|
||||
image: minio/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
restart: unless-stopped
|
||||
labels:
|
||||
- "com.centurylabs.watchtower.enable=false"
|
||||
networks: [dev]
|
||||
command: server /data --console-address ":9001"
|
||||
env_file:
|
||||
- stack.env
|
||||
environment:
|
||||
- MINIO_ROOT_USER
|
||||
- MINIO_ROOT_PASSWORD
|
||||
volumes:
|
||||
- /storage1/labdata/plane/minio:/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -sf http://localhost:9000/minio/health/live || exit 1"]
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
start_period: 30s
|
||||
|
||||
networks:
|
||||
dev:
|
||||
name: dev
|
||||
|
||||
@@ -17,19 +17,3 @@ BOOKSTACK_OIDC_CLIENT_ID=8YV4BI2JVIG1QzS2DbylEgqv56sgfiOVRXOgw2Z5
|
||||
BOOKSTACK_OIDC_CLIENT_SECRET=wIyiw7LmGBORDyTdc2crSZryXJHzIq4gtajAKSpOU7e8BkBSO6SstM9gGPrnp4tbJhCFSQggYAgtYd5LOjUvQpSWInzm0JLlmLg1BTlPq5EVVieNYuWRCCQrerj8gRZ0
|
||||
OIDC_CLIENT_ID=8YV4BI2JVIG1QzS2DbylEgqv56sgfiOVRXOgw2Z5
|
||||
OIDC_CLIENT_SECRET=wIyiw7LmGBORDyTdc2crSZryXJHzIq4gtajAKSpOU7e8BkBSO6SstM9gGPrnp4tbJhCFSQggYAgtYd5LOjUvQpSWInzm0JLlmLg1BTlPq5EVVieNYuWRCCQrerj8gRZ0
|
||||
|
||||
# Plane project management
|
||||
# Rotate with: openssl rand -hex 32
|
||||
PLANE_SECRET_KEY=60gp0byfz2dvffa45cxl20p1scy9xbpf6d8c5y0geejgkyp1b52
|
||||
SECRET_KEY=60gp0byfz2dvffa45cxl20p1scy9xbpf6d8c5y0geejgkyp1b52
|
||||
PLANE_DB_PASSWORD=plane_d3v_p4ss_8x3m
|
||||
POSTGRES_PASSWORD=plane_d3v_p4ss_8x3m
|
||||
DATABASE_URL=postgresql://plane:plane_d3v_p4ss_8x3m@postgres_plane:5432/plane
|
||||
PLANE_MINIO_USER=planeadmin
|
||||
MINIO_USER=planeadmin
|
||||
AWS_ACCESS_KEY_ID=planeadmin
|
||||
PLANE_MINIO_PASSWORD=plane_minio_p4ss
|
||||
MINIO_PASSWORD=plane_minio_p4ss
|
||||
AWS_SECRET_ACCESS_KEY=plane_minio_p4ss
|
||||
MINIO_ROOT_USER=planeadmin
|
||||
MINIO_ROOT_PASSWORD=plane_minio_p4ss
|
||||
@@ -46,7 +46,8 @@ services:
|
||||
|
||||
famapp-minio:
|
||||
container_name: minio_famapp
|
||||
image: minio/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
# minio/minio vanished from Docker Hub 2026-10; self-hosted copy of the last cached tag.
|
||||
image: registry.ginnoir.com/mirror/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
command: server /data --console-address ":9003"
|
||||
restart: unless-stopped
|
||||
labels:
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
# mcp — shared MCP gateway
|
||||
|
||||
One [mcp-proxy](https://github.com/sparfenyuk/mcp-proxy) container runs the homelab MCP
|
||||
servers once on valhalla. Every agent on every machine connects by URL:
|
||||
|
||||
```
|
||||
https://mcp.ginnoir.com/servers/<name>/mcp # streamable HTTP
|
||||
https://mcp.ginnoir.com/servers/<name>/sse # legacy SSE
|
||||
```
|
||||
|
||||
`<name>` ∈ `arr bookstack ntfy uptime-kuma portainer gitea authentik freshrss vault`.
|
||||
Every request needs `Authorization: Bearer <MCP_PROXY_AUTH_TOKEN>` (value in `stack.env`).
|
||||
Reachable from LAN + tailnet only (Caddy `internal_only`).
|
||||
|
||||
Obsidian is **not** here; its MCP is the Local REST API plugin inside the Obsidian app
|
||||
(`http://127.0.0.1:27123/mcp/` on whichever machine has Obsidian open).
|
||||
|
||||
## Setting up a new machine / agent
|
||||
|
||||
Replace `TOKEN` with `MCP_PROXY_AUTH_TOKEN` from `stack.env`. Repeat the entry per server name.
|
||||
|
||||
**Claude Code** (`~/.claude.json` → `mcpServers`):
|
||||
```json
|
||||
"gitea": { "type": "http", "url": "https://mcp.ginnoir.com/servers/gitea/mcp",
|
||||
"headers": { "Authorization": "Bearer TOKEN" } }
|
||||
```
|
||||
or `claude mcp add --scope user --transport http gitea https://mcp.ginnoir.com/servers/gitea/mcp --header "Authorization: Bearer TOKEN"`
|
||||
|
||||
**Codex** (`~/.codex/config.toml`):
|
||||
```toml
|
||||
[mcp_servers.gitea]
|
||||
url = "https://mcp.ginnoir.com/servers/gitea/mcp"
|
||||
http_headers = { Authorization = "Bearer TOKEN" }
|
||||
```
|
||||
|
||||
**Antigravity** (`~/.gemini/config/mcp_config.json` → `mcpServers`):
|
||||
```json
|
||||
"gitea": { "serverUrl": "https://mcp.ginnoir.com/servers/gitea/mcp",
|
||||
"headers": { "Authorization": "Bearer TOKEN" } }
|
||||
```
|
||||
|
||||
**Gemini CLI** (`~/.gemini/settings.json` → `mcpServers`): same as Antigravity but `httpUrl`
|
||||
instead of `serverUrl`.
|
||||
|
||||
## Ops
|
||||
|
||||
- Add / bump a server: edit `gateway/Dockerfile` (install + pin) and `gateway/servers.json`,
|
||||
push. `.gitea/workflows/build-mcp-gateway.yml` builds `registry.ginnoir.com/ginnoir/mcp-gateway`,
|
||||
then Portainer (stack id 39) redeploys on its next poll. Any new secrets go in `stack.env`.
|
||||
Every var reaches every server (`--pass-environment`).
|
||||
- Status: `curl -H "Authorization: Bearer TOKEN" https://mcp.ginnoir.com/status`
|
||||
- Logs: `docker logs mcp-gateway` (servers start one after another, ~60s total)
|
||||
- Rotate the token: change `MCP_PROXY_AUTH_TOKEN` in `stack.env`, push, update the clients.
|
||||
- freshrss-mcp needs Python ≥3.14, so it gets a uv-managed interpreter. The base image
|
||||
has no `git`, so git-pinned packages install from a GitHub `archive/<sha>.tar.gz` URL.
|
||||
@@ -0,0 +1,90 @@
|
||||
# mcp stack — one shared MCP gateway for every agent on every machine.
|
||||
#
|
||||
# Before: each agent session (Claude Code, Codex, Gemini/Antigravity, ...) on
|
||||
# each machine spawned its own 9 npx/uvx/Go processes, with API tokens copied
|
||||
# into ~/.claude.json, ~/.codex/config.toml, ~/.gemini/... by hand.
|
||||
# Now: mcp-proxy runs those servers once here and exposes each over
|
||||
# streamable HTTP at https://mcp.ginnoir.com/servers/<name>/mcp
|
||||
# (SSE at .../sse for older clients). Clients hold a URL + one bearer token.
|
||||
#
|
||||
# Servers: arr, bookstack, ntfy, uptime-kuma, portainer, gitea, authentik,
|
||||
# freshrss, vault (list: gateway/servers.json; pins: gateway/Dockerfile).
|
||||
# Obsidian is NOT here: its Local REST API MCP runs inside the Obsidian app
|
||||
# itself (desktop-local, and valhalla's instance binds 127.0.0.1 only).
|
||||
#
|
||||
# Auth: MCP_PROXY_AUTH_TOKEN (stack.env) — every request, /status included,
|
||||
# needs `Authorization: Bearer <token>`; mcp-proxy strips it from the child
|
||||
# env. Caddy additionally keeps it internal-only (LAN + tailnet). Not behind
|
||||
# Authentik forward_auth: agents can't do a browser login.
|
||||
#
|
||||
# The token is effectively admin over the lab (Portainer, Gitea, Authentik
|
||||
# writes). Treat it like the Portainer API key. Vault access is scoped: the
|
||||
# gateway holds a periodic mcp-gateway-policy token, not root (vault-policy.hcl;
|
||||
# kept alive by vault-token-renewer below).
|
||||
#
|
||||
# Upstreams are the public https://*.ginnoir.com names (same as the clients
|
||||
# used before); container -> Caddy hairpin passes internal_only (172.16/12).
|
||||
#
|
||||
# Image is built by .gitea/workflows/build-mcp-gateway.yml; no build: key here
|
||||
# (Portainer never builds — see portainer-never-builds-only-pulls).
|
||||
|
||||
services:
|
||||
mcp-gateway:
|
||||
image: registry.ginnoir.com/ginnoir/mcp-gateway:latest
|
||||
pull_policy: always
|
||||
container_name: mcp-gateway
|
||||
restart: unless-stopped
|
||||
networks: [edge]
|
||||
env_file:
|
||||
- stack.env
|
||||
command:
|
||||
- --named-server-config=/app/servers.json
|
||||
- --pass-environment
|
||||
- --host=0.0.0.0
|
||||
- --port=8096
|
||||
- --allowed-host=mcp.ginnoir.com
|
||||
- --allowed-host=mcp-gateway:8096
|
||||
- --log-level=INFO
|
||||
# No published port: only reachable through Caddy on edge.
|
||||
healthcheck:
|
||||
# /healthz needs the bearer token too.
|
||||
test: ["CMD-SHELL", "python -c \"import os,urllib.request as u;u.urlopen(u.Request('http://127.0.0.1:8096/healthz',headers={'Authorization':'Bearer '+os.environ['MCP_PROXY_AUTH_TOKEN']}),timeout=5)\""]
|
||||
interval: 60s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 60s
|
||||
|
||||
# Keeps the gateway's scoped Vault token alive. VAULT_TOKEN is an orphan
|
||||
# periodic token (720h period, policy mcp-gateway — see vault-policy.hcl), NOT
|
||||
# root. A periodic token dies if not renewed within its period, so renew it
|
||||
# daily; on failure (e.g. Vault sealed) log + ntfy the homelab topic and retry
|
||||
# hourly. Same image digest as the Vault server (portainer-compose.yml).
|
||||
vault-token-renewer:
|
||||
image: hashicorp/vault@sha256:3fd53308acccd9e4e83fde3e6c6cf5b15e0f7fac1ff7510780b8b23f5e4c3de7
|
||||
container_name: vault-token-renewer
|
||||
restart: unless-stopped
|
||||
networks: [edge]
|
||||
env_file:
|
||||
- stack.env
|
||||
labels:
|
||||
- com.centurylabs.watchtower.enable=false
|
||||
entrypoint: ["/bin/sh", "-c"]
|
||||
command:
|
||||
- |
|
||||
while :; do
|
||||
if out=$$(vault token renew -format=json 2>&1); then
|
||||
echo "$$(date -u +%FT%TZ) renewed (ttl $$(echo "$$out" | grep -o '"lease_duration": [0-9]*' | grep -o '[0-9]*' | tail -1)s)"
|
||||
sleep 86400
|
||||
else
|
||||
echo "$$(date -u +%FT%TZ) RENEW FAILED: $$out"
|
||||
wget -q -O- --header "Title: mcp-gateway Vault token renew failed" \
|
||||
--post-data "vault-token-renewer could not renew the gateway's Vault token (sealed?). It expires 30 days after the last good renewal. $$(echo "$$out" | tail -1)" \
|
||||
"$$NTFY_URL/$$NTFY_TOPIC" >/dev/null 2>&1 || true
|
||||
sleep 3600
|
||||
fi
|
||||
done
|
||||
|
||||
networks:
|
||||
edge:
|
||||
name: edge
|
||||
external: true
|
||||
@@ -0,0 +1,51 @@
|
||||
# MCP gateway image: mcp-proxy + every homelab MCP server preinstalled at a
|
||||
# pinned version. Clients (Claude Code, Codex, Gemini, Hermes, ...) connect to
|
||||
# https://mcp.ginnoir.com/servers/<name>/mcp instead of each spawning 9 local
|
||||
# npx/uvx processes per session.
|
||||
#
|
||||
# Built by .gitea/workflows/build-mcp-gateway.yml -> registry.ginnoir.com.
|
||||
# Portainer only pulls, never builds (see stacks/romhacks note).
|
||||
#
|
||||
# Bump a server: change its pin below, push. Nothing resolves at runtime: no
|
||||
# `npx -y` / `uvx --refresh`, so a broken upstream release can't take a tool
|
||||
# down until we choose to pull it in.
|
||||
|
||||
FROM hashicorp/vault-mcp-server:0.2.0 AS vault
|
||||
|
||||
FROM ghcr.io/sparfenyuk/mcp-proxy:v0.15.2-debian-node
|
||||
|
||||
# --- Node servers -----------------------------------------------------------
|
||||
RUN npm install -g --omit=dev \
|
||||
@dodwmd/mcparr@0.1.1 \
|
||||
bookstack-mcp@5.7.3 \
|
||||
ntfy-me-mcp@1.5.0 \
|
||||
@davidfuchs/mcp-uptime-kuma@0.7.0 \
|
||||
&& npm cache clean --force
|
||||
|
||||
# --- Python servers (uv tools, binaries land in /usr/local/bin) -------------
|
||||
ENV UV_TOOL_DIR=/opt/uv-tools \
|
||||
UV_TOOL_BIN_DIR=/usr/local/bin \
|
||||
UV_PYTHON_INSTALL_DIR=/opt/uv-python
|
||||
RUN uv tool install --python-preference only-system "mcp-portainer~=2.42.0" \
|
||||
&& uv tool install --python-preference only-system --extra-index-url https://nikitatsym.github.io/gitea-mcp/simple "gitea-mcp==1.0.76" \
|
||||
&& uv tool install --python-preference only-system --extra-index-url https://nikitatsym.github.io/authentik-mcp/simple "authentik-mcp==1.0.27" \
|
||||
&& rm -rf /root/.cache/uv
|
||||
# freshrss-mcp-server requires Python >=3.14; base image is 3.13, so this one
|
||||
# tool gets its own uv-managed interpreter.
|
||||
RUN uv tool install --python 3.14 --python-preference only-managed --with "mcp<2" \
|
||||
"freshrss-mcp-server @ https://github.com/darknight/freshrss-mcp-server/archive/d6b3c4c342fc493b95d20a14be8284004e3312aa.tar.gz" \
|
||||
&& rm -rf /root/.cache/uv
|
||||
|
||||
# --- Go server --------------------------------------------------------------
|
||||
COPY --from=vault /bin/vault-mcp-server /usr/local/bin/vault-mcp-server
|
||||
|
||||
COPY servers.json /app/servers.json
|
||||
|
||||
# Fail the build (not the deploy) if any entrypoint is missing.
|
||||
RUN for b in mcparr bookstack-mcp ntfy-me-mcp mcp-uptime-kuma mcp-portainer \
|
||||
gitea-mcp authentik-mcp freshrss-mcp vault-mcp-server; do \
|
||||
command -v "$b" >/dev/null || { echo "missing $b" >&2; exit 1; }; \
|
||||
done
|
||||
|
||||
EXPOSE 8096
|
||||
# ENTRYPOINT (catatonit -- mcp-proxy) is inherited; args come from compose.
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"mcpServers": {
|
||||
"arr": { "command": "mcparr" },
|
||||
"bookstack": { "command": "bookstack-mcp" },
|
||||
"ntfy": { "command": "ntfy-me-mcp" },
|
||||
"uptime-kuma": { "command": "mcp-uptime-kuma" },
|
||||
"portainer": { "command": "mcp-portainer" },
|
||||
"gitea": { "command": "gitea-mcp" },
|
||||
"authentik": { "command": "authentik-mcp" },
|
||||
"freshrss": { "command": "freshrss-mcp", "args": ["--transport", "stdio"] },
|
||||
"vault": { "command": "vault-mcp-server", "args": ["stdio"] }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
# mcp stack env — every var is passed to all 9 MCP servers (--pass-environment).
|
||||
# Values copied from the per-machine client configs this stack replaces.
|
||||
|
||||
# Gateway bearer token (clients send Authorization: Bearer <this>).
|
||||
MCP_PROXY_AUTH_TOKEN=sYfgLZgfPHxZ2hwAa1oyOH1ABQjM6LotqFe1395LZgQ
|
||||
|
||||
# arr
|
||||
RADARR_API_KEY=94159a19beef48f185bd3e330f8dde3a
|
||||
SONARR_API_KEY=383c9489253e445baf8514013a4e37a4
|
||||
PROWLARR_URL=https://prowlarr.ginnoir.com
|
||||
PROWLARR_API_KEY=a02364e8ce5b4a3aa7396d41b189e9f8
|
||||
BAZARR_URL=https://bazarr.ginnoir.com
|
||||
BAZARR_API_KEY=4273a73be71259b95d1eedf933a4a1df
|
||||
RADARR_URL=https://radarr.ginnoir.com
|
||||
OVERSEERR_API_KEY=MTY2NzgxNTk0Mzk1MGIzNWE5ZmE2LTRjYzAtNDI2Yy05NDFhLTY0NDY3OTYzMmM2NCk=
|
||||
SONARR_URL=https://sonarr.ginnoir.com
|
||||
OVERSEERR_URL=https://requests.ginnoir.com
|
||||
|
||||
# bookstack
|
||||
BOOKSTACK_ENABLE_WRITE=true
|
||||
BOOKSTACK_TOKEN_ID=T6LYOXe4PQ0Hw2gz2VL2cZWdlJkzdrtY
|
||||
BOOKSTACK_BASE_URL=https://docs.ginnoir.com
|
||||
BOOKSTACK_TOKEN_SECRET=XvW1V5W6LwGa3Vs1SalQCa7zPykDeSj3
|
||||
|
||||
# ntfy
|
||||
NTFY_TOPIC=homelab
|
||||
NTFY_URL=https://ntfy.ginnoir.com
|
||||
|
||||
# uptime-kuma
|
||||
UPTIME_KUMA_URL=https://uptime.ginnoir.com
|
||||
|
||||
# portainer
|
||||
PORTAINER_API_KEY=ptr_Ep2pXkdoT6y2Pn8AAt4gRdUr7NFMyE06S8WYR+ciNq4=
|
||||
PORTAINER_URL=https://portainer.ginnoir.com
|
||||
PORTAINER_EXPOSE_ENV_VALUES=1
|
||||
|
||||
# gitea
|
||||
GITEA_TOKEN=54ea93904439c2919f1d8dab1ba545e54a2a3e86
|
||||
GITEA_URL=https://gitea.ginnoir.com
|
||||
|
||||
# authentik
|
||||
AUTHENTIK_TOKEN=ZeactSoXSFtz0CYyS0ZENAzvCKyBKS3r297yaoUvsAmqODSVZyIvYSOAmK0C
|
||||
AUTHENTIK_URL=https://auth.ginnoir.com
|
||||
|
||||
# freshrss
|
||||
FRESHRSS_API_PASSWORD=d0fet0th3x
|
||||
FRESHRSS_API_URL=https://freshrss.ginnoir.com/api/greader.php
|
||||
FRESHRSS_USERNAME=ginnoir
|
||||
|
||||
# vault
|
||||
VAULT_ADDR=https://vault.ginnoir.com
|
||||
VAULT_TOKEN=hvs.CAESIMtptUgBbV_zYwyMbT8lNLW9w9CWopDb_GrsEnvYPKwNGh4KHGh2cy5NQVJrT2dEcTVDQWhCN3FyWlZ6U3Z0TVo
|
||||
@@ -0,0 +1,51 @@
|
||||
# Vault ACL policy "mcp-gateway": what the vault MCP in stacks/mcp may do.
|
||||
# Reference copy only (not mounted anywhere). Apply with a root/admin token:
|
||||
# vault policy write mcp-gateway stacks/mcp/vault-policy.hcl
|
||||
#
|
||||
# Token: orphan, periodic (720h), policies [default, mcp-gateway]. The
|
||||
# vault-token-renewer service in this stack renews it daily, so it never lapses
|
||||
# unless Vault stays sealed/unreachable for 30 days. (The default policy grants
|
||||
# renew-self / lookup-self.)
|
||||
#
|
||||
# Deliberately NOT granted: sys/* writes (mount/auth/policy/seal management),
|
||||
# auth/*, identity/*, the agent-registry mount. Mount creation and other admin
|
||||
# stays a root-token job, done by hand.
|
||||
|
||||
# list_mounts
|
||||
path "sys/mounts" {
|
||||
capabilities = ["read"]
|
||||
}
|
||||
|
||||
# KV v2 at secret/ (mount it first: vault secrets enable -path=secret kv-v2)
|
||||
path "secret/data/*" {
|
||||
capabilities = ["create", "read", "update", "delete"]
|
||||
}
|
||||
path "secret/metadata/*" {
|
||||
capabilities = ["read", "list", "delete"]
|
||||
}
|
||||
path "secret/metadata" {
|
||||
capabilities = ["list"]
|
||||
}
|
||||
path "secret/delete/*" {
|
||||
capabilities = ["update"]
|
||||
}
|
||||
path "secret/undelete/*" {
|
||||
capabilities = ["update"]
|
||||
}
|
||||
|
||||
# PKI at pki/: read config/issuers/roles and issue certs, no CA or role admin.
|
||||
path "pki/issue/*" {
|
||||
capabilities = ["create", "update"]
|
||||
}
|
||||
path "pki/roles" {
|
||||
capabilities = ["list"]
|
||||
}
|
||||
path "pki/roles/*" {
|
||||
capabilities = ["read"]
|
||||
}
|
||||
path "pki/issuers" {
|
||||
capabilities = ["list"]
|
||||
}
|
||||
path "pki/issuer/*" {
|
||||
capabilities = ["read"]
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
# 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 (native OIDC, LAN + tailnet only) |
|
||||
| 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.**
|
||||
|
||||
- **books / storyteller (Pattern B):** proxy providers `homelab-{books,storyteller}` (pk 44–45). They're `forward_single`, cloned from `homelab-sonarr`, attached to the embedded outpost, and each has an app with the same slug.
|
||||
- **Chaptarr (Pattern A):** OIDC provider `homelab-chaptarr` (pk 47) plus app `chaptarr`, with the strict redirect URI `https://chaptarr.ginnoir.com/signin-oidc`. This replaced the forward_auth provider it started with (pk 43). The client ID and secret are in `stack.env` (`CHAPTARR_OIDC_CLIENT_*`).
|
||||
In Chaptarr, go to Settings → General → Authentication, choose OIDC, and fill in:
|
||||
- OIDC Authority: `https://auth.ginnoir.com/application/o/chaptarr/`
|
||||
- Scopes: `openid profile email`
|
||||
- Allowed Emails: your Authentik account email(s)
|
||||
- Authentik's default email mapping sends `email_verified: false`, and Chaptarr requires `true`. So the chaptarr provider uses its own mapping, `homelab: OpenID 'email' (verified)`. The app is also bound to the `ginnoir` user, so no other account can match the allowlist by changing its email.
|
||||
- Changing anything in `stack.env` makes Portainer recreate every media container. Don't do it while you're in the middle of a login.
|
||||
- **Audiobookshelf (Pattern A):** OIDC provider `homelab-audiobooks` (pk 46) plus app `audiobooks`. Its strict redirect URIs are `https://audiobooks.ginnoir.com/audiobookshelf/auth/openid/{callback,mobile-redirect}` (current ABS serves under `/audiobookshelf`), the same pair without the prefix, 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: Storyteller runs the CUDA 12.9 image on the P100 (`nvidia.com/gpu=0`, CDI). Upstream only tags CUDA images by commit SHA, so the tag is pinned and Watchtower is off. To bump it, pick a newer SHA from the registry's `amd64-cuda-12.9.0` repository. Don't use the CUDA 13.x images: they drop Pascal. The whisper build has no sm_60 kernels, so the first GPU run JIT-compiles PTX (~60 s). `CUDA_CACHE_PATH=/data/.nv-compute-cache` keeps that cache across restarts.
|
||||
- Chaptarr is young and runs on `:latest` with Watchtower. If an update breaks it, pin a tag and add `com.centurylabs.watchtower.enable=false`.
|
||||
@@ -34,6 +34,10 @@ services:
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- /config/sonarr:/config
|
||||
# Unified /storage1 mount enables atomic hardlinks between /storage1/complete
|
||||
# and /storage1/{TV,Anime} (separate /tv + /downloads mounts force EXDEV copies).
|
||||
# Legacy mounts kept temporarily during root-folder migration.
|
||||
- /storage1:/storage1
|
||||
- /storage1/Media/TV:/tv
|
||||
- /storage1/Media/Anime:/anime
|
||||
- /storage1/complete:/downloads
|
||||
@@ -52,6 +56,10 @@ services:
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- /config/radarr:/config
|
||||
# Unified /storage1 mount enables atomic hardlinks between /storage1/complete
|
||||
# and /storage1/Movies (separate /movies + /downloads mounts force EXDEV copies).
|
||||
# Legacy mounts kept temporarily during root-folder migration.
|
||||
- /storage1:/storage1
|
||||
- /storage1/Media/Movies:/movies
|
||||
- /storage1/complete:/downloads
|
||||
ports:
|
||||
@@ -70,6 +78,8 @@ services:
|
||||
- UMASK_SET=022
|
||||
volumes:
|
||||
- /config/bazarr:/config
|
||||
# Unified /storage1 mount keeps subtitle paths in sync once Sonarr/Radarr move to /storage1/*.
|
||||
- /storage1:/storage1
|
||||
- /storage1/Media/Movies:/movies
|
||||
- /storage1/Media/TV:/tv
|
||||
- /storage1/Media/Anime:/anime
|
||||
@@ -121,22 +131,61 @@ services:
|
||||
- "8181:8181"
|
||||
|
||||
qbittorrent:
|
||||
image: lscr.io/linuxserver/qbittorrent:latest
|
||||
# Pinned to the last 5.2.x build (downgraded from 5.3.0); Watchtower off so it stays put.
|
||||
image: lscr.io/linuxserver/qbittorrent:5.2.4_v2.0.15-ls481
|
||||
container_name: qbittorrent
|
||||
restart: unless-stopped
|
||||
labels:
|
||||
- com.centurylabs.watchtower.enable=false
|
||||
networks: [media, edge]
|
||||
env_file:
|
||||
- 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
|
||||
|
||||
# autobrr: grabs freeleech uploads from tracker IRC announces into qbittorrent
|
||||
# (category autobrr) and forwards every announce to cross-seed. Native OIDC via
|
||||
# Authentik (homelab-autobrr, pk 48); built-in login disabled.
|
||||
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"
|
||||
|
||||
whisparr:
|
||||
container_name: whisparr
|
||||
@@ -165,7 +214,11 @@ services:
|
||||
env_file:
|
||||
- stack.env
|
||||
volumes:
|
||||
- ./recyclarr:/config
|
||||
# Absolute path: ./recyclarr resolved to Portainer's internal
|
||||
# /data/compose/10/... and bound an EMPTY dir from 2026-06-17 to 2026-11-21,
|
||||
# so recyclarr never synced. Canonical config is stacks/media/recyclarr/;
|
||||
# scp recyclarr.yml + secrets.yml to /config/recyclarr/ after edits.
|
||||
- /config/recyclarr:/config
|
||||
|
||||
stash:
|
||||
image: stashapp/stash:latest
|
||||
@@ -196,6 +249,138 @@ 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
|
||||
# CUDA 12.9 build so whisper runs on the P100 (~6x the CPU build). CUDA 13.x
|
||||
# images drop Pascal. Upstream publishes CUDA images only as commit-SHA tags
|
||||
# (no :latest), so this is pinned and out of Watchtower; bump the tag by hand
|
||||
# from the registry's amd64-cuda-12.9.0 repository.
|
||||
# 67260c54 = web-v3.0.0-beta.51 (main is the v3 beta; stable v2.14.23 is
|
||||
# deb8bbf4). The v2->v3 DB migration ran 2026-10-18; its pre-migration
|
||||
# backup is /storage1/labdata/storyteller/backups/storyteller-pre-v3-*.db.
|
||||
image: registry.gitlab.com/storyteller-platform/storyteller/amd64-cuda-12.9.0:67260c54
|
||||
restart: unless-stopped
|
||||
labels:
|
||||
- "com.centurylabs.watchtower.enable=false"
|
||||
networks: [media, edge]
|
||||
env_file:
|
||||
- stack.env # STORYTELLER_SECRET_KEY lives here
|
||||
devices:
|
||||
- nvidia.com/gpu=0
|
||||
environment:
|
||||
# The whisper build has no sm_60 kernels, so the P100 JIT-compiles PTX on
|
||||
# first use (~60 s). Persist the JIT cache so that only happens once.
|
||||
- CUDA_CACHE_PATH=/data/.nv-compute-cache
|
||||
- CUDA_CACHE_MAXSIZE=4294967296
|
||||
volumes:
|
||||
- /storage1/labdata/storyteller:/data
|
||||
- /storage1/Media/Books:/libraries/books:ro
|
||||
- /storage1/Media/Audiobooks:/libraries/audiobooks:ro
|
||||
ports:
|
||||
- "8001:8001"
|
||||
|
||||
courarr:
|
||||
container_name: courarr
|
||||
# Seasonal anime lists from AniList (no key, no OAuth), mapped to TVDB via
|
||||
# Fribb/anime-lists. Replaces the Trakt "latest-anime" list whose OAuth
|
||||
# lapsed 2024-12-02. Sonarr reads http://courarr:6161/feed/<slug> over the
|
||||
# media network; lists/settings/API key live in /config/courarr/courarr.db.
|
||||
image: ghcr.io/jpjoseph12/courarr:latest
|
||||
restart: unless-stopped
|
||||
networks: [media, edge]
|
||||
env_file:
|
||||
- stack.env
|
||||
volumes:
|
||||
- /config/courarr:/config
|
||||
ports:
|
||||
- "6161:6161"
|
||||
|
||||
mam-bonus:
|
||||
container_name: mam_bonus
|
||||
# Once a day, spend MAM bonus points on upload credit (json/bonusBuy.php,
|
||||
# spendtype=upload, "Max Affordable ") so seedbonus never caps out. Uses its
|
||||
# own dedicated MAM session (MAM_BONUS_MAM_ID); the rotating cookie is kept
|
||||
# in /config/mam-bonus. Failures go to ntfy topic `mam`.
|
||||
image: alpine:3.20
|
||||
restart: unless-stopped
|
||||
networks: [edge] # egress + ntfy:80 for failure alerts
|
||||
env_file:
|
||||
- stack.env
|
||||
volumes:
|
||||
# Absolute host path on purpose: a relative ./ mount resolves to
|
||||
# /data/compose/<id>/... (Portainer-internal) and binds an EMPTY host dir.
|
||||
# Canonical copy is stacks/media/mam-bonus/buy-upload.sh; scp it here.
|
||||
- /config/mam-bonus/buy-upload.sh:/app/buy-upload.sh:ro
|
||||
- /config/mam-bonus:/data
|
||||
entrypoint: ["/bin/sh", "-c"]
|
||||
command:
|
||||
- |
|
||||
apk add --no-cache curl jq tzdata >/dev/null
|
||||
# crond jobs get a bare env, so hand the job its vars via a file
|
||||
printenv | grep -E '^(MAM_BONUS_|TZ=)' | sed "s/^\([^=]*\)=\(.*\)/export \1='\2'/" > /etc/mam-bonus.env
|
||||
chmod 600 /etc/mam-bonus.env
|
||||
# busybox crond silently skips a crontab not owned by root
|
||||
echo '17 4 * * * . /etc/mam-bonus.env && /bin/sh /app/buy-upload.sh >> /proc/1/fd/1 2>&1' > /etc/crontabs/root
|
||||
chown root:root /etc/crontabs/root && chmod 600 /etc/crontabs/root
|
||||
exec crond -f -l 8 -c /etc/crontabs
|
||||
labels:
|
||||
- "com.centurylabs.watchtower.enable=false"
|
||||
|
||||
networks:
|
||||
media:
|
||||
name: media
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
#!/bin/sh
|
||||
# Daily MAM bonus-point spend: buy as much upload credit as the balance allows
|
||||
# so seedbonus never sits at the cap. Run by crond in the mam-bonus container.
|
||||
#
|
||||
# Session handling: MAM rotates mam_id on responses. Prowlarr survives that by
|
||||
# saving the new cookie; autobrr didn't and died (2026-11-20). So this keeps a
|
||||
# curl cookie jar in /data and lets curl re-save the rotated value on each call.
|
||||
# The jar is (re)seeded from MAM_BONUS_MAM_ID only when that env value changes.
|
||||
#
|
||||
# Env (stack.env):
|
||||
# MAM_BONUS_MAM_ID bare mam_id of a DEDICATED MAM session (not shared w/ autobrr/prowlarr)
|
||||
# MAM_BONUS_RESERVE points to leave unspent (default 0 = "Max Affordable ")
|
||||
# MAM_BONUS_NTFY ntfy topic URL for failures (default http://ntfy:80/mam)
|
||||
# MAM_BONUS_DRY_RUN 1 = check balance + log what would be bought, don't buy
|
||||
set -eu
|
||||
|
||||
BASE=https://www.myanonamouse.net
|
||||
JAR=/data/cookies.txt
|
||||
SEED=/data/seed.sha
|
||||
RESERVE="${MAM_BONUS_RESERVE:-0}"
|
||||
NTFY="${MAM_BONUS_NTFY:-http://ntfy:80/mam}"
|
||||
PER_GIB=500 # MAM store price: 500 BP per GiB of upload
|
||||
MIN_GIB=50 # API rejects < 50 GiB
|
||||
|
||||
log() { echo "$(date '+%F %T') mam-bonus: $*"; }
|
||||
fail() {
|
||||
log "FAIL: $*"
|
||||
curl -fsS -m 15 -H "Title: MAM bonus buy failed" -H "Priority: high" -H "Tags: warning" \
|
||||
-d "$*" "$NTFY" >/dev/null 2>&1 || log "(ntfy post failed too)"
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ -n "${MAM_BONUS_MAM_ID:-}" ] || fail "MAM_BONUS_MAM_ID is not set in media stack.env"
|
||||
|
||||
# (Re)seed the jar when the configured session changes.
|
||||
want=$(printf %s "$MAM_BONUS_MAM_ID" | sha256sum | cut -d' ' -f1)
|
||||
if [ ! -s "$JAR" ] || [ "$(cat "$SEED" 2>/dev/null)" != "$want" ]; then
|
||||
printf '# Netscape HTTP Cookie File\n.myanonamouse.net\tTRUE\t/\tTRUE\t0\tmam_id\t%s\n' \
|
||||
"$MAM_BONUS_MAM_ID" > "$JAR"
|
||||
echo "$want" > "$SEED"
|
||||
chmod 600 "$JAR" "$SEED"
|
||||
log "cookie jar seeded from MAM_BONUS_MAM_ID"
|
||||
fi
|
||||
|
||||
mam() { curl -sS -m 30 -b "$JAR" -c "$JAR" -A "homelab-mam-bonus/1.0" "$@"; }
|
||||
|
||||
# Balance check (also proves the session is alive).
|
||||
me=$(mam "$BASE/jsonLoad.php") || fail "jsonLoad.php request failed"
|
||||
bp=$(printf %s "$me" | jq -er '.seedbonus | floor' 2>/dev/null) \
|
||||
|| fail "session rejected or bad response from jsonLoad.php (mam_id expired/IP-locked?): $(printf %s "$me" | head -c 200)"
|
||||
|
||||
spendable=$((bp - RESERVE))
|
||||
gib=$((spendable / PER_GIB))
|
||||
log "seedbonus=$bp reserve=$RESERVE -> can buy ${gib} GiB"
|
||||
|
||||
if [ "$gib" -lt "$MIN_GIB" ]; then
|
||||
log "below the ${MIN_GIB} GiB minimum (${MIN_GIB}*${PER_GIB}=$((MIN_GIB * PER_GIB)) BP); nothing to do"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$RESERVE" -eq 0 ]; then amount="Max Affordable "; else amount="$gib"; fi
|
||||
|
||||
if [ "${MAM_BONUS_DRY_RUN:-0}" = 1 ]; then
|
||||
log "DRY RUN: would buy upload amount='$amount'"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
res=$(mam -G "$BASE/json/bonusBuy.php/" \
|
||||
--data-urlencode "spendtype=upload" \
|
||||
--data-urlencode "amount=$amount" \
|
||||
--data-urlencode "_=$(date +%s)000") || fail "bonusBuy.php request failed"
|
||||
|
||||
if [ "$(printf %s "$res" | jq -r '.success // false' 2>/dev/null)" = true ]; then
|
||||
log "bought upload: $(printf %s "$res" | jq -c 'del(.success)')"
|
||||
else
|
||||
fail "bonusBuy rejected (seedbonus was $bp): $(printf %s "$res" | head -c 300)"
|
||||
fi
|
||||
@@ -0,0 +1,110 @@
|
||||
#!/usr/bin/env python3
|
||||
"""qBittorrent "run on torrent finished" hook.
|
||||
|
||||
Host-managed copy lives at /config/qbittorrent/scripts/on-complete.py (container
|
||||
path /config/scripts/on-complete.py); this file is the canonical source, scp it
|
||||
over after editing. AutoRun program in qBittorrent.conf:
|
||||
|
||||
python3 /config/scripts/on-complete.py "%I" "%L" "%F" "%D" <cross-seed apikey>
|
||||
|
||||
1. Every torrent: notify cross-seed's webhook (what the old inline curl did).
|
||||
2. Category "mam" (autobrr MyAnonamouse grabs): file the payload into the book
|
||||
libraries without touching the seeding copy. autobrr saves MAM grabs to
|
||||
/storage1/complete/mam/<Category>/<SubCategory>/<Author>/<Title>/ so the path carries the
|
||||
metadata the .torrent name lacks.
|
||||
- Audiobook -> hardlinked into /storage1/Media/Audiobooks/<Author>/<Title>/
|
||||
(Audiobookshelf). Never use ABS "embed metadata" on these: it rewrites the
|
||||
shared inode and breaks the seed.
|
||||
- Ebook -> COPIED into the CWA ingest folder. CWA edits and then deletes
|
||||
ingest files, so a hardlink would corrupt the seeding data.
|
||||
"""
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
import urllib.parse
|
||||
import urllib.request
|
||||
from datetime import datetime
|
||||
|
||||
MAM_ROOT = "/storage1/complete/mam"
|
||||
AUDIOBOOKS = "/storage1/Media/Audiobooks"
|
||||
EBOOK_INGEST = "/storage1/complete/books-ingest"
|
||||
AUDIO_EXT = {".m4b", ".m4a", ".mp3", ".flac", ".ogg", ".opus", ".aac", ".wma"}
|
||||
# Sidecars ABS uses for covers/metadata.
|
||||
AUDIO_SIDECAR_EXT = {".jpg", ".jpeg", ".png", ".webp", ".opf", ".nfo", ".cue"}
|
||||
EBOOK_EXT = {".epub", ".azw3", ".azw", ".mobi", ".pdf", ".kepub", ".fb2", ".cbz", ".cbr"}
|
||||
LOG = "/config/scripts/on-complete.log"
|
||||
|
||||
|
||||
def log(msg):
|
||||
with open(LOG, "a", encoding="utf-8") as f:
|
||||
f.write(f"{datetime.now():%Y-%m-%d %H:%M:%S} {msg}\n")
|
||||
|
||||
|
||||
def notify_cross_seed(info_hash, apikey):
|
||||
data = urllib.parse.urlencode({"infoHash": info_hash, "includeSingleEpisodes": "true"}).encode()
|
||||
url = "http://cross-seed:2468/api/webhook?" + urllib.parse.urlencode({"apikey": apikey})
|
||||
try:
|
||||
urllib.request.urlopen(urllib.request.Request(url, data=data, method="POST"), timeout=30)
|
||||
except Exception as e: # cross-seed being down must not block filing
|
||||
log(f"cross-seed webhook failed for {info_hash}: {e}")
|
||||
|
||||
|
||||
def payload_files(content_path):
|
||||
"""Yield (abs_path, path relative to the torrent's root) for every file."""
|
||||
if os.path.isfile(content_path):
|
||||
yield content_path, os.path.basename(content_path)
|
||||
return
|
||||
for dirpath, _, names in os.walk(content_path):
|
||||
for n in names:
|
||||
p = os.path.join(dirpath, n)
|
||||
yield p, os.path.relpath(p, content_path)
|
||||
|
||||
|
||||
def file_mam(content_path, save_path):
|
||||
rel = os.path.relpath(save_path, MAM_ROOT).split(os.sep)
|
||||
if len(rel) < 3 or rel[0].startswith(".."):
|
||||
log(f"mam: unexpected save path {save_path!r}, skipping")
|
||||
return
|
||||
# autobrr's Category renders as "Audiobook/Non-Fiction", so the path is
|
||||
# <Category>/<SubCategory>/<Author>/<Title>; take author/title from the end.
|
||||
category, author, title = rel[0], rel[-2], rel[-1]
|
||||
linked = 0
|
||||
if category.lower() == "audiobook":
|
||||
dest = os.path.join(AUDIOBOOKS, author, title)
|
||||
for src, r in payload_files(content_path):
|
||||
ext = os.path.splitext(src)[1].lower()
|
||||
if ext not in AUDIO_EXT | AUDIO_SIDECAR_EXT:
|
||||
continue
|
||||
target = os.path.join(dest, r)
|
||||
if os.path.exists(target):
|
||||
continue
|
||||
os.makedirs(os.path.dirname(target), exist_ok=True)
|
||||
os.link(src, target)
|
||||
linked += 1
|
||||
log(f"mam audiobook: {linked} file(s) -> {dest}")
|
||||
elif category.lower() == "ebook":
|
||||
for src, _ in payload_files(content_path):
|
||||
if os.path.splitext(src)[1].lower() not in EBOOK_EXT:
|
||||
continue
|
||||
target = os.path.join(EBOOK_INGEST, os.path.basename(src))
|
||||
if os.path.exists(target):
|
||||
continue
|
||||
shutil.copy2(src, target)
|
||||
linked += 1
|
||||
log(f"mam ebook: {linked} file(s) copied to ingest from {content_path}")
|
||||
else:
|
||||
log(f"mam: category {category!r} not filed ({content_path})")
|
||||
|
||||
|
||||
def main():
|
||||
info_hash, category, content_path, save_path, apikey = sys.argv[1:6]
|
||||
notify_cross_seed(info_hash, apikey)
|
||||
if category == "mam":
|
||||
try:
|
||||
file_mam(content_path, save_path)
|
||||
except Exception as e:
|
||||
log(f"mam: filing failed for {content_path}: {e!r}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,19 +1,22 @@
|
||||
# TRaSH Guides sync — WEB-1080p (Sonarr) + HD Bluray + WEB (Radarr).
|
||||
# TRaSH Guides sync — WEB-1080p + [Anime] Remux-1080p (Sonarr), HD Bluray + WEB (Radarr).
|
||||
# Run manually: docker exec recyclarr recyclarr sync
|
||||
sonarr:
|
||||
main:
|
||||
sonarr-main:
|
||||
base_url: http://sonarr:8989
|
||||
api_key: !secret sonarr_api_key
|
||||
delete_old_custom_formats: true
|
||||
quality_definition:
|
||||
type: series
|
||||
quality_profiles:
|
||||
- trash_id: 72dae194fc92bf828f32cde74482a9dde
|
||||
- trash_id: 72dae194fc92bf828f32cde7744e51a1 # WEB-1080p (standard series)
|
||||
reset_unmatched_scores:
|
||||
enabled: true
|
||||
- trash_id: 20e0fc959f1f1704bed501f23bdae76f # [Anime] Remux-1080p (anime series)
|
||||
reset_unmatched_scores:
|
||||
enabled: true
|
||||
|
||||
radarr:
|
||||
main:
|
||||
radarr-main:
|
||||
base_url: http://radarr:7878
|
||||
api_key: !secret radarr_api_key
|
||||
delete_old_custom_formats: true
|
||||
|
||||
@@ -4,3 +4,44 @@
|
||||
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
|
||||
|
||||
# chaptarr — Authentik OIDC client (homelab-chaptarr, pk 47). Reference only:
|
||||
# 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
|
||||
QBIT_USER=ginnoir
|
||||
QBIT_PASS=d0fet0th3x
|
||||
|
||||
# autobrr — native OIDC via Authentik (homelab-autobrr, pk 48)
|
||||
AUTOBRR__HOST=0.0.0.0
|
||||
AUTOBRR__PORT=7474
|
||||
AUTOBRR__SESSION_SECRET=f553711d2281745aac667fecd91306340c92a81f9a3d0c1e38a69d70a93b062a
|
||||
AUTOBRR__OIDC_ENABLED=true
|
||||
AUTOBRR__OIDC_ISSUER=https://auth.ginnoir.com/application/o/autobrr/
|
||||
AUTOBRR__OIDC_CLIENT_ID=Gz9Ip2b2lTOaGewfkaIi07fjlhz05RTST8DLei5I
|
||||
AUTOBRR__OIDC_CLIENT_SECRET=sX0qXKzdBiE9N8QGN5LM2x29xxI1Hs2lAhMdnN2qsatp43SQep83LHFTzepHaDD3F2GOBc14oFoLL2EUJyCSk8Pfz8NIHascAnztHNKGk5hdrXAyIUCE7S37twHQRNIF
|
||||
AUTOBRR__OIDC_REDIRECT_URL=https://autobrr.ginnoir.com/api/auth/oidc/callback
|
||||
AUTOBRR__OIDC_DISABLE_BUILT_IN_LOGIN=true
|
||||
|
||||
# autobrr API key for scripted ops (row "homelab-ops" in api_key table)
|
||||
AUTOBRR_API_KEY=3076c984c78d9ef477228379faea6b04
|
||||
|
||||
# mam-bonus: dedicated MAM session (bare mam_id) for the daily upload-credit buy.
|
||||
# Seeds /config/mam-bonus/cookies.txt; MAM rotates it and the job re-saves it there.
|
||||
MAM_BONUS_MAM_ID=JbRgCtBtbsFjCbXsDOUhtMpuUO-oe2dc1i1wT8-8OZRJ0dmBspWkG2SmK5euqhgX-XbtncjiGHWHBYMRS_DSvO4DXsdH--OHZAcZmUgcDuPBaDAcSMEmKSkpvPayUazed0YU3ncV6om380HXPnBgaAvTvocM5lcPruIHWgcji4771TuLriZ7D5xPtqjkO9YdsjOh2A_ckhQQLhFPmejFjgx9mJJ6fc4Xw3ctFwO2CY8EDcH6u3ViF7jD73Qpr8gWnfwGokuHVpKSyJDUzUWPkj7NbldwUhdS-C4l
|
||||
MAM_BONUS_RESERVE=0
|
||||
MAM_BONUS_NTFY=http://ntfy:80/mam
|
||||
@@ -31,7 +31,8 @@ services:
|
||||
|
||||
resume-minio:
|
||||
container_name: minio_resume
|
||||
image: minio/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
# minio/minio vanished from Docker Hub 2026-10; self-hosted copy of the last cached tag.
|
||||
image: registry.ginnoir.com/mirror/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
restart: unless-stopped
|
||||
labels:
|
||||
- "com.centurylabs.watchtower.enable=false"
|
||||
@@ -47,8 +48,6 @@ services:
|
||||
environment:
|
||||
- MINIO_BROWSER_REDIRECT_URL=https://minio.ginnoir.com
|
||||
- MINIO_IDENTITY_OPENID_CONFIG_URL=https://auth.ginnoir.com/application/o/minio/.well-known/openid-configuration
|
||||
- MINIO_IDENTITY_OPENID_CLIENT_ID
|
||||
- MINIO_IDENTITY_OPENID_CLIENT_SECRET
|
||||
- MINIO_IDENTITY_OPENID_SCOPES=openid,profile,email
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -sf http://localhost:9000/minio/health/live || exit 1"]
|
||||
|
||||
@@ -22,9 +22,13 @@
|
||||
services:
|
||||
jellyfin:
|
||||
container_name: jellyfin
|
||||
image: lscr.io/linuxserver/jellyfin:latest
|
||||
# Pinned 2026-10-23 (Jellyfin 12.3.0): Watchtower recreates mid-day caused
|
||||
# ~9 min of 502s while 10.11+/12.x starts silently on virtiofs. Bump manually.
|
||||
image: lscr.io/linuxserver/jellyfin:12.3ubu2604-ls56
|
||||
restart: unless-stopped
|
||||
networks: [streaming, edge]
|
||||
labels:
|
||||
- "com.centurylabs.watchtower.enable=false"
|
||||
env_file:
|
||||
- stack.env
|
||||
devices:
|
||||
@@ -82,6 +86,23 @@ services:
|
||||
ports:
|
||||
- "5690:5690"
|
||||
|
||||
# Jellyfin-backed Seerr, alongside the Plex-backed `seerr` in the media stack
|
||||
# until the Plex cutover. Reaches sonarr/radarr over edge.
|
||||
jellyseerr:
|
||||
container_name: jellyseerr
|
||||
image: ghcr.io/seerr-team/seerr:latest
|
||||
init: true
|
||||
restart: unless-stopped
|
||||
networks: [streaming, edge]
|
||||
env_file:
|
||||
- stack.env
|
||||
environment:
|
||||
- UMASK=002
|
||||
volumes:
|
||||
- /config/jellyseerr:/app/config
|
||||
ports:
|
||||
- "5056:5055"
|
||||
|
||||
jellyplex-watched:
|
||||
container_name: jellyplex-watched
|
||||
image: luigi311/jellyplex-watched:latest
|
||||
|
||||
@@ -22,7 +22,7 @@ JWT_SECRET=0dd9fcdb632277b76977dbada8226e547cc773e1deafc8d778d4038f8d59393b
|
||||
# gets an empty reply. Temporary host socat proxy plex-http-proxy.service
|
||||
# exposes loopback Plex HTTP on :32402 for Docker clients (Plexyfin + jellyplex).
|
||||
# Tear down that unit after Plex is decommissioned / Plexyfin is done.
|
||||
PLEX_URL=http://192.168.1.69:32402
|
||||
PLEX_BASEURL=http://192.168.1.69:32402
|
||||
PLEX_TOKEN=hM9aycswHKSsUrxiHqwq
|
||||
JELLYFIN_BASEURL=http://jellyfin:8096
|
||||
JELLYFIN_TOKEN=a3d9ee827d5c42298cae087a2c31d3fa
|
||||
|
||||
Reference in new issue
Block a user