LibrePortal/scripts/cli/commands/system/cli_system_header.sh
librelad 2d1e4aa98f feat(health): self-healing control-plane watchdog + crash-loop failure cap
An offline trivy install crash-looped (server FATALs when it can't fetch the
vuln DB), and on rootless docker the restart storm churned the shared network's
port-forwarder until the WebUI's own published host port was torn down — the
WebUI stayed healthy INSIDE its container but was unreachable from the host, with
nothing detecting or healing it.

Three fixes, in the house self-healing style (mirrors the network-drift trio):

1. Control-plane health checker wired into the existing task-processor idle poll
   (maybeRegenPoll), no new daemon. dockerHealthScan (read-only) detects daemon
   down, a WebUI running-but-host-port-unreachable (the port-forward corruption),
   and crash-looping containers. webuiSystemHealthCheck writes
   frontend/data/system/health_status.json + self-dispatches a heal — the user
   can't click a button on a dead WebUI, so the poll drives the fix. Frontend
   health-notifier surfaces a topbar badge + dashboard banner + details panel.

2. Failure cap, enforced centrally by dockerHealthHeal (task-gated): stops
   crash-loopers (removing the churn), restarts the WebUI to re-publish a lost
   port forward, and — only if that fails — recycles the rootless daemon and
   restarts the core container. Caps every app immediately, no template churn.

3. Trivy no longer crash-loops offline: the server runs in a shell retry-loop so
   the container stays Up and quietly retries on a backoff instead of exiting
   FATAL. Verified: container stays Up across repeated DB-download failures.
   Core WebUI compose gains restart: unless-stopped so it self-recovers after a
   reboot / daemon recycle instead of staying down.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: librelad <librelad@digitalangels.vip>
2026-07-17 22:03:02 +01:00

22 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# System Commands Header
# Shows available system commands and help information
cliShowSystemHelp()
{
echo ""
echo "Available System Commands:"
echo ""
echo " libreportal system status - Show overall system status"
echo " libreportal system update - Update LibrePortal to latest version"
echo " libreportal system reset - Reinstall LibrePortal install files"
echo " libreportal system reclaim - Reclaim Docker space (build cache + dangling images)"
echo " libreportal system image rm [--force] <ids> - Remove specific images (comma-separated ids)"
echo " libreportal system network check - Re-scan for apps stranded off the docker subnet"
echo " libreportal system network heal [app] - Re-IP stranded apps from the current subnet (ports kept)"
echo " libreportal system health check - Check the rootless docker / WebUI control plane"
echo " libreportal system health heal - Stop crash-loops + repair the WebUI port forward"
echo ""
}