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

@ -11,6 +11,8 @@
# MONITORING_PAGE_URLS optional full URL list (overrides host+path construction)
# MONPAGES_EXTRA_URLS additional absolute URLs (space-separated)
# TIMEOUT curl timeout (from lib.sh)
# MONPAGES_STAGING_BASE / HTML_OUT optional staging root for diagnosis
# HTML_OK_DIR staging subdir (default monitoring)
#
set -euo pipefail
ROOT=$(cd "$(dirname "$0")" && pwd)
@ -171,8 +173,25 @@ for u in "${URLS[@]}"; do
done
if [ "$ec" -ne 0 ]; then
echo " hint: HTML may exist only under ~/monitoring-sites-staging; public needs"
echo " writable DEPLOY_WWW_ROOT + Caddy handles (sudo ~/koopa-caddy/apply-monitoring-live.sh)"
echo " hint: public pages down (merchant JSON code 21 = Caddy has no /monitoring* handles)"
echo " fix on stack host: sudo ~/koopa-caddy/apply-monitoring-live.sh"
# Staging vs public diagnosis (host-agent sets MONPAGES_STAGING_BASE / HTML_OUT)
_stg="${MONPAGES_STAGING_BASE:-${HTML_OUT:-${HTML_BASE:-$HOME/monitoring-sites-staging}}}"
_ok_dir="${HTML_OK_DIR:-monitoring}"
if [ -n "${MON_HOSTS:-}" ] && [ -n "$_stg" ]; then
for _h in $MON_HOSTS; do
_f="$_stg/$_h/${_ok_dir}/index.html"
if [ -f "$_f" ]; then
echo " staging OK: $_f ($(wc -c <"$_f" | tr -d " ") bytes) — not published/served"
else
echo " staging missing: $_f"
fi
done
fi
_www="${DEPLOY_WWW_ROOT:-/var/www/monitoring-sites}"
if [ -e "$_www" ] && [ ! -w "$_www" ]; then
echo " DEPLOY_WWW_ROOT=$_www not writable by $(id -un 2>/dev/null || echo user)"
fi
fi
exit "$ec"