release 1.7.1: host-agent fails when public pages down

This commit is contained in:
Hernâni Marques 2026-07-19 00:52:56 +02:00
parent 4a4a9cd0ad
commit 2e3dd6c686
No known key found for this signature in database
GPG key ID: CB5738652768F7E9
5 changed files with 69 additions and 31 deletions

View file

@ -9,6 +9,7 @@
# 4) always write HTML (first run / empty staging too) + Forgejo commit link
# 5) rsync to DEPLOY_WWW_ROOT (ERROR if not writable — v1.3.1)
# 6) monpages post-check: public FQDN must serve monitoring HTML
# 7) exit code: STRICT_EXIT default 1 (v1.7.1) — unit fails if publish/public pages fail
#
# Configure via env file (not in git):
# ${XDG_CONFIG_HOME:-$HOME/.config}/taler-monitoring/env
@ -412,19 +413,38 @@ else
fi
# Post-publish: verify this job's pages via FQDN (same paths as monpages phase)
_monpages_failed=0
if [ "${MONPAGES_POSTCHECK:-1}" = "1" ] && [ -x "$ROOT/check_monitoring_pages.sh" ]; then
echo "--- monpages post-check (public FQDN) ---"
export MON_HOSTS HTML_URL_OK HTML_URL_ERR TALER_DOMAIN
export MON_HOSTS HTML_URL_OK HTML_URL_ERR TALER_DOMAIN HTML_OUT HTML_BASE
export MONPAGES_STAGING_BASE="${HTML_BASE}"
if ! bash "$ROOT/check_monitoring_pages.sh"; then
echo "ERROR: public monitoring page(s) missing or not suite HTML via FQDN" >&2
echo " staging HTML_OUT=${HTML_BASE} · DEPLOY_WWW=${DEPLOY_WWW:-}" >&2
ec=1
_monpages_failed=1
fi
fi
# If public check failed after first HTML write, rewrite pages so sticky bar shows monpages ERRORs
if [ "$_monpages_failed" = "1" ]; then
echo "--- re-htmlify after monpages failure (include public outage in report) ---"
# append marker to log so converter sees ERROR lines if monpages was post-only
{
echo ""
echo "ERROR monpages: public FQDN monitoring HTML missing or merchant JSON code 21"
echo "ERROR monpages: fix with sudo ~/koopa-caddy/apply-monitoring-live.sh (www + Caddy handles)"
} >>"$LOG"
for host in $MON_HOSTS; do
htmlify_host "$host"
done
fi
ls -1t "$LOG_DIR"/run-*.log 2>/dev/null | tail -n +30 | xargs rm -f 2>/dev/null || true
echo "======== done ec=$ec · log=$LOG · ${COMMIT_URL:-} ========"
if [ "${STRICT_EXIT:-0}" = "1" ]; then
# v1.7.1: default STRICT_EXIT=1 so systemd/timer reflects publish/public failures
if [ "${STRICT_EXIT:-1}" = "1" ]; then
exit "$ec"
fi
exit 0