my-homelab-configs/apps/opsproof/README.md

8.1 KiB

OpsProof

OpsProof is an evidence-first operations workspace built on top of Jeannie. It turns the homelab's existing status, Doctor, incident, and change-journal data into a reviewable workflow:

  1. show desired and observed state together;
  2. preserve the commands and output that support a diagnosis;
  3. explain the likely root cause without treating AI output as evidence;
  4. propose an allowlisted Jeannie mitigation with risk and rollback context;
  5. require an explicit operator approval before a state-changing request;
  6. validate the result and produce a reusable incident report.

Technology decision

The UI will use Laravel Go with Inertia, React, and TypeScript. Laravel Go fits the repository's existing Go services and produces a single deployable binary while still providing a modern client UI. Laravel Rust was considered, but it would add a second systems language without improving the first OpsProof use cases.

Laravel Go is currently beta and requires Go 1.27 or newer. OpsProof therefore lives in its own module and deployment boundary. The UI must depend on the stable OpsProof/Jeannie HTTP contract rather than importing Jeannie internals, so the framework can be upgraded or replaced without changing remediation authority.

The application will run on Debian, outside Kubernetes. It must remain usable when the cluster is the component being diagnosed.

The Debian installation is owned by the Jeannie pipeline:

./jeannie deploy-opsproof

The command starts a dedicated, persistent PostgreSQL container, downloads a checksum-pinned Go 1.27 toolchain into the OpsProof data directory, checks out an exact Laravel Go starter commit, normalizes the UI overlay with that starter's pinned formatter, runs its frontend checks and build, runs the Go feature tests against PostgreSQL, builds the binary, applies database migrations, installs a hardened systemd unit, and verifies /up. Database credentials are generated once and retained in the private OpsProof data directory. Jeannie resolves the database account's UID and GID from the image before preparing the bind mount, so it does not depend on a host-specific numeric account. The single OpsProof process uses Laravel Go's supported in-memory cache and session stores; durable application records remain in PostgreSQL. A successful redeployment explicitly restarts the systemd service so updated listen addresses and other environment values take effect. It does not replace Debian's system Go.

The landing page collects status all --json through the authenticated Jeannie API on the server side. Browser props contain only the status, area, check, and summary fields; the bearer token and raw diagnostic details remain on Debian. If the API, token, execution, or JSON contract is unavailable, OpsProof fails closed and labels the overview unavailable instead of presenting stale data as current. The authenticated workspace makes this boundary visible with connection state, the read operation, and evidence time without revealing the endpoint or token. Warning and failing checks show a read-only focused Doctor command but cannot submit it.

Unhealthy Kubernetes applications link to /incidents/cluster/{application}. The incident page runs the exact focused Doctor target with --json, assigns stable evidence IDs to the returned rows, and presents bounded command-output excerpts, observed state, missing evidence, and root-cause hypotheses. Route input is restricted to Kubernetes application names and cannot become arbitrary Jeannie arguments.

For warning or failing evidence, the same page now builds a proposal-only view model tied to the Doctor execution and evidence IDs. It shows the exact focused Jeannie/Holmes action, preconditions, risk, deterministic validation, and the absence of a target-specific rollback. It cannot become durable until an authenticated operator supplies that rollback procedure.

Operator mode uses a dedicated Dex OAuth client through Laravel Go's social provider support. The authorization-code flow uses PKCE and server-side sessions. /login presents the operator boundary before /auth/dex starts the external authorization flow. Only verified identities in LAB_OPSPROOF_OPERATOR_EMAILS may sign in; when the variable is omitted, the pipeline defaults to the committed Dex user identity. Incident and future mutation routes require both authentication and current membership in that allowlist. The overview remains a read-only landing page.

An authenticated operator may convert current incident evidence into a durable proposal only after supplying a rollback procedure. PostgreSQL stores the proposal, its evidence hash, exact command and arguments, risk, creator, and a separate one-time approval record. Approval requires a deliberate review confirmation, reruns Doctor, requires an exact evidence-hash match, checks Jeannie's advertised command allowlist, and validates the fixed argument shape. Approval records the decision but does not execute it.

After an execution reaches a terminal state, OpsProof automatically runs the same focused Doctor target again. It retains the before/after evidence and bounded execution output in a durable incident report with findings, diagnostic, Five Whys, mitigation, validation, and recommendation sections. Failed or incomplete validation is recorded explicitly instead of being shown as a successful repair.

/demo is an unauthenticated portfolio surface backed only by a compiled, sanitized fixture. It does not construct a Jeannie client and has no approval or execution controls. The canonical application URL is https://opsproof.lab2025.duckdns.org/; unauthenticated root requests redirect to the fixture. The OCI edge publishes only the fixture, build assets, and the explicit Dex/operator route families. Incident data and mutations still require both a valid Dex session and current operator allowlist membership.

Security boundary

OpsProof is not a shell console.

  • Read operations consume structured data from authenticated Jeannie API endpoints.
  • Mutations submit only commands advertised by Jeannie's allowlist.
  • A proposal and an approval are separate records.
  • The server revalidates command, arguments, current evidence, and operator identity at execution time.
  • Secrets and raw bearer tokens are never sent to browser props or reports.
  • Every proposal, approval, execution, validation, and report is auditable.
  • Public portfolio mode uses sanitized fixtures and cannot reach the execution API.

Delivery slices

Each slice should be a small, independently testable commit:

  1. architecture decision and API contract;
  2. Laravel Go/Inertia application shell and health page;
  3. read-only homelab overview backed by Jeannie status;
  4. incident evidence page backed by Doctor output (implemented for Kubernetes applications);
  5. remediation proposal with risk and rollback details (implemented as a blocked, non-executable proposal);
  6. Dex login and operator authorization (implemented);
  7. approval-gated execution and live progress (implemented);
  8. post-change validation and incident report (implemented);
  9. sanitized public demo mode and portfolio link (implemented).

Initial demonstration

The first complete scenario will model the Orange Pi K3s storage incident:

  • desired state: the pinned SSD is mounted read-write and K3s is active;
  • observed state: a stale read-only mount refers to a disappeared device;
  • evidence: service state, mount identity, block-device inventory, and kernel filesystem errors;
  • proposal: the existing guarded doctor opi5 --repair-k3s path;
  • validation: pinned cluster identity, node readiness, and application health;
  • report: findings, diagnosis, 5 Whys, mitigation, and validation evidence.

The public demo now presents a sanitized fixture of this completed scenario, including bounded evidence, the approval-gated repair, rollback boundary, post-change validation, Five Whys, and a prevention recommendation. It never connects to Jeannie or exposes private infrastructure data.

This scenario is valuable to a prospective client because it demonstrates diagnosis, safety design, AI-assisted reasoning, infrastructure automation, observability, and a verified operational outcome rather than a chat demo.