caelum0x 32d8482958 feat(watch): ship Railyard Watch's box 1 checks agent (stacks/gatus-customers)
apps/console/README.md and lib/watch/types.ts already documented
WATCH_AGENT_TOKEN and RAILYARD_WATCH_LIVE as if stacks/gatus-customers/agent.sh
existed. It did not -- the console side (agentChecks/recordResults, the
/api/v1/watch/agent/* routes) had nothing on the other end to call it, so
Watch could never actually turn on.

Adds the real box 1 stack: a Gatus probe engine (docker-compose.yml,
config.yaml) plus agent.sh, the bridge that pulls the console's check list,
regenerates Gatus's config, reads Gatus's own results, and pushes them back
-- stateless by design since the console already dedupes by last_checked_at.
Plus agent.env.sample, a systemd unit and install.sh (same shape as
tools/reconcile-relay-rago).

Verified against real components: a real ghcr.io/twin/gatus:stable container
and a scratch server wiring the exact shipped lib/watch/http.ts handlers to
a MemoryWatchStore, exercised end to end over two passes against a real
https://example.com check -- which caught and fixed two real bugs (Gatus
refuses to start with zero endpoints; the generated config's timestamp was
forcing a gatus restart on every single pass). Container, volume and image
removed afterward; apps/console's existing 167 tests and 3 bundle tests
pass unchanged (this item touched no console source file).
2026-10-24 01:12:45 +03:00

35 lines
1.4 KiB
YAML

# Static Gatus settings (RAILYARD_WATCH_LIVE / PY2.2). Merged by Gatus itself
# with endpoints.generated.yaml, which agent.sh rewrites every pass — never
# edit that file by hand, it is overwritten.
#
# This instance only ever probes the https addresses customers give Railyard
# Watch through the console (apps/console/lib/watch/service.ts::checkUrl
# already refuses private/loopback/our-own-domain names before a check is
# ever created, so nothing here can be pointed at box 1 itself). It binds to
# 127.0.0.1 only (see ../docker-compose.yml) — agent.sh is its only caller.
web:
port: 8080
storage:
type: sqlite
path: /data/data.db
maximum-number-of-results: 100
# Gatus refuses to start with zero endpoints in its merged config, and the
# console can genuinely have zero active Watch checks (a fresh box, every
# customer paused). This one loopback self-check keeps Gatus always
# startable either way; it is never surfaced to a customer (agent.sh only
# reads results for the ids it got from the console, and this endpoint's
# name is not one of them).
endpoints:
- name: "gatus-self-check"
group: "railyard-internal"
url: "http://127.0.0.1:8080/health"
interval: 5m
conditions:
- "[STATUS] == 200"
# Gatus's own alerting stays off: Railyard Watch's alert email (Rally Send,
# apps/console/lib/watch/service.ts::alertText) is the only alert a customer
# ever sees. This instance exists purely as the probe engine behind it.