taler-monitoring/host-agent/ROOT-APPLY-MONITORING.md
Hernâni Marques c1a3cba28b
fix 1.23.1: only /monitoring-max-ladder for GOA (drop classic ladder page)
Hacktivism mon page is max-search only on bank/exchange/taler. Remove
classic /monitoring-ladder units, monpages catalog, and Caddy bare redirs.
2026-07-19 15:05:21 +02:00

77 lines
3.2 KiB
Markdown

# 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:
```json
{ "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`**.
## One-shot as root (recommended)
```bash
# 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) |
| **monitoring-max-ladder** | `/monitoring-max-ladder` · `/` · `_err` | bank + exchange + taler (**GOA** max-search only) | `taler-monitoring-max-ladder.timer` (**daily**) |
| **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) |
No classic **`/monitoring-ladder`**. Max-ladder served via Caddy `handle /monitoring*` under `/var/www/monitoring-sites/{host}/`.
HTML is generated as **hernani** into
`$DEPLOY_STAGING (or $HOME/monitoring-sites-staging)/`.
## Manual equivalent
```bash
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)
```bash
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.