feat(agents): one-line install and Compose files for agents #135

Merged
Sebi merged 1 commits from feat/agent-install into main 2026-11-23 18:28:35 +00:00
Owner

Builds on #134 (and so #132, #133); merge those first.

GET /install.sh (public, no-store): the script from deploy/agent/install.sh.tmpl with UPTIME_PUBLIC_URL, UPTIME_AGENT_IMAGE and the platform's channel (latest for releases, beta for prereleases, edge otherwise) filled in; values are validated so nothing can break out of the shell quoting.

curl -fsSL https://uptime.example.com/install.sh | sudo sh -s -- checker --token usa_…
curl -fsSL https://uptime.example.com/install.sh | sudo sh -s -- statuspage --token usa_… --host status.example.com --tls --email ops@example.com

Script (POSIX sh): Linux on x86_64/aarch64/armv7l/armv6l only, Docker + Compose plugin + daemon reachable — clear messages otherwise; token via --token or UPTIME_AGENT_TOKEN (must be usa_…); writes /opt/uptimesebi/<kind>[-<name>]/compose.yaml and .env (umask 077, previous .env kept as .env.bak), docker compose pull && up -d, waits for healthy, prints logs on failure. Options: --name, --dir, --manual-updates (plain image), --docker-socket (checker; writes compose.override.yaml with the socket read-only and its group), --host (repeatable), --tls, --email, --http-port, --https-port, --no-start.

Compose files deploy/agent/compose.{checker,statuspage,docker-socket}.yaml: static, configured only through .env (UPTIME_AGENT_IMAGE, UPTIME_AGENT_TAG, ports), log rotation, named data volume — usable without the script; embedded in the script and the binary from one source.

Checks

  • Go tests run the rendered script under bash --posix with a fake docker: files, .env contents and mode, socket override, --no-start, re-run, and refusals (no/user token, unknown kind or option, TLS without host, wrong options per kind, bad name) leave no files.
  • Locally also: busybox sh -n (Alpine) and shellcheck (official image) clean; CI lint installs shellcheck and runs it on every PR.
  • Real run with Docker on this machine: the script installed an autoupdate checker from a local registry against the dev API on :8080 — pulled, started, healthy in ~6 s, connected; removed afterwards.

README documents the one-liner and the Compose files.

Closes #130

🤖 Generated with Claude Code

https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3

> Builds on #134 (and so #132, #133); merge those first. **`GET /install.sh`** (public, `no-store`): the script from `deploy/agent/install.sh.tmpl` with `UPTIME_PUBLIC_URL`, `UPTIME_AGENT_IMAGE` and the platform's channel (`latest` for releases, `beta` for prereleases, `edge` otherwise) filled in; values are validated so nothing can break out of the shell quoting. ```sh curl -fsSL https://uptime.example.com/install.sh | sudo sh -s -- checker --token usa_… curl -fsSL https://uptime.example.com/install.sh | sudo sh -s -- statuspage --token usa_… --host status.example.com --tls --email ops@example.com ``` **Script** (POSIX sh): Linux on x86_64/aarch64/armv7l/armv6l only, Docker + Compose plugin + daemon reachable — clear messages otherwise; token via `--token` or `UPTIME_AGENT_TOKEN` (must be `usa_…`); writes `/opt/uptimesebi/<kind>[-<name>]/compose.yaml` and `.env` (umask 077, previous `.env` kept as `.env.bak`), `docker compose pull && up -d`, waits for `healthy`, prints logs on failure. Options: `--name`, `--dir`, `--manual-updates` (plain image), `--docker-socket` (checker; writes `compose.override.yaml` with the socket read-only and its group), `--host` (repeatable), `--tls`, `--email`, `--http-port`, `--https-port`, `--no-start`. **Compose files** `deploy/agent/compose.{checker,statuspage,docker-socket}.yaml`: static, configured only through `.env` (`UPTIME_AGENT_IMAGE`, `UPTIME_AGENT_TAG`, ports), log rotation, named data volume — usable without the script; embedded in the script and the binary from one source. **Checks** - Go tests run the rendered script under `bash --posix` with a fake `docker`: files, `.env` contents and mode, socket override, `--no-start`, re-run, and refusals (no/user token, unknown kind or option, TLS without host, wrong options per kind, bad name) leave no files. - Locally also: busybox `sh -n` (Alpine) and shellcheck (official image) clean; CI lint installs shellcheck and runs it on every PR. - Real run with Docker on this machine: the script installed an autoupdate checker from a local registry against the dev API on :8080 — pulled, started, `healthy` in ~6 s, connected; removed afterwards. README documents the one-liner and the Compose files. Closes #130 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
Sebi added 5 commits 2026-11-23 18:07:11 +00:00
feat(release): sign checksums and publish an SBOM
ci / image (pull_request) Successful in 4m1s
ci / build (pull_request) Successful in 8m59s
ci / lint (pull_request) Successful in 10m34s
ci / test (pull_request) Successful in 12m29s
b1ca8eb19f
Releases carry SHA256SUMS signed in the minisign format (prehashed
Ed25519, the release tag as trusted comment) and an SPDX SBOM of the Go
modules and the npm packages the frontend build bundles. internal/signing
signs and verifies; the release keys are committed in release.pub and
compiled in, so the self-updating agents can check their downloads.
Without the RELEASE_SIGNING_KEY secret a release is published unsigned
with a warning.

Closes #34

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
feat(agents): multi-arch checker and status page images on scratch
ci / image (pull_request) Successful in 7m15s
ci / test (pull_request) Successful in 9m5s
ci / lint (pull_request) Successful in 14m17s
ci / build (pull_request) Successful in 15m59s
a9f94fc492
uptimesebi-checker and uptimesebi-statuspage for linux/amd64, arm64,
arm/v7 and arm/v6, from a Raspberry Pi Zero to servers. tools/image
assembles them from the cross-compiled binaries without Docker or
emulation: one layer on an empty base with the binary, a data volume
owned by the unprivileged user and a HEALTHCHECK running the new
`checker health` / `statuspage health` commands. The binaries embed time
zone data and fallback CA roots, so no base image ever needs updating.
CI pushes them with the same channel tags as the main image; releases
carry tarballs for all four platforms.

Refs #128

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
# Conflicts:
#	README.md
feat(agents): self-updating agent image variant
ci / image (pull_request) Successful in 4m40s
ci / lint (pull_request) Successful in 12m17s
ci / test (pull_request) Successful in 9m12s
ci / build (pull_request) Successful in 16m25s
a35dadd8f6
The -autoupdate variant of the checker and status page images adds a
launcher layer. The launcher runs the agent as a child process and keeps
it on the platform's release: GET /agent/v1/update names the API's own
release and the agent image for it, the launcher downloads the binary
for its platform from the registry, accepts it only when the index is
signed with a release key for exactly that version, swaps the agent
gracefully and rolls back when the new release does not become ready or
crashes right after starting. Agents never get ahead of the API, and
installations on unreleased builds are not followed.

CI pushes both variants and signs each index with RELEASE_SIGNING_KEY
(minisign signature in a sha256-<digest>.minisig image next to it). The
image builder moves to internal/agentimage; the API image job takes the
build job's version so the API reports the release its agents are tagged
with. Agents gain a version command.

Closes #129
Closes #128

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
feat(agents): one-line install and Compose files for agents
ci / build (pull_request) Successful in 11m3s
ci / lint (pull_request) Successful in 10m38s
ci / image (pull_request) Successful in 4m40s
ci / test (pull_request) Successful in 17m29s
0c382f814c
The API serves /install.sh with its public address and agent image
filled in. The POSIX sh script checks for Linux on a supported CPU,
Docker and Compose, writes /opt/uptimesebi/<kind>[-<name>]/compose.yaml
and a .env readable only by its owner, starts the agent and waits until
it is healthy. Options cover status page hosts with Let's Encrypt, the
plain image for manual updates, the Docker socket for checkers and
several agents per host; running it again changes the settings.

The Compose files in deploy/agent are configured through .env alone, so
they also work without the script. Images follow the platform's channel
(latest, beta or edge). CI shellchecks the rendered script.

Closes #130

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
Sebi merged commit 8d9a52d97d into main 2026-11-23 18:28:35 +00:00
Sebi deleted branch feat/agent-install 2026-11-23 18:28:37 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ZB-Server/uptimesebi#135