New third producer container (host-poller) owning the server chassis subsystem, separate from the SAS-shelf poller: - services/host_sensors.py: in-band IPMI (ipmitool sdr) for Inlet/Exhaust/etc. + CPU package temps from coretemp hwmon - host_poller.py: own single-instance lock + heartbeat (host_poll keys), restart-storm guard, paced; writes jbod:host_sensors + jbod:host_drives - move host/on-metal drive collection off the SAS poller to host-poller (reads jbod:zfs_map for annotation) - store: generalized lock/meta with a key param; host_sensors + host-poll keys - mqtt_publisher: publish env/CPU/host-drive temps as entities on the hub device (JBOD Monitor) - Dockerfile host-poller target (ipmitool+smartmontools); compose.infra adds host-poller; build.sh gains host-poller/all
47 lines
1.5 KiB
Bash
Executable File
47 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Usage: ./build.sh [poller|web|all] [commit message]
|
|
# web — build/push ONLY the web image (use this for web iterations so the
|
|
# poller image is never rebuilt/repushed)
|
|
# poller— build/push ONLY the poller image (touch deliberately)
|
|
# all — both (default)
|
|
#
|
|
# Deploy pins images by SHA (compose.*.yml ship :latest as a convenience only).
|
|
|
|
REG="docker.adamksmith.xyz"
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
# First arg is the target if it's a known one; otherwise it's treated as the
|
|
# commit message (backward-compatible with `./build.sh "message"`).
|
|
case "${1:-}" in
|
|
poller) TARGETS="poller"; MSG="${2:-Build and push images}" ;;
|
|
host-poller) TARGETS="host-poller"; MSG="${2:-Build and push images}" ;;
|
|
web) TARGETS="web"; MSG="${2:-Build and push images}" ;;
|
|
all|"") TARGETS="poller host-poller web"; MSG="${2:-Build and push images}" ;;
|
|
*) TARGETS="poller host-poller web"; MSG="${1}" ;;
|
|
esac
|
|
TARGET="${TARGETS// /+}"
|
|
|
|
# Stage and commit all changes
|
|
git add -A
|
|
if git diff --cached --quiet; then
|
|
echo "No changes to commit, using HEAD"
|
|
else
|
|
git commit -m "${MSG}"
|
|
fi
|
|
|
|
SHA=$(git rev-parse --short HEAD)
|
|
|
|
for target in ${TARGETS}; do
|
|
img="${REG}/jbod-${target}"
|
|
echo "Building ${img}:${SHA}"
|
|
docker build --target "${target}" -t "${img}:${SHA}" -t "${img}:latest" .
|
|
echo "Pushing ${img}:${SHA}"
|
|
docker push "${img}:${SHA}"
|
|
docker push "${img}:latest"
|
|
done
|
|
|
|
echo "Done (${TARGET}): ${REG}/jbod-{${TARGETS// /,}}:${SHA}"
|