From a5d66ce4770a2f2347d2cae3ca4bdea60a5d7847 Mon Sep 17 00:00:00 2001 From: Natalie Date: Sat, 27 Jun 2026 09:56:56 -0400 Subject: [PATCH] feat(infra): make DO workers render-capable (weston + Mesa) + dist:render Golden image now installs the software-render stack (weston, libgl1-mesa-dri llvmpipe, mesa-vulkan-drivers, vulkan-tools) so any worker renders proof scenes via gl_compatibility/opengl3 with no GPU. New ./run dist:render wraps tools/capture-proof.sh against a worker (replaces the apricot SCREENSHOT_HOST). Co-Authored-By: Claude Opus 4.8 --- infra/packer/provision.sh | 8 ++++++-- scripts/run/dist.sh | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/infra/packer/provision.sh b/infra/packer/provision.sh index 37f62ad9..1d943349 100755 --- a/infra/packer/provision.sh +++ b/infra/packer/provision.sh @@ -15,12 +15,16 @@ GIT_REF="${GIT_REF:-main}" BUILD_USER="${BUILD_USER:-mc}" REPO_PATH="Code/@projects/@magic-civilization" # relative to the build user's HOME -echo "=== [1/7] base packages ===" +echo "=== [1/7] base packages (incl. software-render stack: weston + Mesa llvmpipe) ===" export DEBIAN_FRONTEND=noninteractive apt-get update -y apt-get install -y --no-install-recommends \ git curl ca-certificates build-essential pkg-config libssl-dev \ - unzip sudo python3-pip flatpak rsync + unzip sudo python3-pip flatpak rsync \ + weston libgl1-mesa-dri libegl1 libgles2 libwayland-egl1 \ + mesa-vulkan-drivers vulkan-tools +# So every worker can render proof scenes (opengl3/gl_compatibility) under a +# headless weston with no GPU — see tools/capture-proof.sh + tools/autoplay-batch.sh --weston. echo "=== [2/7] build user '$BUILD_USER' ===" if ! id "$BUILD_USER" >/dev/null 2>&1; then diff --git a/scripts/run/dist.sh b/scripts/run/dist.sh index d4553e0a..bcd77a1e 100755 --- a/scripts/run/dist.sh +++ b/scripts/run/dist.sh @@ -37,6 +37,7 @@ Distributed test/train fleet (DigitalOcean). Set TF_VAR_do_token first. ./run dist:test cargo test --workspace on a worker ./run dist:build cargo build + wasm on a worker (wasm rsync'd back) ./run dist:sync [ref] git pull + rebuild gdext on live workers + ./run dist:render render a proof scene (software weston, no GPU) → png ./run dist:down EOF } @@ -252,3 +253,16 @@ cmd_dist_build() { rsync -az "$host:~/$repo/.local/build/wasm/" "$root/.local/build/wasm/" 2>/dev/null \ && echo "wasm → .local/build/wasm/" || echo "note: no wasm at .local/build/wasm/ on worker" } + +cmd_dist_render() { + # Render a proof scene on a worker (software weston + Mesa llvmpipe, no GPU) and + # pull the PNG back to plum. Replaces the apricot SCREENSHOT_HOST flow. + local scene="${1:-}" out="${2:-}" + [ -n "$scene" ] && [ -n "$out" ] || { echo "usage: ./run dist:render [timeout_s]" >&2; return 1; } + local host + host="$(_dist_first_host)" || { echo "no fleet — run ./run dist:up 1 first" >&2; return 1; } + local user="${host%@*}" + AUTOPLAY_HOST="$host" \ + PROJECT_ROOT_REMOTE="/home/${user}/Code/@projects/@magic-civilization" \ + bash "$(_dist_repo_root)/tools/capture-proof.sh" "$scene" "$out" "${3:-180}" +}