Commit Graph

61 Commits

Author SHA1 Message Date
root
df6aca888c homelab: re-exec 'secret' via sudo for non-root users
/etc/age/key.txt is 0600 root and /etc/age is 0700 root, so the CLI's
Path.exists() check was returning False under regular users — making the
subcommand look broken when bootstrap had actually written the key fine.
Re-exec via sudo preserves the existing UX (one password prompt, then
plaintext) without loosening the key's perms.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 17:48:32 +02:00
root
58bd4df3b1 client-enrol: republic-laptop pubkey + hello.yaml recipient
Phase 2 first workstation enrolled. age1vf8... is republic-laptop's
issued pubkey; added as a recipient on hello.yaml so the post-bootstrap
decrypt test works there.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 17:34:30 +02:00
root
44d4d00aff operations: add agent-enrollment.md — bootstrap doc for new clients
Captures the full enrollment flow validated during Phase 2 rollout: per-OS
dep install (dnf/apt/brew), Gitea PAT prerequisite, DNS gotchas, the
bootstrap command, post-bootstrap verification, the homelab client add
ceremony for new inventory entries, secret grant/revoke, and a
troubleshooting table mapping every failure mode we hit during validation
to the commit that fixed it.

Linked from README under Operations.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 17:27:56 +02:00
root
c5fa756c7d Use mcp/secrets.hubris.network for the canonical endpoints
Caddy + split-horizon DNS now resolve these to LXC 105 (via 121).
Workstations off-LAN reach them via Netbird (192.168.8.0/24 is a
network resource routed through hubris).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 17:17:19 +02:00
root
a7d2a7a08c bootstrap.sh: emit dnf install hint on Fedora/RHEL clients
Was apt-only on Linux; republic-laptop is Nobara so installs use dnf and
yaml is python3-pyyaml (not python3-yaml).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 17:12:13 +02:00
root
6848640fa4 mcp/server: disable FastMCP DNS-rebinding protection
We're nftables-gated to mesh+LAN; the browser-attack threat doesn't
apply, and the default whitelist (127.0.0.1/localhost/[::1] only) blocks
every LAN/mesh client.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 16:43:35 +02:00
root
1dc40ca715 mcp/server: bind 0.0.0.0:9810 (FastMCP default is 127.0.0.1:8000)
The MCP service unit expects port 9810 per the inventory; FastMCP only
binds correctly when we set mcp.settings.host/port before run().

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 16:42:30 +02:00
root
bc578df39b secrets: add encrypted hello.yaml (bootstrap verification)
Encrypted to hubris + apps; expand recipients as new clients enrol via
'sops updatekeys -y secrets/hello.yaml'. Tests the full sops + age path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 16:39:33 +02:00
root
1ae328f04d inventory: record age pubkeys for hubris + apps (Phase 3a)
First two clients have age keys issued by secrets-issuance.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 16:38:44 +02:00
root
582823a89c secrets-issuance: trust LAN subnet 192.168.8.0/24
Hubris is Netbird-only and LXC 105 is Tailscale-only; they share LAN
but not a mesh, so on-host \`curl http://192.168.8.205:9820/issue\`
arrives with source IP 192.168.8.77. In a homelab LAN with no
untrusted devices the trust boundary is reasonable; if that changes
later, narrow this.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 16:36:09 +02:00
root
3c9d2f975d bootstrap.sh: require python3 + PyYAML (used by homelab CLI)
The homelab CLI imports yaml; missing on a fresh LXC. Preflight now
checks and emits the right install hint per OS.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 16:31:28 +02:00
root
de6f8bec42 bootstrap.sh: preserve URL scheme in credentials file
git credential helper does exact prefix match including scheme. Hardcoding
https:// breaks for in-LAN clones using http://192.168.8.121:3000 (which
LXC 105 needs because its DNS doesn't have the split-horizon override).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 16:30:17 +02:00
root
385deb6dec bootstrap.sh: add --gitea-token / HOMELAB_GITEA_TOKEN
Each non-hubris client needs HTTPS auth against gitea for the initial
context clone (chicken-and-egg: a PAT stored in SOPS can't be fetched
until after the clone exists). Adds a --gitea-token flag that writes
credentials to /etc/homelab-context/git-credentials and points git's
credential.helper at it, so the clone and all future pulls succeed
without prompting.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 16:24:31 +02:00
root
3c25f936d3 Phase 1: cross-client homelab context + MCP scaffolding
Add the foundation for distributing homelab context to every client
(LXCs, VMs, workstations including republic-laptop, mac-mini, ludo-mini)
with a single source of truth, structured query layer (MCP), and per-client
age-key issuance for secrets:

- inventory.yaml — canonical topology (hosts, services, mesh addresses)
- hosts/*.yaml — per-host identity files generated from inventory by
  mcp/build_host_files.py; do not edit by hand
- AGENTS.md — orientation doc symlinked to /root/AGENTS.md on every client
- bootstrap.sh — one-shot enroll (Linux + macOS), clones repo, fetches age
  key from issuance, installs sync timer/launchd job, drops the homelab CLI
- bin/homelab — single-binary Python CLI: whoami, list, ssh, pct, logs,
  restart, open, status, secret, sync, mcp, client add/remove, nuke
- mcp/server.py — FastMCP server: context tools + read-only management
  tools (no mutations exposed); shell-outs use mcp-reader restricted ssh key
- mcp/deploy/ — claudio-monitor-style gitea webhook deploy scaffold for the
  MCP service on LXC 105 (ports 9810 mcp, 9811 webhook)
- secrets-issuance/ — per-client age key auto-provisioning over the mesh;
  source-IP gated against inventory, with denylist for revoked clients
  (ports 9820 issue, 9821 webhook)
- secrets/, .sops.yaml — SOPS recipient scaffolding; the operator fills in
  age public keys after Phase 3a generates them
- scripts/sync/ — systemd timer (Linux) + launchd plist (macOS) pulling
  /opt/homelab-context every 5 min

Mesh: both Netbird (preferred, 100.122.0.0/16) and Tailscale accepted
during the in-flight migration; no client is gated on completing the move.

Plan reference: /root/.claude/plans/lets-make-a-plan-fluttering-trinket.md

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 15:47:48 +02:00
Claudio
8f598a0e7a 127-mule-photos-new: deploy.sh fix for OIDC state-cookie rotation
PhotoPrism rotates its session HMAC key on every container start, so any
auto-deploy that recreated pp-app invalidated in-flight OIDC logins. The
deploy script was force-recreating + image-pulling on each push; pinned
both so pp-app survives a routine code deploy.
2026-05-18 21:36:29 +02:00
root
bb063d6f94 127-mule-photos-new: pre-transcode pass + perf characterisation
Measured cold-cache behaviour: thumbnails ~2ms, HEVC video playback
12-21s TTFB because libx264 transcodes inline and serialised one
ffmpeg at a time. Sibling thumbs unaffected (~2ms during transcode).
With 11/45 .mov files already pre-baked, ~75% of clicks were cold.
Ran `photoprism convert` to bring sidecar coverage to 45/45; previously
cold videos now serve in ~2ms TTFB.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 10:12:14 +02:00
root
3bf8175d97 100-zimaos: fix UI delete by remounting NFS at /media/library
NFS was mounted at /DATA/library, so the icewhale-files trash regex
(^/media/([^/]+)) derived drive=ZimaOS-HD and tried to rename into
/media/ZimaOS-HD/.trash on local ext4 -- cross-device EXDEV from NFS.
Remounting at /media/library makes 'library' its own /media/<name>
segment, so trash resolves to /media/library/.trash on the NFS itself.
2026-05-18 10:11:19 +02:00
Claudio
a154070e03 LXC 127: capture OIDC bridge, indexer caps, folder fixes, gitea webhook gotcha 2026-05-18 00:12:12 +02:00
Claudio
eaa014d37a Add LXC 127 mule-photos-new (PhotoPrism M0 test on @new branch) 2026-05-17 21:52:31 +02:00
Claudio
5dda267013 118-elementsynapse: install suppress_redactions push-rule for @admin
Stops redaction events (Signal disappearing messages, deletes,
etc.) from bumping the mobile notification badge in the
future.
2026-05-15 21:59:37 +02:00
Claudio
565453773c 118-elementsynapse: phantom-notification cleanup + DB fact-fix
Synapse runs on SQLite (not Postgres — Postgres only hosts the
mautrix bridge dbs). Documented the post-disk-full
event_push_actions cleanup that took @admin'\''s phantom count
from 125 to 4.
2026-05-15 21:56:35 +02:00
Claudio
c9eb7fdab3 118-elementsynapse: document disk-full fix + bridges
Rootfs grew to 16 GiB on 2026-05-15. Added bridges section
(mautrix slack/signal/meta/linkedin/whatsapp), synapse-admin
port, Postgres backend note, and operational tips for future
disk growth.
2026-05-15 21:48:58 +02:00
Claudio
685d6a9d48 Decommission LXC 109 (syncthing)
Container had been stopped since 2026-04-21 and was never re-enabled.
pct destroy 109 --purge cleaned up vm-109-disk-0 on local-lvm and the
config file. /mnt/library/syncthing subtree was already empty at the
time of destruction and is retained as an empty dir (no real data to
migrate or back up).

- README.md, containers/index.md: removed row, moved to "recently
  destroyed" table
- hosts/hubris.md: dropped from /mnt/library subtree list, updated
  containers/index summary line, added changelog entry
- infrastructure/media-permissions.md: dropped from membership table
  and onboarding example, generalised pct-exec gotcha hostname,
  added changelog
- vms/100-zimaos.md: dropped from "existing fleet" enumeration
- containers/102-nfs-export.md: dropped from bind-mount sibling list
  (7 LXCs now, not 8)
- containers/109-syncthing.md: deleted

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 23:12:32 +02:00
Claudio
aca2ff836e hubris: network performance baseline 2026-05-14
WAN 113/20 Mbit, vmbr0 intra-host ~34.7 Gbit/s, eno1 1G negotiated.
Flag: eno1 rx_errors at ~1.7% over 14d uptime — recheck trend.
2026-05-14 22:49:26 +02:00
Claudio
82d4e35fcb Promote NFS export to rw + capture ZimaOS Drives-API finding + mesh reachability
After Files-UI evaluation passed (library renders as folder, thumbnails
work), flipped /etc/exports from ro to rw on LXC 102. Tested: write from
ZimaOS appears on /mnt/library as www-data:media, confirming the
all_squash,anonuid=33,anongid=10000 design works.

Documented two architectural findings discovered this session:
- ZimaOS Drives panel sources from GET /v2/local_storage/storages (read-only
  API). Network shares cannot become Drives — Files-as-folder is supported.
- Mesh peers reach ZimaOS via hubris's existing 192.168.8.0/24 netbird subnet
  advertisement; no new infra needed, just DNS (Management nameserver group
  for hubris.network or per-device /etc/hosts override).
2026-05-14 22:29:11 +02:00
root
060eff826c Decommission LXC 116 (heaper)
User destroyed the heaper LXC on 2026-05-14. Removed it from the
container index, README quicktable, hubris host doc, and
media-permissions membership table; moved to the "recently destroyed"
archaeology list. /mnt/library/heaper retained (224 MiB).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 12:55:53 +02:00
claudio
838052543b 120-mule-images: drop AI pipeline, swap to plain postgres, log refresh
Reflects state after the 2026-05-14 session: the OpenCLIP vision
classifier and worker-vision are gone, the db image is now postgres:16,
and the one-shot full_refresh.py reaped 7982 orphan thumbnail dirs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 01:02:48 +02:00
Claudio
23c7f6a4f1 Document TCP BBR + Apache keepalive tuning (Nextcloud throughput follow-up) 2026-05-13 21:22:17 +02:00
Claudio
c27cd99c6d Document Nextcloud throughput tuning (FPM + event MPM + opcache JIT + MariaDB) 2026-05-13 21:01:32 +02:00
claudio
94d02785f6 wiki: plato auto-deploy (gitea webhook on dtoro/Plato → LXC 126:9799)
- infrastructure/auto-deploy.md: Plato pipeline added (Shape B,
  port 9799, hook id 8); ALLOWED_HOST_LIST gains 192.168.8.190;
  per-pipeline note for the LXC 126 specifics (origin URL, no
  ProtectHome); Changelog updated
- containers/126-plato.md: Auto-deploy section + Changelog entry
2026-05-13 09:00:34 +02:00
claudio
40691dae20 wiki: add 126-plato, decommission 125-seafile
- containers/126-plato.md: Plato (notes/discovery) on LXC 126 — stack,
  bind mount, caddy + DNS, fresh-DB bootstrap workaround
- containers/125-seafile.md: removed (LXC destroyed 2026-05-13)
- containers/index.md: 126 added; 125 moved to recently-destroyed
- infrastructure/dns.md: plato entry added, files entry removed,
  Changelog reflects both
- README.md: top-level quick-links table swaps 125 → 126
2026-05-13 08:52:55 +02:00
Claudio on hubris
1ad56435e5 seafile: enable Metadata management + Views (Pro)
ENABLE_METADATA_MANAGEMENT=True + METADATA_SERVER_URL=http://seafile-md-server:8084 in seahub_settings.py. Library owners can now toggle metadata per library and create table/gallery/kanban Views over their files.
2026-05-12 19:25:14 +02:00
Claudio on hubris
dc0780bcaf seafile: add Pro metadata-server + thumbnail-server
Two new services on LXC 125's docker stack:
- seafile-md-server (Pro extended metadata, internal-only on :8084)
- thumbnail-server (Pro accelerated thumbnails, bound to .185:8081)

Caddy now routes /thumbnail/* to the thumbnail-server; everything else stays
on the main seafile container. End-to-end smoke verified: routing works,
per-request permission checks via INNER_SEAHUB_SERVICE_URL=http://seafile
correctly return 403 for cross-user thumbnail requests.
2026-05-12 19:06:50 +02:00
Claudio on hubris
02ad003e52 seafile: CE -> Pro upgrade, ES, Caddy resumable-upload fix
Same-day-as-deploy upgrade: image swapped to seafileltd/seafile-pro-mc:13.0-latest, elasticsearch:8.15.0 added as new compose service for Pro's full-text search. Free Pro tier (<=3 users, no license). Existing data + users survived.

Also documented the Caddy patch stripping IETF resumable-upload headers (Upload-Draft-Interop-Version etc.) so the iOS Seafile Pro 4.0.2 app falls back to plain multipart upload; without it large uploads stalled and cancelled after ~60s.
2026-05-12 18:45:56 +02:00
Claudio on hubris
40f6c93fd5 Add 125 (seafile) — Nextcloud-replacement evaluation
LXC 125 stood up as a Seafile CE 13.0 docker-compose deployment, behind
files.hubris.network. Authentik OAuth wired up via ak shell. No data
migration — exploration alongside Nextcloud (114).
2026-05-12 12:45:45 +02:00
claudio
bb410eea49 120 mule-images: Phase 4 — retire /data/thumbs; SECRET_KEY bug fix
- Vision fetches NC preview at 640px via new sync helper.
- WORKER_THUMB_SIZES = set(); generate_thumbnails still does pHash.
- All medium.webp purged after verification.
- Bug: SECRET_KEY was missing from workers in compose, so
  Fernet decrypt silently failed everywhere outside the backend
  container. Phase 3 had been falling back to ExifTool the whole
  time. Fix replicates SECRET_KEY to all worker services.
2026-05-11 14:00:50 +02:00
claudio
372b856b32 120 mule-images: Phase 3 — extract_metadata via Memories HTTP API
Tries Memories /api/image/info/{fileid} first (OCS-APIRequest header
bypasses CSRF), falls back to ExifTool on 404 / non-NC / errors.
Kept the full date-fallback chain because 35% of the library uses
filename-encoded dates that Memories doesn't recover.
2026-05-11 13:41:54 +02:00
claudio
599715a447 120 mule-images: folder rename round-trip both ways
- handle_directory_rename in scan.py covers NC-side renames via the
  webhook. Iterates rows in Python (asyncpg int-type quirk on raw
  SUBSTRING+LENGTH).
- Existing PATCH /folders/{id} handles mule-side renames; webhook
  feedback hits the same helper and is a 0-row no-op (idempotent).
2026-05-11 13:19:05 +02:00
claudio
02571093d4 120 mule-images: post-Phase-2 delete-roundtrip patches (A + C)
- Folder delete now propagates: webhook handler detects directory
  deletes and runs a single UPDATE that discards every Photo under
  the path prefix.
- PUT-overwrite of a previously-discarded file now resurrects the
  Photo row (is_discarded=false, re-queue extract_metadata).
- Trashbin restore and folder rename remain known gaps (documented).
2026-05-11 12:54:38 +02:00
claudio
a4bf4367e6 120 mule-images: Phase 1 + 2 NC integration (thumbnail proxy + webhook receiver)
- Worker-watcher retired; file events come from NC webhook_listeners.
- Thumbnails proxy /index.php/core/preview keyed by photos.nextcloud_fileid.
- backfill_gps auto-trigger killed (was queueing ~60k tasks per deploy).
- Range support added to /api/v1/photos/{id}/original so .mov plays.
- NC cron tightened to */1 for ~60s webhook latency.
2026-05-11 12:33:10 +02:00
Claudio
71e890c8f1 docs(mule-image): duplicates path strip now shows grandparent/parent
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 00:51:05 +02:00
Claudio
86009d316f docs(mule-image): duplicates path strip + duplicate-worker orphan post-mortem
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 00:45:23 +02:00
Claudio
53c0193dc9 docs(mule-image): drop Title field, add bulk Notes editor
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 00:11:36 +02:00
Claudio
d68ce2ee2a docs(mule-image): right sidebar compact two-section rebuild
ActiveHeapCard gone, Edit + Metadata collapsibles collapsed into one
Metadata block (readonly + hr + form), Camera split out at the
bottom. Section helper deleted along with the orphan ActiveHeapCard
component file.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 23:45:28 +02:00
Claudio
3d59f2287b docs(mule-image): timeline scroll-to-top on section switch
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 23:29:48 +02:00
Claudio
51221afe7d docs(mule-image): filter-bar 422-on-date-from
date_from went out as bare YYYY-MM-DD; pydantic v2 datetime parser
rejected it with 422, frontend swallowed the failure, grid showed
nothing. Fixed both sides.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 23:19:31 +02:00
Claudio
0673f28213 docs(mule-image): date-extraction overhaul
EXIF:ModifyDate dropped, SubSec promoted, path-guess fallback added,
manual edits now preserved on rescan. backfill_taken_at sweep firing
across all non-manual photos.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 23:05:30 +02:00
Claudio
3eafc17900 docs(mule-image): cascade-delete FK fixes + tz-aware taken_at fix
After the hard-remove SourceRoot endpoint shipped, two real-world FK
issues surfaced (parent_id self-FK and cross-source-root children) and
one tz-aware datetime issue on PATCH /photos/{id}. All three fixed in
the same session. Trash icon also picks up a spinner during the multi-
second cascade.

Deploy.sh's --force-recreate flag isn't actually recreating reliably;
flagged as open infra question.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 22:43:15 +02:00
Claudio
21423d9f2d docs(mule-image): hard-delete SourceRoot + 30-min discard catch-up
Trash icon is now an actual hard delete (SourceRoot + Folders +
Photos, Nextcloud files untouched). Watcher's 5-minute soft-time-
limit kill is fixed. Beat schedule fires discard_missing_photos
every 30 min as a safety net for events the real-time watcher
might miss.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 22:23:50 +02:00
Claudio
8a17a8dcf5 docs(mule-image): OIDC auto-redirect + deploy.sh caveat
LoginPage now bounces straight through Authentik when OIDC is on,
with skipAutoSso escape hatches for logout / error / explicit
password use. Also flagging that the first deploy.sh --force-recreate
run raced with a manual --no-deps recreate and broke the stack;
recovery via docker compose down && up.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 22:03:47 +02:00