diff --git a/README.md b/README.md index a6b69e4..019affb 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,9 @@ -This repo bootstraps a hybrid kubeadm cluster and then hands app delivery to Argo CD. +This repo bootstraps a hybrid kubeadm cluster, moves Kubernetes capacity onto +Pimox VMs, keeps bootstrap services on the Debian host, and hands app delivery +to Argo CD. ## Quick Start @@ -30,4 +32,37 @@ The canonical non-secret inventory is [homelab.yml](homelab.yml). Keep LAN IPs, `./jeannie` reads `homelab.yml` at startup and exports matching OpenTofu variables. `scripts/render-docs` renders the documentation and the static service catalog page. +## Current Operating Model + +- Debian remains the operations host: Jeannie, Docker builds, external Gitea, + GitOps mirror, local registry endpoint, Ollama, OmniRoute, and the AI tool + wrappers run there outside Kubernetes. +- Kubernetes workloads run on the Pimox VM cluster where practical. The current + target is three Debian arm64 VMs on the Orange Pi 5 Plus: one control-plane VM + and two worker VMs, each exposing two Kubernetes CPUs. +- Pimox VMs are treated as rebuildable capacity. Jeannie owns the golden image, + VM clone lifecycle, KVM CPU pinning for the Orange Pi big cores, qemu guest + readiness waits, containerd registry trust, and stale node cleanup. +- The canonical local image endpoint is the Debian LAN IP and registry NodePort + (`192.168.100.73:30500` by default). Containerd pulls through that endpoint + even when the registry pod is running on a Pimox worker. + +## AI Stack + +The Debian-hosted AI stack is intentionally split between a containerized +gateway and host-level tools: + +- `./jeannie deploy-ai-stack` starts OmniRoute with Docker Compose + under `/data/homelab-ai-stack`, seeds OpenRouter/NVIDIA keys from local files, + creates the no-auth/free provider connections, validates real chat + completions, and writes `models.env`. +- `./jeannie deploy-ai-tools` wires bare-metal `goose`, `holmes`, and + `hermes` wrappers to OmniRoute through `ai-tools.env` and a Holmes config. +- `./jeannie ai-check` verifies the local knowledge index, wrappers, + OmniRoute endpoint, and validated model routes. +- `./jeannie doctor-k8s` performs read-only Kubernetes collection and + can ask Holmes for triage through OmniRoute. Ollama remains useful for small + local tasks, but agentic Kubernetes triage is routed through OmniRoute-backed + cloud/free providers. + Run `./jeannie up` and `./jeannie nuke` only from the Debian homelab server. diff --git a/README.md.tmpl b/README.md.tmpl index 254077f..c0199a4 100644 --- a/README.md.tmpl +++ b/README.md.tmpl @@ -2,7 +2,9 @@ -This repo bootstraps a hybrid kubeadm cluster and then hands app delivery to Argo CD. +This repo bootstraps a hybrid kubeadm cluster, moves Kubernetes capacity onto +Pimox VMs, keeps bootstrap services on the Debian host, and hands app delivery +to Argo CD. ## Quick Start @@ -30,4 +32,37 @@ The canonical non-secret inventory is [homelab.yml](homelab.yml). Keep LAN IPs, `./{{ main_script }}` reads `homelab.yml` at startup and exports matching OpenTofu variables. `scripts/render-docs` renders the documentation and the static service catalog page. +## Current Operating Model + +- Debian remains the operations host: Jeannie, Docker builds, external Gitea, + GitOps mirror, local registry endpoint, Ollama, OmniRoute, and the AI tool + wrappers run there outside Kubernetes. +- Kubernetes workloads run on the Pimox VM cluster where practical. The current + target is three Debian arm64 VMs on the Orange Pi 5 Plus: one control-plane VM + and two worker VMs, each exposing two Kubernetes CPUs. +- Pimox VMs are treated as rebuildable capacity. Jeannie owns the golden image, + VM clone lifecycle, KVM CPU pinning for the Orange Pi big cores, qemu guest + readiness waits, containerd registry trust, and stale node cleanup. +- The canonical local image endpoint is the Debian LAN IP and registry NodePort + (`192.168.100.73:30500` by default). Containerd pulls through that endpoint + even when the registry pod is running on a Pimox worker. + +## AI Stack + +The Debian-hosted AI stack is intentionally split between a containerized +gateway and host-level tools: + +- `./{{ main_script }} deploy-ai-stack` starts OmniRoute with Docker Compose + under `/data/homelab-ai-stack`, seeds OpenRouter/NVIDIA keys from local files, + creates the no-auth/free provider connections, validates real chat + completions, and writes `models.env`. +- `./{{ main_script }} deploy-ai-tools` wires bare-metal `goose`, `holmes`, and + `hermes` wrappers to OmniRoute through `ai-tools.env` and a Holmes config. +- `./{{ main_script }} ai-check` verifies the local knowledge index, wrappers, + OmniRoute endpoint, and validated model routes. +- `./{{ main_script }} doctor-k8s` performs read-only Kubernetes collection and + can ask Holmes for triage through OmniRoute. Ollama remains useful for small + local tasks, but agentic Kubernetes triage is routed through OmniRoute-backed + cloud/free providers. + Run `./{{ main_script }} up` and `./{{ main_script }} nuke` only from the Debian homelab server. diff --git a/apps/demos-static/public/homelab-catalog/index.html b/apps/demos-static/public/homelab-catalog/index.html index 106f01a..7786e74 100644 --- a/apps/demos-static/public/homelab-catalog/index.html +++ b/apps/demos-static/public/homelab-catalog/index.html @@ -168,6 +168,14 @@ not exposed apps/website/ollama/README.md + + AI Stack / OmniRoute + debian (control-plane, 192.168.100.73) + Docker Compose / jeannie deploy-ai-stack + http://192.168.100.73:20128/ + not exposed + docs/ai-ops.md + OCI Edge oci_edge diff --git a/apps/website/blog.php b/apps/website/blog.php index 5d448c5..0458a47 100644 --- a/apps/website/blog.php +++ b/apps/website/blog.php @@ -18,6 +18,9 @@ $activityKeys = [ 'blog_activity_14', 'blog_activity_15', 'blog_activity_16', + 'blog_activity_17', + 'blog_activity_18', + 'blog_activity_19', ]; $todoKeys = [ @@ -58,6 +61,9 @@ $stackKeys = [ 'blog_stack_17', 'blog_stack_18', 'blog_stack_19', + 'blog_stack_20', + 'blog_stack_21', + 'blog_stack_22', ]; $caseStudyCards = [ @@ -181,6 +187,21 @@ $stackSourceLinks = [ ['label' => 'n8n app manifest', 'path' => 'apps/n8n/web-app.yaml'], ['label' => 'Ollama Modelfile', 'path' => 'apps/website/ollama/Modelfile'], ], + 'blog_stack_20' => [ + ['label' => 'AI ops docs', 'path' => 'docs/ai-ops.md'], + ['label' => 'AI stack pipeline', 'path' => 'lib/jeannie/pipeline.sh'], + ['label' => 'AI inventory', 'path' => 'homelab.yml'], + ], + 'blog_stack_21' => [ + ['label' => 'doctor-k8s', 'path' => 'lib/jeannie/commands.sh'], + ['label' => 'self-heal eventd', 'path' => 'scripts/jeannie-eventd'], + ['label' => 'self-heal infra', 'path' => 'infra/jeannie-eventd/'], + ], + 'blog_stack_22' => [ + ['label' => 'Pimox provisioning', 'path' => 'bootstrap/provisioning/main.tf'], + ['label' => 'Pimox docs', 'path' => 'bootstrap/provisioning/README.md'], + ['label' => 'containerd repair flow', 'path' => 'lib/jeannie/pipeline.sh'], + ], ]; function renderStackSourceLinks(string $stackKey, array $sourceLinks, string $sourceBase): void { diff --git a/apps/website/lang/en.php b/apps/website/lang/en.php index ec73c63..c888535 100644 --- a/apps/website/lang/en.php +++ b/apps/website/lang/en.php @@ -93,13 +93,13 @@ return [ 'blog_kicker' => 'Homelab field notes', 'blog_title' => 'I accidentally built a tiny CI/CD platform', - 'blog_subtitle' => 'A case-study style walkthrough of how a Debian control plane, Pimox app workers, external Gitea, local registry, Kyverno policy, Argo CD, monitoring, static demos, and a tuned website path became a repeatable Kubernetes delivery system.', + 'blog_subtitle' => 'A case-study style walkthrough of how a Debian operations host, all-Pimox Kubernetes VMs, external Gitea, local registry, Kyverno policy, Argo CD, monitoring, static demos, and a Debian-hosted AI stack became a repeatable delivery system.', 'case_studies_kicker' => 'Portfolio case studies', 'case_studies_title' => 'Production-shaped evidence', 'case_studies_intro' => 'These are the three proof points a hiring manager should see first: platform ownership, production reliability at scale, and the reserved MLOps path for model-serving work.', 'case_platform_label' => 'Case 01', 'case_platform_title' => 'Self-hosted Kubernetes delivery platform', - 'case_platform_desc' => 'Git push, validation, image build, registry, GitOps sync, policy guardrails, monitoring, retained storage, and VM worker provisioning in one small but operationally honest platform.', + 'case_platform_desc' => 'Git push, validation, image build, registry, GitOps sync, policy guardrails, monitoring, retained storage, VM provisioning, AI-assisted doctors, and deterministic self-heal hooks in one small but operationally honest platform.', 'case_platform_link' => 'View architecture', 'case_sre_label' => 'Case 02', 'case_sre_title' => 'Enterprise SRE and incident automation', @@ -151,6 +151,9 @@ return [ 'blog_stack_17' => 'The portfolio website keeps Apache at the core, runs PHP through PHP-FPM with OPcache, pre-renders read-heavy pages into static HTML during the image build, and leaves PHP for write and translation endpoints.', 'blog_stack_18' => 'The supply-chain path now uses BuildKit SBOM attestations, Cosign signatures, a cluster-published public key, and an audit-first Kyverno ImageValidatingPolicy that can be promoted to deny unsigned local-registry pods.', 'blog_stack_19' => 'The translation path now uses Redis for per-string cache hits, a custom Ollama website-translator model on the Debian server for cache misses, n8n for prewarming and batch workflow automation, and structured logs for cache, latency, JSON parse, and timeout signals.', + 'blog_stack_20' => 'The AI stack is Debian-hosted by design: OmniRoute runs in Docker Compose under /data/homelab-ai-stack, seeds OpenRouter and NVIDIA keys locally, creates free/no-auth provider routes, validates real completions, and writes model hints for the tools.', + 'blog_stack_21' => 'Goose, Holmes, and Hermes stay installed as bare-metal tools with Jeannie wrappers. That means doctor-k8s can collect read-only Kubernetes evidence and ask Holmes for triage even when the cluster itself is the broken component.', + 'blog_stack_22' => 'The Pimox migration turned the Orange Pi 5 Plus into rebuildable Kubernetes capacity: three Debian arm64 VMs, big-core KVM pinning, containerd 2.x registry trust, known-host refresh, imagefs cleanup, and app rollouts that do not depend on manual node edits.', 'blog_arch_kicker' => 'Architecture map', 'blog_arch_title' => 'The homelab, end to end', 'blog_arch_intro' => 'The current delivery path starts with a push to Gitea, runs local validation, builds arm64 images, syncs the validated commit into the GitOps mirror, and lets Argo CD reconcile from the app workers. The infrastructure path stays manual through jeannie, including the PXE/Pimox template builder, NVMe-backed worker clones, Kyverno policy placement, Redis-backed website translation, n8n workflow automation, and the opt-in OpenWrt firewall VM, while the OCI edge routes public traffic back through the private path.', @@ -175,7 +178,9 @@ return [ 'blog_activity_14' => 'Reworked the website image to keep Apache as the web server while moving PHP execution to PHP-FPM, enabling OPcache, and validating the runtime through Gitea Actions instead of local image builds.', 'blog_activity_15' => 'Pre-rendered the read-heavy website pages into static HTML, moved visitor ideas behind a small JSON endpoint, added cache headers, enabled HTTP/2 and connection reuse at the OCI edge, and measured reused HTTP/2 asset loads around 60ms.', 'blog_activity_16' => 'Added image signing and SBOM validation: jeannie now builds with SBOM metadata, signs php-website and demos-static with Cosign, attaches signed SPDX SBOM attestations, and Kyverno audits unsigned local-registry pods before enforcement is promoted.', - 'blog_activity_17' => 'Provisioned and joined a fourth node (pimox-worker-03) to the cluster, offloading stateless workloads from the Debian control plane to stabilize system memory usage.', + 'blog_activity_17' => 'Migrated Kubernetes to the Pimox VM profile while keeping Debian responsible for Jeannie, Gitea, Docker builds, the registry endpoint, Ollama, and the AI stack.', + 'blog_activity_18' => 'Added the OmniRoute AI gateway, seeded provider keys safely from local files, created runtime-validated free model routes, and wired goose, Holmes, and Hermes through Jeannie wrappers.', + 'blog_activity_19' => 'Hardened Pimox redeployability after real failures: VM CPU pinning on big cores, qemu-agent/SSH readiness waits, containerd 2.x registry configuration, stale pod cleanup, and node imagefs cleanup before app deploys.', 'blog_todo_kicker' => 'Improvement backlog', 'blog_todo_title' => 'Todo list for the next homelab pass', 'blog_todo_intro' => 'These are improvement proposals, not chores for the sake of chores. Each item either reduces rebuild risk, tightens supply-chain hygiene, or makes the platform easier to operate when something fails.', @@ -193,6 +198,7 @@ return [ 'blog_todo_12' => 'Move sensitive app configuration into Sealed Secrets, External Secrets, or another explicit secret-management path.', 'blog_todo_13' => 'Test the OpenWrt VM in a maintenance window before making it a gateway: confirm WAN, LAN, rollback access, DHCP settings, and that Pimox remains reachable.', 'blog_todo_14' => 'Buy or configure a managed switch before VLAN work. Until then, keep OpenWrt as a simple two-interface firewall and avoid risky remote bridge rewrites.', + 'blog_todo_15' => 'Turn the AI doctor path into a tighter loop: Holmes proposes the root cause, Jeannie records impact and confidence, and only allowlisted runbooks can become self-heal actions.', 'blog_ideas_kicker' => 'Visitor ideas', 'blog_ideas_title' => 'What would you improve next?', 'blog_ideas_intro' => 'Send a practical idea for the homelab backlog. Submissions are stored as plain text, limited in size, and rendered escaped.', diff --git a/apps/website/lang/nah.php b/apps/website/lang/nah.php index 1174494..7017456 100644 --- a/apps/website/lang/nah.php +++ b/apps/website/lang/nah.php @@ -93,13 +93,13 @@ return [ 'blog_kicker' => 'Homelab tlahcuilolli', 'blog_title' => 'Tlatecpanaliztli homelab CI/CD pipeline', - 'blog_subtitle' => 'Case-study style tlahcuilolli: quen Debian control plane, Pimox app workers, external Gitea, local registry, Kyverno policy, Argo CD, monitoring, static demos, ihuan tuned website path omocuepque repeatable Kubernetes delivery system.', + 'blog_subtitle' => 'Case-study style tlahcuilolli: quen Debian operations host, all-Pimox Kubernetes VMs, external Gitea, local registry, Kyverno policy, Argo CD, monitoring, static demos, ihuan Debian-hosted AI stack omocuepque repeatable delivery system.', 'case_studies_kicker' => 'Portfolio tlamantli', 'case_studies_title' => 'Evidence quen production', 'case_studies_intro' => 'Inin yeyi proof points ma quitta hiring manager achto: platform ownership, production reliability at scale, ihuan reserved MLOps path para model-serving tequitl.', 'case_platform_label' => 'Tlamantli 01', 'case_platform_title' => 'Self-hosted Kubernetes delivery platform', - 'case_platform_desc' => 'Git push, validation, image build, registry, GitOps sync, policy guardrails, monitoring, retained storage, ihuan VM worker provisioning ipan ce tepiton platform in quipia operational truth.', + 'case_platform_desc' => 'Git push, validation, image build, registry, GitOps sync, policy guardrails, monitoring, retained storage, VM provisioning, AI-assisted doctors, ihuan deterministic self-heal hooks ipan ce tepiton platform in quipia operational truth.', 'case_platform_link' => 'Xiquitta architecture', 'case_sre_label' => 'Tlamantli 02', 'case_sre_title' => 'Enterprise SRE ihuan incident automation', @@ -151,6 +151,9 @@ return [ 'blog_stack_17' => 'Portfolio website keeps Apache at core, runs PHP through PHP-FPM ika OPcache, pre-renders read-heavy pages into static HTML during image build, ihuan leaves PHP para write ihuan translation endpoints.', 'blog_stack_18' => 'Supply-chain path axcan uses BuildKit SBOM attestations, Cosign signatures, public key ipan cluster, ihuan audit-first Kyverno ImageValidatingPolicy in huel mopromote para deny unsigned local-registry pods.', 'blog_stack_19' => 'Translation path axcan uses Redis para per-string cache hits, custom Ollama website-translator model ipan Debian server para cache misses, n8n para prewarming ihuan batch workflows, ihuan structured logs para cache, latency, JSON parse, ihuan timeout signals.', + 'blog_stack_20' => 'AI stack mocahua ipan Debian by design: OmniRoute runs in Docker Compose under /data/homelab-ai-stack, seeds OpenRouter ihuan NVIDIA keys locally, creates free/no-auth provider routes, validates real completions, ihuan writes model hints para tools.', + 'blog_stack_21' => 'Goose, Holmes, ihuan Hermes mocahuah quen bare-metal tools ika Jeannie wrappers. Ica doctor-k8s huel collect read-only Kubernetes evidence ihuan ask Holmes for triage quema cluster itself is broken.', + 'blog_stack_22' => 'Pimox migration quicuep Orange Pi 5 Plus into rebuildable Kubernetes capacity: yeyi Debian arm64 VMs, big-core KVM pinning, containerd 2.x registry trust, known-host refresh, imagefs cleanup, ihuan app rollouts without manual node edits.', 'blog_arch_kicker' => 'Architecture mapa', 'blog_arch_title' => 'Homelab, end to end', 'blog_arch_intro' => 'Current delivery path starts ika push to Gitea, runs local validation, builds arm64 images, syncs validated commit into GitOps mirror, ihuan lets Argo CD reconcile from app workers. Infrastructure path stays manual through jeannie, including PXE/Pimox template builder, NVMe-backed worker clones, Kyverno policy placement, Redis-backed website translation, n8n workflow automation, ihuan opt-in OpenWrt firewall VM, while OCI edge routes public traffic back through private path.', @@ -175,7 +178,9 @@ return [ 'blog_activity_14' => 'Reworked website image para Apache ma mocahua web server while PHP runs through PHP-FPM, OPcache enabled, ihuan runtime validated through Gitea Actions instead of local image builds.', 'blog_activity_15' => 'Pre-rendered read-heavy website pages into static HTML, moved visitor ideas behind small JSON endpoint, added cache headers, enabled HTTP/2 ihuan connection reuse at OCI edge, ihuan measured reused HTTP/2 asset loads around 60ms.', 'blog_activity_16' => 'Added image signing ihuan SBOM validation: jeannie axcan builds ika SBOM metadata, signs php-website ihuan demos-static ika Cosign, attaches signed SPDX SBOM attestations, ihuan Kyverno audits unsigned local-registry pods before enforcement is promoted.', - 'blog_activity_17' => 'Added fourth node (pimox-worker-03) ipan cluster, para tlapalehuia Debian control plane ihuan stabilize memory usage.', + 'blog_activity_17' => 'Migrated Kubernetes to Pimox VM profile while Debian keeps Jeannie, Gitea, Docker builds, registry endpoint, Ollama, ihuan AI stack.', + 'blog_activity_18' => 'Added OmniRoute AI gateway, seeded provider keys safely from local files, created runtime-validated free model routes, ihuan wired goose, Holmes, ihuan Hermes through Jeannie wrappers.', + 'blog_activity_19' => 'Hardened Pimox redeployability after real failures: VM CPU pinning on big cores, qemu-agent/SSH readiness waits, containerd 2.x registry config, stale pod cleanup, ihuan node imagefs cleanup before app deploys.', 'blog_todo_kicker' => 'Improvement tlatecpanaliztli', 'blog_todo_title' => 'Todo list para next homelab pass', 'blog_todo_intro' => 'Inin cateh improvement proposals, amo chores zan pampa chores. Each item either reduces rebuild risk, tightens supply-chain hygiene, o makes platform easier to operate quema tlein fails.', @@ -193,6 +198,7 @@ return [ 'blog_todo_12' => 'Move sensitive app configuration into Sealed Secrets, External Secrets, o occe explicit secret-management path.', 'blog_todo_13' => 'Test the OpenWrt VM ipan maintenance window before making it a gateway: confirm WAN, LAN, rollback access, DHCP settings, ihuan Pimox remains reachable.', 'blog_todo_14' => 'Buy o configure managed switch before VLAN work. Until then, keep OpenWrt quen simple two-interface firewall ihuan avoid risky remote bridge rewrites.', + 'blog_todo_15' => 'Make AI doctor path tighter: Holmes proposes root cause, Jeannie records impact ihuan confidence, ihuan only allowlisted runbooks can become self-heal actions.', 'blog_ideas_kicker' => 'Visitor tlamachiliztli', 'blog_ideas_title' => 'Tlein tijpatlaz next?', 'blog_ideas_intro' => 'Xititla ce practical idea para homelab backlog. Submissions mocahua quen plain text, limited size, ihuan escaped quema rendered.', diff --git a/docs/ai-ops.md b/docs/ai-ops.md index 105ae9a..c25dce7 100644 --- a/docs/ai-ops.md +++ b/docs/ai-ops.md @@ -11,6 +11,55 @@ AI/RAG, data-heavy utilities, or cases where an existing Python ecosystem is the clear fit. New repo features should choose the smallest language that fits the task instead of defaulting to Bash. +## Debian-Hosted AI Stack + +The current AI stack is part of the Debian operations layer, not the Kubernetes +workload layer. That is deliberate: if the Pimox workers or Kubernetes control +plane are unhealthy, the triage tools still need to be available from the host +that runs Jeannie. + +The split is: + +- OmniRoute runs in Docker Compose under `/data/homelab-ai-stack` and exposes an + OpenAI-compatible endpoint on the Debian host. +- `deploy-ai-stack` seeds local OpenRouter and NVIDIA keys when present, + creates the no-auth/free provider connections, validates real chat + completions, rejects stale routes, and writes + `/data/homelab-ai-stack/models.env`. +- `deploy-ai-tools` keeps `goose`, `holmes`, and `hermes` as bare-metal tools + and generates wrapper commands (`jeannie-goose`, `jeannie-holmes`, + `jeannie-hermes`) plus `/data/homelab-ai-stack/ai-tools.env`. +- `ai-check` verifies the knowledge index, wrappers, OmniRoute endpoint, and + validated model route hints before Jeannie relies on them. +- Ollama remains on Debian for single-purpose local tasks such as translation + cache misses, but Holmes agentic Kubernetes triage should use the + OmniRoute-backed routes. + +Bootstrap and validation from the Debian server: + +```bash +./jeannie deploy-ai-stack +./jeannie deploy-ai-tools +./jeannie ai-check +``` + +## Holmes-Assisted Kubernetes Doctor + +`doctor-k8s` is the first integration point between deterministic Jeannie +doctors and the AI stack. It collects read-only Kubernetes evidence, writes an +artifact directory under `~/.local/share/homelab/doctor-k8s`, and asks Holmes +for triage through the OmniRoute route selected in `models.env`. + +```bash +./jeannie doctor-k8s +./jeannie doctor-k8s --no-holmes +``` + +The AI output is advisory. Jeannie keeps remediation deterministic: fixes must +map to explicit heal/runbook commands, self-heal allowlists, or human-reviewed +pipeline changes. This keeps the diagnostic layer read-only while still using +Holmes to summarize likely root cause, impact, and next action. + ## Version Discipline The lab should converge on one Kubernetes minor across the API server and every @@ -15319,4 +15368,3 @@ tool-correctness signals over time: ``` Use `--live` only when Ollama is available. - diff --git a/docs/app-ops.md b/docs/app-ops.md index 2f128c0..0f4dc98 100644 --- a/docs/app-ops.md +++ b/docs/app-ops.md @@ -26,6 +26,19 @@ definition lives under `infra/arr-stack` and stores persistent data under `/data/arr`. Historical Kubernetes manifests are archived under `archive/apps/arr-stack` for migration reference only. +The AI operations stack is also host-level. OmniRoute runs from +`/data/homelab-ai-stack` with Docker Compose, while `goose`, `holmes`, `hermes`, +Ollama, Jeannie doctors, and the generated wrappers stay on the Debian host. +Keep it outside Kubernetes so `doctor-k8s` and recovery workflows still work +when Pimox workers or cluster networking are the thing being investigated. + +```bash +./jeannie deploy-ai-stack +./jeannie deploy-ai-tools +./jeannie ai-check +./jeannie doctor-k8s +``` + ## Storage OpenEBS provides the platform storage provisioner. Stateful Kubernetes apps use diff --git a/docs/architecture.md b/docs/architecture.md index 9db2f29..9ddb7ae 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -4,8 +4,13 @@ The lab is intentionally small but production-shaped: -- a Debian amd64 host runs the kubeadm control plane and local deployment tools -- a Raspberry Pi arm64 node runs selected workloads +- Debian remains the always-on operations host for Jeannie, Docker builds, + external Gitea, the GitOps mirror, the local registry endpoint, Ollama, + OmniRoute, and AI tool wrappers +- Kubernetes capacity now comes from Pimox Debian arm64 VMs on the Orange Pi 5 + Plus, with one control-plane VM and worker VMs managed as rebuildable capacity +- a Raspberry Pi arm64 host runs selected support services outside the + Kubernetes rebuild blast radius - the Debian host also runs the always-on Gitea Docker service outside Kubernetes - the Debian host keeps a bare GitOps mirror under @@ -16,6 +21,9 @@ The lab is intentionally small but production-shaped: - Argo CD continuously reconciles Kubernetes manifests from this repo - a local registry stores the website and demos images built for the worker architecture +- a Debian-hosted OmniRoute gateway routes Holmes/goose/Hermes AI calls through + validated free/no-auth, OpenRouter, and NVIDIA-backed models while Ollama + remains available for small local tasks - the website image keeps Apache as the public server, uses PHP-FPM with OPcache for dynamic endpoints, and pre-renders read-heavy pages to static HTML during the image build @@ -88,7 +96,17 @@ accidentally modify the cluster. `demos-static`, the `heimdall` route bundle, `n8n`, and `supply-chain-policy` -5. `bootstrap/edge` +5. Debian host services + - keep Gitea, Heimdall, the ARR/media stack, Ollama, and OmniRoute outside + Kubernetes so a cluster rebuild does not remove the tools needed to repair + or redeploy it + - run `deploy-ai-stack` to create the OmniRoute gateway and validated model + routes, then `deploy-ai-tools` to wire goose, Holmes, and Hermes to that + gateway + - use `doctor-k8s` for read-only Kubernetes evidence collection and + Holmes-assisted triage before any deterministic heal/runbook action + +6. `bootstrap/edge` - connects to the OCI jump box - uploads nginx, HAProxy, Varnish, and Squid configs - obtains and renews Let's Encrypt certificates for the configured hostname @@ -96,6 +114,31 @@ accidentally modify the cluster. - enables gzip, HTTP/2, TLS session reuse, client keepalive, upstream keepalive, and cache headers for the public website path +## Pimox Migration Lessons + +The Pimox migration moved Kubernetes workloads away from the old Debian-hosted +cluster shape, but it also clarified what should not move into Kubernetes. +Debian keeps the Git source of truth, build tooling, registry endpoint, AI +gateway, and recovery commands. Pimox VMs provide disposable Kubernetes capacity. + +Operational lessons now encoded in Jeannie: + +- Preserve two guest CPUs per Pimox VM. The Orange Pi 5 Plus has mixed core + classes, so the VMs are pinned to the big-core CPU set with a Proxmox hook + script instead of shrinking workers to one Kubernetes CPU. +- Treat VM disks as rebuildable. Durable application data belongs on retained + OpenEBS paths, host-level `/data`, or backups, not inside an untracked VM root + disk. +- Use the Debian LAN IP as the registry endpoint, even when the registry pod + runs on a Pimox worker. Jeannie configures containerd 2.x registry trust on + workers so image pulls survive pod movement. +- Rebuilt worker IPs can change SSH host keys. Jeannie refreshes known-host + state and waits for guest SSH/qemu-agent readiness instead of assuming a VM is + reachable immediately after `qm start`. +- Image filesystem pressure on small VM roots can evict registry or website + pods. App deploys include deterministic stale-pod and unused image cleanup + rather than relying on manual `kubectl delete` or node shell history. + ## Prerequisites On the Debian host: @@ -6169,4 +6212,3 @@ Operational runbooks: - [Edge failures](docs/runbooks/edge-failures.md) - [Gitea failures](docs/runbooks/gitea-failures.md) - [Cluster stop/start failures](docs/runbooks/cluster-stop-start-failures.md) - diff --git a/docs/service-catalog.md b/docs/service-catalog.md index 3556ef8..012965f 100644 --- a/docs/service-catalog.md +++ b/docs/service-catalog.md @@ -31,6 +31,7 @@ Update `homelab.yml`, then run `scripts/render-service-catalog`. | Provisioning PXE/HTTP | debian (control-plane, 192.168.100.73) | OpenTofu / bootstrap/provisioning | [local](http://192.168.100.73:8088/) | | `bootstrap/provisioning/README.md` | | PXE Rescue Toolkit | debian (control-plane, 192.168.100.73) | OpenTofu / bootstrap/provisioning | [local](http://192.168.100.73:8088/rescue/) | | `bootstrap/provisioning/README.md` | | Ollama | debian (control-plane, 192.168.100.73) | Local Debian service | [local](http://192.168.100.73:11434) | | `apps/website/ollama/README.md` | +| AI Stack / OmniRoute | debian (control-plane, 192.168.100.73) | Docker Compose / jeannie deploy-ai-stack | [local](http://192.168.100.73:20128/) | | `docs/ai-ops.md` | | OCI Edge | oci_edge | OpenTofu / bootstrap/edge | `/opt/homelab-edge` | [public](https://lab2025.duckdns.org) | `docs/runbooks/edge-failures.md` | | Heimdall | debian (control-plane, 192.168.100.73) | Docker Compose / jeannie deploy-heimdall | [local](http://192.168.100.73:8082/) | [public](https://heimdall.lab2025.duckdns.org/) | `infra/heimdall/README.md` | | n8n | Kubernetes | Argo CD / apps/n8n | [local](http://192.168.100.240/) | [public](https://n8n.lab2025.duckdns.org/) | `apps/n8n/` | diff --git a/docs/templates/ai-ops.md.tmpl b/docs/templates/ai-ops.md.tmpl index ad53673..10602eb 100644 --- a/docs/templates/ai-ops.md.tmpl +++ b/docs/templates/ai-ops.md.tmpl @@ -11,6 +11,55 @@ AI/RAG, data-heavy utilities, or cases where an existing Python ecosystem is the clear fit. New repo features should choose the smallest language that fits the task instead of defaulting to Bash. +## Debian-Hosted AI Stack + +The current AI stack is part of the Debian operations layer, not the Kubernetes +workload layer. That is deliberate: if the Pimox workers or Kubernetes control +plane are unhealthy, the triage tools still need to be available from the host +that runs Jeannie. + +The split is: + +- OmniRoute runs in Docker Compose under `/data/homelab-ai-stack` and exposes an + OpenAI-compatible endpoint on the Debian host. +- `deploy-ai-stack` seeds local OpenRouter and NVIDIA keys when present, + creates the no-auth/free provider connections, validates real chat + completions, rejects stale routes, and writes + `/data/homelab-ai-stack/models.env`. +- `deploy-ai-tools` keeps `goose`, `holmes`, and `hermes` as bare-metal tools + and generates wrapper commands (`jeannie-goose`, `jeannie-holmes`, + `jeannie-hermes`) plus `/data/homelab-ai-stack/ai-tools.env`. +- `ai-check` verifies the knowledge index, wrappers, OmniRoute endpoint, and + validated model route hints before Jeannie relies on them. +- Ollama remains on Debian for single-purpose local tasks such as translation + cache misses, but Holmes agentic Kubernetes triage should use the + OmniRoute-backed routes. + +Bootstrap and validation from the Debian server: + +```bash +./{{ main_script }} deploy-ai-stack +./{{ main_script }} deploy-ai-tools +./{{ main_script }} ai-check +``` + +## Holmes-Assisted Kubernetes Doctor + +`doctor-k8s` is the first integration point between deterministic Jeannie +doctors and the AI stack. It collects read-only Kubernetes evidence, writes an +artifact directory under `~/.local/share/homelab/doctor-k8s`, and asks Holmes +for triage through the OmniRoute route selected in `models.env`. + +```bash +./{{ main_script }} doctor-k8s +./{{ main_script }} doctor-k8s --no-holmes +``` + +The AI output is advisory. Jeannie keeps remediation deterministic: fixes must +map to explicit heal/runbook commands, self-heal allowlists, or human-reviewed +pipeline changes. This keeps the diagnostic layer read-only while still using +Holmes to summarize likely root cause, impact, and next action. + ## Version Discipline The lab should converge on one Kubernetes minor across the API server and every @@ -15319,4 +15368,3 @@ tool-correctness signals over time: ``` Use `--live` only when Ollama is available. - diff --git a/docs/templates/app-ops.md.tmpl b/docs/templates/app-ops.md.tmpl index 60b958d..8ff0b68 100644 --- a/docs/templates/app-ops.md.tmpl +++ b/docs/templates/app-ops.md.tmpl @@ -26,6 +26,19 @@ definition lives under `infra/arr-stack` and stores persistent data under `/data/arr`. Historical Kubernetes manifests are archived under `archive/apps/arr-stack` for migration reference only. +The AI operations stack is also host-level. OmniRoute runs from +`/data/homelab-ai-stack` with Docker Compose, while `goose`, `holmes`, `hermes`, +Ollama, Jeannie doctors, and the generated wrappers stay on the Debian host. +Keep it outside Kubernetes so `doctor-k8s` and recovery workflows still work +when Pimox workers or cluster networking are the thing being investigated. + +```bash +./{{ main_script }} deploy-ai-stack +./{{ main_script }} deploy-ai-tools +./{{ main_script }} ai-check +./{{ main_script }} doctor-k8s +``` + ## Storage OpenEBS provides the platform storage provisioner. Stateful Kubernetes apps use diff --git a/docs/templates/architecture.md.tmpl b/docs/templates/architecture.md.tmpl index 6dc83fe..c8d6583 100644 --- a/docs/templates/architecture.md.tmpl +++ b/docs/templates/architecture.md.tmpl @@ -4,8 +4,13 @@ The lab is intentionally small but production-shaped: -- a Debian amd64 host runs the kubeadm control plane and local deployment tools -- a Raspberry Pi arm64 node runs selected workloads +- Debian remains the always-on operations host for Jeannie, Docker builds, + external Gitea, the GitOps mirror, the local registry endpoint, Ollama, + OmniRoute, and AI tool wrappers +- Kubernetes capacity now comes from Pimox Debian arm64 VMs on the Orange Pi 5 + Plus, with one control-plane VM and worker VMs managed as rebuildable capacity +- a Raspberry Pi arm64 host runs selected support services outside the + Kubernetes rebuild blast radius - the Debian host also runs the always-on Gitea Docker service outside Kubernetes - the Debian host keeps a bare GitOps mirror under @@ -16,6 +21,9 @@ The lab is intentionally small but production-shaped: - Argo CD continuously reconciles Kubernetes manifests from this repo - a local registry stores the website and demos images built for the worker architecture +- a Debian-hosted OmniRoute gateway routes Holmes/goose/Hermes AI calls through + validated free/no-auth, OpenRouter, and NVIDIA-backed models while Ollama + remains available for small local tasks - the website image keeps Apache as the public server, uses PHP-FPM with OPcache for dynamic endpoints, and pre-renders read-heavy pages to static HTML during the image build @@ -88,7 +96,17 @@ accidentally modify the cluster. `demos-static`, the `heimdall` route bundle, `n8n`, and `supply-chain-policy` -5. `bootstrap/edge` +5. Debian host services + - keep Gitea, Heimdall, the ARR/media stack, Ollama, and OmniRoute outside + Kubernetes so a cluster rebuild does not remove the tools needed to repair + or redeploy it + - run `deploy-ai-stack` to create the OmniRoute gateway and validated model + routes, then `deploy-ai-tools` to wire goose, Holmes, and Hermes to that + gateway + - use `doctor-k8s` for read-only Kubernetes evidence collection and + Holmes-assisted triage before any deterministic heal/runbook action + +6. `bootstrap/edge` - connects to the OCI jump box - uploads nginx, HAProxy, Varnish, and Squid configs - obtains and renews Let's Encrypt certificates for the configured hostname @@ -96,6 +114,31 @@ accidentally modify the cluster. - enables gzip, HTTP/2, TLS session reuse, client keepalive, upstream keepalive, and cache headers for the public website path +## Pimox Migration Lessons + +The Pimox migration moved Kubernetes workloads away from the old Debian-hosted +cluster shape, but it also clarified what should not move into Kubernetes. +Debian keeps the Git source of truth, build tooling, registry endpoint, AI +gateway, and recovery commands. Pimox VMs provide disposable Kubernetes capacity. + +Operational lessons now encoded in Jeannie: + +- Preserve two guest CPUs per Pimox VM. The Orange Pi 5 Plus has mixed core + classes, so the VMs are pinned to the big-core CPU set with a Proxmox hook + script instead of shrinking workers to one Kubernetes CPU. +- Treat VM disks as rebuildable. Durable application data belongs on retained + OpenEBS paths, host-level `/data`, or backups, not inside an untracked VM root + disk. +- Use the Debian LAN IP as the registry endpoint, even when the registry pod + runs on a Pimox worker. Jeannie configures containerd 2.x registry trust on + workers so image pulls survive pod movement. +- Rebuilt worker IPs can change SSH host keys. Jeannie refreshes known-host + state and waits for guest SSH/qemu-agent readiness instead of assuming a VM is + reachable immediately after `qm start`. +- Image filesystem pressure on small VM roots can evict registry or website + pods. App deploys include deterministic stale-pod and unused image cleanup + rather than relying on manual `kubectl delete` or node shell history. + ## Prerequisites On the Debian host: @@ -6169,4 +6212,3 @@ Operational runbooks: - [Edge failures](docs/runbooks/edge-failures.md) - [Gitea failures](docs/runbooks/gitea-failures.md) - [Cluster stop/start failures](docs/runbooks/cluster-stop-start-failures.md) - diff --git a/scripts/render-service-catalog b/scripts/render-service-catalog index b38bba9..d83fe6a 100755 --- a/scripts/render-service-catalog +++ b/scripts/render-service-catalog @@ -200,6 +200,14 @@ def service_rows(values: dict[str, object]) -> list[dict[str, str]]: "public": "", "docs": "apps/website/ollama/README.md", }, + { + "name": "AI Stack / OmniRoute", + "host": value(values, "services.ai_stack.host", "debian"), + "managed_by": "Docker Compose / jeannie deploy-ai-stack", + "local": f"http://{host_ip(values, value(values, 'services.ai_stack.host', 'debian'))}:{value(values, 'services.ai_stack.port', '20128')}/", + "public": "", + "docs": "docs/ai-ops.md", + }, { "name": "OCI Edge", "host": "oci_edge",