Commit Graph

4826 Commits

Author SHA1 Message Date
rcourtman
0565781655 feat(sensor-proxy): Phase 2 - atomic config management with CLI
Implements bullet-proof configuration management to completely eliminate
allowed_nodes corruption by design. This builds on Phase 1 (file-only mode)
by replacing all shell/Python config manipulation with proper Go tooling.

**New Features:**
- `pulse-sensor-proxy config validate` - parse and validate config files
- `pulse-sensor-proxy config set-allowed-nodes` - atomic node list updates
- File locking via flock prevents concurrent write races
- Atomic writes (temp file + rename) ensure consistency
- systemd ExecStartPre validation prevents startup with bad config

**Architectural Changes:**
1. Installer now calls config CLI instead of embedded Python/shell scripts
2. All config mutations go through single authoritative writer
3. Deduplication and normalization handled in Go (reuses existing logic)
4. Sanitizer kept as noisy failsafe (warns if corruption still occurs)

**Implementation Details:**
- New cmd/pulse-sensor-proxy/config_cmd.go with cobra commands
- withLockedFile() wrapper ensures exclusive access
- atomicWriteFile() uses temp + rename pattern
- Installer update_allowed_nodes() simplified to CLI calls
- Both systemd service modes include ExecStartPre validation

**Why This Works:**
- Single code path for all writes (no shell/Python divergence)
- File locking serializes self-heal timer + manual installer runs
- Validation gate prevents proxy from starting with corrupt config
- CLI uses same YAML parser as the daemon (guaranteed compatibility)

**Phase 2 Benefits:**
- Corruption impossible by design (not just detected and fixed)
- No more Python dependency for config management
- Atomic operations prevent partial writes
- Clear error messages on validation failures

The defensive sanitizer remains active but now logs loudly if triggered,
allowing us to confirm Phase 2 eliminates corruption in production before
removing the safety net entirely.

This completes the fix for the recurring temperature monitoring outages.

Related to Phase 1 commit 53dec6010
2025-11-19 09:37:49 +00:00
rcourtman
5f4143f0ab fix(sensor-proxy): eliminate allowed_nodes config corruption
Phase 1 hotfix to address recurring config file corruption that causes
99% of temperature monitoring failures. The root cause was the installer
oscillating between inline and file-based allowlist modes, creating
duplicate `allowed_nodes:` keys in config.yaml.

Changes:
- Force file-based allowlist mode exclusively (refuse versions < v4.31.1)
- Add automatic migration from inline to file-based config
- Remove inline mode code path from update_allowed_nodes()
- Migration runs on every install/self-heal to clean up existing corruption

The self-heal timer runs every 5 minutes and was the primary source of
corruption when version detection failed or encountered edge cases.

This eliminates the dual code paths and ensures config.yaml is never
edited for allowlist changes - only /etc/pulse-sensor-proxy/allowed_nodes.yaml
is modified.

Phase 2 (next release) will implement proper Go-based config management
with atomic writes, locking, and systemd validation to prevent corruption
by design.

Related to recurring temperature monitoring outages
2025-11-19 09:21:54 +00:00
rcourtman
45a8cf68ac fix(hostmetrics): dedupe ZFS pools for usable storage
Related to #718
2025-11-18 23:38:11 +00:00
rcourtman
ce0fb90182 feat: avoid redundant PBS snapshot polling (Related to #717) 2025-11-18 23:10:43 +00:00
rcourtman
15d32adb10 feat: surface LXC mountpoints in UI (related to #715) 2025-11-18 22:57:20 +00:00
rcourtman
6e77c4dbea fix: sanitize sensor proxy config during self-heal
Related to #714.
2025-11-18 22:51:40 +00:00
rcourtman
51744d22c8 fix: update js-yaml to address CVE-2025-64718 prototype pollution vulnerability 2025-11-18 22:50:07 +00:00
rcourtman
3c7bfd1a1c Fix node modal form reset when toggling temperature (#713) 2025-11-18 22:28:49 +00:00
rcourtman
9ea509ea8b Improve host agent binary handling and docker installer purge (Related to #693) 2025-11-18 22:11:44 +00:00
rcourtman
51b368ddc1 feat: make PVE polling interval configurable (related to #467) 2025-11-18 21:30:04 +00:00
rcourtman
b474a77b65 Add direct node fallback for storage polling 2025-11-18 19:58:38 +00:00
rcourtman
509e87ca35 Sanitize duplicate allowed_nodes blocks 2025-11-18 19:33:26 +00:00
rcourtman
a03f8115b6 Improve installer temperature proxy and backup polling 2025-11-18 18:42:33 +00:00
rcourtman
9d34327dbe Don't disable storages when cluster metadata omits flags 2025-11-18 17:18:23 +00:00
rcourtman
a9e751d165 Allow PBS backup poll to finish after poller returns 2025-11-18 16:55:46 +00:00
rcourtman
9603c48ad5 Gate backups spinner on initial payload only 2025-11-18 16:43:02 +00:00
rcourtman
653c8b6b53 Stop showing indefinite backup spinner with no data 2025-11-18 16:37:10 +00:00
rcourtman
766cbe573e Handle missing storage on cluster nodes 2025-11-18 15:57:29 +00:00
rcourtman
28278aa0cb Deduplicate inline proxy allow list 2025-11-18 14:58:50 +00:00
rcourtman
c176f9eb51 Document proxy control-plane refresh 2025-11-18 14:31:08 +00:00
rcourtman
1abff55feb Improve temperature proxy detection 2025-11-18 14:25:09 +00:00
rcourtman
9d6f32a56d Include control-plane allow list in proxy config 2025-11-18 10:42:13 +00:00
rcourtman
5411f809bf Allow temperature proxy to authorize standalone nodes 2025-11-18 10:30:41 +00:00
rcourtman
c25b6f4e94 Fix setup-script tokens and proxy registration timing 2025-11-18 10:22:54 +00:00
rcourtman
23d194128d Skip inactive storages during content scans 2025-11-18 09:46:48 +00:00
rcourtman
50f8b76921 Fix auto-registration token parsing and hostname 2025-11-18 09:10:03 +00:00
rcourtman
13daa61d1d Harden turnkey install and proxy auto-registration 2025-11-18 00:24:50 +00:00
rcourtman
2eaeccac44 Avoid blocking self-heal start during install 2025-11-17 23:14:51 +00:00
rcourtman
c4ce9a71c0 Break self-heal recursion when proxy unregistered 2025-11-17 23:01:57 +00:00
rcourtman
2f74ff985a Fix inline allowed_nodes cleanup 2025-11-17 22:50:25 +00:00
rcourtman
fb1e44300b Refresh container sensor proxy installer 2025-11-17 22:41:17 +00:00
rcourtman
3fe6b4fe9b Improve temp proxy install UX 2025-11-17 22:30:32 +00:00
rcourtman
b80242a571 Restore pending control-plane helpers 2025-11-17 22:04:30 +00:00
rcourtman
99ab7171e7 Fix pending control-plane helpers 2025-11-17 22:01:11 +00:00
rcourtman
825e9e75ab Speed up proxy self-heal reconciliation 2025-11-17 21:56:21 +00:00
rcourtman
ca4c570fa1 Add automatic control-plane reconciliation 2025-11-17 21:55:47 +00:00
rcourtman
fea8380444 Improve sensor proxy installer compatibility 2025-11-17 21:38:28 +00:00
rcourtman
8cc725e8e0 Fix proxy install summary and allowed_nodes cleanup 2025-11-17 14:38:01 +00:00
rcourtman
7f248e7ba9 Fix proxy UI type errors 2025-11-17 14:35:32 +00:00
rcourtman
f9341ae1fc Improve temperature proxy workflow 2025-11-17 14:25:46 +00:00
rcourtman
eca1f272ca Move allowed_nodes to managed file 2025-11-16 10:06:58 +00:00
rcourtman
48b5bc5489 Auto-deploy proxy for standalone temp monitoring 2025-11-16 09:47:07 +00:00
rcourtman
f4794b1993 Set initialDataReceived on first websocket payload 2025-11-16 00:03:04 +00:00
rcourtman
398e9ee653 Tie backup loading state to initial data flag 2025-11-15 23:46:20 +00:00
rcourtman
55922bb36a Gate backups spinner on websocket connection 2025-11-15 23:41:38 +00:00
rcourtman
1c47a07f14 Stop backup page spinner after first state update 2025-11-15 23:31:36 +00:00
rcourtman
c1b490b11f Fix backup UX and proxy config dedupe 2025-11-15 23:26:44 +00:00
rcourtman
326f0a6d07 Fix allowed_nodes sanitizer indentation handling 2025-11-15 22:42:08 +00:00
rcourtman
00916e189c Rewrite proxy allowed_nodes sanitizer 2025-11-15 22:34:29 +00:00
rcourtman
a236d308d3 Gracefully handle missing PVE instance during proxy registration 2025-11-15 22:25:50 +00:00