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 <scene> <out.png>
wraps tools/capture-proof.sh against a worker (replaces the apricot SCREENSHOT_HOST).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Natalie 2026-06-27 09:56:56 -04:00
parent 9ee33f49ed
commit a5d66ce477
2 changed files with 20 additions and 2 deletions

View file

@ -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

View file

@ -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 <res://scene.tscn> <out.png> 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 <res://scene.tscn> <out.png> [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}"
}