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

94 lines
4.2 KiB
Markdown

# 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:
```bash
./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. It does not replace Debian's system Go.
## 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.