Crossdev and native build scripts that produce hardened Gentoo images for the
HugMesh cluster: three Raspberry Pi 5 (aarch64) role images plus an x86_64
GPU host. The repo also holds the GitOps payload that runs Casdoor, tuwunel (Matrix) + Akkoma (fediverse), the
Spring APIs and hugmesh.games on those images. Everything connects behind
hugmesh.net through per-namespace Spring Cloud Gateways.
Every image boots, then provisions itself from a USB FAT32
KEYS partition (users, SSH keys, passwords, certificates, headscale/k8s
config, attached storage, backups). See keys-template/.
Every build is stamped with a build ENV, test (default, LAN-only) or
prod (real public domain), baked into the image at creation. The simplest
way in is make local (a LAN .test fleet) or make prod; see
Build ENV below.
New operator? Start with
docs/RUNNING.md, the end-to-end runbook (prerequisites → clone →brand.conf+ build knobs → build → keys + KEYS USB → flash → provision → cluster). Then readdocs/ARCHITECTURE.mdfor the full topology anddocs/LOCAL-TESTING.mdfor LAN testing. To generate a whole platform from scratch and serve it, locally and then publicly over a Tor.onion/ a Dynamic-DNS host / a tunnel, followdocs/SERVE-YOUR-MESH.md.
All build output lands in a git-ignored work directory: ./out by default,
for both make and the scripts called directly (override with WORK_DIR= /
-w). The finished products (.img, .iso, .fs.tar.xz, stage4-*,
keys-<role>/) land directly in the work dir. Each arch's heavy build tree
(sysroot, distfiles, pkgdir, ISO staging) lives in a per-arch subdirectory
under it: out/snap-build-pi5 (aarch64) and out/snap-build-x86 (amd64). The Pi and x86 builds
therefore never share a sysroot, even when make build-all builds the whole fleet
into one work dir. Override a subdir name with
--build-subdir NAME (or BUILD_SUBDIR=NAME). make clean wipes the work dir,
subdirs included.
As of 2026-08-05, except the kind SSO e2e bullets, re-measured 2026-10-14. State key: ✅ shipped (on main) · 🚧 in-flight · 🔭 planned.
"Ships dark" counts as shipped. Several capabilities below are complete on
mainand deliberately inert behind a documented default-off flag. That is a deployment posture, not an unfinished feature. Every such entry names the flag or runbook that lights it, and the caveats that survive the flip.
- ✅ Hardened image fleet — three RPi 5 role images (pki / backend / frontend)
- the x86_64 GPU host, built compact and grown on first boot, plus the client /
appliance families that ride the same arm64 cross path + mesh/KEYS provisioning:
the opt-in Frite light desktop, the Jetson Orin edge-AI family, and the
Orange Pi platform family (see below). All images build the MCS SELinux
policy with per-pod/per-app category isolation. But
⚠️ nodes boot PERMISSIVE, not enforcing:provision.json's.selinux.modedefaults topermissive, and the enforce-gate (specs/etc/init.d/selinux-enforce-gate) ships inert (in no runlevel,SELINUX_ENFORCE_GATE="no") unless an operator setsHUGMESH_SELINUX_ENFORCE_GATE=1at build time. That is deliberate: the node-policy.terules are still taggedINFERRED-WIDEand can only be narrowed against a real AVC pass. Seedocs/selinux-module-loading.md. Every image carries a SELinux permissive rescue and a one-boot SELinux enforcing (test) entry: GRUB entries on the x86.img(signed UKI twins for Secure Boot as well as GRUB+vmlinuz),grub.dsnippets for installed x86 nodes, extraLABELs in every extlinux board's menu, and on the Picmdline-rescue.txt(addcmdline=cmdline-rescue.txttoconfig.txt) plus a one-boottryboot.txttrial. The image runs sysvinit, so the trial is started withreboot -m "0 tryboot"; systemd'sreboot "0 tryboot"is a usage error there.-mimplies-f: it restarts without running the shutdown runlevel. The signed-selinux-rescueUKI is a Secure Boot-signed permissive path that anyone at the.imgGRUB menu can pick (no GRUB superusers): once enforcing becomes the default, physical console access means permissive. LUKS still gates an encrypted root. That trade is deliberate, because a rescue has to exist before enforcing can be the default.
- the x86_64 GPU host, built compact and grown on first boot, plus the client /
appliance families that ride the same arm64 cross path + mesh/KEYS provisioning:
the opt-in Frite light desktop, the Jetson Orin edge-AI family, and the
Orange Pi platform family (see below). All images build the MCS SELinux
policy with per-pod/per-app category isolation. But
- ✅ SELinux node policy compiled + loaded (all ten builders) — the hugmesh
node-policy modules are compiled against the sysroot's refpolicy headers,
installed into every image and loaded at first boot from
/usr/share/hugmesh/selinux-modules.list. Seven modules are mandatory (a compile failure fails the build); the two k8s exemplars are conditional onselinux-containerheaders.tests/scripts/test-selinux-policy-install.shgates this (theSLXbucket of the build matrix). Flipping the fleet to enforcing is the remaining step; see Roadmap. - ✅ Boot + kernel hardening (both arches) — kernel lockdown (
lsm=lockdown, yama,selinux,bpf+lockdown=integrityon x86 + rpi5;lsm=lockdown,yama,selinuxlockdown=integrityon the 8 ARM boards), Secure Boot UKI signing on x86 (dracut--uefi→ org-keysbsign), and sysctl/SSH hardening, plus the x86 build fixes that supersede the earlier kernel-config changes. The x86 k8s netfilter/NAT/eBPF kernel surface the Service/kube-proxy/CNI path needs now lives in the amd64 fragment, with a fail-closed build guard and a CI lint (lint:x86-kernel-net-symbols) that keeps it from re-truncating. (The standalone fix PR is superseded: the symbols, guard and test landed onmainwith the hardening pass.) Host firewall differs by arch: x86 shipsfirewalld(test/prod zone profiles). On the cross-compiled rpi5 arm64 platform, firewalld is a deliberate, gate-pinned exclusion: the 2026-08-05 real build proved thatglib[introspection]'s in-source gobject-introspection bootstrap does not cross-compile. Sonftables+iptables+specs/usr/sbin/hugmesh-firewall-reconcilecarry the host firewall there, andrequested-atoms-resolvable.shfails the build if either half of that decision is quietly reverted.
- ✅ Unified Spring baseline — the baked GitOps payload now targets Spring
Boot 4.0.7 / Spring Cloud 2025.1.2 on Java 25, with the shared Maven artifacts
hugmesh-parent(metapom, 2.8.0),hugmesh-commons(shared security/tenancy,net.hugmesh.commons.*, 2.1.0),hugmesh-auth-core(shared account/session/MFA/Casdoor-admin infra; depends on commons; consumed by user-bff + admin-bff only — two consumer pins, by design: 2.4.2 for user-bff main, 2.5.0 for admin-bff main, since the two consumers are on separate release cadences;m2-bootstrap.shalso builds 2.5.1, the coordinate the org release chain now publishes, for when both consumers move to it) andhugmesh-build-config(0.5.0 — the shared PMD/Checkstyle/SpotBugs rulesets the parent references). The groupId isnet.hugmesh:*after the rebrand.federation-apiwas migrated onto this baseline. The authoritative pins live intests/stack/m2-bootstrap.sh(SHA-pinned — the org repos carry no git tags);⚠️ 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, which is why the pin-drift guard exists and must run after every auth-core release. - ✅ SSO auth model wired into the cluster payload (data plane) — Casdoor is
the SSO IdP, reached only from inside the cluster. Login is a native,
first-party form:
login-uiPOSTs username/password (and any MFA passcode) to user-bffPOST /bff/login; user-bff generates PKCE + state server-side, POSTs the credentials to the internal Casdoor/api/login, exchanges the returned code, and holds per-session JWT custody/refresh. The browser only ever holds an OPAQUEbff_-prefixed session — it never sees a Casdoor JWT, thecode_verifier, thestate, or any Casdoor URL. The gateway is a pure Casdoor-JWT OAuth2 resource server: a pre-security exchange filter swapsbff_→ the internal custody JWT so JWT validation + the role gate run unchanged. Authorization is data-driven by thegateway_route_accessPostgres table (source of truth) viaGatewayRouteAccessFilter— ADMIN/GAME-MASTER bypass within own domain, SUPERADMIN cross-domain. Because there is no front-channel redirect, Casdoor needs no public ingress; Cloudflare fronts only the platform front door in prod. Login/session/account logic has RELOCATED from admin-bff → user-bff (the shared core lives inhugmesh-auth-core); account/session data stays in admin-bff-db, reached by user-bff via admin-bff/bff/internalover mTLS +X-Internal-Token. The generator leg of this relocation — the user-bff Casdoor confidential client with the internal redirect-uri, the relocated/bff/login|register|me|session|provisionfe-gateway routes, the permitAll/bff/loginroute-access seed, and retiring the dead/bff/auth/callbackOAuth-redirect route the old browser-driven model used — is onmainand lit by default:APP_BFF_OIDC_ENABLED/APP_SESSION_COOKIE_ENABLED/APP_BFF_EXCHANGE_ENABLEDare all baked"true"inspecs/cluster/manifests/{user,admin,mod}-bff-api/deployment.yaml; only the Casdoor client secret and the AES custody key remain ESO-secret-gated (optional: true, populated from Vault before real logins work). Covered end-to-end bytests/e2e/specs/27-native-login.spec.ts, which drives the real form and asserts the browser never navigates to a Casdoor origin. - ✅ Casdoor MFA (TOTP + WebAuthn + recovery codes) — enrollment and challenge live
in admin-bff via
hugmesh-auth-core:APP_CASDOOR_MFA_ENABLEDis baked"true",APP_MFA_FACTOR_KEY(ESO/Vault) encrypts enrolled TOTP secrets at rest, andAPP_MFA_WEBAUTHN_RP_ID/_ORIGINSare branded per-tenant (not left on the dev-onlylocalhostdefault);login-ui/admin-uiship the enroll/challenge/security pages.mfa_satisfiedis stamped into the opaquebff_session. The privileged-MFA floor is also shipped and ships dark — themfa_requiredcolumn + theUPDATEthat seeds it on every allow row under/bff/admin/**+/bff/superadmin/**(specs/cluster/manifests/route-access/initdb/20-schema.sql), the shared gateway chart'smfa:values block renderingAPP_MFA_ENABLED/APP_MFA_FRESHNESS_WINDOW/APP_MFA_ENFORCE_PRIVILEGED_FLOORinto every gateway pod, both CI gates (lint:mfa-required-rules,lint:gateway-mfa-envwith pinned fail-closedhelm+REQUIRE_HELM=1), the compose-stack defaults (dev stackAPP_MFA_ENABLED=true, floor still off) and e2e coverage (tests/e2e/specs/29-mfa-privileged-floor.spec.ts) are all onmain. On a cluster the chart default ismfa.enabled: false/enforcePrivilegedFloor: false, so the seeded rows are inert. What remains is the live-cluster operator flip, in the order and with the lockout preconditions indocs/MFA-ROLLOUT.md— see alsodocs/ROUTE-ACCESS.md. - ✅ SCG-5 route config — Spring Cloud Gateway 5.0 moved route config from
spring.cloud.gateway.routestospring.cloud.gateway.server.webflux.routes(the legacy prefix silently binds nothing). Thehugmesh-gatewaychart templates and every generator route file render the corrected namespace. Theroutes:lists inapps/2x-gateway-*.yamlare chart values, which the chart maps onto the new prefix. - ✅ Multi-tenancy / multi-brand + superadmin — per-domain CA loop
(
brands/domains.conf), per-domain namespace + mTLS isolation, and a real code-enforced superadmin → admin → mod → user role cascade enforced at the gateway. A domain-registry → brand-repo bridge (signed-export reconcile agent: mTLSGET /bff/admin/domains/export→ fail-closed Ed25519 verify → synth adomains.confrow + CA + brand repo per registered-not-provisioned domain) is baked as the 4th instance of the device-registry / egress-VPN / node-storage reconcile triad, and ships DARK/inert (optional-service gate, placeholder-pubkey crypto-fail-closed,.domain_registry.enabled=falsedefault). Seespecs/usr/sbin/hugmesh-domain-reconcile,specs/etc/init.d|cron.d/hugmesh-domain-reconcile, thehugmesh_domain_reconcileSELinux module, andprovision_domain_registry()in the KEYS engine. - ✅ Optional services (add/remove) — 25 slugs in
specs/cluster/optional-services.yaml: akkoma / tuwunel / phpBB / games / owncast / LocalTube (tube) / character-studio (VN character-creator + chat remote, default-off; registered as a federation module via hugmesh-federation-api's040-register-character-studio-module.xml) / character-forge (3D character forge — BFF + DB + federated UI, apps38b/39b/49c; likewise registered via hugmesh-federation-api's038/039changesets) / edge-AI (+edge-ai-analysis,edge-ai-tts; GPU inference, OpenAI model API to the mesh — docs/EDGE-AI.md) / coturn / meshbridge (Meshtastic LoRa mesh ↔ Matrix bridge, DEFAULT-OFF runtime-only,dependsOn: tuwunel— docs/MESHTASTIC-BRIDGE.md) / and the non-user-level slugs egress-vpn / tor / workloadConsole / anubis / headwind / attestation-server / metrics-server / keda / kyverno / observability / service-catalog-builder / optional-services-operator. The UI greys out when a service is absent, games defaults togames.<domain>. A build with no selection bakesakkoma tuwunel phpbb; the other user-level slugs are opt-in. Build-time prune ships; the 🚧 live ApplicationSet cut-over is pending. - ✅ A/V relay via coturn (TURN/STUN) — ships dark — the
coturnslug is a DEFAULT-OFF optional service running RFC-5766 REST long-term-credential mode against a single ESO/Vault-sourced secret shared with tuwunel (which mints the time-limited credential onGET /_matrix/client/v3/voip/turnServer). A default build deploys no coturn pod, and clients keepiceServers: []. Enabling the slug gives an in-clusterClusterIPrelay. Public reachability is a separate, operator-deferred opt-in overlay (manifests/coturn-public:hostNetworkrelay pod, thecoturn-public-configpublic-IP/URI knobs, a/etc/hugmesh/coturn-publicfirewall marker, an unproxied A/AAAA record, and a public cert for non-fleet clients).⚠️ No SFU is deployed — coturn is a 1:1/mesh relay only. The MatrixRTC / LiveKit client half is merged and dark inhugmesh-matrix-ui; the server half is designed, not built (docs/GROUP-CALL-SFU.md). Seedocs/COTURN.md. - ✅ Encrypted versioned backups — ships dark — Velero server + node-agent
(Kopia filesystem/PV backups) as
apps/55-velero.yaml, and the BackupStorageLocation + ESO-sourced object-store credentials + least-privilege RBAC + status-sweep CronJob asapps/56-velero-config.yaml. Backups are per-domain and superadmin-scoped, and step-up gated in the admin-bffcloudbackuppackage (BackupStepUpGate/BackupAdminController/BackupService). Two independent OFFs keep them dark: both Applications are NON-automated (manual superadmin sync), and the admin-bff effector stays on theNoopBackupEffectoruntilapp.backups.effector.enabled=true, so a createdbackup_setsits atpendingand emits no Velero CR. Kopia repository passwords are provisioned, not upstream defaults. Seedocs/CLOUD-BACKUPS.md. - ✅ Egress-VPN drop-in — admin-supplied WireGuard/OpenVPN
.conffor node public egress, with split tunneling that keeps the tailnet direct (specs/usr/sbin/hugmesh-egress-vpn, theegress-vpnnode slug, its secret-projector delivery app13e). Default-off per node. Seedocs/EGRESS-VPN.md. - ✅ Per-node attached storage — attach + register extra storage to a node,
node-pinned local PV / local-path (FDE), capacity-aware scheduling and graceful
degrade (
apps/13b-node-storage.yaml+ thespecs/usr/sbin/hugmesh-node-storage-reconcileagent, now baked and enabled by every builder). Seedocs/NODE-STORAGE.md. - ✅ Desktop app governance — ships dark — per-license SSO-enforced sudo, an
admin-curated Plasma Discover store (default-NONE, domain-locked Flatpak/OCI),
user install-requests and admin remote-install over the device-SSH-license
transport. The client side is
specs/etc/hugmesh/desktop-governance/(polkit rule, the root claim→groupdesktop-sudo-mapper+ its 60 s cron, Discover/Flatpak wiring, autostart SSO deposit scripts); the server side is a full controller set inhugmesh-admin-bff-api. Dark behindapp.desktop.registry.enabled=false/app.desktop.remote-install.enabled=false.⚠️ Honest gap: the SSO token producer (FD-07 increment 2) is now code (hugmesh-sso-token, an RFC 8628 device-flow client) and unit-tested against the real deposit and mapper, but it has never run against a live Casdoor or on an image, so the sudo leg stays inert until the flags flip on a governed image. (The original SSSDid_provider = oidcdesign was retracted — that syntax exists in no released SSSD.) Seedocs/CLIENT-IMAGES.md§7. - ✅ Workload Console — ships dark (the WHOLE console, not just an RBAC
backstop) — the pod-management + live-log + exec + port-forward surface exists
end to end: the
/bff/{admin,superadmin}/workloads/**module in the always-present admin-bff, the hidden-tier federated admin-ui remote the host loads only when the grant guard passes, and this repo'sworkloadConsoleslug (the two-SA least-privilege RBAC appapps/14-workload-console-rbac.yaml, the superadmin cluster-read SA/ClusterRole, the deploy-provenance Kyverno policy, the admin-bff deployment overlay that lightsWORKLOAD_CONSOLE_ENABLED+WORKLOAD_CONSOLE_K8S_ENABLEDand mounts both SA tokens, and the two route-access rows). Three independent OFFs: the generator slug (default-off, and deselected the admin-bff renders byte-identical), the k8s seam (absent token → the fail-closedNoopWorkloadClient, 503 on every call), and the runtimeworkload_console_configDB master flag plus a per-admin TTL'd grant. Exec is restricted to a read-only first-token allowlist, port-forward to a curated app-tier triple list, and namespaces to an allowlist that mirrors the RBAC bindings. Seedocs/OPTIONAL-SERVICES.md§7.2. For "how do I see stats / which versions are running?" — the four gates counted separately, the exact order to open them, and the missing aggregate version surface — seedocs/WORKLOAD-CONSOLE-STATS-AND-VERSIONS.md, and read your own posture withscripts/workload-console-posture.sh. - ✅ Games App-Store control plane, ✅ Device-license registry (per-node sshd obeys the signed export), ✅ Superadmin Service Catalog (data layer + tailnet superadmin-gateway + Kaniko builder, ships dark), ✅ Pen-test CI (OWASP ZAP + Dependency-Check + nuclei + k6 as a GitLab pipeline stage, not a deployed CronJob).
- ✅ Binhost auto-update — ships dark (default-off, superadmin opt-in) —
provision_update()bakes the poller cron on every target as plumbing. The absence of a policy means auto-update is OFF (fail-safe to off, never to a pull). A superadmin opts a fleet in via the livedevops/hugmesh-update-policyConfigMap (enabled/cadence/window/reboot/staging). Changed packages then pull from the node'sPORTAGE_BINHOSTsubtree, and kured drains and reboots one node at a time. Seedocs/DEVOPS.md. - ✅ Data-access standard — the Spring services use Spring Data R2DBC
reactive repositories (no raw SQL strings / inline
@Query). - ✅ Wiki service (hugmesh-wiki-bff-api + hugmesh-wiki-ui) — fully deployed; manifests in
specs/cluster/manifests/wiki-bff-api/+manifests/wiki-ui/, ArgoCD apps34a-wiki-bff-db,34b-wiki-bff-api,49a-wiki-ui; fe-gateway routes/bff/wiki/**(#173, #176). - ✅ MDM phone MDM (fourth onboarding form) —
scripts/phone-wizard.shflashes verified GrapheneOS onto a USB-connected Pixel (or onboards an existing GrapheneOS/stock-Android phone with no reflash), attests it to a self-hosted GrapheneOS AttestationServer, device-owner-enrolls it into Headwind MDM (both merged, default-off, tailnet-only cluster optional-services), joins it to the mesh tailnet, and escrows an enterprise profile. Real pre-deploy gaps remain (Casdoor SSO for Headwind, an automated attestation-verdict API) — seedocs/MDM.md"Deferred". Themake phone-*targets exist, includingphone-mdm-enrollandphone-attest. - ✅ Orange Pi platform family (EXPERIMENTAL) — six builders (seven boards: the
Orange Pi 5 builder covers the 5 and the 5 Plus) across two SoC vendors, Rockchip
and Allwinner, each with its own
specs-<platform>/tree, builder andmaketarget: Orange Pi 5 / 5 Plus (Rockchip RK3588/RK3588S, light desktop,--boardaxis), Orange Pi 4 LTS (Rockchip RK3399, light desktop, single-board, blob-free boot chain), and the headless appliance line Orange Pi Zero 2 (Allwinner H616), Zero 2W + Zero 3 (H618 — no mainline display-engine driver, so headless is a hard constraint, not a choice) and Orange Pi 3 LTS (H6, headless by scope). Each islive | installer | bothand carries the standard mesh/KEYS provisioning.⚠️ Hardware validation pending on every one of them — no physical Orange Pi has booted an image from this repo; the board facts are researched against upstream Linux/U-Boot/ATF source, and the ports are--print-plan-clean and matrix-gated, not hardware-proven. Seedocs/BUILD-MATRIX.mdand eachspecs-orangepi*/README.md. - ✅ Shared per-arch build assets (binpkg pools, distfiles, stage3 seed) —
one shared asset root (
<WORK_DIR>/sharedby default, overridable with--shared-assets DIR/HUGMESH_SHARED_ASSETS, opt-out with--no-shared-assets) holding the stage3 seed cache, fleet-wide read-only distfiles and per-BOARD binpkg pools, resolved in one place (scripts/_shared-assets-lib.sh). Closes the produce→consume loop the cross builders never had (FEATURES=buildpkgalways produced; four of five never consumed), adds a compile-once--packages-onlyprebuild phase (make:prebuild-binaries; also on the ncurses menu), and — load-bearing — a pool fingerprint guard, because--binpkg-respect-use=ycompares USE only and every aarch64 board shares a CHOST while differing in-mcpu(the SIGILL class portage cannot catch).⚠️ The mechanism + guard are shipped; the compile-once speedup itself is still owed a real cross-build to prove. Seedocs/SHARED-BINPKG.md. - ✅ mesh-bff platform wiring — the LoRa/Meshtastic BFF is a first-class
cluster service:
apps/34c-mesh-bff-db.yaml+apps/34d-mesh-bff-api.yaml, manifests, the fe-gateway/bff/mesh/**route behind aROLE_MESHfloor (with an explicit DENY row on/bff/mesh/internal/**, which is SERVICE-only bridge-sync ingest), the Casdoor role, ESO secrets and PKI wiring. Owns themesh_node_directory/mesh_roomtables;meshbridgeand matrix-ui are its producers, thehugmesh-user-mesh-uiremote its future consumer. - ✅ In-cluster Kaniko image-builder (ALWAYS-ON) —
apps/60-image-builder.yamlmoved out ofapps-optional/into the app-of-apps' recursedapps/tree, so ArgoCD now always syncs thehugmesh-image-buildsnamespace (PSSrestricted)- its default-deny-ingress NetworkPolicy — and nothing else: the per-build
Kaniko Job stays a template that is deliberately absent from the kustomization,
so no workload runs until the GitLab
build:imagesjob (or another driver) dispatches one. Gated bylint:image-builder-always-on.⚠️ Live validation of an actual in-cluster build is still pending a kernel-fixed x86 image. The service-catalog Kaniko builder (apps/54) remains the separate per-catalog path.
- its default-deny-ingress NetworkPolicy — and nothing else: the per-build
Kaniko Job stays a template that is deliberately absent from the kustomization,
so no workload runs until the GitLab
- ✅ Repo-templating archetypes + runnable federation examples — six
archetypes under
templates/archetypes/(spring-bff,angular-mfe,angular-host,remote-fragment,gateway,generator), four of them with a runnable_skeleton/example codebase that renders when the Tier-2 base repo is unpullable (two-tier fallback), so a whole host-shell + remote + API trio can be instantiated for a brand with no base clone. Seedocs/MESH-TEMPLATING.md(render engine + guardrails) anddocs/FEDERATION-EXAMPLES.md(the runtime host↔remote walkthrough). - 🚧 Kind SSO e2e harness —
KIND_PROFILE=ssoplusmake kind-images/kind-up/kind-doctor/kind-e2e/kind-downstand up a real kind cluster and drive the native-login path against it. Not yet proven end to end — see Roadmap anddocs/KIND-SSO-E2E-FINDINGS.md. - 🚧 Cloud deploy (Studio/ncurses/
make deploy-*side-flow) — publish an already-built, cloud-packaged x86 image to AWS/Azure/OpenShift/any-qcow2 host via offline-rendered plans (x86-only, no real-cloud CI verification) — seedocs/CLOUD-DEPLOY.md.
The auth model is documented in depth in
docs/SECURITY.mdanddocs/ARCHITECTURE.md; the application-side login relocation + OIDC token-handler live inhugmesh-user-bff-api,hugmesh-admin-bff-api,hugmesh-auth-coreand thehugmesh-gatewayrepos. A mesh node can validate tokens against the built-in Casdoor (the default) or an external OIDC provider (Azure Entra ID / AWS Cognito / generic OIDC) — seedocs/IDENTITY-PROVIDERS.mdfor the--idpflags, the wizard/ncurses pickers, and the honest limits of external mode.
What is genuinely NOT done. Everything that ships dark by design has moved up
into Current State — a default-off flag is a posture, not an
unfinished feature. See also the Roadmap section of
docs/ARCHITECTURE.md.
Re-audited against the tree and the 2026-08-14 build/boot artifacts; the items checked again on 2026-10-07 say so. Each bullet carries the evidence for its own state. Items whose remaining step is only provable on a running cluster are marked (needs a live cluster). Compose green is not evidence for the cluster.
- 🚧 SSO kind-cluster e2e — harness shipped, payload blockers 1–16 and the
in-cluster signing-key fix merged, the live proof not run. The
KIND_PROFILE=ssoharness +make kind-images|kind-up|kind-doctor|kind-e2e|kind-downare onmain. The first real run (2026-08-05) hit 16 fresh-cluster payload blockers because the GitOps payload had never been run end to end; every one of 1–16 is now fixed onmain(item 1 for kind only, item 16 in the admin-bff source) and re-measured on 2026-10-14 against the tree and the offline guards, with commit evidence per item indocs/KIND-SSO-E2E-FINDINGS.md. The 2026-08-06 live run passed specs01-frontpageand27-native-login, but spec 27 only proves the cookie is minted. TheGET /bff/session500 on kind (the BFF manifests gave the signing-key fetch a public host that does not resolve in-cluster) is fixed onmain: pull requests #709 and #736 merged on 2026-10-14 and #693 is closed. The BFF manifests now set an in-clusterCASDOOR_JWKS_URI(e.g.admin-bff-api/deployment.yaml), pinned offline bytests/scripts/test-bff-jwks-in-cluster.sh. Open: that guard reads manifests, not a cluster, so the fix has no live proof; the kind lane still side-loads every image so the Harbor pull path is unexercised (finding 17); and findings 20, 25 and 26. No kind run is recorded after the 2026-10-07 rebuild. Compose green is not evidence for the cluster, andmake kind-upis the prerequisite for this and for every (needs a live cluster) item below. - 🔭 MFA privileged-floor — the live operator flip. (needs a live cluster)
Seeds, gateway env wiring, the
gateway_route_access.mfa_requiredcolumn and its fail-closed enforcement, the per-feature step-up legs (SSH key issuance, phone-fleetFLEET_ADMIN, superadmin lockout withSUPERADMINnot exempt), CI gates, e2e and runbook all shipped and the route-access rows were verified against the running compose mesh (see Current State); what is left is not code. On a real cluster an operator must verify every privileged principal can produce a freshmfa_satisfiedstamp, then flipmfa.enabled→true, then (separately —enforce-privileged-flooris not a sub-flag ofenabled)enforcePrivilegedFloor→true, moving the posture-gate expectations in lockstep (three suites for the first flip, two for the second — measured, listed in the runbook's §3 steps 6-7). Order, lockout preconditions and the exact operator commands:docs/MFA-ROLLOUT.md§3 and §9. - 🚧 SELinux — both acknowledged load defects are FIXED; enforcing now waits
on an AVC workout that has not run yet. Updated 2026-08-19. This section
used to say the modules bake and the loader is wired "but nothing actually
loads". Both root causes are closed. The silent load
failure (fixed, PR #68): the manifest-driven loader ran one batched
semodule -i … 2>/dev/null || warn, so all four 2026-08-14 QEMU runs shipped green ("33 passed, 0 failed") while every node kept base policy only.provision.shnow capturessemodule's stderr into the provision log, retries per module when the batch fails (per-module stderr too), and derives per-module verdicts from the store (semodule -l, not exit codes) into/var/lib/keys-provision/selinux-modules.status. Any manifest module that ends up not loaded records the/var/lib/keys-provision/selinux-load-failedmarker, and the enforce-gate refuses to flip while it stands.tests/qemu/assertions.shno longer stops atgetenforce. It asserts that every name in/usr/share/hugmesh/selinux-modules.listappears in the store, the status file is clean, the marker is down, and the mode matches the expected mode; it also harvests AVCs into everyassertions.log. The x86 profile-binding no-op (fixed, PR #44):build-x86-host-stage4.shcopiedspecs-x86/portage/profile/parentinto/etc/portage/profile/, a placement portage silently ignores. Every x86 image therefore built against plainhardenedand shipped SELinux-inert userland (no policy loader in PID 1, selinux-unaware pam/sudo/dbus) while the summary banner claimedhardened/selinux. The builder now derives an absolutemake.profilesymlink from the spec'sprofile/parent, the pattern the ARM builders had all along.tests/requested-atoms-resolvable.shsection E gates it, and the first post-fix x86 image confirmed it live, withProfile: default/linux/amd64/23.0/hardened/selinux. (Two earlier seams stay closed:provision_selinux()clears/.autorelabelafter its own successful relabel socheck_relabel_clean()can pass, and first boot still never fails outright: degrade loudly, never brick.) What remains is the issue #45 roadmap. The AVC workout harness shipped with PR #68 (make avc-workoutboots an image behind a qcow2 overlay, drives the workloads the ninespecs/selinux/*.temodules confine, and groups denials by owning.tefile) but has not yet been run against the rebuilt images; until it has, theINFERRED-WIDErules inspecs/selinux/*.testay unnarrowed; and the enforce-gate flip (HUGMESH_SELINUX_ENFORCE_GATE=1) stays pending until an enforcing workout pass comes back AVC-clean — nodes still boot PERMISSIVE with the gate inert. - 🔭 bpf-LSM enforcement beyond a registered hook layer. The LSM stack each
image advertises is now the one it runs —
yamaandbpfwere named inCONFIG_LSM, the cmdline, the generatedgrub.cfgand the signed UKI while the kernel silently initialized onlylockdown,capability,selinux; x86 + rpi5 now buildCONFIG_SECURITY_YAMA+CONFIG_BPF_LSM, the 8 ARM boards dropped thebpfname they never built, andtests/scripts/test-lsm-posture-honesty.shfails the build if the two ever diverge again. Kernel lockdown is now a fleet posture: all 10 boards buildCONFIG_SECURITY_LOCKDOWN_LSM(+_EARLY), listlockdownfirst inCONFIG_LSM/lsm=and passlockdown=integrity; the lint pins that for every board, not only agreement between fragment and cmdline. bpf-LSM attach prerequisites (x86 + rpi5): attaching aBPF_PROG_TYPE_LSMprogram needs BTF, so both fragments now carry the BTF block (CONFIG_DEBUG_INFO_BTF,_BTF_MODULES, the DWARF choice) anddev-util/paholeis provided where each kernel is linked (x86: package list plus the chroot top-up; rpi5:Dockerfile.build, since that kernel is cross-linked on the builder host). Both builders fail the build ifolddefconfigdrops BTF,tests/scripts/test-btf-pahole-pairing.shpins the pairing, andtests/scripts/test-btf-kconfig-resolve.sh <kernel-tree>shows the x86 symbols survive a real Kconfig resolve. BTF and struct layout randomisation are mutually exclusive in Kconfig (DEBUG_INFO_BTFdepends on it being off); it is off today. What remains: a booted-image proof that a bpf-LSM program really attaches (the build proves the kernel config, not a boot, and the rpi5 resolve is only enforced by its builder guard on the real tree), and the ARM boards, which also needCONFIG_BPF_LSMplus its deps beforebpfmay return to theirlsm=. The ARM lockdown change is proven only by a Kconfig resolve and the offline lint, not by a boot: an image build plus the in-guest/sys/kernel/security/lockdownassertion on real boards (orlaunch-arm.sh) is still owed. - 🔭 Group-call SFU. coturn gives 1:1/mesh TURN relay only. The MatrixRTC
client half (decision 102a/102b, hugmesh-admin-bff-api#98) is merged and dark
in
hugmesh-matrix-uibehind__HUG_MATRIX_RTC__. The server half (a LiveKit SFU, lk-jwt-service, their secret, tuwunel'slivekit_url, public reachability) is not built and nothing was run against a live mesh. Design and staged plan:docs/GROUP-CALL-SFU.md. - 🔭 Desktop-governance go-live — three dark flags, zero dial rows, no image.
All three governance flags still default off (
DEVICE_TERMINAL_ENABLED,DEVICE_TERMINAL_DIAL_ENABLED,DESKTOP_REMOTE_INSTALL_ENABLED), but they are no longer invisible: each has an admin-BFFapplication.ymlentry (app.desktop.remote-install.enabledpreviously existed only as amatchIfMissing = truebean condition), is declared"false"in the cluster Deployment and read through${NAME:-false}in compose, andtests/desktop-governance/test-governance-flags-visible.shpins that. What remains is not a flag flip: flipping the dial flag needs a mandatory security re-review anddevice_ssh_dialrows (zero on the mesh audited 2026-08; the pinned channel factory refuses without an ACTIVE row carrying a matchinghost_key_fp, TOFU forbidden), and the per-device dial-key Secrets mounted into the BFF pod, which no manifest does today. No laptop / chromebook / desktop image has ever been built (the defaultX86_ROLE_LISTispki backend frontend backend-gpu, and 28 build sessions contain no such artifact), so the desktop boot-verify (Qt6/KF6 Discover pull, thehugmesh-desktopPKCE client, the desktop-sudo claim → polkit path) has never run. Preconditions in full:docs/CLIENT-IMAGES.md§7 "Go-live preconditions". - 🚧 Desktop-governance SSO token producer (FD-07 increment 2) — the producer
is written and unit-tested (
specs/etc/hugmesh/desktop-governance/sso/), but unproven against a live Casdoor device endpoint and on a desktop image; the lightdm-greeter / password-grant PAM login is not built. - 🔭 Notifications external channels — Matrix DM + Akkoma feed + phpBB + email adapters on top of the shipped in-app MVP + SSE push.
- 🚧 Live ApplicationSet cut-over for optional services — the build-time
prune ships; the hardcoded
30-*/50-*Applications still own the workloads. - 🔭 Headscale ACL — the BFF push leg is dark, and the fleet is still file-mode.
The write seam landed (
HeadscalePolicyClient,GET/PUT /api/v1/policy, real impl + Noop default, leader-gated reconciler) and stays dark behindapp.registry.headscale-acl.enabled=false. Decision 101 = B made the BFF the only policy writer, which needs headscale inpolicy.mode: database; the fleet as built still runsmode: filewith the node renderer writing, tracked in hugmesh-generator#634 (switch the mode, seed the stored policy so the tailnet does not fall to allow-all, retire the node-side writer; needs a live control node to confirm). Until then nobody may flipenabled. keys-provision now refuses to start headscale unless headscale's own reading of its config ispolicy.mode: filewith/etc/headscale/policy.hujson, so #634 has to change that check as well. The BFF now refuses to wire the push client unless it declarespolicy-mode: database(HeadscaleAclConfig.requireDbPolicyMode, hugmesh-admin-bff-api), but headscale's API does not report its mode, so the guard can only check the declaration. Thegen-headscale-policy.shapply leg now captures thepolicy setrefusal, restarts headscale to load the rewritten file (asprovision.shdoes sincee1743555), waits for it to answer before forcing tags, and retries an apply that failed. A policy headscale will not load is no longer rolled back to the previous file as it was (that put a just-revoked operator's ssh edge back until some later export generation): the fallback is the previous policy minus every ssh edge the refused one revokes, the refused policy is retried on up to three later ticks, and an alarm (/var/lib/hugmesh/headscale-policy/apply-failedplus adaemon.critline) stays raised until the exported policy, or a newer generation, is loaded (loading the fallback does not clear it). When the previous policy cannot be narrowed it is not restored at all, and a policy that cannot be written into/etc/headscaleis alarmed, kept pending, and holds the export cursor so the same generation is installed again.tests/device-registry/test-layer-a-headscale-acl.shruns against thenet/hugmeshBFF tree; its two policy-mode checks stay red against adatabaseBFF until #634 lands, by design. - 🔭 Live in-cluster image build. (needs a live cluster) The Kaniko manifests,
the namespace + NetworkPolicy, the ESO wiring, the always-on ArgoCD Application
(out of
apps-optional/) and theROLE_IMAGE_BUILDERseed + gateway route row all landed; the pipeline is correct-by-construction and lint-gated but has never run a real build, blocked behind bringing a cluster up.APPSTORE_EFFECTOR_ENABLEDandAPPSTORE_FEDERATION_ENABLEDare nowtruein the admin-BFF deployment (the ArgoCD and federation seams are the real clients, not the Noop ones), but neither leg can send its bearer token yet. Both tokens now have a source (external-secrets/appstore-effector-externalsecrets.yaml-> Secretappstore-effector-tokens, read by the deployment asoptional: truesecretKeyRefs), but the VALUES are operator-seeded in Vault (secret/<brand>/appstore-effector-tokens: the ArgoCD token is minted by ArgoCD, the federation token is a Casdoor superadmin JWT) and until then the ExternalSecret reports SecretSyncedError by design. Neither leg gets as far as a 401 today: both fail at the TLS handshake (admin-bff-api #62, #82), so the token is the second wall.APPSTORE_BUILDER_ENABLEDis deliberately stillfalse. The push credential the Kaniko build pod mounts is now created: Secretservice-catalog-registry-credentials(Opaque, keyconfig.json, the name and key the templateKanikoBuildLauncherloads from the admin-BFF classpath asks for) inhugmesh-service-catalog-builds, and this repo's own template carries the same name and key. The builder stays off because that credential is not the only wall: the runtime template names aserviceAccountName: service-catalog-builderthat no manifest creates, its pod spec cannot pass the namespace'srestrictedPodSecurity level, and no Role lets the admin-BFF ServiceAccount create Jobs there (all three live in the admin-BFF repo or its RBAC; seemanifests/service-catalog-builder/README.md). The mount is NOToptional, so a missing Secret leaves the build pod wedged inContainerCreatingfor 1800s rather than failing, and a pod can only mount a Secret from its own namespace, so copyingexternal-secrets/image-builder-externalsecrets.yamland leaving itsnamespace: hugmesh-image-buildsin place reproduces the wedge with every name and key correct.tests/scripts/test-appstore-effector-flags.shderives the contract from both templates, requires them to agree and the Secret to exist in that namespace from a manifest the kustomization actually applies (flag false or true), requires both token refs to be optional refs to a Secret created in the admin-BFF's namespace, and turns RED on the ServiceAccount / PodSecurity walls if the builder flag is flipped. Nothing here has run a build.CASDOOR_ADMIN_ENABLEDis still absent from the deployment (the per-service role leg stays skipped). - 🔭 DB-hardening flips. (needs a live cluster) Merged dark, awaiting an
operator. PG in-cluster TLS is implemented, but
PG_TLS_ENABLEDis"false"on all 9 DB deployments (flip per DB only after each<db>-mtlsESO Secret materializes). Cassandra auth already ships ON; only TLS stage 2 is open. The tier-egress default-deny NetworkPolicies are manual-sync, with an overlay whoseresources: []renders zero objects by design. They need per-namespace staged enablement with the devops namespace last (ArgoCD self-wedge risk). - 🔭 Real cross-build proof for the shared binpkg pools — the mechanism and the fingerprint guard are shipped; the compile-once speedup is unmeasured.
Beyond the build/keys/DNS story below, the GitOps payload this repo bakes now
ships a full multi-tenant platform. State key: ✅ shipped (on main) ·
🚧 in-flight · 🔭 planned.
- ✅ Multi-tenancy / multi-brand + superadmin — per-domain CA loop
(
brands/domains.conf), per-domain namespace + mTLS isolation, and a real code-enforced superadmin → admin → mod → user role cascade enforced at the gateway. Seedocs/ARCHITECTURE.md,docs/SECURITY.md. - ✅ Optional services (add/remove) — 25 slugs: akkoma / tuwunel / phpBB /
games / owncast / tube / character-studio / character-forge / edge-ai (+
edge-ai-analysis / edge-ai-tts) (+ egress-vpn / tor / workloadConsole /
anubis / coturn / meshbridge / headwind / attestation-server / metrics-server /
keda / kyverno / observability / service-catalog-builder /
optional-services-operator); the UI greys
out when a service is absent, games defaults to
games.<domain>. Build-time prune ships; the 🚧 live ApplicationSet cut-over is pending. Seedocs/OPTIONAL-SERVICES.md. - ✅ Managed backing services — point in-mesh datastores (Postgres, object
store, Kafka, ClickHouse, SMTP) at a hosted AWS/Azure equivalent per image
(
--managed-service id=endpoint); self-hosted stays the byte-identical default.docs/MANAGED-SERVICES.md. - ✅ Egress-VPN — admins drop provider WireGuard/OpenVPN
.conffor outgoing public egress, split-tunnel keeps the tailnet direct.docs/EGRESS-VPN.md. - ✅ Node storage — attach + register extra storage to a node, node-pinned
local PV / local-path (FDE), capacity-aware scheduling.
docs/NODE-STORAGE.md. - ✅ Games App-Store control plane, ✅ owncast + ✅ tube (GPU-dependent
video), ✅ notifications in-app MVP + SSE real-time push — notification bell (60 s polling) +
SseNotificationBusper-user multicast stream (GET /bff/user/notifications/events, user-bff PR #72) +NotificationToastServicebearer-fetch SSE toast (hugmesh.net PR #104) are all shipped. And the ✅ superadmin Service Catalog (data layer + tailnet superadmin-gateway + Kaniko builder, PR #110).docs/GAMES-APPSTORE.md. - ✅ Device-license registry — physical-ownership / domain-residency / SSH
operate-licenses; per-node sshd obeys the signed export.
docs/DEVICE-REGISTRY-KEY-ROTATION.md. - ✅ Pen-test CI — continuous OWASP (ZAP + Dependency-Check + nuclei + k6) as a
GitLab pipeline stage, not a deployed CronJob.
docs/PENTEST-SCHEDULES.md. - ✅ Ships-dark platform surfaces — encrypted versioned backups (Velero +
Kopia), the whole Workload Console (admin-bff module + hidden-tier admin-ui
remote + two-SA RBAC), desktop app governance, coturn TURN relay, and the
gateway MFA privileged floor are all on
mainbehind documented default-off flags. See Current State for each flag and its caveats. - 🚧 / 🔭 Roadmap — everything not done is listed once, in Roadmap
and in the Roadmap section of
docs/ARCHITECTURE.md.
| Image | Build command | Runs |
|---|---|---|
| pki (RPi 5) | ./build-rpi5-stage4.sh --role pki |
k8s control plane, headscale, Casdoor, Cassandra, pki-gateway |
| backend (RPi 5) | ./build-rpi5-stage4.sh --role backend |
tuwunel (Matrix) + Akkoma (fediverse), Spring APIs, DBs, be-gateway, LAN wildcard DNS (test) |
| frontend (RPi 5) | ./build-rpi5-stage4.sh --role frontend |
hugmesh.net Angular host + login/matrix/mastodon/wiki remotes, fe-gateway |
| host (x86_64) | sudo ./build-x86-host-stage4.sh |
GPU worker: ArgoCD, hugmesh.games, backend capacity |
| edge-ai (x86_64 / Jetson) | ./build-x86-host-stage4.sh --role edge-ai |
GPU inference node: serves an OpenAI-compatible model API (Ollama) to the mesh over k8s + tailnet; NVIDIA + CUDA + nvidia-device-plugin. See docs/EDGE-AI.md |
| Frite light desktop (Libre Computer, arm64) — opt-in client | make frite (or ./build-frite-stage4.sh) |
LEAN LXDE desktop on the Amlogic La Frite / Le Potato SBC; joins the tailnet + Casdoor login. LIVE + INSTALLER flavors, --desktop light|none |
| Jetson Orin edge-AI (NVIDIA Tegra234, arm64) — EXPERIMENTAL | make jetson (or ./build-jetson-stage4.sh --role edge-ai|backend-gpu|omnibus|desktop) |
arm64 edge-AI node family on the Jetson Orin Nano/NX: same mesh + KEYS provisioning + shared cluster tree; mainline kernel (NO CUDA yet — the L4T/CUDA flavor is a documented stub). Hardware validation pending — see specs-jetson/README.md |
| Orange Pi family (6 builders, arm64) — EXPERIMENTAL | make orangepi5 / orangepi4-lts / orangepizero2 / orangepizero2w / orangepizero3 / orangepi3-lts (each -live / -installer too); cluster nodes make orangepi5-pki / -backend / -frontend / -omnibus RAM_GB=16 and make orangepi4-lts-frontend |
Light desktops on Rockchip (Orange Pi 5 / 5 Plus RK3588/RK3588S, --board axis; Orange Pi 4 LTS RK3399, single-board, blob-free boot chain) and headless appliances on Allwinner (Zero 2 H616; Zero 2W + Zero 3 H618 — headless is forced, no mainline display-engine driver; 3 LTS H6, headless by scope). Same mesh + KEYS provisioning. The Orange Pi 5 / 5 Plus can also be a pki, backend, frontend or omnibus cluster node (omnibus needs 16 GB+ RAM, backend 8 GB+) and the Orange Pi 4 LTS a frontend node (installer images). Hardware validation pending on all six — see docs/BUILD-MATRIX.md and each specs-orangepi*/README.md |
The friendlier path is the Makefile (
make local/make prod/make build-all), which dispatches the same builders inside a self-contained Docker builder — no host toolchain, no host sudo. See Quick start and Build options.
The Frite light desktop is an opt-in client appliance, not a cluster node — it is not part of the default fleet. It reuses the arm64 cross path and the SAME mesh + KEYS-USB provisioning + hardened key-only SSH as the other client images. See Frite light desktop.
Cloud targets:
scripts/cloud-package.shre-packages a built x86 raw.imgasqcow2/ fixedVHD/ checksummed raw for KubeVirt, Azure and AWS import — seedocs/CLOUD-IMAGE-PACKAGING.md.
Each image is stamped with a build ENV at creation time, written to
/etc/hugmesh/env in the image and threaded through the whole build
(--env test|prod on every builder, ENV=test|prod through make). The ENV
bakes the right posture into the image — you do not flip it at runtime.
test (default) |
prod |
|
|---|---|---|
| domain | <brand>.test (e.g. hugmesh.test) |
the real domain (e.g. hugmesh.net) |
| DNS mode | in-cluster wildcard DNS (apps/09-lan-dns.yaml kept — only for a .test domain) |
public DNS / Cloudflare (apps/12-cloudflared.yaml kept) |
| the other DNS app | 12-cloudflared.yaml pruned from the baked tree (and 09-lan-dns.yaml is also pruned if the domain is not .test, so an ENV=test build on a real domain keeps neither edge) |
09-lan-dns.yaml pruned from the baked tree |
| cloudflared / external-DNS / ACME | off | on (go-live edge; creds from the keys USB) |
| TLS | internal cluster CA only (Vault-PKI / self-signed root) | cluster CA + ACME/public (ACME is additive) |
| OAuth / SMTP | optional / absent → Casdoor native login, admin-approval registration | creds expected from the keys USB (still optional if absent) |
| build banner | quiet | LOUD announced (BUILDING PROD IMAGE for <domain>) |
The default is test (local-first / safe). prod is explicit and
announced because it bakes the real public domain. The builders prune the
ENV-irrelevant ArgoCD app from /var/lib/hugmesh/cluster/apps so ArgoCD only
ever syncs the right one for the baked ENV.
make local # ENV=test + brands/local.conf (hugmesh.test) — LAN fleet
make prod # ENV=prod, real domain (announced)
make build-all ENV=test BRAND=acme # any brand, test
make build-all ENV=prod BRAND=acme DOMAIN=acme.example
./build-x86-host-stage4.sh --env test --config brands/local.conf --role backend-gpu
./scripts/build-all-roles.sh --env prodFull reference:
docs/LOCAL-TESTING.md.
You can test an ENV=test fleet fully on a LAN, before it has any public address.
Two pieces make that work with zero internet:
-
Cluster-served wildcard DNS. Cluster nodes already resolve each other (
provision.shwrites/etc/hosts), but LAN clients (your browser, the Playwright runner) are not on the mesh and have no record forid.<domain>,api.<domain>,matrix.<domain>,mastodon.<domain>or the apex.apps/09-lan-dns.yamldeploys a CoreDNS resolver (manifests/lan-dns) that runshostNetworkon the backend node (the same node ingress-nginx binds:80/:443on) and binds host:53(udp+tcp), answering every name under the brand domain with that node's LAN IP (injected bybootstrap.sh). Point your router's DHCP DNS (fleet-wide) or a single client's resolver at the backend/ingress node:53once, and every LAN device resolves*.<domain>→ the cluster.# backend node IP (the one your router forwards 80/443 to): kubectl get node -l hugmesh.net/backend=true \ -o jsonpath='{.items[0].status.addresses[?(@.type=="InternalIP")].address}' # point a client at it, then: dig @<BACKEND_IP> id.hugmesh.test +short # -> the backend node IP curl -k https://hugmesh.test/ # reaches the front door via the fe-gateway ingress
-
Internal cluster-CA TLS. All certs chain to the internal cluster CA (Vault-PKI / self-signed root) — no ACME, no public CA, no internet. This is the same offline issuer prod uses; prod merely adds the public edge.
So ENV=test needs no public internet, no Cloudflare, no OAuth, no SMTP:
only Casdoor's native login, the internal cluster CA, and the in-cluster
wildcard resolver. See docs/LOCAL-TESTING.md.
The default naming is hugmesh / hugmesh.net, but you can build images for any
brand/domain. A brand
profile is a plain shell file the builders source (via --config FILE, or an
auto-detected ./brand.conf). Precedence is built-in defaults < profile < CLI
flags, so an absent file changes nothing. See brands/README.md.
Committed profiles live in brands/:
| File | Contains |
|---|---|
brands/local.conf |
the LAN .test profile — hugmesh.test, MAIL_PROVIDER=none, OAuth/Cloudflare off, local-first mesh. Used by make local. |
brands/example.conf |
a complete, safe-to-commit example (example.test) to copy. |
brands/<yourbrand>.conf |
your brand's BRAND / BRAND_TITLE / ORG / CLUSTER_DOMAIN / MAIL_PROVIDER / mesh (no secrets). |
../brand.conf (gitignored) |
the same vars with real passwords/tokens. |
cp brands/example.conf brands/acme.conf # edit BRAND / BRAND_TITLE / ORG / CLUSTER_DOMAIN / MAIL_PROVIDER
make build-all BRAND=acme # threads --config brands/acme.conf into every builder
make build-all BRAND=acme DOMAIN=acme.example # DOMAIN= overrides the profile's CLUSTER_DOMAIN
# or directly, no make:
./build-rpi5-stage4.sh --config brands/acme.conf --role backend
./build-rpi5-stage4.sh --role backend --brand acme --domain acme.example --org Acme-Inc --brand-title "Acme Corp"At build time the builders rewrite the baked cluster payload from the hugmesh
defaults to your brand: every namespace
(acme-pki/acme-backend/…), gateway name, ingress host (matrix.acme.example),
image org (acme-inc/…), title and hostname. (Internal install paths like
/var/lib/hugmesh and the provisioning JSON key keep the tool's vendor
namespace.) Never put real secrets in a committed brands/*.conf; they go in the
gitignored ./brand.conf or the environment.
An opt-in, lean desktop client image for the Amlogic arm64 Libre Computer
SBCs, built by build-frite-stage4.sh. It is a desktop appliance, not a
cluster node — it is not in the default fleet. It reuses the same aarch64
cross path as the Pi5 image, and the same mesh + KEYS-USB provisioning +
hardened key-only SSH, so a Frite joins the same Tailscale/headscale tailnet
and does Casdoor login exactly like every other client image (and honors the
device-license SSH posture — no broad SSH access is baked in).
Light here means a lean LXDE-class desktop (Openbox + LXpanel + PCManFM + a small browser), explicitly not the full Plasma + gaming stage4 — sized for the low-end SBC.
make frite # La Frite, BOTH live + installer (default)
make frite FRITE_BOARD=le-potato # the pricier S905X sibling (has microSD)
make frite-live # LIVE image only (boots ephemerally off USB/SD)
make frite-installer # INSTALLER image only (writes to onboard eMMC/SD)
FRITE=1 ./scripts/build-all-roles.sh # ALSO build the Frite alongside the fleet
FRITE_ONLY=1 ./scripts/build-all-roles.sh # ONLY the Frite
# or directly:
./build-frite-stage4.sh --board la-frite --flavor bothBoard variants (--board / FRITE_BOARD):
| Board | Board id | SoC | microSD? | LIVE root | INSTALLER target |
|---|---|---|---|---|---|
la-frite (default) |
AML-S805X-AC | Amlogic S805X | no | USB | eMMC module |
le-potato |
AML-S905X-CC | Amlogic S905X | yes | SD or USB | eMMC or SD |
sweet-potato |
AML-S905X-CC-V2 | Amlogic S905X | yes | SD or USB | eMMC or SD |
La Frite has NO microSD slot. Its u-boot lives in SPI NOR; the LIVE image boots off USB and the INSTALLER writes to the eMMC module. The 512 MB and 1 GB RAM SKUs are the SAME image (RAM is auto-detected; the 512 MB SKU leans on a zram swap configured at first boot).
Two flavors (--flavor / FRITE_FLAVOR, default both): live boots
and runs ephemerally (squashfs in RAM, no persistence); installer is a live
medium that also carries install-frite.sh + the stage4 to write the desktop
to onboard storage.
u-boot caveat (honest): Amlogic GXL u-boot needs Amlogic's proprietary FIP/BL31 blobs to be flashable — mainline u-boot alone is not. The builder does not vendor those blobs; pass a prebuilt, signed board image with
--uboot-url(e.g. a Tow-Boot release) or flash u-boot separately. Seedocs/RUNNING.mdfor the VERIFIED-vs-NEEDS-HARDWARE matrix.
OAuth and mail are both optional and absent by default. With neither, the
platform falls back to its native username/password login (the first-party
login-ui form → POST /bff/login → user-bff → internal Casdoor credentials) and
admin-approval registration (no email verification) — exactly what an
ENV=test LAN fleet uses.
Where login runs. Casdoor is the SSO IdP, reached only internally.
login-uirenders a native username/password form and POSTs it to user-bff (not admin-bff)POST /bff/login; user-bff does the PKCE + internal Casdoor/api/login+ code exchange server-side and holds the per-session JWT, handing the browser only an opaquebff_session (never a Casdoor JWT or URL). The gateway swapsbff_→ the custody JWT before its JWT/role checks. Login/session/account logic is relocating from admin-bff → user-bff (shared inhugmesh-auth-core); see Current State.
OAuth federation providers (seeded into Casdoor when creds are present). The Casdoor init jobs seed each provider if its creds are present, else skip it: an absent client secret makes the provider a no-op.
- Systems realm (
manifests/casdoor/init-job.yaml): the Google OAuth provider, seeded from thecasdoor-googleSecret (Vaultsecret/<brand>/casdoor: google_client_id/google_client_secret). - Games realm (
manifests/casdoor-games/init-job.yaml): a GitHub OAuth provider that creates native gamesplayers, seeded fromcasdoor-games-github(Vaultcasdoor-games: github_client_id/github_client_secret).
The games realm is a separate Casdoor (org
threewizards, issuerid.<domain.games>) from the platform realm (orghugmesh); seedocs/ARCHITECTURE.md.
Mail (SMTP). The MAIL_PROVIDER brand knob selects the mail posture.
none (the brands/local.conf default) disables mail entirely, the typical
local/test setting: registration stays admin-approval instead of
email-verify. Set it in your brands/<x>.conf:
MAIL_PROVIDER="none" # none | smtp (none = no mail; the LAN/test default)Credentials flow. scripts/gen-cluster-secrets.sh
produces the OAuth client IDs/secrets, cluster app secrets and the
Cloudflare go-live token. Delivery is either online via Vault → External Secrets
Operator or offline via the
KEYS USB (KEYS/vault/secrets.json, plus KEYS/cloudflared/tunnel-token for
the prod edge). Vault comes first, the USB is the fallback, and all of it is
read if present. See
keys-template/vault/README.md and
keys-template/cloudflared/README.md.
- RPi 5 images (cross-compiled, run with sudo — cross-emerge merges into
the sysroot + writes host caches; fakeroot is not enough):
crossdevwithaarch64-unknown-linux-gnubuilt, pluscurl,tar,file,xorrisofs(dev-libs/libisoburn).crossdev --stable --target aarch64-unknown-linux-gnu. - x86_64 host image (native, root required): an amd64 Gentoo host with
grub,squashfs-tools,libisoburn(forgrub-mkrescue/xorriso). - QEMU test:
app-emulation/qemu(aarch64 target),dosfstools,e2fsprogs.
For a step-by-step walkthrough of the whole pipeline (configure → build → keys → flash → boot → cluster), with every flag and the per-arch recipes, see the operator runbook:
docs/RUNNING.md.
The Makefile is the front door. Its default build path runs inside a
self-contained Gentoo builder image (Dockerfile.build), so the host needs no
cross-toolchain and no sudo. Build the builder image once (LONG — it compiles
the aarch64 cross-toolchain), then build images:
make docker-image # one-time: build the self-contained Gentoo builder image (LONG)
make local # LAN .test fleet: ENV=test + brands/local.conf (hugmesh.test)
make prod # PROD fleet: ENV=prod, real domain (announced)
make build-all # the default fleet (3 Pi + x86 pki/backend/frontend/backend-gpu), ENV defaults to test
make rpi # all 3 Pi roles make rpi-frontend # one Pi role
make x86 # the 4 x86 roles make x86-backend-gpu # one x86 role
make omnibus # opt-in x86 all-in-one node (OMNIBUS_PLATFORM=rpi|orangepi5 RAM_GB=16+ for ARM)Products land in ./out (gitignored). Run make help for every target. Use
NATIVE=1 to run the scripts directly on a local Gentoo host instead of Docker.
Run the builds as root (the cross-emerge merges into the sysroot's package DB
and writes host caches; fakeroot is not enough). Artifacts land in the git-ignored
./out/ (-w DIR changes it).
Every artifact of one build run is brand- and timestamp-named so test vs prod images are distinguishable and runs never clobber each other:
<brand>-<arch>-<role>-<env>-<UTC-stamp>.<ext>
# e.g. (test) hugmesh-rpi5-arm64-frontend-test-20260610T193045Z.img
# (prod) hugmesh-x86-amd64-backend-gpu-prod-20260610T193045Z.img
<arch> is rpi5-arm64 or x86-amd64; <env> is test or prod; <UTC-stamp>
is date -u +%Y%m%dT%H%M%SZ, computed once per run so the .img, .iso,
.stage4.tar.xz and .fs.tar.xz all share it. The make flash / make qemu
targets and flash-disk.sh autodetect the newest matching image, so you rarely
type the full name. Run flash-disk.sh or run-qemu-test.sh directly with
-w out: their own default work dirs are ./rpi5-stage4-build and ./x86-host-build.
# 0. Build-host prerequisites (one-time). RPi5 cross-toolchain + ISO tooling:
sudo emerge -an dev-libs/libisoburn app-arch/tar sys-apps/file net-misc/curl
sudo crossdev --stable --target aarch64-unknown-linux-gnu
# x86_64 host image also needs: sys-boot/grub sys-fs/squashfs-tools
# QEMU integration test also needs: app-emulation/qemu sys-fs/dosfstools sys-fs/e2fsprogs
# 1. Build the images (--env defaults to test; add --env prod for a go-live image)
sudo ./scripts/build-all-roles.sh -j "$(nproc)" # default fleet: Pi pki/backend/frontend + x86 pki/backend/frontend/backend-gpu (sudo env SKIP_X86=1 for Pi only)
sudo ./build-rpi5-stage4.sh --role pki -j "$(nproc)" # …or just one Pi role
sudo ./build-x86-host-stage4.sh -j "$(nproc)" # x86_64 GPU host (native amd64 Gentoo)
# 2. Cluster secrets + a per-node KEYS provisioning stick (users, SSH, certs, k8s join, GitOps)
./scripts/gen-cluster-secrets.sh # cluster-wide secrets (Vault + USB fallback) — once
./scripts/gen-provision-keys.sh -r pki -o keys-pki # also: -r backend | -r frontend | -r host
sudo ./scripts/make-keys-usb.sh /dev/sdY keys-pki # FAT32 stick labelled KEYS (one per node)
# 3. Flash the OS to each node's SD/NVMe. The Pi build makes a raw .img by default:
sudo ./scripts/flash-disk.sh --role pki --arch arm64 -w out /dev/sdX # SD card, or /dev/nvme0n1
# (only if you built with --iso/--both: mount the ISO and run /mnt/iso/install.sh /dev/sdX)
# x86 host: boot the hugmesh-x86-amd64-*.iso live image, then run install-x86.sh /dev/sdX from it.
# 4. Boot each node with its KEYS stick inserted — first boot self-provisions.
# 5. (optional) Integration-test an image under QEMU before flashing (root)
sudo ./tests/qemu/run-qemu-test.sh -w out --role pkiBoot the pki node first — it is the Kubernetes control plane. If its KEYS
manifest sets hugmesh.gitops.enabled=true, keys-provision runs kubeadm init
and the GitOps bootstrap automatically; otherwise run the bootstrap by hand on the
pki node:
# On the pki node, after kubeadm init:
export KUBECONFIG=/etc/kubernetes/admin.conf
sudo -E /var/lib/hugmesh/cluster/bootstrap/bootstrap.sh # installs ArgoCD + the root app-of-apps
# Backend / frontend / x86-host nodes join automatically at first boot (the kubeadm
# join token rides on their KEYS stick) — or run kubeadm join <pki>:6443 … manually.
# Watch ArgoCD converge the platform (Calico, Vault+ESO, Casdoor, Cassandra, the three
# gateways behind ingress-nginx, Akkoma, tuwunel, Forgejo, the Spring APIs, the
# frontends, hugmesh.games):
kubectl -n devops get applications
kubectl get pods -A
# ArgoCD admin password:
kubectl -n devops get secret argocd-initial-admin-secret -o jsonpath='{.data.password}' | base64 -d; echo
bootstrap.shalso injects the backend node's LAN IP into the resolver Corefile (ENV=testonly) so the in-cluster wildcard DNS answers*.<domain>→ that node. After bootstrap, point your router/clients at the backend node:53— see LAN testing.
The .img artifacts are built compact: only as large as the ext4 root
(--img-size, default 9216 MiB on the Pi / 8192 MiB on x86) plus the 512 MiB
boot/ESP partition and alignment. They are never padded to the size of the
target USB, so they flash fast, and a small image can be written to a large
medium. The root (ext4) partition is the LAST partition in the table.
On first boot the growroot OpenRC service expands that last partition, and its
filesystem, to fill the medium. Then it disables itself: a /var/lib/growroot.done
marker makes it idempotent and safe to re-run, and it is strictly non-fatal, so a quirk
never blocks boot. Device detection is dynamic (findmnt → /sys/class/block
→ lsblk PKNAME), so the same image works on Pi SD/USB (mmcblk*, sda)
and on x86 SATA/USB/NVMe (sd*, nvme*) with no hard-coded device name.
Grow policy: default fill, configurable. The default fills the whole USB; set a
size to use less:
| value | effect |
|---|---|
fill (default) |
expand the root to fill the whole USB/SD/NVMe |
none (--no-grow) |
do not grow — keep the compact flashed layout |
<size> |
cap the root filesystem, e.g. 16G, 12000M, 50% (% of device); the rest is left free for a separate data partition |
Set it at build time with --grow <value> / --no-grow, or GROW_POLICY=
in brand.conf. It is baked to /etc/growfs.conf and a copy is dropped on the
FAT /boot (Pi) / ESP (x86) as growfs.conf so you can retune a single
flashed medium without a rebuild. Runtime precedence (first wins):
- kernel cmdline token
growfs=<value>(cmdline.txton the Pi, the GRUB line on x86) growfs.confon the boot/ESP partition (GROW=<value>)/etc/growfs.confbaked from--grow/GROW_POLICY- built-in
fill
Encryption-at-rest note. The encrypted volumes (LUKS2) are the attached data partitions provisioned by
keys-provision(.storage.devices[]), which are created at100%of their device already. The root thatgrowrootexpands is plaintext ext4, so the grow never touches LUKS today.growrootis nonetheless LUKS-aware: if/is ever mounted from a/dev/mapper/*LUKS device, it grows the backing partition, runscryptsetup resize, thenresize2fs(partition → crypt container → filesystem). Seedocs/ENCRYPTION-AT-REST.md.
At first boot the keys-provision service finds the FAT32 KEYS partition,
mounts it read-only, and applies (all optional):
- users from
users.json(groups, sudo, SSH keys, SHA-512 password hashes) - SSH host keys + per-user
authorized_keys(login is key-only) - hostname / timezone / Wi-Fi / NetworkManager profiles
- certificates and arbitrary files at given paths
- headscale (control server) + tailscale (client, preauth-key join)
- Kubernetes PKI + kubeadm config; stage or run
kubeadm init/join - attached storage — mount M.2/NVMe or USB, relocate containerd/kubelet data
- backups — schedule etcd + PostgreSQL dumps to attached storage and/or an NFS/CIFS share
- GitOps — on the pki control plane, bootstrap ArgoCD + the app-of-apps
If no KEYS stick is present the image still boots and creates a fallback user so
you are never locked out. Full schema + examples: keys-template/.
The cluster manifests live in specs/cluster/ and are baked
into every image at /var/lib/hugmesh/cluster. The pki node installs ArgoCD
and a root app-of-apps; ArgoCD syncs the hugmesh-gateway Helm chart (one
release per namespace, fronted by an ingress-nginx facade on the backend node),
Casdoor, Cassandra, Akkoma (fediverse) + tuwunel (Matrix), Forgejo
(in-cluster git on pki), the Spring APIs, the Angular host + federated remotes
(login/matrix/mastodon/admin/wiki) and hugmesh.games. In ENV=test it also syncs
the in-cluster wildcard-DNS resolver (apps/09-lan-dns.yaml); in ENV=prod the
cloudflared go-live edge instead. See
specs/cluster/README.md.
Gateway route config (SCG 5.0). The
hugmesh-gatewaychart renders itsroutes:values into thespring.cloud.gateway.server.webflux.routesnamespace required by Spring Cloud Gateway 5.0 (the legacyspring.cloud.gateway.routesprefix silently binds nothing). Authorization is not in the route YAML — it is data-driven by thegateway_route_accessPostgres table (manifests/route-access/initdb/20-schema.sql) read by the gateway'sGatewayRouteAccessFilter.
A user can serve their PUBLIC profile at https://<username>.hugmesh.net.
The routing is:
*.hugmesh.net ──► backend ingress ──► fe-gateway
(wildcard DNS: │ (apps/20-gateway-fe.yaml)
lan-dns in test, │
Cloudflare wildcard in prod) ▼
Host=*.hugmesh.net route ──► federation-api (direct, no be-gateway)
(SetPath=/api/federation/vanity, GET /api/federation/vanity
Host header preserved) resolves the PUBLIC profile fragment
by the first DNS label of the Host
Three baked-in pieces make this work:
-
Wildcard DNS already points
*.hugmesh.netat the backend ingress.manifests/lan-dnsanswers the whole brand zone (apex + every subdomain) with the ingress IP inENV=test; the Cloudflare wildcard does so inENV=prod. The be-gateway ingress + cloudflared front the reserved service subdomains (id. api. matrix. mastodon. scale. headscale.), not the fe-gateway. -
The fe-gateway ingress admits the wildcard.
apps/20-gateway-fe.yamladdsingress.extraHosts: ["*.hugmesh.net"], so the nginx Ingress accepts the vanity hosts and hands them to the gateway. -
A
Host=*.hugmesh.netgateway route, ordered for PRECEDENCE. Spring Cloud Gateway matches routes first-in-declared-order, so the route sits after the apex/path routes and before thefrontend-hostPath=/**catch-all. TheHost=*.<domain>predicate matchesalice.<domain>but not the apex<domain>(the*needs ≥1 label), so the apex still falls through tofrontend-host, and the reserved hosts never reach this gateway. The route rewrites the path to/api/federation/vanity(viaSetPath) and forwards directly to federation-api (NOT via the be-gateway) with the Host header preserved. Federation extracts the username from the first DNS label (VanityController.resolveByHost) and returns the public profile-fragment descriptor. The route skips the be-gateway because the resolve is a public read (no JWT; it IS the public profile) and federation-api alreadypermitAllsGET /api/federation/vanity/**. The be-gateway would add an auth layer that 401s the anonymous request.
Precedence summary (first-match wins, top to bottom): the be-gateway
ingress + the cloudflared rules claim the reserved service
subdomains (id. api. matrix. mastodon. scale. headscale.) above the wildcard, so
they never reach the fe-gateway. The apex hugmesh.net is not matched by
Host=*.<domain> and falls through to frontend-host. Only the remaining
<username>.<domain> hosts hit the vanity route. The cloudflared *.<domain> rule
(manifests/cloudflared) is likewise ordered after the reserved hostnames and
before the 404 catch-all.
Cross-service note (a THIRD repo). The shared gateway image
(hugmesh-gateway) ends its SecurityConfig with anyExchange().authenticated()
and permits only a hardcoded PUBLIC_PATHS allowlist. That list used to omit
/api/federation/vanity/**, so the fe-gateway pod would have 401'd the anonymous
vanity request before proxying. It no longer does: /api/federation/vanity and
/api/federation/vanity/** are in PUBLIC_PATHS on hugmesh-gateway main
(SecurityConfig.java; checked 2026-10-07). The generator side (wildcard DNS,
fe-gateway ingress wildcard host, the ordered Host=*.<domain> route to
federation-api, the cloudflared wildcard rule) renders clean (helm template /
kubectl kustomize).
The PUBLISH path (marking a user's profile fragment visibility=public when they
enable vanity in user-bff-api) and the SERVING page (the host shell that renders
the resolved fragment) are documented, with their cross-service
deferrals, in the
hugmesh-federation-api README
("Vanity subdomains" + "Deferred / stubbed").
Cluster secrets are generated by
scripts/gen-cluster-secrets.sh and pushed to
HashiCorp Vault (KV v2, mount secret/, base path hugmesh/, tracking
the brand slug). The External Secrets Operator syncs them into k8s via the
ClusterSecretStore hugmesh-vault (one ExternalSecret per Secret,
refreshed hourly) — the workloads keep their existing secretKeyRefs
(casdoor-google, clickhouse-auth, uptrace-auth). The same values are also
written to the KEYS stick at vault/secrets.json (with vault/token for online
sync) so keys-provision can create the Secrets offline — Vault first, USB
fallback — if Vault is unreachable. See specs/cluster/.
tests/qemu/run-qemu-test.sh boots a built image under
qemu-system-aarch64 -M virt with a synthetic FAT32 KEYS disk and asserts that
provisioning worked end-to-end (users, sshd, headscale, the k8s stack, the role
marker). See tests/qemu/README.md.
Two rootless test suites run on this machine with Docker:
Brings up a rootless stack — generated TLS certs + runtime values, plus
multi-user mock Matrix/Mastodon/BFF servers — serves the built Angular host
over HTTPS, and drives it with Playwright (browsers come from the local
hugmeshgames-e2e image, so no browser download). It proves, with
screenshots in tests/e2e/screenshots/:
- front page loads over the generated certs + values,
- an admin (Casdoor admin role) manages the Gmail + Discord allowlist,
- registration is Google/Discord-only and allowlist-gated (denied otherwise),
- two-stage registration — Matrix/Mastodon stay locked until registration completes,
- five users fully register and reach both services,
- users chat with each other over Matrix and post to Mastodon through our UI.
# one-shot: build host, gen certs, up stack, run Playwright, screenshot, tear down
./tests/e2e/run-all.sh
# or, against an already-running stack (tests/stack/up.sh):
./tests/e2e/run.sh
# the GHERKIN lane, against any of the three meshes (NOTHING is started for you):
./tests/e2e/run.sh --bdd --env docker # the compose stack above
./tests/e2e/run.sh --bdd --env kind # the local devops cluster
./tests/e2e/run.sh --bdd --env qemu # an emulated device
./tests/e2e/run.sh --print-command --env kind # the plan as JSON; executes nothing
./tests/e2e/run.sh --evidence # where this run's screenshots/transcripts wentrun.sh is the single entry point: make stack-e2e-bdd [BDD_ENV=…] [BDD_TAGS=…] [BDD_FEATURES=…] and make stack-e2e-bdd-evidence delegate to it, so there is
one way to spell a run rather than several that drift. tests/e2e/features/README.md
§4d has the whole flag set; tests/scripts/test-e2e-cli-lane.sh is its gate.
tests/stack/mock-*.mjsare fast in-memory test doubles.tests/stack/up-real.shbrings up real tuwunel + Casdoor + Mastodon (+ the platform Cassandra) fromcompose.real.yaml— it preps Mastodon's DB, thendocker compose up -d(tuwunel needs no first-run step at all: it is configured entirely declaratively viaTUWUNEL_*env on its service, so a fresh volume comes up registration-enabled). Point the suite at it withSNAP_BASE_URL=...(andREAL_MATRIX=1for the UI). This is not full fidelity, though: the UI is still served bytests/stack/up.sh'smock-bff.mjs, a hand-written stand-in for the Spring BFF that never calls Casdoor and has no "real Mastodon" mode — only the tuwunel leg becomes real. For the UI to talk to the REAL gateway + Spring BFFs + Casdoor OAuth login, usemake stack-upinstead (seedocs/LOCAL-STACK.md). Tear the real-services stack down withtests/stack/down-real.sh.
Runs the real keys-provision engine inside a container against a generated
KEYS directory (no block device needed) for each role — pki, backend,
frontend, host — asserting users/SSH-keys/sudoers/host-keys/hostname/markers:
./tests/boot/emulate-firstboot.sh # pki, backend, frontend, backend-gpu
./tests/boot/emulate-firstboot.sh pki backend # specific rolesThis validates the boot-time provisioning the images run; it does not boot the aarch64 kernel (that needs a built stage4 — see the QEMU section, which boots the produced Image under
-M virt).
Run ./build-rpi5-stage4.sh --help (and ./build-x86-host-stage4.sh --help)
for the full man-style reference. Highlights:
| Flag | Default | Description |
|---|---|---|
-r, --role |
generic (RPi) / backend-gpu (x86) |
RPi: pki | backend | frontend | desktop | generic. Sets hostname, services, GitOps payload. |
--env test|prod |
test |
Build ENV, baked into /etc/hugmesh/env. test = LAN-only (wildcard DNS kept, cloudflared/ACME pruned, internal CA); prod = real public domain (cloudflared/ACME kept, announced banner). See Build ENV. |
-C, --config FILE |
auto ./brand.conf |
Source a brand profile (e.g. brands/local.conf). |
--cluster-domain |
hugmesh.net |
Base domain for gateways / Casdoor. |
-w, --work-dir |
./out |
Git-ignored output directory. |
-j, --jobs |
$(nproc) |
Parallel emerge/make jobs. |
--headscale-version / --tailscale-version |
pinned | Mesh binary versions. |
--skip-mesh / --skip-tailscale |
off | Omit mesh VPN / tailscale client. |
--skip-kernel / --skip-iso / --skip-clean / --resume |
off | Build phases. |
--pcie-gen3 |
off | Force PCIe Gen 3 for NVMe (RPi, test your drive). |
--print-plan |
off | Dry run (all ten builders): resolve + validate every flag, print the machine-greppable build plan (PLAN_KEY=VALUE lines) and exit 0 — no root, no writes, no network. Invalid role/flag combinations exit non-zero; secrets print as REDACTED. The build-matrix harness verifies every cell through it. |
make is the front door over the builders + tooling (run make help for the
live list). Common overrides: ENV=test|prod, BRAND=, DOMAIN=,
HEADSCALE_URL=, WORK_DIR=, JOBS=, ROLE=, ARCH=x86|arm64, DEV=/dev/sdX,
IMG_FLAGS='--no-iso', NATIVE=1, CA_CERT=/CA_KEY=.
| Target | What it does |
|---|---|
make docker-image (alias docker) |
build the self-contained Gentoo builder image (LONG first time). |
make menu |
interactive console build menu (scripts/build-menu.sh) — pick images with live progress; quit without stopping the build. On NixOS/SteamOS/no-make hosts, scripts/studio-launch.sh --menu reaches it too (see docs/NIXOS-STEAMOS.md). |
make local |
ENV=test + brands/local.conf → the LAN hugmesh.test fleet. |
make prod |
ENV=prod, real domain (announced; creds from the keys USB). |
make build-all / make rebuild |
the default fleet (3 Pi + x86 pki/backend/frontend/backend-gpu); rebuild wipes first. |
make rpi / make rpi-<role> |
all 3 Pi roles / one Pi role (rpi-frontend). |
make x86 / make x86-<role> |
the 4 x86 roles / one (x86-backend-gpu, x86-pki, x86-omnibus). |
make omnibus |
the opt-in x86 all-namespaces-on-one-node image; OMNIBUS_PLATFORM=rpi (a 16 GB Pi 5) or orangepi5 (EXPERIMENTAL) with RAM_GB=16 or more builds it on ARM. |
make frite / frite-live / frite-installer |
the opt-in Frite client (FRITE_BOARD=, FRITE_FLAVOR=, FRITE_DESKTOP=light|none). |
make jetson / make jetson-<role> |
the EXPERIMENTAL Jetson Orin edge-AI platform (jetson-edge-ai, jetson-backend-gpu, jetson-omnibus, jetson-desktop; JETSON_BOARD=, JETSON_KERNEL_FLAVOR=). Hardware validation pending. |
make build-everything |
the FULL documented matrix: 3 Pi + all 12 x86 roles (nodes + omnibus + edge-ai + clients + standalone, incl. unaffiliated) + Frite + Jetson + the six Orange Pi builders (honors ENV=test|prod). |
make matrix-check |
dry-run validate the whole build matrix across five channels (CLI, make, menu, Studio GUI and the Job worker's whitelist; no root, no writes; tests/build-matrix/check.sh). |
make flash DEV=/dev/sdX ROLE=frontend ARCH=arm64 |
write a role image to a disk (.img preferred). |
make qemu (qemu-rpi / qemu-x86) |
boot a role image under QEMU (ARCH=arm64→Pi, x86→q35+OVMF). |
make e2e |
boot a role VM under QEMU and run the Playwright e2e with seeded accounts. |
make ci / make ci-quick |
full pipeline (rebuild fleet → e2e) / fast (build x86 backend-gpu → e2e). |
make clean |
wipe the work dir. |
Every documented image option is reachable from every build front-end
("channel"): the CLI builders (build-*-stage4.sh, ten of them),
the make targets, the ncurses menu (make menu) and the Studio GUI
(studio/), each crossed with the build ENV (test|prod). That is a standing
rule (specs-jetson/README.md), and it is enforced,
not aspirational: tests/build-matrix/ carries the
canonical 172-cell matrix.tsv (platform × role × env × board/flavor/desktop) and
make matrix-check proves the channels agree on every cell — via the
builders' --print-plan dry run, make -n recipe inspection, the menu's
composed command, the Studio's headless --print-command and the Job worker's
whitelist (a fifth channel) — plus negative checks that invalid combinations
fail loudly. See
docs/BUILD-MATRIX.md.
On NixOS / SteamOS (Steam Deck) / Arch / Debian / Fedora, where
python3ormakemay be absent or the layout is non-FHS, an additive Nix flake (flake.nix/shell.nix) and a portable launcher (scripts/studio-launch.sh— detects the distro, bootstraps a project-local venv, and works whenmakeis absent by shelling the builder scripts directly) bring up the Studio wizard and the menu. They add nothing to the build engine and leave themaketargets untouched. Seedocs/NIXOS-STEAMOS.md.
The specs are split by architecture, mirroring the same pattern for both
builders: specs-rpi5/ (aarch64/RPi5-specific) and specs-x86/ (amd64-specific)
each hold that arch's portage/kernel/boot/installer specs, while specs/ holds
the arch-agnostic specs both builds share (the etc/ services, the KEYS
provisioning engine, the backup engine, and the cluster/ GitOps payload).
| Path | Purpose |
|---|---|
specs-rpi5/portage/* |
RPi5 portage config (make.conf, packages, profile, keywords, USE) |
specs-rpi5/kernel/hardened-k8s.config |
RPi kernel fragment (hardened + k8s + USB/VFAT + virtio); reference for the arch-neutral k8s netfilter/NAT/eBPF symbols both arches share |
specs-x86/kernel/hardened-k8s.config |
amd64 kernel fragment (hardened + k8s). Boot-critical: carries the full netfilter/NAT/eBPF surface k8s Service networking needs — xtables match/target layer, NF_NAT_MASQUERADE, nft NAT/MASQ/CT, IPv6 nf tables, IP_NF_MANGLE (was a truncated copy that left ClusterIP/kube-proxy/MASQUERADE/dual-stack/NetworkPolicy dead). A fail-closed build guard in build-x86-host-stage4.sh (mirrored in build-rpi5-stage4.sh) asserts the load-bearing subset survives make olddefconfig; tests/scripts/test-x86-kernel-net-symbols.sh (CI lint:x86-kernel-net-symbols) keeps the fragment from re-truncating. BTF (bpf-LSM attach, eBPF CO-RE) is built too, paired with dev-util/pahole — see the BTF note in the fragment. |
specs-rpi5/boot/{config.txt.tmpl,cmdline.txt} |
RPi firmware boot config + kernel command line |
specs-rpi5/etc/fstab |
RPi filesystem table (mounts the /boot firmware partition) |
specs-rpi5/installer/install.sh |
SD/NVMe installer (ships in the RPi5 ISO) |
specs-x86/** |
amd64 host portage/kernel/installer/grub specs |
specs/etc/keys-provision/provision.sh |
USB KEYS provisioning engine (shared) |
specs/etc/init.d/{containerd,kubelet,headscale,tailscaled,keys-provision} |
OpenRC services (shared) |
specs/etc/init.d/growroot |
First-boot disk-grow service (fill the medium / growfs.conf cap; shared) |
specs/etc/headscale/config.yaml |
Default headscale config (shared) |
specs/etc/kubernetes/*, specs/etc/containerd/config.toml |
k8s + CRI config (shared) |
specs/etc/local.d/01-firstboot.start.tmpl |
First-boot finaliser (fallback user, shared) |
specs/usr/local/sbin/hugmesh-backup |
etcd + PostgreSQL backup engine (shared) |
specs/cluster/** |
ArgoCD app-of-apps, gateway Helm chart, manifests, bootstrap (shared) |
keys-template/** |
The KEYS USB template + schema docs |
This repo is the image/infra layer; application code lives in sibling repos —
see the full table in docs/ARCHITECTURE.md. The
hugmesh.net host shell federates the per-feature remotes
(hugmesh-login-ui, hugmesh-matrix-ui, hugmesh-mastodon-ui,
hugmesh-admin-ui, hugmesh-mod-ui, hugmesh-user-ui,
hugmesh-forum-ui, hugmesh-wiki-ui) over module federation, backed by the
hugmesh-{admin,mod,user,forum,wiki}-bff-api Spring BFFs and
hugmesh-federation-api (vanity-subdomain / public-profile resolver).
The Spring services share a unified Maven baseline — Spring Boot 4.0.7 /
Spring Cloud 2025.1.2 on Java 25 — built on three shared artifacts: hugmesh-parent
(metapom), hugmesh-commons (shared security/tenancy,
net.hugmesh.commons.*) and hugmesh-auth-core (shared
account/session/MFA/Casdoor-admin infra, consumed by user-bff + admin-bff).
SSO login/session/account ownership is being relocated from admin-bff →
user-bff (login-ui native form → POST /bff/login → user-bff PKCE + internal
Casdoor login/exchange → opaque bff_ session; the gateway swaps bff_ → custody
JWT). Account/session data stays in
admin-bff-db; user-bff reaches it via admin-bff /bff/internal over mTLS +
X-Internal-Token. See Current State.
Continuous integration runs on GitLab (.gitlab-ci.yml).
GitHub is pull-mirrored into an in-cluster GitLab, and a privileged runner on
the x86 node builds the role ISOs and delivers them as generic-package release
assets (latest-link path) for the admin UI's download links. ISOs carry no
keys: KEYS material comes from the USB at first boot and is never baked in or
published.
The app container images (gateway, frontends, BFFs, …) are built
from their own repos in the GitLab org mirror. The build:images job dispatches into the
in-cluster Kaniko image-build pipeline (specs/cluster/manifests/image-builder/), which is
always-on: the root app-of-apps syncs specs/cluster/apps/60-image-builder.yaml, so the
hugmesh-image-builds namespace + its default-deny NetworkPolicy always exist. The per-build
Kaniko Job stays a template, so nothing runs until a build is dispatched. The build:images
job itself runs on the default branch and tags only, and needs a cluster KUBECONFIG on the
runner plus the ESO-materialized image-builder-registry push credential. The service-catalog
Kaniko builder (PR #110) is the separate per-service-catalog build path.
The OWASP pen-test suite (ZAP + Dependency-Check + nuclei + k6) runs as a GitLab pipeline
stage, not a deployed CronJob. Its SCA step (Dependency-Check) needs a free, activated
NVD API key — the NVD_API_KEY CI variable / org secret, or the key box in the Studio's
Fleet window: see docs/NVD-API-KEY.md. The pipeline also runs fail-closed lint/verify gates
before any build:
lint:x86-kernel-net-symbols (the k8s netfilter/NAT fragment can't re-truncate),
the casdoor-jwt-custom-gate (mints a real RS256 token against
casbin/casdoor and asserts the JWT-Custom token shape, with the leaked secrets
ABSENT and the authz/MFA claims present, before that config can flip live), and
domain-registry-reconcile-verify (the signed-export domain bridge fails closed
on a bad/placeholder key). See docs/DEVOPS.md.
CI lives in GitLab; GitHub Actions is additive.
.gitlab-ci.yml(128 jobs, in-cluster privileged runner) is the real pipeline. It is the only lane that can build ISOs and images.This repository previously said Actions was billing-blocked org-wide and that
.github/workflowsmust not be added. That is no longer true:gh api repos/hugmesh/<repo>/actions/permissionsreturns{"enabled":true,"allowed_actions":"all"}, and sibling repositories have runubuntu-latestjobs successfully. Three workflows now exist, all on GitHub-hosted runners:
Workflow What it does shell-suites.ymlThe pre-merge gate: runs a curated set of the shell test suites on every pull request (jobs alpine,debian,node,extras). GitLab here is a pull mirror whose pipelines run after the merge, so this is what can stop a bad merge.studio-tests.ymlRuns the Qt-free studio/test subset on a pull request that touchesstudio/. A fast pre-merge answer, not a replacement for GitLab's fullertest:studio-suite.studio-release.ymlBuilds the Studio's Windows MSI, Linux Flatpak and tarball, signs them, and publishes them as a GitHub Release when run on a studio-v*tag.studio-release-cut.ymlThe one way to release the Studio: scripts/release-studio.sh <version>(or Actions > "Cut a Studio release") bumps__version__on main, creates the tag on GitHub and starts the signed build. Seedocs/STUDIO-INSTALLERS.md.Releasing the whole org (every Maven library, image, the mesh node, the Studio and the site) is one command,
scripts/release.sh --channel beta|stable(scripts/release-beta.shis the beta one; a read-only dry run unless given--apply). Seedocs/RELEASING.md.Never target
[self-hosted, hugmesh-x86]from a GitHub workflow. No self-hosted runners are registered against this org, so such a job queues for 24 hours and then is cancelled. Useubuntu-latest/windows-latest.
- SSH is key-only; provide a key via KEYS or use the console fallback user.
- Prefer
password_hashover plaintext; generate withgen-provision-keys.sh. - The KEYS stick holds the cluster CA, preauth and backup credentials — keep it offline once provisioning is done. Generated secrets and build output are git-ignored.
- Nodes run the hardened/selinux MCS policy with per-app/per-pod MCS
identities and the hugmesh node-policy modules loaded — but they boot
PERMISSIVE by default (
.selinux.mode), and the enforce-gate ships inert until an operator opts in; API-to-API traffic is mTLS; per-app SCRAM Postgres roles; secrets via Vault/ESO. Seedocs/SECURITY.mdanddocs/selinux-module-loading.md. - The kernel boots with lockdown (
lsm=lockdown,yama,selinux,bpf,lockdown=integrity; the 8 ARM boards carrylsm=lockdown,yama,selinuxwith the samelockdown=integrity, nobpf); x86 ships a Secure Boot UKI signed with the org key (sbsign) and runs firewalld (test/prod zone profiles), while the cross-compiled rpi5 arm64 platform excludes firewalld deliberately (theglib[introspection]cross bootstrap does not compile) and usesnftables+iptables+hugmesh-firewall-reconcile. Both arches get sysctl/SSH hardening.
MIT