Add the deployment path: agent systemd unit and container image

The README referenced `deploy/install-agent.sh` and a `Containerfile` that
did not exist, so a fresh clone had no way to actually run this anywhere.

* agent: `--token-file` (and AGENT_TOKEN_FILE). The token guards hostname,
  mounts, disk and GPU models and process names, and argv is world-readable
  through `ps`, so a file has to win over the flag. Missing or empty token
  files are fatal — falling back to "no token" would expose the host.
* deploy/install-agent.sh: creates a system user, generates the token once
  (re-runs reuse it, --rotate-token for a new one), stores it 0600
  root-owned, and runs the agent under ProtectSystem=strict with no
  capabilities; --status and --uninstall included.
* Containerfile: two-stage, uv.lock resolved in the builder and slim Python
  in the runtime. Verified with podman — the image serves /api/health as an
  unprivileged user and writes its history under /var/lib/dashboards.
  UV_PROJECT_ENVIRONMENT and --no-editable are what make the venv survive
  being copied into the runtime stage.
* .containerignore keeps .git, .venv, data/ and .env out of the build
  context.

258 tests, 94% coverage; ruff and pyright clean.

LLM-Generated: true
This commit is contained in:
2026-10-16 17:33:24 -04:00
parent c4bb374ccc
commit 426682a999
7 changed files with 331 additions and 11 deletions
+17
View File
@@ -0,0 +1,17 @@
# Keep the build context small and local state out of it. The image copies exactly what it
# needs (manifest, src/, agent/), so nothing here is missed — a stray .env or .venv in the
# context is how secrets end up in an image layer by accident.
.git
.github
.venv
.pytest_cache
.ruff_cache
.coverage
data
tests
.env
.env.*
agents
.agents
Containerfile
.containerignore