Boxes set up one way, and the Linux test machine in raea's own Sprites org (11-18)

- sdk/cloud/deploy/sprites/setup.sh: everything a box needs, run on the Sprite as
  bash -s -- NAME RAEA_VERSION AGENTS [REF] < setup.sh: packages, Node, raea's Linux release (sha256-checked),
  sdk/cloud's server (a tarball box.sh sends, or the public repo at REF), the ACP agents, the box's token, the farm's
  env, the skills, and the raea-cloud service. box.sh up runs it by hand (RAEA_CLOUD_REF for a commit instead of the
  local tree), and raea cloud's agents run the same script through the Sprites API, so the two can't differ (CR11).
  Tested on two throwaway Sprites, one each way: both ready in about 50 s with the same /v1/health.
- sdk/cloud/deploy/sprites/org.sh: the org guard box.sh had, shared: the org only from
  ~/.config/raea-cloud/sprites.env, refused when private/cloud/sprites-denied.txt lists it.
- tools/linux-box.sh: makes and completes the Linux test Sprite raea-linux (RAEA_LINUX_BOX picks another) in that
  org: build packages, the toolchain, the public repo, and an ubuntu 24.04 root /srv/noble for builds at glibc 2.39.
  tools/linux-check.sh uses it by default; its first check passed at 5194d34ef (raea-cli in 726 s, raea-render
  without default features in 134 s).
- tools/denied.sh: fails on any name from the private Sprites deny list found outside it, in the whole working tree;
  with no private checkout (public CI) there's nothing to check. L1 runs it.
This commit is contained in:
shinyobjectz committed 2026-11-21 17:21:26 -08:00
1 parent fcbfba57b9
commit f70360f1ee
6 files changed
+233 -61

No files matched your search

+19 -55
View File
@@ -4,34 +4,25 @@
# bills the CPU and memory it actually uses, sleeps when nothing talks to it and keeps its disk, so an agent that mostly
# waits on its model costs little; the GPUs it needs come from the farm and stop when the render does. From sdk/cloud:
#
# deploy/sprites/box.sh up NAME the Sprite, made or completed, and its server started
# deploy/sprites/box.sh up NAME the Sprite, made or completed by deploy/sprites/setup.sh (the script a bot's
# box is set up by too), and its server started
# deploy/sprites/box.sh status NAME its URL, raea, the server's health
# deploy/sprites/box.sh token NAME its RAEA_CLOUD_TOKEN, for the TypeScript client
# deploy/sprites/box.sh key NAME a raea agent key (repos and storage scopes) from stdin, or the clipboard, onto
# the box as RAEA_AGENT_KEY: its agents clone raea projects (raea-repo clone OWNER
# PROJECT DIR, deploy/git/repo.sh), push, and send renders' media by hash (CR22, CR23)
#
# RAEA_VERSION (0.1.6) and AGENTS ("kimi-code claude-acp") pick what goes on; the farm comes from
# RAEA_VERSION (0.1.6) and AGENTS ("kimi-code claude-acp") pick what goes on, and RAEA_CLOUD_REF takes sdk/cloud from
# raea's public repo at that commit instead of this working tree; the farm comes from
# ~/.config/raea-cloud/farm.env (RAEA_CLOUD_GPU_URL, RAEA_CLOUD_GPU_TOKEN). The Sprite's URL stays private to the org.
set -euo pipefail
# The org is the one raea owns, written once in ~/.config/raea-cloud/sprites.env (RAEA_SPRITES_ORG=...), never taken
# from the environment, and never one listed in private/cloud/sprites-denied.txt (orgs that belong to other businesses).
# (No apostrophe may go in a ${VAR:?message}: it opens a quote that swallows the lines after it, as it once did this
# guard's, and a box went into the wrong org.)
CONF=${RAEA_SPRITES_ENV:-$HOME/.config/raea-cloud/sprites.env}
ORG=$( [ -f "$CONF" ] && sed -n 's/^RAEA_SPRITES_ORG=//p' "$CONF" | tail -1 || true)
[ -n "$ORG" ] || { echo "box: write RAEA_SPRITES_ORG=<the Sprites org raea owns> in $CONF (sprite org list)"; exit 2; }
DENIED=$(git -C "$(dirname "$0")" rev-parse --show-toplevel 2>/dev/null)/private/cloud/sprites-denied.txt
if [ -f "$DENIED" ] && grep -qxF "$ORG" "$DENIED"; then
echo "box: $ORG belongs to another business ($DENIED); raea boxes go in an org raea owns"
exit 2
fi
# the org raea owns, never another business's (org.sh)
. "$(dirname "$0")/org.sh"
NAME=${2:-}
[ -n "$NAME" ] || { echo "box: name the Sprite"; exit 2; }
RAEA_VERSION=${RAEA_VERSION:-0.1.6}
AGENTS=${AGENTS:-kimi-code claude-acp}
NODE=24.22.0
HERE=$(cd "$(dirname "$0")/../.." && pwd)
FARM=${RAEA_FARM_ENV:-$HOME/.config/raea-cloud/farm.env}
@@ -39,52 +30,25 @@ FARM=${RAEA_FARM_ENV:-$HOME/.config/raea-cloud/farm.env}
quiet() { grep --line-buffered -v 'bind: warning' || true; }
x() { sprite exec -o "$ORG" -s "$NAME" -- bash -c "$*" 2>&1 | quiet; }
# a file onto the Sprite over exec's stdin (the CLI's own upload times out on large files)
put() { sprite exec -o "$ORG" -s "$NAME" -- bash -c "mkdir -p \"\$(dirname $2)\" && cat > $2" <"$1" 2>&1 | quiet; }
put() { sprite exec -o "$ORG" -s "$NAME" -- bash -c "umask 077 && mkdir -p \"\$(dirname $2)\" && cat > $2" <"$1" 2>&1 | quiet; }
case "${1:-}" in
up)
[ -f "$FARM" ] || { echo "box: $FARM names no farm (RAEA_CLOUD_GPU_URL, RAEA_CLOUD_GPU_TOKEN)"; exit 2; }
sprite list -o "$ORG" | grep -qx "$NAME" || sprite create -o "$ORG" --skip-console --label raea --label raea-cloud "$NAME"
# raea's runtime libraries, and Mesa's lavapipe: the box draws previews on its CPU, its renders go to the farm
x "sudo DEBIAN_FRONTEND=noninteractive apt-get update -qq && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends \
ca-certificates curl git git-lfs zstd xz-utils procps ripgrep libasound2t64 libfontconfig1 libvulkan1 mesa-vulkan-drivers vulkan-tools >/dev/null"
x "node -v 2>/dev/null | grep -q '^v24' || { curl -fsSL https://nodejs.org/dist/v$NODE/node-v$NODE-linux-x64.tar.xz | sudo tar -xJ -C /opt \
&& sudo ln -sf /opt/node-v$NODE-linux-x64/bin/node /opt/node-v$NODE-linux-x64/bin/npm /opt/node-v$NODE-linux-x64/bin/npx /usr/local/bin/; }"
x "[ \"\$(/opt/raea/bin/raea --version 2>/dev/null)\" = $RAEA_VERSION ] || { set -e; f=raea-$RAEA_VERSION-linux-x86_64.tar.gz; \
u=https://github.com/shinyobjectz/raea/releases/download/v$RAEA_VERSION; cd /tmp && curl -fsSL -o \$f \$u/\$f && curl -fsSL -o \$f.sha256 \$u/\$f.sha256 \
&& sha256sum -c \$f.sha256 && sudo rm -rf /opt/raea && sudo mkdir -p /opt/raea && sudo tar -xzf \$f -C /opt/raea --strip-components=1 && rm -f \$f \$f.sha256; }"
# sdk/cloud's server, client and wrapper, as the image has them (image/Dockerfile)
pack=$(mktemp)
COPYFILE_DISABLE=1 tar -czf "$pack" --no-mac-metadata -C "$HERE" server src image deploy/git package.json package-lock.json
put "$pack" /tmp/raea-cloud.tgz
rm -f "$pack"
x "sudo mkdir -p /opt/raea-cloud && sudo chown \$(id -u):\$(id -g) /opt/raea-cloud && tar -xzf /tmp/raea-cloud.tgz -C /opt/raea-cloud && rm /tmp/raea-cloud.tgz \
&& cd /opt/raea-cloud && npm ci --omit=dev --no-fund --no-audit --loglevel=error && node server/agents.ts install $AGENTS \
&& chmod +x image/*.sh deploy/git/* && sudo ln -sf /opt/raea-cloud/image/raea.sh /usr/local/bin/raea \
&& sudo ln -sf /opt/raea-cloud/deploy/git/repo.sh /usr/local/bin/raea-repo && git lfs install --skip-repo >/dev/null"
# the box's commits say which box made them
x "git config --global user.name 'raea cloud $NAME' && git config --global user.email '$NAME@box.raea.io' && git config --global init.defaultBranch main"
# the box's own token, made once and kept on its disk; the farm's, from this Mac
x "[ -s ~/.raea-cloud.env ] || { umask 077; echo RAEA_CLOUD_TOKEN=\$(openssl rand -hex 32) > ~/.raea-cloud.env; }"
# sdk/cloud's files from this working tree; with RAEA_CLOUD_REF set, setup.sh takes them from raea's public repo at
# that commit instead, as a bot's box does
if [ -z "${RAEA_CLOUD_REF:-}" ]; then
pack=$(mktemp)
COPYFILE_DISABLE=1 tar -czf "$pack" --no-mac-metadata -C "$HERE" server src image deploy/git package.json package-lock.json
put "$pack" /tmp/raea-cloud.tgz
rm -f "${pack:?}"
fi
put "$FARM" /tmp/farm.env
x "umask 077; grep -v '^RAEA_CLOUD_GPU_' ~/.raea-cloud.env > ~/.raea-cloud.env.new; cat /tmp/farm.env >> ~/.raea-cloud.env.new; rm /tmp/farm.env; mv ~/.raea-cloud.env.new ~/.raea-cloud.env"
for a in $AGENTS; do x "raea skills install --agent $a >/dev/null 2>&1 || echo 'box: raea skills for $a not installed'"; done
# the server, as the Sprite's HTTP service on 8080: raea on lavapipe (docs/cloud.feature CL13), renders to the farm
start=$(mktemp)
cat >"$start" <<'EOF'
#!/bin/bash
set -a
. ~/.raea-cloud.env
set +a
export PORT=8080 RAEA_CLOUD_DEVICE=cpu WGPU_BACKEND=vulkan __EGL_VENDOR_LIBRARY_DIRS=/nonexistent
export VK_DRIVER_FILES=$(ls /usr/share/vulkan/icd.d/lvp_icd*.json | head -1)
mkdir -p ~/work
exec node /opt/raea-cloud/server/main.ts
EOF
put "$start" /opt/raea-cloud/image/sprite-start.sh
rm -f "$start"
x "chmod +x /opt/raea-cloud/image/sprite-start.sh && { sprite-env services list | grep -q '\"raea-cloud\"' \
&& sprite-env services restart raea-cloud >/dev/null || sprite-env services create raea-cloud --cmd /opt/raea-cloud/image/sprite-start.sh --http-port 8080; }"
# the box itself, set up by the one script a bot's box is set up by too
if ! sprite exec -o "$ORG" -s "$NAME" -- bash -s -- "$NAME" "$RAEA_VERSION" "$AGENTS" "${RAEA_CLOUD_REF:-}" < "$(dirname "$0")/setup.sh" 2>&1 | quiet; then
echo "box: setup.sh failed on $NAME"; exit 1
fi
"$0" status "$NAME"
;;
status)
+14
View File
@@ -0,0 +1,14 @@
# shellcheck shell=bash
# The Sprites org raea's machines go in, sourced by deploy/sprites/box.sh, tools/linux-box.sh and tools/linux-check.sh
# (it sets ORG). The org is the one raea owns, written once in ~/.config/raea-cloud/sprites.env (RAEA_SPRITES_ORG=...),
# never taken from the environment, and never one listed in private/cloud/sprites-denied.txt (orgs that belong to other
# businesses). (No apostrophe may go in a ${VAR:?message}: it opens a quote that swallows the lines after it, as it
# once did this guard's, and a box went into the wrong org.)
SPRITES_CONF=${RAEA_SPRITES_ENV:-$HOME/.config/raea-cloud/sprites.env}
ORG=$( [ -f "$SPRITES_CONF" ] && sed -n 's/^RAEA_SPRITES_ORG=//p' "$SPRITES_CONF" | tail -1 || true)
[ -n "$ORG" ] || { echo "sprites: write RAEA_SPRITES_ORG=<the Sprites org raea owns> in $SPRITES_CONF (sprite org list)"; exit 2; }
SPRITES_DENIED=$(git -C "$(dirname "${BASH_SOURCE[0]}")" rev-parse --show-toplevel 2>/dev/null)/private/cloud/sprites-denied.txt
if [ -f "$SPRITES_DENIED" ] && grep -qxF "$ORG" "$SPRITES_DENIED"; then
echo "sprites: $ORG belongs to another business ($SPRITES_DENIED); raea machines go in an org raea owns"
exit 2
fi
+90
View File
@@ -0,0 +1,90 @@
#!/bin/bash
# One raea cloud box, set up on the Fly Sprite it runs on. Two callers run this same file: deploy/sprites/box.sh up
# from a Mac, and raea-bot's POST /v1/bots (B1: apps/site/bot harness/sprite.ts, through the Sprites API, at the
# commit the bot pins), so a box made by hand and a box a bot makes can't differ (docs/cloud-render.feature CR11).
# It only adds what's missing, so running it again is safe.
#
# bash -s -- NAME RAEA_VERSION "AGENTS" [REF] < setup.sh
#
# Before it runs, the caller writes the farm's env (RAEA_CLOUD_GPU_URL, RAEA_CLOUD_GPU_TOKEN) to /tmp/farm.env, and
# from a working tree, sdk/cloud's files to /tmp/raea-cloud.tgz. With no tarball there, it takes them from raea's
# public repo at REF. What goes on: raea's Linux release, Node, the ACP agents named in AGENTS with raea's skills for
# each, and sdk/cloud's server as the Sprite's HTTP service on 8080, `raea render` there sent to the farm.
set -euo pipefail
NAME=${1:?name} VERSION=${2:?raea version} AGENTS=${3:?agents} REF=${4:-}
NODE=24.22.0
say() { echo "box $NAME: $*"; }
export DEBIAN_FRONTEND=noninteractive
say packages
# raea's runtime libraries, and Mesa's lavapipe: the box draws previews on its CPU, its renders go to the farm
sudo -E apt-get update -qq
sudo -E apt-get install -y -qq --no-install-recommends ca-certificates curl git git-lfs zstd xz-utils procps ripgrep \
libasound2t64 libfontconfig1 libvulkan1 mesa-vulkan-drivers vulkan-tools > /dev/null
node -v 2> /dev/null | grep -q '^v24' || {
say "node $NODE"
curl -fsSL "https://nodejs.org/dist/v$NODE/node-v$NODE-linux-x64.tar.xz" | sudo tar -xJ -C /opt
sudo ln -sf /opt/node-v$NODE-linux-x64/bin/{node,npm,npx} /usr/local/bin/
}
if [ "$(/opt/raea/bin/raea --version 2> /dev/null)" != "$VERSION" ]; then
say "raea $VERSION"
f=raea-$VERSION-linux-x86_64.tar.gz u=https://github.com/shinyobjectz/raea/releases/download/v$VERSION
(cd /tmp && curl -fsSL -o "$f" "$u/$f" && curl -fsSL -o "$f.sha256" "$u/$f.sha256" && sha256sum -c --quiet "$f.sha256")
sudo rm -rf /opt/raea && sudo mkdir -p /opt/raea && sudo tar -xzf "/tmp/$f" -C /opt/raea --strip-components=1
rm -f "/tmp/$f" "/tmp/$f.sha256"
fi
# sdk/cloud's server, client and wrapper, as the image has them (image/Dockerfile)
if [ ! -s /tmp/raea-cloud.tgz ]; then
[ -n "$REF" ] || { echo "box: no /tmp/raea-cloud.tgz and no REF to take sdk/cloud from"; exit 2; }
say "sdk/cloud at $REF"
g=$(mktemp -d)
git -C "$g" init -q && git -C "$g" sparse-checkout set sdk/cloud
git -C "$g" fetch -q --depth 1 --filter=blob:none https://github.com/shinyobjectz/raea "$REF" && git -C "$g" checkout -q FETCH_HEAD
tar -czf /tmp/raea-cloud.tgz -C "$g/sdk/cloud" server src image deploy/git package.json package-lock.json
rm -rf "${g:?}"
fi
say server
sudo mkdir -p /opt/raea-cloud && sudo chown "$(id -u):$(id -g)" /opt/raea-cloud
tar -xzf /tmp/raea-cloud.tgz -C /opt/raea-cloud && rm /tmp/raea-cloud.tgz
cd /opt/raea-cloud
npm ci --omit=dev --no-fund --no-audit --loglevel=error
node server/agents.ts install $AGENTS
chmod +x image/*.sh deploy/git/*
sudo ln -sf /opt/raea-cloud/image/raea.sh /usr/local/bin/raea
sudo ln -sf /opt/raea-cloud/deploy/git/repo.sh /usr/local/bin/raea-repo
git lfs install --skip-repo > /dev/null
# the box's commits say which box made them
git config --global user.name "raea cloud $NAME"
git config --global user.email "$NAME@box.raea.io"
git config --global init.defaultBranch main
# the box's own token, made once and kept on its disk; the farm's, from the caller
umask 077
[ -s ~/.raea-cloud.env ] || echo "RAEA_CLOUD_TOKEN=$(openssl rand -hex 32)" > ~/.raea-cloud.env
if [ -s /tmp/farm.env ]; then
{ grep -v '^RAEA_CLOUD_GPU_' ~/.raea-cloud.env; cat /tmp/farm.env; } > ~/.raea-cloud.env.new
mv ~/.raea-cloud.env.new ~/.raea-cloud.env && rm /tmp/farm.env
fi
grep -q '^RAEA_CLOUD_GPU_URL=' ~/.raea-cloud.env || { echo "box: no farm (write RAEA_CLOUD_GPU_URL and RAEA_CLOUD_GPU_TOKEN to /tmp/farm.env)"; exit 2; }
umask 022
for a in $AGENTS; do raea skills install --agent "$a" > /dev/null 2>&1 || say "raea skills for $a not installed"; done
# the server, as the Sprite's HTTP service on 8080: raea on lavapipe (docs/cloud.feature CL13), renders to the farm
cat > /opt/raea-cloud/image/sprite-start.sh << 'EOF'
#!/bin/bash
set -a
. ~/.raea-cloud.env
set +a
export PORT=8080 RAEA_CLOUD_DEVICE=cpu WGPU_BACKEND=vulkan __EGL_VENDOR_LIBRARY_DIRS=/nonexistent
export VK_DRIVER_FILES=$(ls /usr/share/vulkan/icd.d/lvp_icd*.json | head -1)
mkdir -p ~/work
exec node /opt/raea-cloud/server/main.ts
EOF
chmod +x /opt/raea-cloud/image/sprite-start.sh
if sprite-env services list | grep -q '"raea-cloud"'; then
sprite-env services restart raea-cloud > /dev/null
else
sprite-env services create raea-cloud --cmd /opt/raea-cloud/image/sprite-start.sh --http-port 8080 > /dev/null
fi
say ready
+28
View File
@@ -0,0 +1,28 @@
#!/bin/bash
# Names of other businesses' Sprites orgs, and of machines retired from them, appear nowhere in raea but in the list
# that denies them: private/cloud/sprites-denied.txt, which deploy/sprites/org.sh reads too (the 11-04 rule: nothing in
# raea runs on, is named for or points at another business). L1 runs it. It reads the words from the list itself, so
# it names none of them, and where the list isn't (a public clone, public CI) there is nothing to check. (The Modal
# list, modal-denied.txt, isn't read yet: bench case names still carry its word.)
# tools/denied.sh check every file of the working tree: public and private paths alike, the files Git ignores
# (node_modules, target) and the repositories nested in it (the feed, skills, projects) left out
set -u
ROOT=$(cd "$(dirname "$0")/.." && pwd)
LIVE=${RAEA_LIVE:-$HOME/raea}
list=$LIVE/private/cloud/sprites-denied.txt
[ -f "$list" ] || { echo "denied: no deny list here ($list), nothing to check"; exit 0; }
pat=$(mktemp)
trap 'rm -f "$pat"' EXIT
grep -v -e '^#' -e '^[[:space:]]*$' "$list" | sort -u > "$pat"
[ -s "$pat" ] || exit 0
# the other repositories in the tree are checked by their own
skip=()
while read -r d; do skip+=(-g "!${d#./}/**"); done < <(cd "$ROOT" && find . -maxdepth 4 -name .git -not -path ./.git -not -path ./private/.git | sed 's#/\.git$##')
# --no-ignore-exclude: the private paths are hidden from the public repository by .git/info/exclude, not .gitignore
hits=$(cd "$ROOT" && rg -n -i -F -f "$pat" --no-ignore-exclude --hidden -g '!.git' -g '!private/cloud/sprites-denied.txt' "${skip[@]}" . 2> /dev/null)
if [ -n "$hits" ]; then
echo "denied: a name from private/cloud/sprites-denied.txt (another business's org, or a machine retired from one):" >&2
echo "$hits" | cut -c1-200 >&2
exit 1
fi
echo "denied: none of the $(wc -l < "$pat" | tr -d ' ') denied names outside their list"
+74
View File
@@ -0,0 +1,74 @@
#!/bin/bash
# The Linux test machine tools/linux-check.sh runs on: Fly Sprite raea-linux, in the Sprites org raea owns
# (sdk/cloud/deploy/sprites/org.sh). Ubuntu 26.04 x86_64, 8 CPUs, 15 GB, Vulkan on Mesa's llvmpipe. It is a machine of
# its own, apart from the agent boxes (deploy/sprites/box.sh): a release build takes all of a Sprite's memory, and on
# 10-29 one restarted the Sprite it shared with an agent.
#
# tools/linux-box.sh up the Sprite, made or completed: the build packages, the toolchain rust-toolchain.toml
# pins, raea's public repo in ~/raea (linux-check sends newer commits as a bundle), and
# /srv/noble, the ubuntu 24.04 root a release is built in (so it needs glibc 2.39, not the
# Sprite's 2.43), with the same packages and the toolchain in its /root/.rustup
# tools/linux-box.sh status what it has
#
# RAEA_LINUX_BOX picks the Sprite (raea-linux). `up` only adds what's missing, so it is safe to run again.
set -euo pipefail
cd "$(dirname "$0")/.."
. sdk/cloud/deploy/sprites/org.sh
NAME=${RAEA_LINUX_BOX:-raea-linux}
CH=$(sed -n 's/^channel *= *"\(.*\)"/\1/p' rust-toolchain.toml)
[ -n "$CH" ] || { echo "linux-box: no channel in rust-toolchain.toml"; exit 2; }
# the Sprite's login shell warns about line editing on every exec; only the command's own status counts
quiet() { grep --line-buffered -v 'bind: warning' || true; }
# a script on the Sprite, from stdin
run() { sprite exec -o "$ORG" -s "$NAME" -- bash -s -- "$@" 2>&1 | quiet; return "${PIPESTATUS[0]}"; }
case "${1:-}" in
up)
sprite list -o "$ORG" | grep -qx "$NAME" || sprite create -o "$ORG" --skip-console --label raea --label linux-check "$NAME"
run "$CH" <<'EOF'
set -euo pipefail
CH=$1 N=/srv/noble
# what a raea build compiles C against (alsa, udev, fontconfig, the windowing libraries, openh264's nasm), in both roots
PKGS="build-essential pkg-config cmake ninja-build nasm clang libclang-dev git git-lfs ca-certificates curl zstd binutils
libasound2-dev libudev-dev libxkbcommon-dev libxkbcommon-x11-dev libwayland-dev libx11-dev libxi-dev libxcursor-dev
libxrandr-dev libvulkan-dev libssl-dev libfontconfig-dev"
export DEBIAN_FRONTEND=noninteractive
echo "linux-box: packages"
sudo -E apt-get update -qq
sudo -E apt-get install -y -qq --no-install-recommends $PKGS debootstrap mesa-vulkan-drivers vulkan-tools ffmpeg zsh > /dev/null
echo "linux-box: toolchain $CH"
rustup toolchain install "$CH" --profile minimal > /dev/null 2>&1
[ -d ~/raea/.git ] || { echo "linux-box: raea's public repo"; GIT_LFS_SKIP_SMUDGE=1 git clone -q https://github.com/shinyobjectz/raea ~/raea; }
if ! sudo test -x "$N/root/.rustup/toolchains/$CH-x86_64-unknown-linux-gnu/bin/cargo"; then
if ! sudo test -x "$N/usr/bin/apt-get"; then
echo "linux-box: $N, ubuntu 24.04"
sudo debootstrap --variant=minbase --components=main,universe noble "$N" http://archive.ubuntu.com/ubuntu > /dev/null
fi
for d in proc sys dev; do mountpoint -q "$N/$d" || sudo mount --bind "/$d" "$N/$d"; done
sudo cp --remove-destination /etc/resolv.conf "$N/etc/resolv.conf"
echo "linux-box: $N's packages"
sudo chroot "$N" bash -c "export DEBIAN_FRONTEND=noninteractive; apt-get update -qq && apt-get install -y -qq --no-install-recommends $(echo $PKGS) > /dev/null"
echo "linux-box: $N's toolchain $CH"
sudo chroot "$N" bash -c "curl -fsSL https://sh.rustup.rs | sh -s -- -y -q --profile minimal --default-toolchain $CH --no-modify-path > /dev/null"
fi
sudo mkdir -p /srv/noble-target
echo "linux-box: ready"
EOF
"$0" status
;;
status)
run "$CH" <<'EOF'
CH=$1 N=/srv/noble
echo "linux-box: $(. /etc/os-release; echo $PRETTY_NAME), $(nproc) CPUs, $(free -g | awk '/^Mem:/ {print $2}') GB, $(df -BG --output=avail / | tail -1 | tr -d ' ') free"
echo "linux-box: raea $(git -C ~/raea log -1 --format='%h %cs' 2>/dev/null || echo missing)"
echo "linux-box: toolchain $(rustup run "$CH" rustc --version 2>/dev/null || echo "$CH missing")"
v=$(sudo chroot "$N" ldd --version 2>/dev/null | head -1 | awk '{print $NF}')
c=$(sudo chroot "$N" /root/.rustup/toolchains/$CH-x86_64-unknown-linux-gnu/bin/cargo --version 2>/dev/null)
echo "linux-box: $N ${v:+glibc $v, }${c:-no cargo}"
EOF
;;
*)
sed -n '2,14p' "$0" | sed 's/^# \{0,1\}//'
exit 2
;;
esac
+8 -6
View File
@@ -1,7 +1,7 @@
#!/bin/bash
# PT8, the Linux check after landing (docs/ports.feature): `cargo check` of raea-cli, and of raea-render without its
# default features, for x86_64 Linux on the probe box (Fly Sprite raea-kimi), so an Apple-only call outside a cfg is
# caught the day it lands.
# default features, for x86_64 Linux on the probe box (Fly Sprite raea-linux in raea's own org, set up by
# tools/linux-box.sh), so an Apple-only call outside a cfg is caught the day it lands.
#
# tools/linux-check.sh [SHA] # default: origin/main
# tools/linux-check.sh --release VERSION [SHA] [--dry] # RL3: the Linux tarball, built and tried there
@@ -25,8 +25,8 @@
# - Output: one line a step ("linux <step>: ..."), the first errors, then "linux <sha>: ok" (exit 0), "FAILED" (exit 1)
# or, when the connection to the probe box dropped first, "lost the probe box" (exit 2, run it again).
# Run it under antsy with a stall of 20 minutes (a cold target builds every build script before printing).
# - Memory: the probe box has 8 GB and is shared with kpop's relay (Shane's cloud agent), and running it out of memory
# restarts the whole box (10-29: the release build at 7 jobs with thin LTO did). Every cargo here runs under a floor:
# - Memory: the probe box has 15 GB and runs nothing else, and running it out of memory restarts the whole box (10-29,
# on the 8 GB box before it: the release build at 7 jobs with thin LTO did). Every cargo here runs under a floor:
# its process group is killed once the memory left falls below RAEA_LINUX_FLOOR_MB (default 1536), so the worst case
# is a failed build ("stopped at N MB"), never a restarted box. Memory left is MemTotal less the root cgroup's anon
# and kernel memory (memory.stat): the box's /proc/meminfo is synthetic (MemFree 0, MemAvailable equal to Cached and
@@ -35,7 +35,9 @@
# LLVM reserves far past what it uses, not the sum. The release build runs 4 jobs, a dry run 7.
set -uo pipefail
cd "$(dirname "$0")/.."
S=(-o "${RAEA_SPRITE_ORG:-kamal-hafid}" -s "${RAEA_SPRITE:-raea-kimi}")
# the org raea owns, never another business's (org.sh); RAEA_LINUX_BOX picks the Sprite
. sdk/cloud/deploy/sprites/org.sh
S=(-o "$ORG" -s "${RAEA_LINUX_BOX:-raea-linux}")
say() { echo "linux $*"; }
git fetch -q origin 2> /dev/null
mode=check version= dry=
@@ -109,7 +111,7 @@ if [ "$2" = release ]; then
mountpoint -q "$N$HOME/raea" || sudo mount --bind -o ro "$HOME/raea" "$N$HOME/raea"
mountpoint -q "$N/target" || sudo mount --bind "$T" "$N/target"
slim=; [ -n "${4:-}" ] && slim="CARGO_PROFILE_DIST_LTO=off CARGO_PROFILE_DIST_DEBUG=0 CARGO_PROFILE_DIST_INCREMENTAL=false"
# the probe box has 8 GB: 7 jobs with thin LTO ran it out of memory and restarted it (10-29, canary.2's first try)
# the first probe box had 8 GB: 7 jobs with thin LTO ran it out of memory and restarted it (10-29, canary.2's first try)
jobs=7; [ -z "$slim" ] && jobs=4
# RAEA_LINUX_DIST_ENV: profile overrides for a release build the box's memory can't hold as the dist profile has it
# (canary.2: CARGO_PROFILE_DIST_DEBUG=0, since debug info is most of the final link's memory; the symbol table stays,