authoravatarclover caruso<git@paperclover.net>2026-10-23 15:02:06-07:00
committeravatarclover caruso<git@paperclover.net>2026-10-24 19:01:23-07:00
log1df9a8f395115e6c9d25e0df369674e7b542f4d9
treec996f5113ea0b1b02764ee17dcd93e2d92014d0c
parenteeb6ec5089743d764d55bf4ba8769701afa235a3
signature Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU

Give Knife agents browsers, KVM, and restart-safe deploys

Chromium, Xvfb, fonts, Clang/LLD and desktop build libraries come with the image. Podman's seccomp filter blocks the chroot Chromium-based sandboxes use, so Chromium, Electron and T3's browser run unsandboxed inside the container. /dev/kvm is passed through for emulators. Restarting the container stops every running agent, so deploys leave it running and changes wait for a manual restart. Assisted-by: claude-opus-5.5

3 files changed, 36 insertions(+), 13 deletions(-)

nixos/knife-linux.Containerfile+12-7
...@@ -1,15 +1,20 @@...@@ -1,15 +1,20 @@
1FROM registry.fedoraproject.org/fedora:44@sha256:0d2a354dfdf7ba75083fe371eb6239842fe13f38c52d339dae1ebcf13c7c40621FROM registry.fedoraproject.org/fedora:44@sha256:0d2a354dfdf7ba75083fe371eb6239842fe13f38c52d339dae1ebcf13c7c4062
22
3# Development tools, plus the libraries and fonts T3's headless Chrome needs.3# Development tools, plus Chromium, Xvfb and fonts for headless browser and Electron checks.
4RUN dnf -y install --setopt=install_weak_deps=False \4RUN dnf -y install --setopt=install_weak_deps=False \
5 bzip2 cargo cmake diffutils fd-find file findutils gcc gcc-c++ git hostname iproute jq less \5 bzip2 cargo clang cmake diffutils fd-find file findutils gcc gcc-c++ git glibc-gconv-extra \
6 lsof make neovim openssh-clients openssl-devel patch procps-ng python3 ripgrep rsync rust tar \6 hostname ImageMagick iproute jq less libsecret-devel libxcrypt-compat lld lsof make neovim \
7 time tree unzip which xz zip zlib-ng-compat-devel zsh \7 openssh-clients openssl-devel patch procps-ng python3 ripgrep rsync rust tar time tree unzip \
8 alsa-lib at-spi2-atk at-spi2-core atk dbus-libs expat fontconfig glib2 libX11 libXcomposite \8 which xz zip zlib-ng-compat-devel zsh \
9 libXdamage libXext libXfixes libXrandr libxcb libxkbcommon liberation-mono-fonts \9 chromium fontconfig google-noto-sans-fonts google-noto-sans-mono-fonts google-noto-serif-fonts \
10 liberation-sans-fonts liberation-serif-fonts mesa-libgbm nss \10 liberation-mono-fonts liberation-sans-fonts liberation-serif-fonts mesa-dri-drivers \
11 xorg-x11-server-Xvfb \
11 && dnf clean all12 && dnf clean all
1213
14# The container is the sandbox: its seccomp filter blocks the chroot Chromium-based sandboxes need.
15RUN printf '\nCHROMIUM_FLAGS+=" --no-sandbox"\n' >> /etc/chromium/chromium.conf
16ENV ELECTRON_DISABLE_SANDBOX=1 T3CODE_SERVER_BROWSER_SANDBOX=0
17
13RUN curl -fsSLo /tmp/node.tar.xz https://nodejs.org/dist/v26.12.1/node-v26.12.1-linux-x64.tar.xz \18RUN curl -fsSLo /tmp/node.tar.xz https://nodejs.org/dist/v26.12.1/node-v26.12.1-linux-x64.tar.xz \
14 && echo "6170b2d474e1c626f43cff3adc118df9fe3b573258a4fc3d850c8dbc6b079bbd /tmp/node.tar.xz" | sha256sum -c \19 && echo "6170b2d474e1c626f43cff3adc118df9fe3b573258a4fc3d850c8dbc6b079bbd /tmp/node.tar.xz" | sha256sum -c \
15 && mkdir -p /opt/node/26.12.1 \20 && mkdir -p /opt/node/26.12.1 \
nixos/knife-linux.nix+3
...@@ -25,6 +25,8 @@ in...@@ -25,6 +25,8 @@ in
25 wants = [ "network-online.target" ];25 wants = [ "network-online.target" ];
26 after = [ "network-online.target" "mac-studio-sandbox.service" ];26 after = [ "network-online.target" "mac-studio-sandbox.service" ];
27 requires = [ "mac-studio-sandbox.service" ];27 requires = [ "mac-studio-sandbox.service" ];
28 # Restarting stops every running agent, so changes wait for a manual restart.
29 restartIfChanged = false;
28 serviceConfig = {30 serviceConfig = {
29 Type = "notify";31 Type = "notify";
30 NotifyAccess = "all";32 NotifyAccess = "all";
...@@ -40,6 +42,7 @@ in...@@ -40,6 +42,7 @@ in
40 "--volume=${root}/home:/home/clo"42 "--volume=${root}/home:/home/clo"
41 "--volume=${sandbox}:/Volumes/Code"43 "--volume=${sandbox}:/Volumes/Code"
42 "--volume=/opt/studio-project-store/current/bin/jj-real:/usr/local/bin/jj:ro"44 "--volume=/opt/studio-project-store/current/bin/jj-real:/usr/local/bin/jj:ro"
45 "--device=/dev/kvm"
43 "localhost/knife-linux"46 "localhost/knife-linux"
44 ];47 ];
45 ExecStop = "${run} stop --ignore --time=90 knife-linux";48 ExecStop = "${run} stop --ignore --time=90 knife-linux";
tools/knife-linux.md+21-6
...@@ -4,10 +4,18 @@...@@ -4,10 +4,18 @@
4agents directly beside ZFS. [knife-linux.nix](../nixos/knife-linux.nix) builds it4agents directly beside ZFS. [knife-linux.nix](../nixos/knife-linux.nix) builds it
5from [knife-linux.Containerfile](../nixos/knife-linux.Containerfile) on each start5from [knife-linux.Containerfile](../nixos/knife-linux.Containerfile) on each start
6and runs it as the `knife-linux` system service: uid 3000 (`clo`), no6and runs it as the `knife-linux` system service: uid 3000 (`clo`), no
7capabilities, 12 CPUs, a 32 GiB memory limit, and Podman's NAT network. Knife7capabilities, 12 CPUs, a 32 GiB memory limit, `/dev/kvm`, and Podman's NAT network.
8listens on container loopback port 3773; devices reach it through the mesh as8Knife listens on container loopback port 3773; devices reach it through the mesh
9`snowglobe` (device `4b85ee48…`). User namespaces work inside, so Chrome's9as `snowglobe` (device `4b85ee48…`). User namespaces work inside, but Podman's
10sandbox and agent sandboxes run unprivileged.10seccomp filter blocks the `chroot` Chromium-based sandboxes need, so Chromium,
11Electron, and T3's browser run with their own sandbox off inside the container.
12
13Deploys never restart the container: restarting stops Knife and every running
14agent. Image and unit changes apply at the next manual
15`systemctl restart knife-linux`; packages installed live with
16`knife-linux-podman exec --user root --privileged knife-linux dnf install …`
17last only until then, so add them to the Containerfile too. Devices cannot be
18added to the running container.
1119
12| Container path | Host source |20| Container path | Host source |
13| --- | --- |21| --- | --- |
...@@ -42,6 +50,13 @@ recovery archives are kept privately on the owner's Mac at...@@ -42,6 +50,13 @@ recovery archives are kept privately on the owner's Mac at
42at `Knife Recovery/20261023`. Each copy was restored into an isolated container50at `Knife Recovery/20261023`. Each copy was restored into an isolated container
43with networking disabled, checking the application, databases, and identity keys.51with networking disabled, checking the application, databases, and identity keys.
4452
53`~/computer.py` is a copy of [computer.py](computer.py), a standard-library client
54for scripting VMs through the Computer MCP; its connection lives in
55`~/.config/computer-mcp`. [computer-client-test.py](computer-client-test.py)
56runs it against a local dashboard with a stub host. Git pushes to Shale use a
57personal access token from Clover's Shale settings, kept by git's credential
58store in `~/.git-credentials`.
59
45## Runtime and updates60## Runtime and updates
4661
47The active runtime is `~/.local/share/knife-server/current`, pointing to62The active runtime is `~/.local/share/knife-server/current`, pointing to
...@@ -70,8 +85,8 @@ After the server build, stage `libknife_mesh_node.so` as...@@ -70,8 +85,8 @@ After the server build, stage `libknife_mesh_node.so` as
70`apps/server/dist/knife-mesh/linux-x64/knife_mesh.node` and the resource monitor as85`apps/server/dist/knife-mesh/linux-x64/knife_mesh.node` and the resource monitor as
71`apps/server/dist/resource-monitor/linux-x64/t3-resource-monitor`. Stage the font86`apps/server/dist/resource-monitor/linux-x64/t3-resource-monitor`. Stage the font
72assets in `apps/server/dist/client/fonts` and link `node` in the runtime root to87assets in `apps/server/dist/client/fonts` and link `node` in the runtime root to
73`/opt/node/26.12.1/bin/node`. Switch `current` and `systemctl restart knife-linux`88`/opt/node/26.12.1/bin/node`. Switch `current` and restart only when agents are
74only when idle. Automatic fork updates are not configured for this source build.89idle. Automatic fork updates are not configured for this source build.
7590
76## Agent homes91## Agent homes
7792