From 2e3dd6c68618ece24c7ef249e82d14947f051cea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hern=C3=A2ni=20Marques?= Date: Sun, 19 Jul 2026 00:52:56 +0200 Subject: [PATCH] release 1.7.1: host-agent fails when public pages down --- VERSION | 2 +- VERSIONS.md | 44 ++++++++++++++--------------------- check_monitoring_pages.sh | 23 ++++++++++++++++-- host-agent/README.md | 7 ++++++ host-agent/run-host-report.sh | 24 +++++++++++++++++-- 5 files changed, 69 insertions(+), 31 deletions(-) diff --git a/VERSION b/VERSION index 9dbb0c0..081af9a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.7.0 \ No newline at end of file +1.7.1 \ No newline at end of file diff --git a/VERSIONS.md b/VERSIONS.md index 2d163d4..8697b90 100644 --- a/VERSIONS.md +++ b/VERSIONS.md @@ -5,7 +5,7 @@ Release history for the standalone **taler-monitoring** suite ## Version scheme -Tags and `VERSION` use **MAJOR.FEATURE.FIX** (three components): +Tags and `VERSION` use **MAJOR.FEATURE.FIX** (three components), introduced in **v1.4.0**: | Part | Meaning | |------|---------| @@ -13,16 +13,18 @@ Tags and `VERSION` use **MAJOR.FEATURE.FIX** (three components): | **FEATURE** | New capabilities (phases, HTML features, i18n packs, …) | | **FIX** | Bugfixes and docs that do not add a feature | -Git tags: `vMAJOR.FEATURE.FIX` (e.g. `v1.7.0`). File `VERSION` omits the `v` prefix. +Git tags: `vMAJOR.FEATURE.FIX` (e.g. `v1.7.1`). File `VERSION` omits the `v` prefix. | Tag | Date (UTC) | Notes | |-----|------------|--------| -| **v1.8.0** | *planned* | **L10n** packs for user-facing strings that need localization: **fr-CH** (FrancPaysan) and **de-CH** (hacktivism / Taler CH German). | -| **v1.7.0** | 2026-07-18 | **CLI version:** `./taler-monitoring.sh --ver` / `--version` / `-V` prints suite version, git commit, branch, and repo/tag/commit URLs. | -| **v1.6.0** | 2026-07-18 | **Mail monitoring:** phase `mail` (`check_mail.sh` + `mail-catalog.conf`) for **firefly** (taler.net, gnunet.org) and **pixel**/TSA (taler-systems.com, mail.anastasis.lu); MX/SMTP/IMAP/SPF/DMARC; host-agent `/taler-monitoring-mail*`. | -| **v1.5.0** | 2026-07-18 | **Mattermost monitoring:** phase `mattermost` (`check_mattermost.sh`) for `mattermost.taler.net` (SPA + `/api/v4/system/ping` + TLS); host-agent HTML `/taler-monitoring-mattermost*`; hourly timer. | -| **v1.4.1** | 2026-07-18 | **Docs/versioning:** canonical tree `~/src/taler-monitoring`; docs use generic ops/outside-runner wording (no client hostnames); tags always **MAJOR.FEATURE.FIX**. | -| **v1.3.4** | 2026-07-18 | Summary i18n, monpages code-21, aptdeploy rsync path. | +| **v1.8.0** | *planned* | **L10n** packs for user-facing strings: **fr-CH** (FrancPaysan) and **de-CH** (hacktivism / Taler CH German). | +| **v1.7.1** | 2026-07-18 | Host-agent default `STRICT_EXIT=1`; monpages staging-vs-public diagnosis; re-htmlify after public check fails. | +| **v1.7.0** | 2026-07-18 | CLI `--ver` / `--version` / `-V`: suite version, git commit, repo/tag/commit URLs. | +| **v1.6.0** | 2026-07-18 | **Mail monitoring:** phase `mail` (firefly + pixel/TSA); MX/SMTP/IMAP/SPF/DMARC; `/taler-monitoring-mail*`. | +| **v1.5.0** | 2026-07-18 | **Mattermost monitoring:** phase `mattermost` for `mattermost.taler.net`; `/taler-monitoring-mattermost*`. | +| **v1.4.1** | 2026-07-18 | Generic docs (no client hostnames); canonical install path `~/src/taler-monitoring`. | +| **v1.4.0** | 2026-07-18 | **MAJOR.FEATURE.FIX** version scheme formalized (three-component tags + `VERSION` file). | +| **v1.3.4** | 2026-07-18 | Summary i18n, monpages code-21 detection, aptdeploy rsync path. | | **v1.3.3** | 2026-07-18 | GIT notes vs GUI notes; monpages in TESTS. | | **v1.3.2** | 2026-07-18 | Suite paths only `~/src/taler-monitoring` (no admin-log suite tree). | | **v1.3.1** | 2026-07-18 | monpages FQDN check + deploy no longer silent-skip. | @@ -31,33 +33,23 @@ Git tags: `vMAJOR.FEATURE.FIX` (e.g. `v1.7.0`). File `VERSION` omits the `v` pre | **v1.1.0** | 2026-07-18 | i18n chrome: English default; French for FrancPaysan. | | **v1.0.0** | 2026-07-18 | Initial standalone release. | -Older short tags (`v1`, `v1.0`, `v1.1`, `v1.2`, `v1.3`) are obsolete; use the three-component tags above. - ## Sticky bar version (v1.3.0+) -Generated HTML shows the installed release tag (e.g. `v1.7.0`) next to the host line. -Clicking opens the tag page on Forgejo: +Generated HTML shows the installed release tag (e.g. `v1.7.1`) and links to Forgejo: `https://git.hacktivism.ch/hernani/taler-monitoring/src/tag/` -Resolved via `git describe --tags` after `update-suite.sh`, with fallback to the `VERSION` file. +Resolved via `git describe --tags` / `VERSION`. ## Public monitoring pages (v1.3.1+) -Host-agent must publish under `DEPLOY_WWW_ROOT` **and** the reverse proxy must `handle` the paths. -If not, public FQDNs return merchant **JSON code 21**. +Publish under `DEPLOY_WWW_ROOT` and Caddy `handle`s. Missing handles → merchant **JSON code 21**. +See koopa-admin-log issue **I-09** / `apply-monitoring-live.sh`. | Check | How | |-------|-----| -| Phase | `./taler-monitoring.sh monpages` (or `pages`) | -| Auto | host-agent default phases include `monpages`; post-check after HTML write | -| URLs | `https://$MON_HOSTS$HTML_URL_OK` | - -On the stack host (e.g. koopa), publish + Caddy handles: - -```bash -sudo ~/koopa-caddy/apply-monitoring-live.sh -``` +| Phase | `./taler-monitoring.sh monpages` | +| CLI version | `./taler-monitoring.sh --ver` | ## Language (v1.2.0+) @@ -67,11 +59,11 @@ sudo ~/koopa-caddy/apply-monitoring-live.sh | Env | `TALER_MON_LANG=en` or `fr` | | Auto | `*lefrancpaysan*` → fr, else en | -Full locale packs (fr-CH / de-CH) are scheduled for **v1.8.0**. +Full locale packs (fr-CH / de-CH): **v1.8.0** (planned). ## Pin a release ```bash git clone https://git.hacktivism.ch/hernani/taler-monitoring.git ~/src/taler-monitoring -cd ~/src/taler-monitoring && git checkout v1.7.0 +cd ~/src/taler-monitoring && git checkout v1.7.1 ``` diff --git a/check_monitoring_pages.sh b/check_monitoring_pages.sh index cbf7f19..9c9656b 100755 --- a/check_monitoring_pages.sh +++ b/check_monitoring_pages.sh @@ -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" diff --git a/host-agent/README.md b/host-agent/README.md index 71a1198..4f08517 100644 --- a/host-agent/README.md +++ b/host-agent/README.md @@ -185,3 +185,10 @@ zypper in qrencode zbar Without them, monitoring still runs; QR group WARNs and skips encode/decode. Caddy `/var/www/monitoring-sites` is separate (you configured hernani write access). + + +## Exit codes (v1.7.1+) + +Host-agent jobs default to **`STRICT_EXIT=1`**: non-zero exit if suite checks fail, `DEPLOY_WWW_ROOT` is not writable, or public monpages (FQDN) fail. + +Set `STRICT_EXIT=0` only if you want timers to stay green while still logging errors (not recommended for production). diff --git a/host-agent/run-host-report.sh b/host-agent/run-host-report.sh index ae4a79f..84d0d5e 100755 --- a/host-agent/run-host-report.sh +++ b/host-agent/run-host-report.sh @@ -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