feat: add auto-update with --no-auto-update flag

Collector now checks for updates at startup (after 30s) and every 6h.
When a newer version is detected via the /collector/release/latest endpoint,
it downloads the new binary, atomically replaces itself, then re-execs
in-place so the service manager sees no interruption.

Auto-update is enabled by default; pass --no-auto-update to disable.
Version is injected at build time via -ldflags for release builds.
This commit is contained in:
Joel Male
2026-02-25 14:36:42 +10:00
parent 4aa08d0ef4
commit c2241e8d87
2 changed files with 191 additions and 17 deletions
+5 -2
View File
@@ -1,4 +1,7 @@
#!/bin/bash
set -e
go build -o pulsewise-collector .
echo "Built: pulsewise-collector"
VERSION="${VERSION:-0.1.0}"
go build -ldflags "-X main.version=${VERSION}" -o pulsewise-collector .
echo "Built: pulsewise-collector (v${VERSION})"