Skip to content

Latest commit

 

History

History
615 lines (551 loc) · 39.7 KB

ARCHITECTURE.md

File metadata and controls

615 lines (551 loc) · 39.7 KB

HugMesh cluster architecture

Everything connects behind hugmesh.net through per-namespace Spring Cloud Gateways, and every gateway validates the same internal Casdoor OAuth2 JWT. Cloudflare maps the public hugmesh.net / hugmesh.games names onto those gateways through an opt-in Cloudflare Tunnel (apps/12-cloudflared.yaml). The tunnel is present only in ENV=prod images; the builders prune it from ENV=test images.

Nodes & images

Image Build Arch Role in the cluster
pki build-rpi5-stage4.sh --role pki aarch64 (RPi 5) Kubernetes control plane + identity: headscale (mesh control), Casdoor, Cassandra, hugmesh-pki-gateway
backend build-rpi5-stage4.sh --role backend aarch64 (RPi 5) tuwunel (Matrix), Akkoma (fediverse), Spring APIs, databases, hugmesh-be-gateway
frontend build-rpi5-stage4.sh --role frontend aarch64 (RPi 5) hugmesh.net Angular host federating hugmesh-matrix-ui + hugmesh-mastodon-ui + hugmesh-wiki-ui + login/admin/mod/user/forum remotes, hugmesh-fe-gateway
host build-x86-host-stage4.sh (default --role backend-gpu) x86_64 (desktop/server) GPU worker: ArgoCD, GitLab/Runner/binhost (devops), hugmesh.games, owncast + tube (GPU-dependent video), heavy datastores (Kafka/ClickHouse/Uptrace), local-path/node-storage default (Mesa/Vulkan via /dev/dri)
edge-ai build-x86-host-stage4.sh --role edge-ai (x86_64) / build-jetson-stage4.sh --role edge-ai (Jetson Orin Nano, arm64 crossdev — the x86 builder is amd64-only and cannot produce a Jetson image) x86_64 / Jetson Orin Nano (arm64) GPU inference node: Ollama serving an OpenAI-compatible model API (/v1) to the mesh over k8s (ClusterIP) + tailnet (ai.<domain> gateway route); NVIDIA proprietary + CUDA + nvidia-device-plugin (which also makes the GPU schedulable for owncast/coturn/tube voice+video). Model library is the edge-ai-models ConfigMap. See EDGE-AI.md

All nodes are hardened Gentoo, join one Kubernetes cluster, sit on one headscale mesh, and are provisioned at first boot from a USB KEYS stick (see keys-template/). The pki Pi is the kubeadm control plane. The backend and frontend Pis and the x86_64 host join it as workers and are labelled (hugmesh.net/role, …/compute=gpu) so workloads land on the right hardware.

flowchart TD
    CF["Cloudflare edge<br/>hugmesh.net / hugmesh.games"]
    CF --> FEGW["hugmesh-fe-gateway<br/>(hugmesh.net)"]
    CF --> BEGW["hugmesh-be-gateway<br/>(api / matrix / mastodon .*)"]

    subgraph FE["hugmesh-frontend (frontend Pis)"]
        HOST["hugmesh.net Angular host shell"]
        HOST --> MUI["hugmesh-matrix-ui"]
        HOST --> MASTUI["hugmesh-mastodon-ui"]
        HOST --> LOGINUI["hugmesh-login-ui"]
        HOST --> ADMINUI["hugmesh-admin-ui / mod-ui / user-ui / forum-ui / wiki-ui"]
    end

    subgraph BE["hugmesh-backend (backend Pis)"]
        TUW["tuwunel (Matrix homeserver)"]
        AKK["Akkoma (Mastodon-API fediverse)"]
        APIS["Spring APIs + DBs"]
        FEDAPI["federation-api"]
        BFFS["admin / mod / user / forum / wiki / mesh BFFs"]
        PHPBB["phpBB (optional)"]
    end

    subgraph PKI["hugmesh-pki (pki Pi — control plane)"]
        CAS["Casdoor (IdP)"]
        CASS["Cassandra"]
        HS["headscale (mesh control)"]
    end

    subgraph INFER["hugmesh-inference (edge-ai GPU node — x86_64 or Jetson)"]
        EDGEAI["edge-ai (Ollama /v1)"]
        EDGEAIAN["edge-ai-analysis"]
    end

    subgraph X86["x86_64 GPU worker"]
        ARGO["ArgoCD"]
        DEVOPS["GitLab / Runner / binhost (devops)"]
        GAMES["hugmesh.games studio"]
        VIDEO["owncast + tube (GPU-dependent video)"]
        HEAVY["heavy datastores: Kafka / ClickHouse / Uptrace"]
        STORE["local-path / node-storage default"]
    end

    FEGW --> FE
    BEGW --> BE
    BE -. "games ns + argocd ns scheduled here" .-> X86
    BEGW -. "ai.hugmesh.net (tailnet-only, not on the public CF fan-out)" .-> INFER
    BEGW -. "headscale-forward ONLY (scale.hugmesh.net) — pki is NOT internet-facing" .-> PKIGW["hugmesh-pki-gateway<br/>(internal ingress on the pki node only)"]
    PKIGW --> PKI

    subgraph SSO["SSO / native login — shipped, lit by default"]
        AUTHCORE["auth-core: account/session/MFA + custody seams (2.5.1; 2.4.2 / 2.5.0 until consumers bump)"]
        GWEXCH["gateway bff_-exchange filter"]
        LOGINOIDC["login-ui native login form -> POST /bff/login"]
        UBRELOC["user-bff native login + server-side Casdoor exchange"]
        CUSTKEY["SSO custody-key + internal-token bootstrap"]
    end

    subgraph DARK["Shipped, SHIPS DARK — on main, inert behind a default-off flag"]
        WC["Workload Console: admin-bff module + hidden-tier admin-ui remote + 2-SA RBAC"]
        MFAFLOOR["MFA privileged floor: mfa_required seeds + gateway env + CI gates"]
        DESKGOV["Desktop app governance: polkit sudo mapper + curated Discover"]
        BACKUPS["Encrypted versioned backups: Velero + Kopia (apps 55/56)"]
        TURN["coturn TURN/STUN relay (public reachability = opt-in overlay)"]
        EGRESS["Egress-VPN drop-in + per-node attached storage"]
    end

    subgraph ROADMAP["Roadmap — genuinely NOT done"]
        KINDE2E["kind SSO e2e: harness shipped, blockers 1-16 and the JWKS fix (#693) merged, live proof not run"]
        MFAFLIP["MFA: the live-cluster operator flip (MFA-ROLLOUT.md)"]
        ENFORCE["SELinux enforcing (nodes boot permissive)"]
        SFU["Group-call SFU: client half dark, server half not built"]
        NOTIFY["Notifications: external channels"]
    end

    classDef dark stroke-dasharray:2,stroke:#4a7,color:#3a6;
    classDef planned stroke-dasharray:4,stroke:#888,color:#555;
    class DARK,WC,MFAFLOOR,DESKGOV,BACKUPS,TURN,EGRESS dark;
    class ROADMAP,KINDE2E,MFAFLIP,ENFORCE,SFU,NOTIFY planned;
Loading

The superadmin Service Catalog surface (tailnet-only hugmesh-superadmin-gateway

  • Kaniko build namespace) is now ✅ shipped on main but is reachable only over the headscale tailnet via the internal ingress on the pki node — it is deliberately off every public-ingress gateway, so it is not drawn on the public fan-out above. See § Superadmin & multi-tenancy.

The gateway pattern

hugmesh-gateway (Spring Cloud Gateway) is deployed once per namespace from one Helm chart, differentiated by SPRING_APPLICATION_NAME. It is modelled on the org's hugmesh-gateway / hugmesh-pki-gateway:

  • OAuth2 resource server against Casdoor's JWKS. The same JWT validates at every gateway and API.
  • ExternalAuthHeaderFilter appends External-Authorization / External-Auth-Provider / External-Auth-Id, so downstream services see the outside identity without re-decoding tokens.
  • Public paths are /api/auth, /api/login, /api/registration, /bff/login and a few other pre-login paths such as password reset and the public theme. They allow Google-federated sign-up and the native login. Everything else is authenticated. Casdoor exposes no browser-facing login UI: the browser hits the platform's own native form and /bff/login, and Casdoor is reachable only in-cluster.
  • Routes per gateway are rendered into an application-routes.yml ConfigMap and loaded via SPRING_CONFIG_ADDITIONAL_LOCATION.

Identity & login

Casdoor (id.hugmesh.net) is the single IdP. It is reached only from inside the cluster: it has no public ingress, and the browser never sees it.

  • Admin-created accounts sign in through the platform's native login form (login-ui), which POSTs credentials to user-bff POST /bff/login. user-bff drives Casdoor over the internal network.
  • Google federation handles public registration and sign-up.
  • tuwunel (Matrix homeserver, OIDC) and Akkoma (Mastodon-API-compatible fediverse, OIDC) both sign in through Casdoor. The hugmesh.net front page can therefore show Matrix / Mastodon links to logged-in users and hand each module a service access token, so the hugmesh-matrix-ui and hugmesh-mastodon-ui Angular micro-frontends never render their own login forms. The public hostnames stay matrix.<domain> / mastodon.<domain> for API compatibility, but the backing servers are tuwunel / Akkoma, never Synapse / Mastodon.

Authentication / SSO (BFF JWT custody)

State convention: ✅ shipped = merged to main · 🚧 in-flight = code on an open branch/PR, not yet merged · 🔭 planned = design-complete, no code. The SSO flags are lit by default on main (see "Safety-flag posture" below); only the secret values behind two of them default to empty.

The mandate: SSO login is a native, first-party form. The browser POSTs username and password (and, when challenged, an MFA passcode) to user-bff POST /bff/login and gets back only an opaque bff_ session cookie. Casdoor and every OAuth/OIDC token stay internal. user-bff generates PKCE + state server-side, POSTs the credentials to the internal Casdoor /api/login, exchanges the returned code, and holds and refreshes the JWT under custody. The browser never receives a JWT, the code_verifier, the state or any Casdoor URL. The gateway swaps bff_ for an internal custody JWT just before resource-server validation, and the user never sees their own JWT. This keeps the r2dbc/Casdoor management stack off the gateway's classpath and puts login in the BFF tier. With no front-channel redirect, Casdoor needs no public ingress at all.

Component ownership (post auth-relocation):

  • hugmesh-auth-core (shared jar net.hugmesh:hugmesh-auth-core) is the stateful auth stack: AccountStore/BffSession (account + session + MFA), OidcExchangeClient (code→token + refresh), BffCustodyCipher (AES-256-GCM encryption at rest for the held JWT), SessionCookieService (the opaque bff_ cookie) and InternalTokenWebFilter (mTLS + X-Internal-Token guard for /bff/internal/**). Only admin-bff and user-bff consume it, never the gateway.
  • hugmesh-admin-bff-api owns the account and session data (admin-bff-db), the in-cluster /bff/internal account/session API, the custody/stamp endpoint and the session/exchange endpoint.
  • hugmesh-user-bff-api owns the native login endpoint POST /bff/login (permitAll at the BFF): server-side PKCE + state, the internal Casdoor /api/login POST, the MFA challenge handshake and the OidcExchangeClient code exchange. It owns the rest of the login surface too (/bff/register, /bff/session, …). It reads and writes account and session data over admin-bff /bff/internal and never touches admin-bff-db; the NetworkPolicy layer denies the two BFF databases to each other.
  • hugmesh-gateway holds the BffJwtExchangeWebFilter, which swaps bff_ for the custody JWT (pre-security, fail-closed, behind a flag), and the permitAll /bff/login route-access seed. No front-door route exposes Casdoor: /login/oauth/authorize and the Casdoor UI are never proxied to the browser.
  • hugmesh-login-ui is the first-party native username/password form. It POSTs to /bff/login and renders the MFA step-up when challenged. It never redirects the browser to Casdoor and holds no Casdoor URL.
  • hugmesh-generator (this repo) holds the app-user-bff Casdoor confidential client (authorization_code grant + internal redirect-uri) and the permitAll /bff/login route-access seed (#156).
sequenceDiagram
    autonumber
    participant B as Browser (login-ui native form)
    participant C as Casdoor (IdP, internal-only)
    participant GW as hugmesh-gateway
    participant UB as user-bff
    participant AB as admin-bff (+ admin-bff-db)
    Note over B: native form - user types username/password (+ MFA passcode if challenged)
    B->>GW: POST /bff/login {username, password} [permitAll route]
    GW->>UB: forward
    Note over UB: generate PKCE verifier + S256 challenge + state SERVER-SIDE
    UB->>C: POST /api/login (OIDC/PKCE query + {username,password,type:code,signinMethod:Password}) [INTERNAL]
    C-->>UB: status:ok + data=code  (or data=NextMfa -> 200 {mfaRequired:true}, or status:error -> 401)
    UB->>C: OidcExchangeClient.exchangeCode(code, verifier, redirectUri) [INTERNAL]
    C-->>UB: Casdoor JWTs [access + refresh]
    UB->>AB: /bff/internal ensureAccount, createSession - opaque bff_
    UB->>AB: /bff/internal custody/stamp [BffCustodyCipher.encrypt] - stored in bff_session.*_enc
    UB-->>B: Set-Cookie bff_ [opaque] - browser NEVER sees a JWT, verifier, state, or Casdoor URL
    Note over B,GW: subsequent requests carry the opaque bff_
    B->>GW: Authorization: Bearer bff_... [any /api or /bff route]
    GW->>AB: /bff/internal/session/exchange [mTLS + X-Internal-Token]
    AB-->>GW: custody JWT [lazy-refresh near expiry, fail-closed]
    Note over GW: rewrite Authorization: Bearer custody-jwt, THEN resource-server JWT validation + route-access/revocation/MFA
    GW->>UB: forward [downstream sees a normal Casdoor JWT]
Loading

Invariants (the security contract; it must hold in every deployment):

  • The browser holds only the opaque bff_. The Casdoor JWT, the code_verifier, the state and any Casdoor URL are never sent to or stored in the client. The session token appears only in the Set-Cookie header, never in a response body.
  • Casdoor is reachable only internally (user-bff / be-gateway → casdoor:8000). No gateway route proxies /login/oauth/authorize or the Casdoor UI to the browser, and prod gives Casdoor no public ingress.
  • The custody JWT is encrypted at rest (AES-256-GCM) in bff_session (access_token_enc / refresh_token_enc).
  • The gateway swap is pre-security and fail-closed: any exchange error returns 401, and the raw bff_ is never forwarded downstream.
  • The /bff/internal/** surface is reachable only over mTLS + X-Internal-Token, and the NetworkPolicy layer denies the two BFF databases (admin-bff-db / user-bff-db) to each other.

Safety-flag posture. Each piece above can be switched off on its own: app.bff.oidc.enabled on user-bff/auth-core, app.bff.custody-key on BffCustodyCipher, app.session.cookie.enabled for the bff_ cookie, hugmesh.gateway.bff-exchange.enabled for the gateway swap, and __SNAP_OIDC_ENABLED__ on login-ui. None of them ship dark on main. The manifests bake each flag "true" where its service reads it: APP_BFF_OIDC_ENABLED and APP_SESSION_COOKIE_ENABLED in specs/cluster/manifests/user-bff-api/deployment.yaml; APP_BFF_OIDC_ENABLED and APP_BFF_EXCHANGE_ENABLED in admin-bff-api/deployment.yaml; APP_BFF_EXCHANGE_ENABLED in mod-bff-api/deployment.yaml; HUGMESH_GATEWAY_BFF_EXCHANGE_ENABLED in apps/20-gateway-fe.yaml; and SNAP_OIDC_ENABLED in social-ui/deployment.yaml. Only the secret values behind two of them, the Casdoor client secret and the AES custody key, are optional: true ESO-Secret refs. A fresh cluster without Vault/ESO populated therefore boots with the flags lit and the ciphers inert until those Secrets land.

Progress

PR numbers here come from the pre-squash history and mostly no longer resolve to the same work (hugmesh-generator#171, for one, is an unrelated QEMU change). Trust the named code, not the number.

✅ shipped (merged to main):

  • auth-core extracted and published. It holds the shared account, session, MFA and Casdoor stack and the custody seams (OidcExchangeClient, BffCustodyCipher, SessionCookieService, InternalTokenWebFilter). The 2.1.0 custody columns, the 2.2.0 per-account session-listing seam and the 2.3.0 gen_random_uuid() mint change shipped in that order. The consumers now sit on separate pins, recorded in tests/stack/m2-bootstrap.sh: 2.4.2 for user-bff main and 2.5.0 for admin-bff main. auth-core main itself is at 2.5.1, which the pin table also builds. The 2.4.2 and 2.5.0 rows stay until both consumers name 2.5.1. ⚠️ auth-core has drifted four times (2.4.0 → 2.4.1 → 2.4.2 → 2.5.0) because a released coordinate was re-cut. The pin-drift guard exists for exactly that and must run after every auth-core release.
  • admin-bff adopted auth-core (PR #111) — behavior-preserving, 1517 tests green.
  • admin-bff /bff/internal account/session API (PR #113): ensure, get, complete, allowlist, sessions, namespaces, guarded by InternalTokenWebFilter. The custody tail shipped too: Liquibase 180-bff-jwt-custody.xml, POST /custody/stamp (InternalAccountController) and POST /bff/internal/session/exchange.
  • Gateway BFF-session filter (PR #171): BffJwtExchangeWebFilter swaps bff_ for the custody JWT, pre-security and fail-closed, behind hugmesh.gateway.bff-exchange.enabled.
  • user-bff OIDC login relocation (PR #171): the native login lives in user-bff, behind app.bff.oidc.enabled.
  • SSO custody-key and internal-token bootstrap (PR #172).
  • Generator app-user-bff Casdoor client and the permitAll /bff/login route-access seed (#156): the client is in specs/cluster/manifests/casdoor/init-data-configmap.yaml, the seed row in 20-schema.sql.
  • login-ui native login form (#255/#256): POST /bff/login is the platform's only login surface. The dead /bff/auth/callback OAuth-redirect route and its seed were retired. tests/e2e/specs/27-native-login.spec.ts drives the real form, asserts the old social-login test ids are absent and asserts that no navigation to a Casdoor origin occurs.
  • user-bff to admin-bff NetworkPolicy path (documented in manifests/networkpolicy/tier-ingress.yaml).
  • kind SSO e2e, login path. KIND_PROFILE=sso with make kind-images|kind-up|kind-e2e|kind-down stands up a cluster. On 2026-08-06 specs 01-frontpage and 27-native-login passed against a live kind cluster on merged main, and so did the stack-free TOTP vectors of spec 29. That says nothing about the rest of the suite, which drives services the profile does not deploy. Spec 27 checks the session cookie only. On a kind cluster the BFFs could not validate a Casdoor JWT and GET /bff/session answered 500 (#693); that is fixed on main by pull requests #709 and #736 (merged 2026-10-14) but has not been run on a cluster. Blockers 1-16 are fixed on main, re-measured against the tree on 2026-10-14. Items 17, 20, 25 and 26 of KIND-SSO-E2E-FINDINGS.md are still open; the Roadmap below has the detail.

🚧 in-flight: none known.

🔭 planned: the live operator MFA flip and the other items under "Roadmap" below.

GitOps

The pki control plane installs ArgoCD (pinned to the x86_64 worker) and a root app-of-apps that points at specs/cluster. ArgoCD then syncs Casdoor, Cassandra, the three public gateways (behind an ingress-nginx facade), the tailnet-only superadmin gateway, Akkoma + tuwunel, Forgejo (in-cluster git), the Spring APIs, the frontend host, the matrix-ui / mastodon-ui remotes (the social-ui ArgoCD grouping) and hugmesh.games. See specs/cluster/README.md.

GitOps source migration — ⏳ PARTIAL. Today the root app-of-apps syncs from the GitHub hugmesh-generator repo. The move to an in-cluster Forgejo as source of truth is scaffolded: the Forgejo deploy (apps/09-forgejo.yaml), the service-catalog scmProvider ApplicationSet (apps/13-service-catalog.yaml, already set to scan the in-cluster Forgejo) and the deploy contract (catalog/hugmesh-deploy.example.yaml) all exist. The source flip itself is live-gated: it needs a booted Forgejo, an admin, OIDC, the org mirror and forgejo-scm-token. 9 service repos have adopted the descriptor and a deploy/ kustomize tree, and all ship dark until the flip. All nine ship hugmesh-deploy.yaml, and the generators filter on that one name; the last pre-rebrand spelling was renamed in its repo on 2026-08-20 and the legacy filter entry was retired on 2026-10-21. The adoption state is registered in catalog/adopters.yaml and enforced by scripts/validate-catalog-discovery.sh. The org has 38 hugmesh-* repos, 32 of which produce a container image, so 23 have not adopted yet (you can prepare them now, no cluster needed). See DEVOPS.md.

Autoscaling

HPA (CPU and memory metrics) is wired on 15 workloads: frontend, social-ui, remote-fragment, mod-bff-api, admin-bff-api, user-bff-api, forum-bff-api, wiki-bff-api, mesh-bff-api, character-forge-bff-api, user-ui, mod-ui, forum-ui, wiki-ui and api-docs (manifests/<svc>/hpa.yaml). metrics-server (apps/01-metrics-server.yaml) backs them, and KEDA is present too (apps/01b-keda.yaml). Request-load and latency scaling exists as KEDA ScaledObjects in apps/01c-autoscaling-latency.yaml, which ships dark. It has no automated sync and needs a Prometheus endpoint that the cluster does not have (observability is Uptrace and OTel). ⏳ Remaining: enable that app, which means adding Prometheus and retiring the per-service HPAs it supersedes.

Secrets (Vault + USB)

scripts/gen-cluster-secrets.sh generates the cluster secrets once and pushes them to HashiCorp Vault (KV v2, mount secret/, base path hugmesh/; the base segment tracks the brand slug). The External Secrets Operator then materializes the k8s Secrets the workloads already consume, starting with casdoor-google (hugmesh-pki), clickhouse-auth (hugmesh-backend + observability) and uptrace-auth (observability), and now well over a hundred more (specs/cluster/manifests/external-secrets/ holds 110 ExternalSecret objects on main as of 2026-11-04). It does this through a ClusterSecretStore hugmesh-vault (provider vault, token auth from the vault-token Secret in external-secrets), with one ExternalSecret per Secret, typically refreshed hourly. Workload secretKeyRefs are unchanged.

The same materialized secrets are also written to the KEYS stick at vault/secrets.json (plus vault/token for online sync), so keys-provision can create them offline when Vault is unreachable: Vault first, USB fallback.

Mesh, storage & backups

  • Mesh: headscale runs on the pki node. Every node runs the tailscale client and joins with a preauth key from its KEYS stick.
  • Storage: storage.devices[] in the KEYS manifest mounts attached M.2/NVMe or USB disks and can move containerd/kubelet data onto them.
  • Backups: backup.* schedules etcd and PostgreSQL backups to attached storage and/or an NFS/CIFS network share (/usr/local/sbin/hugmesh-backup).

Superadmin, multi-tenancy and the role cascade

The platform is multi-tenant and multi-brand. One fleet can host several domains, and a least-privilege role cascade (superadmin → admin → mod → user, domain-scoped and enforced at the gateway) governs every surface.

  • Multi-tenancy (✅ shipped): a per-domain CA loop (brands/domains.conf) and per-domain namespace + mTLS isolation as the authoritative cross-domain boundary. Each brand gets one admin-bff, one Casdoor org and one homeserver.
  • Superadmin (✅ shipped): a real, code-enforced role that owns device licenses and domain CRUD. Its Service Catalog console and the service-catalog-ui remote are served by the tailnet-only hugmesh-superadmin-gateway (apps/22-gateway-superadmin.yaml) on the pki node's internal ingress, off every public gateway.
  • Superadmin Service Catalog (✅ shipped on main): the data layer (admin-bff service-curation / app-profile / service-deployment) and the infra legs, the tailnet superadmin-gateway plus the Kaniko in-cluster build namespace (apps/54-service-catalog-builder.yaml, ships dark until a build lands), merged via PR #110. The per-build Kaniko Job is a template that the admin-bff AddService task instantiates; ArgoCD never applies it directly.
  • Device-license + node-storage registries (✅ shipped): see DEVICE-REGISTRY-KEY-ROTATION.md and NODE-STORAGE.md. Layer-B per-node sshd off the signed export is shipped. Layer-A is shipped on the node side too. The control-node renderer (specs/usr/sbin/gen-headscale-policy.sh) verifies the same signed export, renders /etc/headscale/policy.hujson from specs/etc/headscale/policy.hujson.tmpl, applies it with headscale policy set -f, and force-assigns the non-forgeable dst tags (specs/usr/sbin/hugmesh-headscale-forcetags). All 10 builders bake it, and provision_headscale_policy_sync() (boot service + 60 s cron) activates it on every control node. Only the BFF-side push leg is 🔭 deferred: the hugmesh-admin-bff-api HeadscaleAclCompiler and reconcile loop, dark behind app.registry.headscale-acl.enabled=false. Its compile side is reconciled with the node side and gated offline by layer-a-headscale-acl in CI. Enabling it stays cluster-gated. It needs the live confirmation of the fields in docs/CANONICAL-FP.md (in hugmesh-admin-bff-api), a provisioned headscale API key and, first, the single-writer decision: headscale runs policy: mode: file (the node renderer is the writer) while the BFF's PUT /api/v1/policy is DB-mode only.
  • Optional-services framework (✅ build-time, 🚧 live cut-over): akkoma, tuwunel, phpBB and games are added or removed through the apps/13a ApplicationSet. The UI greys out a service that is absent, and games defaults to games.<domain>. Today the build-time prune ships and the hardcoded 30-*/50-* Applications still own the workloads; the live ApplicationSet cut-over is pending. See OPTIONAL-SERVICES.md.
  • Egress-VPN, games App-Store control plane, owncast, tube, notifications in-app MVP (✅ shipped): see EGRESS-VPN.md, GAMES-APPSTORE.md, and the cluster apps 29a, 52, 53, 13c.
  • Pen-test CI (✅ shipped): continuous OWASP checks (ZAP DAST + Dependency-Check SCA
  • Generator supply-chain hardening (✅ shipped): stage3 GPG/sha + headscale / tailscale binary checksum verification, fail-closed in all ten builders via scripts/_download-lib.sh, + de-defaulted baked creds (random one-time first-boot fallback). See CRYPTO-AUDIT.md.

Shipped, ships dark (✅ on main, inert behind a default-off flag)

A default-off flag is a deployment posture, not an unfinished feature. These items are complete on main. Each entry names what lights it and which caveat survives.

  • ✅ Workload Console — podman/OpenShift-like pod management with live logs, exec and port-forward. The whole console ships: the /bff/{admin,superadmin}/workloads/** module in the always-present admin-bff, the hidden-tier federated admin-ui remote that the host mounts only when the grant guard passes, and this repo's workloadConsole slug (two-SA least-privilege RBAC in apps/14-workload-console-rbac.yaml, the superadmin cluster-read SA/ClusterRole, the deploy-provenance Kyverno policy, the admin-bff overlay manifests/admin-bff-api/workload-console-patch.yaml, and the two route-access rows). It has three independent OFFs: the generator slug (default-off; when deselected, the admin-bff renders byte-identical), the k8s seam (no SA token → the fail-closed NoopWorkloadClient, 503 everywhere), and the runtime workload_console_config master flag plus a per-admin TTL'd grant. Superadmin gets cross-cluster manage+exec. Admins stay blind by default until superadmin grants them read-only access on their own domain. See OPTIONAL-SERVICES.md §7.2.
  • ✅ Casdoor MFA + the gateway privileged floor — WebAuthn, TOTP and recovery codes enroll and challenge in admin-bff via auth-core, and mfa_satisfied is stamped into the opaque bff_ session. The floor itself is the mfa_required column plus the UPDATE that seeds every allow row under /bff/admin/** + /bff/superadmin/** (manifests/route-access/initdb/20-schema.sql), the shared gateway chart's mfa: block rendering APP_MFA_ENABLED / APP_MFA_FRESHNESS_WINDOW / APP_MFA_ENFORCE_PRIVILEGED_FLOOR, both CI gates (lint:mfa-required-rules, lint:gateway-mfa-env with pinned fail-closed helm) and compose-stack e2e coverage. The cluster default is mfa.enabled: false / enforcePrivilegedFloor: false, so the seeded rows are inert. What remains is the live operator flip; see the Roadmap below, MFA-ROLLOUT.md and ROUTE-ACCESS.md.
  • ✅ Desktop app governance — per-license, SSO-enforced sudo (a root claim→group desktop-sudo-mapper, a polkit rule and a 60 s cron, not SSSD), an admin-curated Plasma Discover store, user install-requests, and admin remote-install over the device-SSH-license transport. The client side is in specs/etc/hugmesh/desktop-governance/, the server side is a controller set in hugmesh-admin-bff-api. It is dark behind app.desktop.registry.enabled=false / app.desktop.remote-install.enabled=false. ⚠️ The SSO token producer (hugmesh-sso-token, RFC 8628 device flow) is written and unit-tested but has never run against a live Casdoor or on an image, so the sudo leg is inert in practice even once the flags flip. The go-live preconditions (security re-review, device_ssh_dial rows, dial-key mount) are in CLIENT-IMAGES.md §7.
  • ✅ Encrypted versioned backups — the Velero server and node-agent (Kopia) as apps/55-velero.yaml, and the BSL, ESO credentials, least-privilege RBAC and status-sweep CronJob as apps/56-velero-config.yaml. Backups are per-domain plus superadmin, and step-up gated in the admin-bff cloudbackup package. It has two OFFs: both Applications are manual-sync, and the effector stays Noop until app.backups.effector.enabled=true. See CLOUD-BACKUPS.md.
  • ✅ A/V relay via coturn (TURN/STUN) — a default-off optional service in RFC-5766 REST credential mode that shares one ESO/Vault secret with tuwunel. A default build deploys no coturn, and clients keep iceServers: []. ⚠️ Public reachability is a separate, operator-deferred opt-in overlay (manifests/coturn-public: a hostNetwork relay, a public-IP/URI ConfigMap, an /etc/hugmesh/coturn-public firewall marker, an unproxied A/AAAA record and a public cert for non-fleet clients). See COTURN.md.
  • ✅ Egress-VPN drop-in and ✅ per-node attached storage — an admin-supplied WireGuard/OpenVPN .conf with a split tunnel that keeps the tailnet direct (specs/usr/sbin/hugmesh-egress-vpn, slug egress-vpn, delivery app 13e), and a node-pinned local PV / local-path (FDE) with capacity-aware scheduling and graceful degrade (apps/13b-node-storage.yaml plus the node-storage reconcile agent, now baked and enabled by every builder). See EGRESS-VPN.md and NODE-STORAGE.md.
  • ✅ Binhost auto-update — a poller cron baked as plumbing on every target. With no policy, auto-update is OFF: it fails safe to off, never to a pull. Superadmin opts a fleet in through the live devops/hugmesh-update-policy ConfigMap. See DEVOPS.md.

Roadmap (🔭 planned / 🚧 in-flight)

What is not done, or only partly done. Some entries have partial code on main; each says which.

  • 🚧 kind-cluster SSO e2e — harness shipped, payload blockers and the JWKS fix merged, live proof not run. KIND_PROFILE=sso with make kind-images|kind-up|kind-e2e|kind-down stands up a real cluster, and the chain reaches Casdoor and mints a session against a real IdP. The 16 fresh-cluster blockers of the first run are fixed on main (item 1 for kind only; item 16 in the admin-bff source, image rebuild unverified), as re-measured on 2026-10-14 against the tree, not a cluster. The BFFs used to fetch Casdoor's signing keys from a public host that does not resolve in-cluster, so GET /bff/session answered 500 (#693). That is fixed on main (pull requests #709 and #736 merged 2026-10-14, #693 closed, the in-cluster CASDOOR_JWKS_URI pinned by tests/scripts/test-bff-jwks-in-cluster.sh). Open: the live proof (the guard reads manifests, not a cluster); the Harbor pull path is never exercised on kind (finding 17); findings 20, 25 and 26. The last recorded green run (2026-08-06) covers the cookie mint only. See KIND-SSO-E2E-FINDINGS.md.
  • 🔭 The live MFA operator flip — verify that every privileged principal can produce a fresh mfa_satisfied stamp. Then flip mfa.enabled to true. Then, as a separate step (enforce-privileged-floor is not a sub-flag of enabled), flip enforcePrivilegedFloor to true, moving the posture-gate expectations in lockstep. See MFA-ROLLOUT.md.
  • 🔭 SELinux enforcing — node-policy modules compile, install and load on every image. A module whose refpolicy dependency is missing from the policy store is skipped, with the Gentoo package that would fix it named. The fleet boots permissive, and the enforce-gate ships inert (no runlevel, SELINUX_ENFORCE_GATE="no"). The .te rules are still tagged INFERRED-WIDE and can only be narrowed against AVC logs from a real protected build and boot. See selinux-module-loading.md.
  • 🔭 Group-call SFU — coturn is a 1:1/mesh relay only. The MatrixRTC client half is merged and dark in hugmesh-matrix-ui (__HUG_MATRIX_RTC__, default off). The server half (LiveKit, lk-jwt-service, tuwunel livekit_url) is designed but not built. See GROUP-CALL-SFU.md.
  • 🚧 Desktop-governance SSO token producer (FD-07 increment 2): code and unit tests landed. It is unproven on a live Casdoor and on an image, and the lightdm-greeter / password-grant PAM login is not built.
  • 🚧 MDM phones (GrapheneOS on Pixel) — the fourth onboarding form. scripts/phone-wizard.sh flashes signature-verified GrapheneOS, enrolls the handset into the Tailscale root domain (headscale tailnet, ADR-14 register-and-approve), escrows a separately encrypted enterprise profile, and emits a phone-ingest/v2 device-registry record. Azure Intune is a co-equal provider alongside Headwind. Real pre-deploy gaps remain; see MDM.md "Deferred".
  • 🚧 Notifications external channels — Matrix DM, Akkoma feed, phpBB and email adapters on top of the shipped in-app MVP, plus the mod-bff notify_channels directive.
  • 🔭 Live in-cluster image build — the always-on Kaniko pipeline (apps/60-image-builder.yaml) is correct by construction and lint-gated, but has never run a real build. It is blocked on bringing a cluster up on a kernel-fixed x86 image.

Related repositories

All org repos are hugmesh-* since the 2026-07-22 rebrand. The org listing shows 38 hugmesh-* repos and no pre-rebrand ones. The GitHub organization itself is hugmesh (see ORG-MOVE-TODO.md), which is the prefix the paths below use. Two repos changed shape as well as name: the domain-named site repo became hugmesh-host-shell, and hugmesh.games became hugmesh-games.

Shared Maven libraries

Repo Role
hugmesh/hugmesh-parent Metapom every Java service inherits (2.8.0 — Spring Boot 4.0.7 / Spring Cloud 2025.1.2 / Java 25)
hugmesh/hugmesh-commons Shared security/tenancy library, net.hugmesh.commons.* (2.1.0)
hugmesh/hugmesh-auth-core Shared account/session/bff-session store, Casdoor-admin client, MFA subsystem, session-cookie + internal-token filters (2.4.2 for user-bff, 2.5.0 for admin-bff — two pins by design, separate release cadences; main is 2.5.1; consumed by user-bff + admin-bff only)
hugmesh/hugmesh-build-config Shared PMD/Checkstyle/SpotBugs rulesets referenced by the parent (0.5.0)

Platform services

Repo Role
hugmesh/hugmesh-generator This repo — image builders, provisioning, GitOps payload
hugmesh/hugmesh-gateway Shared Spring Cloud Gateway code/image
hugmesh/hugmesh-pki-gateway PKI/identity gateway (Casdoor OAuth2, Postgres routes)
hugmesh/hugmesh-be-gateway Backend gateway (per-node, reuses the shared gateway image)
hugmesh/hugmesh-fe-gateway Frontend gateway (per-node, reuses the shared gateway image)
hugmesh/hugmesh-actions Spring APIs
hugmesh/hugmesh-admin-bff-api Spring admin BFF (allowlist, namespace access, usage, token broker; also the Workload Console, cloud-backups and desktop-governance modules)
hugmesh/hugmesh-mod-bff-api Spring moderator BFF
hugmesh/hugmesh-user-bff-api Spring user BFF (owns native login / session / Casdoor exchange)
hugmesh/hugmesh-forum-bff-api Spring forum BFF (phpBB-facing)
hugmesh/hugmesh-forum-api phpBB 3.3 headless JSON API extension — the forum-bff backend
hugmesh/hugmesh-wiki-bff-api Spring wiki BFF (wiki pages, attachments, audit log; /bff/wiki/**)
hugmesh/hugmesh-mesh-bff-api Mesh BFF: Meshtastic node directory, bridge-sync ingest, mesh functions (/bff/mesh/**)
hugmesh/hugmesh-character-forge-bff-api 3D character forge: BFF + Godot character-maker + federated UI (SVG VN characters → 3D avatars for the XR chat room)
hugmesh/hugmesh-owncast-bff-api Owncast BFF — broadcast grant/timeout/ban overlay + per-streamer provisioning (x86+GPU optional service)
hugmesh/hugmesh-tube-bff-api Tube (LocalTube) BFF — use grants, download, owner-private viewing (x86+GPU optional service)
hugmesh/hugmesh-federation-api Public-profile / vanity-subdomain + federation resolver (owns the federation_modules registrations)

Front ends (native-federation remotes)

Repo Role
hugmesh/hugmesh-host-shell Angular host shell / front page — federates every remote below
hugmesh/hugmesh-matrix-ui Matrix chat + WebRTC video micro-frontend
hugmesh/hugmesh-mastodon-ui Mastodon micro-frontend
hugmesh/hugmesh-login-ui Login/registration micro-frontend (the native login form)
hugmesh/hugmesh-admin-ui Admin console micro-frontend (role-gated; hosts the hidden-tier Workload Console face)
hugmesh/hugmesh-mod-ui Moderator console micro-frontend
hugmesh/hugmesh-user-ui User console micro-frontend
hugmesh/hugmesh-forum-ui Forum micro-frontend
hugmesh/hugmesh-wiki-ui Wiki micro-frontend
hugmesh/hugmesh-user-mesh-ui User-facing mesh dashboard: LoRa node directory, my mesh devices, mesh-enabled channels
hugmesh/hugmesh-character-studio-ui VN character studio — layered-SVG avatar creator (optional service, default-off)
hugmesh/hugmesh-owncast-ui Owncast console remote (My Stream + admin broadcast grants + mod view)
hugmesh/hugmesh-tube-ui Tube console remote (My Tube + admin access grants + storage budgets)
hugmesh/hugmesh-api-docs Admin-gated remote: browse the platform OpenAPI specs
hugmesh/hugmesh-superadmin-service-catalog-ui Superadmin App-Store / Service Catalog console (tailnet-only, mounted at /superadmin/service-catalog)
hugmesh/hugmesh-remote-fragment Sync-and-serve-static nginx fleet serving DB-hosted federated fragment bundles
hugmesh/hugmesh-games Godot 4 WASM game studio and portal (runs on the x86_64 GPU worker)
owncast / LocalTube (tube) Upstream GPU-dependent video services (per-domain enable, federated per-user remotes)