diff --git a/crates/rhema-claw/README.md b/crates/rhema-claw/README.md index 238b8ea..f5e9258 100644 --- a/crates/rhema-claw/README.md +++ b/crates/rhema-claw/README.md @@ -346,19 +346,22 @@ same host serves both: the browser gets the web UI on `/`, the daemon answers `/v1` and `/healthz`; one address for the browser and the phone app, no CORS anywhere. -The image is the daemon plus `bash` and `git` (the agent's shell is -load-bearing); the chart runs exactly one replica, the claw is -single-node by design: one SQLite store, one dispatcher. Single-node -is what makes restarts instant: at boot the daemon releases every -lease the previous process left — outright, not at the dead lease's -TTL — so a turn an update cut mid-flight answers its next message -instead of stalling behind a ghost (the committed tool call revives -at the top of that next dispatch). The -store and workspaces live on a PVC, `claw.yaml` in a ConfigMap (db and -workspace paths are pinned to the mounted volume), credentials in a -Secret, and the bearer token is the `token` value, required since the -daemon binds all interfaces in-cluster. `persistence.enabled=false` -trades restart survival for disposability. +The image is the daemon plus what the agent's shell needs: `bash` and +`git` (the shell is load-bearing, the agent clones in its workspaces), +`curl` for a turn that fetches a URL, and `gob` for a command that +outlives the turn. The agent starts a build or a dev server with `gob +add` and reads its logs and ports on a later one. The chart runs +exactly one replica, the claw is single-node by design: one SQLite +store, one dispatcher. Single-node is what makes restarts instant: at +boot the daemon releases every lease the previous process left — +outright, not at the dead lease's TTL — so a turn an update cut +mid-flight answers its next message instead of stalling behind a ghost +(the committed tool call revives at the top of that next dispatch). +The store and workspaces live on a PVC, `claw.yaml` in a ConfigMap (db +and workspace paths are pinned to the mounted volume), credentials in +a Secret, and the bearer token is the `token` value, required since +the daemon binds all interfaces in-cluster. +`persistence.enabled=false` trades restart survival for disposability. The UI in `web/claw` is one client of the same surface: `npm run dev` proxies to a local claw, `npm run build` emits the static bundle an diff --git a/deploy/docker/claw.Dockerfile b/deploy/docker/claw.Dockerfile index 8a7b876..a8812c0 100644 --- a/deploy/docker/claw.Dockerfile +++ b/deploy/docker/claw.Dockerfile @@ -51,6 +51,23 @@ RUN apt-get update \ && apt-get install -y --no-install-recommends bash curl git tar ca-certificates \ && rm -rf /var/lib/apt/lists/* +# gob (github.com/juanibiapina/gob) is the agent's process manager: a turn +# starts a dev server or a build with `gob add`, and a later turn reads its +# logs, status and ports. Without it a long command either blocks the turn +# for its whole run or is backgrounded with `&`, which no later turn can +# find again. The release is a static binary, so nothing rides along but +# the file; its state lands under XDG_STATE_HOME (/data/state, the volume) +# and its socket under XDG_RUNTIME_DIR. Only amd64 and arm64 are published, +# and a build for any other arch fails here rather than shipping a daemon +# with no `gob` on PATH. +ARG GOB_VERSION=3.9.0 +RUN arch="$(dpkg --print-architecture)" \ + && curl -fsSL -o /tmp/gob.tar.gz \ + "https://github.com/juanibiapina/gob/releases/download/v${GOB_VERSION}/gob_${GOB_VERSION}_linux_${arch}.tar.gz" \ + && tar -xzf /tmp/gob.tar.gz -C /usr/local/bin gob \ + && rm /tmp/gob.tar.gz \ + && gob --version + # Numeric USER: Kubernetes cannot verify runAsNonRoot against a name. RUN useradd --uid 1000 --user-group --create-home claw \ && install -d -o 1000 -g 1000 /config /data @@ -59,8 +76,14 @@ COPY --from=builder /build/target/release/rhema-claw /usr/local/bin/rhema-claw # The chart passes --config /config/claw.yaml (the ConfigMap mount) and # mounts the state PVC at /data; these defaults serve a bare `docker run`. +# +# XDG_RUNTIME_DIR is gob's socket directory. Left unset, gob looks in +# /run/user/1000, which nothing creates here, and its daemon dies with +# "socket not created". A socket does not belong on the volume (an NFS +# PVC cannot hold one), so it lives in the container's own /tmp. ENV XDG_CONFIG_HOME=/config \ - XDG_STATE_HOME=/data/state + XDG_STATE_HOME=/data/state \ + XDG_RUNTIME_DIR=/tmp/run VOLUME /data EXPOSE 7799