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