Phase 8: hardening (startup drift check, audit log viewer, deploy docs, README)
Summary
-
Startup self-check: on boot, compares every
rack_bindings.proxmox_environmentvalue against the currently-configured Proxmox environments and logs a loud warning (not fatal) for any drift — e.g. a rack still bound to a renamed/deleted environment. -
Audit log viewer:
/auditlists every applied Plan (newest first, capped at 200 rows);/audit/{id}shows its actions (kind/before/after/status/error) and the full Plan JSON snapshot. New store queriesListAuditPlans/GetAuditPlanalongside the existingLatestAuditPlanForDevice/ListAuditActions. -
hash-passwordsubcommand: the Makefile already had ahash-passwordtarget, butcmd/raxnever implemented it. Wired it up now (go run ./cmd/rax hash-passwordprompts for a password on stdin, prints its bcrypt hash) — this is how an operator actually generatesLOCAL_ADMIN_PASSWORD_HASH. -
Deployment docs:
docker-compose.ymlnow documents both a host-level Caddy option and a siblingcaddycompose service option; addedCaddyfile.examplefor both. - README: covers config surface, the separate-Rax-Proxmox-tokens deployment prerequisite (Rax needs its own Proxmox API tokens, never the operator's personal ones), local dev, deployment, the audit log, and the startup check.
Test plan
-
gofmt -l .clean -
go build ./... -
go vet ./... -
go test ./...— all packages pass, including new store tests (TestDriftedRackBindingEnvironments,TestAudit_ListAuditPlans_NewestFirst) and web tests (TestAuditLogHandler_ListsPlansNewestFirst,TestAuditPlanDetailHandler_ShowsActions,TestAuditPlanDetailHandler_MissingReturns404)