refactor: remove broken NUT/UPS plugin and managed-NUT startup
The UPS plugin's default driver was snmp-ups, so NUT was just translating network SNMP back into its own protocol — no value over polling the UPS directly through the existing snmp plugin. The managed-NUT entrypoint path also broke container startup when config was incomplete. Deletes nut_setup.py, the NUT block from entrypoint.sh, NUT packages from the Dockerfile, the ups entry from the plugin catalog example, and the ups wiring in alerts METRIC_CATALOG, widgets, settings routes, and the rules form. The plugins/ups source tree (untracked) is also removed from the working copy. Existing ups_* DB tables are orphaned but harmless in dev; a drop migration isn't needed. Follow-up: rebuild "on battery → Ansible shutdown" automation on top of the alerts system as a new action type that runs a playbook. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+3
-47
@@ -1,54 +1,10 @@
|
||||
#!/bin/sh
|
||||
# Roundtable container entrypoint.
|
||||
#
|
||||
# When NUT_MANAGED=1:
|
||||
# - Generates /etc/nut/*.conf from environment variables
|
||||
# - Starts NUT driver (upsdrvctl) and network daemon (upsd)
|
||||
# - Connects to the UPS over the network — no USB passthrough required
|
||||
# - Then drops to 'app' user via gosu to run roundtable
|
||||
#
|
||||
# When NUT_MANAGED=0 (default):
|
||||
# - Drops directly to 'app' user and runs the command
|
||||
#
|
||||
# Required env vars when NUT_MANAGED=1:
|
||||
# NUT_UPS_HOST IP or hostname of the UPS management card (required)
|
||||
# NUT_DRIVER NUT driver — snmp-ups (default) or netxml-ups for Eaton
|
||||
# NUT_UPS_NAME UPS name in NUT (default: ups) — must match UPS plugin setting
|
||||
# NUT_SNMP_COMMUNITY SNMP community string (default: public) [snmp-ups only]
|
||||
# NUT_SNMP_VERSION SNMP version: v1, v2c (default: v1) [snmp-ups only]
|
||||
# NUT_USERNAME Optional upsd auth username
|
||||
# NUT_PASSWORD Optional upsd auth password
|
||||
# Drops from root to the 'app' user via gosu, then runs the command.
|
||||
# The container starts as root only so /data permissions can be fixed up
|
||||
# if needed before handing off to the unprivileged user.
|
||||
|
||||
set -e
|
||||
|
||||
NUT_MANAGED_JSON="/data/nut_managed.json"
|
||||
|
||||
if [ "${NUT_MANAGED:-0}" = "1" ] || [ -f "$NUT_MANAGED_JSON" ]; then
|
||||
NUT_OK=1
|
||||
if [ -f "$NUT_MANAGED_JSON" ]; then
|
||||
echo "[entrypoint] Found $NUT_MANAGED_JSON — configuring NUT from settings..."
|
||||
python3 /app/roundtable/nut_setup.py --from-file "$NUT_MANAGED_JSON" || {
|
||||
echo "[entrypoint] Warning: NUT config failed — UPS host may not be set yet. Skipping NUT startup."
|
||||
NUT_OK=0
|
||||
}
|
||||
else
|
||||
echo "[entrypoint] NUT_MANAGED=1 — configuring NUT from environment..."
|
||||
python3 /app/roundtable/nut_setup.py || {
|
||||
echo "[entrypoint] Warning: NUT config failed — check NUT_UPS_HOST. Skipping NUT startup."
|
||||
NUT_OK=0
|
||||
}
|
||||
fi
|
||||
|
||||
if [ "$NUT_OK" = "1" ]; then
|
||||
echo "[entrypoint] Starting NUT driver..."
|
||||
/sbin/upsdrvctl start || echo "[entrypoint] Warning: upsdrvctl returned non-zero"
|
||||
|
||||
echo "[entrypoint] Starting NUT daemon..."
|
||||
/sbin/upsd || echo "[entrypoint] Warning: upsd returned non-zero"
|
||||
|
||||
sleep 1
|
||||
echo "[entrypoint] NUT ready on 127.0.0.1:3493."
|
||||
fi
|
||||
fi
|
||||
|
||||
exec gosu app "$@"
|
||||
|
||||
Reference in New Issue
Block a user