diff --git a/apps/opsproof/README.md b/apps/opsproof/README.md new file mode 100644 index 0000000..5c9bb79 --- /dev/null +++ b/apps/opsproof/README.md @@ -0,0 +1,74 @@ +# 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. + +## 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; +5. remediation proposal with risk and rollback details; +6. Dex login and operator authorization; +7. approval-gated execution and live progress; +8. post-change validation and incident report; +9. sanitized public demo mode and portfolio link. + +## 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. + +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. diff --git a/docs/opsproof-architecture.md b/docs/opsproof-architecture.md new file mode 100644 index 0000000..4237ce7 --- /dev/null +++ b/docs/opsproof-architecture.md @@ -0,0 +1,80 @@ +# OpsProof architecture + +## Decision + +Use Laravel Go as the OpsProof web application, with Inertia, React, and +TypeScript for the browser experience. Deploy it as an independent Debian +service and keep Jeannie as the sole remediation authority. + +Laravel Go and Laravel Rust both provide a compiled full-stack Laravel runtime, +Inertia support, and OpenTelemetry. Laravel Go is the better fit here because: + +- Jeannie's API and workflow worker are already written in Go; +- Go's fast compile cycle is useful while Laravel's new runtimes are in beta; +- the application is primarily an orchestration and evidence UI, not a + CPU-bound component that benefits materially from Rust's additional + performance; +- one systems language reduces maintenance and makes the portfolio story more + coherent. + +This is a reversible decision. Laravel Go remains behind an HTTP boundary and +must not be imported into the root Go module. + +## Component boundaries + +```text +browser + | + | Inertia pages and form submissions + v +OpsProof on Debian + |-- session, Dex identity, authorization + |-- incident/proposal/audit records + |-- redaction and public-demo projection + | + | authenticated structured requests + v +Jeannie API on Debian + |-- command allowlist + |-- status and Doctor evidence + |-- execution tracking + |-- Temporal-backed long operations + v +homelab targets (Debian, OCI, RPi, Orange Pi, Kubernetes) +``` + +OpsProof may link to Grafana, Loki, Tempo, and change-journal artifacts, but +their data does not grant execution authority. AI explanations must cite the +evidence identifiers supplied to the model and remain visibly unverified until +confirmed by deterministic validation. + +## Deployment constraints + +- Run on Debian so a Kubernetes outage does not remove the incident UI. +- Build with a pinned Laravel Go dependency and Go 1.27 or newer. +- Publish a health endpoint independently from Jeannie health. +- Send Laravel Go's OpenTelemetry traces to the existing Debian monitoring + stack. +- Store the Jeannie bearer token server-side only. +- Use Dex OIDC for operator mode; never expose operator actions in public demo + mode. +- Fail closed when Jeannie is unreachable or its advertised command surface + differs from the proposal. + +## Why not Laravel Rust now? + +Laravel Rust is a credible future option, particularly for a high-throughput or +memory-constrained product. OpsProof's latency is dominated by remote checks, +Doctor analysis, and remediation workflows. Rust would not improve those paths +enough to justify another toolchain in the first version. A later comparison +can implement the same read-only overview against the stable contract and +measure build time, binary size, memory, and request throughput. + +## Non-goals for the first version + +- arbitrary shell execution; +- autonomous remediation without operator approval; +- replacing Jeannie, Holmes, Temporal, or Argo CD; +- storing raw infrastructure secrets in the UI database; +- making Kubernetes a runtime dependency for OpsProof availability; +- presenting sanitized portfolio fixtures as live production data.