release 1.9.3: monpages code 21 always ERROR; suite apply script + absolute paths

This commit is contained in:
Hernâni Marques 2026-07-19 01:09:52 +02:00
parent 530385b19d
commit ea95fb3d8d
No known key found for this signature in database
GPG key ID: CB5738652768F7E9
7 changed files with 154 additions and 59 deletions

View file

@ -3,31 +3,33 @@
Host Caddy runs as **root/systemd** (`caddy` user). Static monitoring HTML is
**not** put into Taler containers — only host paths + Caddy `handle`.
After `generate-monitoring-sites.sh` + `deploy-monitoring-sites.sh` (as hernani),
files live in:
After host-agent / `generate-monitoring-sites.sh` + deploy (as hernani), files live in:
```text
/home/hernani/monitoring-sites-staging/<hostname>/monitoring/index.html
/home/hernani/monitoring-sites-staging/<hostname>/monitoring_err/index.html
```
## One-shot as root (copy + Caddy)
## One-shot as root (preferred)
```bash
# on koopa (koopa-external), as root:
# absolute path — as root, ~ is /root (script not found under ~/koopa-caddy/…)
sudo /home/hernani/koopa-caddy/apply-monitoring-live.sh
# same script is versioned in the suite:
# host-agent/apply-monitoring-live.sh → install/sync to /home/hernani/koopa-caddy/
```
# 1) web root
install -d -o caddy -g caddy -m 755 /var/www/monitoring-sites
That rsyncs staging → `/var/www/monitoring-sites`, installs the prepared
Caddyfile, reloads Caddy, and smokes mon URLs (including bare surface).
## Manual equivalent
```bash
install -d -o hernani -g caddy -m 755 /var/www/monitoring-sites
rsync -a --delete /home/hernani/monitoring-sites-staging/ /var/www/monitoring-sites/
chown -R caddy:caddy /var/www/monitoring-sites
# 2) Caddyfile — from ~/koopa-caddy (host ops), then:
# (either edit /etc/caddy/Caddyfile by hand using snippet below,
# or copy full mirror after review)
#
# install -m 644 /home/hernani/koopa-caddy/Caddyfile /etc/caddy/Caddyfile
# # or: ~/koopa-caddy/apply.sh after syncing Caddyfile into ~/koopa-caddy/
chown -R hernani:caddy /var/www/monitoring-sites
install -m 644 /home/hernani/koopa-caddy/Caddyfile /etc/caddy/Caddyfile
caddy validate --config /etc/caddy/Caddyfile
systemctl reload caddy
systemctl is-active caddy
@ -35,23 +37,10 @@ systemctl is-active caddy
## Snippet per hacktivism site (inside each `*.hacktivism.ch { }` block)
Place **before** the catch-all `reverse_proxy` (same idea as `/intro*`):
Place **before** the catch-all `reverse_proxy`. Canonical copy:
`site-gen/caddy-monitoring-handles.snippet`.
```caddy
# Public taler-monitoring console HTML (static; host only)
handle /monitoring_err* {
root * /var/www/monitoring-sites/{host}
rewrite * /monitoring_err{uri}
# uri is /monitoring_err or /monitoring_err/ → serve directory index
file_server
}
handle /monitoring* {
root * /var/www/monitoring-sites/{host}
file_server
}
```
Simpler layout (recommended): path on disk matches URL under host root:
Disk layout (path on disk matches URL under host root):
```text
/var/www/monitoring-sites/bank.hacktivism.ch/monitoring/index.html
@ -59,34 +48,50 @@ Simpler layout (recommended): path on disk matches URL under host root:
```
```caddy
handle_path /monitoring_err/* {
root * /var/www/monitoring-sites/{host}/monitoring_err
# bare → slash (MUST use redir * /path/ — see footgun below)
handle /monitoring {
redir * /monitoring/ 302
}
handle /monitoring* {
root * /var/www/monitoring-sites/{host}
file_server
}
handle /monitoring_err {
redir /monitoring_err/ 302
redir * /monitoring_err/ 302
}
handle_path /monitoring/* {
root * /var/www/monitoring-sites/{host}/monitoring
handle /monitoring_err* {
root * /var/www/monitoring-sites/{host}
file_server
}
handle /monitoring {
redir /monitoring/ 302
}
```
Canonical snippet is also in `caddy-monitoring-handles.snippet` and applied
in `configs/caddy/Caddyfile` for the three GOA hosts.
### Caddy redir footgun (merchant code 21)
```caddy
# WRONG — parsed as matcher=/monitoring/ to="302" → Location: 302
handle /monitoring {
redir /monitoring/ 302
}
# RIGHT
handle /monitoring {
redir * /monitoring/ 302
}
```
Symptom: `https://…/monitoring` or `…/taler-monitoring-surface` returns merchant
JSON `{"code":21,…}` while the slash form serves HTML.
## Check
```bash
curl -sS -o /dev/null -w '%{http_code}\n' https://bank.hacktivism.ch/monitoring/
curl -sS -o /dev/null -w '%{http_code}\n' https://bank.hacktivism.ch/monitoring_err/
curl -sS https://bank.hacktivism.ch/monitoring_err/ | head
curl -sS -D- -o /dev/null https://taler.hacktivism.ch/taler-monitoring-surface | head -15
# bare: expect 302 Location: /taler-monitoring-surface/ — not JSON code 21
curl -sS -o /dev/null -w '%{http_code}\n' https://taler.hacktivism.ch/taler-monitoring-surface/
```
## Not needed as root
- Running `taler-monitoring` (use **optional outside runner** (SSH alias via `FIRECUDA_SSH`) / laptop)
- Running `taler-monitoring` (use **optional outside runner** / laptop)
- Writing into podman Taler containers