Each server runs an ultralight probe (scratch image, ~7 MiB RSS) that tails the logs, ships raw lines to the hub over HTTPS with an on-disk spool, and applies enforce decisions locally. The hub keeps one node per probe (primary node = the 1.x data dir, unchanged), does all analysis and serves the UI. Peer federation is removed. 'urutau import' brings 1.x data dirs in with hash and count verification. UI: probes page, host qualified incidents, IPs never wrap, egress heatmap labels, live and replay globes no longer auto-rotate, replay repeat, live traffic metrics. BREAKING CHANGE: URUTAU_PEERS, URUTAU_PEER_* and /api/v1/peer/* are gone; log path variables move from the hub to the probe. See docs/migration-2.0.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
35 lines
1.9 KiB
Bash
Executable File
35 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Smoke-tests an Urutau probe image: it is small (under 15 MB), runs as a
|
|
# non-root user, ships CA certificates and zoneinfo, has a HEALTHCHECK, answers
|
|
# --help, and refuses to start without a hub (a clear error, no panic).
|
|
# The image is FROM scratch: there is no shell, so nothing runs through `sh`.
|
|
#
|
|
# scripts/smoke-probe.sh <image-ref>
|
|
set -euo pipefail
|
|
|
|
image=${1:?usage: smoke-probe.sh <image-ref>}
|
|
max_bytes=$((15 * 1000 * 1000))
|
|
fail() { echo "smoke-probe: $*" >&2; exit 1; }
|
|
|
|
size=$(docker image inspect -f '{{.Size}}' "$image")
|
|
[ "$size" -lt "$max_bytes" ] || fail "image is $size bytes (limit $max_bytes)"
|
|
|
|
out=$(docker run --rm "$image" --help 2>&1) || fail "'--help' failed: $out"
|
|
[ -n "$out" ] || fail "'--help' printed nothing"
|
|
grep -qi 'probe' <<<"$out" || fail "'--help' does not mention the probe: $out"
|
|
|
|
[ "$(docker inspect -f '{{.Config.User}}' "$image")" = 10001:10001 ] || fail "the probe must run as 10001:10001"
|
|
[ "$(docker inspect -f '{{if .Config.Healthcheck}}yes{{end}}' "$image")" = yes ] || fail "image has no HEALTHCHECK"
|
|
[ -z "$(docker inspect -f '{{range $p, $_ := .Config.ExposedPorts}}{{$p}}{{end}}' "$image")" ] || fail "the probe must not expose a port"
|
|
|
|
# CA certificates and zoneinfo are in the image (copy them out: no shell inside).
|
|
cid=$(docker create "$image")
|
|
trap 'docker rm -f "$cid" >/dev/null 2>&1 || true' EXIT
|
|
docker cp "$cid:/etc/ssl/certs/ca-certificates.crt" - >/dev/null || fail "CA certificates missing"
|
|
docker cp "$cid:/usr/share/zoneinfo/America/Sao_Paulo" - >/dev/null || fail "zoneinfo missing"
|
|
|
|
# Without configuration the probe stops with a message that names the missing setting.
|
|
if out=$(docker run --rm "$image" 2>&1); then fail "the probe must not start without URUTAU_HUB"; fi
|
|
grep -qi 'hub' <<<"$out" || fail "the missing-hub error does not mention the hub: $out"
|
|
echo "smoke-probe: $image ok ($((size / 1000)) kB)"
|