taler-monitoring/host-agent/ROOT-APPLY-MONITORING.md
Hernâni Marques 5a5431bfa9
taler-monitoring v1.13.12
Multi-phase global SUMMARY, warn-filter dimmed context, SUMMARY chrome
as meta; FP stage host-agent via francpaysan-stage-user (stagepaysan);
monpages GOA + FP stage.
2026-07-19 04:22:10 +02:00

2.9 KiB

Root: make monitoring pages live on koopa (GOA)

Detection (v1.3.1+)

Suite phase monpages and the host-agent post-check curl each public FQDN (https://taler.hacktivism.ch/monitoring/ …). Merchant JSON code 21 or non-HTML is an ERROR until this apply is done.

Symptom if not applied

Public URLs return merchant/bank JSON like:

{ "code": 21, "hint": "There is no endpoint defined for the URL provided..." }

or a 404 HTML page from the app reverse_proxy.

Cause: live /etc/caddy/Caddyfile has no handle /monitoring* (falls through to API). Prepared config is only under $KOOPA_CADDY_DIR/Caddyfile.

# absolute path required: as root, ~ is /root (not /home/hernani)
sudo $APPLY_MONITORING_LIVE
# or already root:
# $APPLY_MONITORING_LIVE

Caddy bare-path redir (v1.9.2+): inside a handle block use redir * /path/ 302 — never redir /path/ 302 alone (Caddy treats the first token as matcher and sets Location: 302, so bare URLs fall through to the merchant API as JSON code 21).

That script:

  1. rsync staging HTML → /var/www/monitoring-sites/ (incl. surface + aptdeploy)
  2. Makes tree writable for hernani (group caddy + ACL) so later runs self-sync
  3. Installs prepared Caddyfile → /etc/caddy/Caddyfile, validates, reloads Caddy
  4. Smoke-curls all monitoring URLs (must not be JSON code:21)

Paths (only three families — suite name ≠ URL)

There is no public page /taler-monitoring. Each family needs bare and slash (redir * /path/ 302 inside Caddy handle):

Family Paths Host Source timer
monitoring /monitoring · /monitoring/ · /monitoring_err · /monitoring_err/ bank + exchange + taler (and other landings) taler-monitoring-hacktivism.timer (4h)
taler-monitoring-surface bare + slash + _err taler.hacktivism.ch only taler-monitoring-surface.timer (1h)
taler-monitoring-aptdeploy bare + slash + _err taler.hacktivism.ch only taler-monitoring-aptdeploy.timer (4h)

HTML is generated as hernani into
$DEPLOY_STAGING (or $HOME/monitoring-sites-staging)/.

Manual equivalent

rsync -a --delete $DEPLOY_STAGING (or $HOME/monitoring-sites-staging)/ /var/www/monitoring-sites/
chown -R hernani:caddy /var/www/monitoring-sites && chmod -R g+rwX /var/www/monitoring-sites
sudo $KOOPA_CADDY_DIR/apply.sh   # or apply-monitoring-live.sh

Expect 200 (HTML with sticky bar). Not merchant JSON code:21.

After each monitoring run (if www is not hernani-writable)

rsync -a --delete $DEPLOY_STAGING (or $HOME/monitoring-sites-staging)/ /var/www/monitoring-sites/
chown -R caddy:caddy /var/www/monitoring-sites

Or grant hernani write on /var/www/monitoring-sites once so the host-agent can rsync itself.