build: ship gob in the claw image
A coding turn that starts a dev server or a build has to either wait for it or background it with `&`, and a backgrounded process is gone from the next turn's view: no id, no logs, no port. gob keeps the process table that the agent and the operator both read, so the turn returns and a later one asks what happened. The release carries a static linux binary for amd64 and arm64. The image downloads one from a pinned tag (GOB_VERSION, a build arg) and unpacks it to /usr/local/bin/gob; no package rides along. No other arch is published, so a build for one fails at the download instead of shipping a container whose shell has no gob. The image gains XDG_RUNTIME_DIR=/tmp/run with it. Left unset, gob looks for /run/user/1000, which nothing creates here, and its daemon dies with "socket not created" even though the job table is writable. The socket stays off the volume, where an NFS PVC cannot hold one. The state (state.db, the run logs) follows XDG_STATE_HOME to /data/state, so jobs survive a restart of the container. Checked on the image's own base: gob run, gob add, gob list and gob shutdown as uid 1000, no flags. The full image still cannot build before the 0.4.2 sandbox release (cargo fetch rejects the unpublished pin), so the runtime stage was built from the Dockerfile's own lines.
This commit is contained in:
1 parent
dc269472eb
commit
ea26019f0c
2 files changed
+40
-14
No files matched your search
+16
-13
@@ -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
|
answers `/v1` and `/healthz`; one address for the browser and the
|
||||||
phone app, no CORS anywhere.
|
phone app, no CORS anywhere.
|
||||||
|
|
||||||
The image is the daemon plus `bash` and `git` (the agent's shell is
|
The image is the daemon plus what the agent's shell needs: `bash` and
|
||||||
load-bearing); the chart runs exactly one replica, the claw is
|
`git` (the shell is load-bearing, the agent clones in its workspaces),
|
||||||
single-node by design: one SQLite store, one dispatcher. Single-node
|
`curl` for a turn that fetches a URL, and `gob` for a command that
|
||||||
is what makes restarts instant: at boot the daemon releases every
|
outlives the turn. The agent starts a build or a dev server with `gob
|
||||||
lease the previous process left — outright, not at the dead lease's
|
add` and reads its logs and ports on a later one. The chart runs
|
||||||
TTL — so a turn an update cut mid-flight answers its next message
|
exactly one replica, the claw is single-node by design: one SQLite
|
||||||
instead of stalling behind a ghost (the committed tool call revives
|
store, one dispatcher. Single-node is what makes restarts instant: at
|
||||||
at the top of that next dispatch). The
|
boot the daemon releases every lease the previous process left —
|
||||||
store and workspaces live on a PVC, `claw.yaml` in a ConfigMap (db and
|
outright, not at the dead lease's TTL — so a turn an update cut
|
||||||
workspace paths are pinned to the mounted volume), credentials in a
|
mid-flight answers its next message instead of stalling behind a ghost
|
||||||
Secret, and the bearer token is the `token` value, required since the
|
(the committed tool call revives at the top of that next dispatch).
|
||||||
daemon binds all interfaces in-cluster. `persistence.enabled=false`
|
The store and workspaces live on a PVC, `claw.yaml` in a ConfigMap (db
|
||||||
trades restart survival for disposability.
|
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`
|
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
|
proxies to a local claw, `npm run build` emits the static bundle an
|
||||||
|
|||||||
@@ -51,6 +51,23 @@ RUN apt-get update \
|
|||||||
&& apt-get install -y --no-install-recommends bash curl git tar ca-certificates \
|
&& apt-get install -y --no-install-recommends bash curl git tar ca-certificates \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& 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.
|
# Numeric USER: Kubernetes cannot verify runAsNonRoot against a name.
|
||||||
RUN useradd --uid 1000 --user-group --create-home claw \
|
RUN useradd --uid 1000 --user-group --create-home claw \
|
||||||
&& install -d -o 1000 -g 1000 /config /data
|
&& 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
|
# The chart passes --config /config/claw.yaml (the ConfigMap mount) and
|
||||||
# mounts the state PVC at /data; these defaults serve a bare `docker run`.
|
# 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 \
|
ENV XDG_CONFIG_HOME=/config \
|
||||||
XDG_STATE_HOME=/data/state
|
XDG_STATE_HOME=/data/state \
|
||||||
|
XDG_RUNTIME_DIR=/tmp/run
|
||||||
VOLUME /data
|
VOLUME /data
|
||||||
EXPOSE 7799
|
EXPOSE 7799
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user