~ knotless Search/
↑↓ move↵ open⇧↵ all results

socialweb.computer/socialweb-computer-kcp

socialweb.computer: a compute market on atproto (kcp)

1 collaborator
0
0

plan 0040 step 1: promote.sh --dry-run, rehearsed on the release image

Merged johnandersen777.bsky.social asked to merge into main from socialweb.computer/socialweb-computer-kcp:step-1
docs/plans/0040-release-pipeline.md+4−0
@@ -284,4 +284,8 @@ Each: what was seen (with the log), the cause, the fix, its proof.
- `superseded: finish` applies on every ref in the deployed runner (af321883 `lib.rs` 2492, 2629), so an asked branch
`test` waits behind a running or frozen one (up to 300 min); `test.yml`'s comment and `AGENTS.md` say a branch push
cancels (true only from 4cb9bbb3, step 7). Until then: cancel the older branch run by hand.
- A request's summary can say `"phase": "released"`, `"termination": "deleted_on_request"` with `"releaseOk": false`
(`releaseStatus` 200): 15 of 246 saved request logs on hat-8 (`~/.tmp/swc-system-tests/runs/*/logs/*/release.log`), and
the step 1 rehearsal (2026-11-17, `~/.tmp/rehearse.log`); `finishRelease` sets it true (`internal/market/requester/
runner.go`): not root-caused.
- `scripts/ci-hand-market.sh` uses sudo on the bidder hosts (sudo on the hats is allowed by the owner).
docs/ci-debug.md+33−0
@@ -122,6 +122,39 @@ Differences from CI, and only these:
| platforms | linux/amd64, linux/arm64 | `CI_PLATFORMS` |
| freeze TTL | 1800 s on main | `CI_FREEZE_TTL=7200`, ended by hand (SIGTERM) when debugging is done |
## Promote, by hand: the dry run on a VM with the release image
`promote.yml` cannot be rehearsed by an asked run (release-workload writes the rc's records before its command runs).
`scripts/promote.sh --dry-run` fetches and checks the binary, reads each rc operator's heartbeat once and prints the
droplet deploys and the gate command; it runs none and needs no secret. On the release binding's image and size
(socialweb.computer's `com.fedfork.exec.binding/release`: `ci-toolchain` 0049d853, 4 vCPUs, 8 GiB), as the account:
```sh
S=$(git rev-parse HEAD) M=<the main commit whose release published this tests/ and rust/ tree>
B=https://socialweb-computer-kcp.sfo3.digitaloceanspaces.com I=0049d853de17ff3bedfc3c9931b99906fd46c6bc108c1c8be2118d68d27f4dec
d=$HOME/.tmp/local-src/$S; mkdir -p $d; git archive HEAD | gzip > $d/src.tar.gz; cp scripts/promote-rehearse.sh $d/
(set -a; . "$CI_BUCKET_CREDS"; set +a; deno run -A --no-lock scripts/publish-spaces.ts --dir $d --prefix local/$S/src)
RU=$B/main/$M/binaries/socialweb-computer-linux-amd64
RS=$(curl -fsS $B/main/$M/binaries/SHA256SUMS | awk '$2 ~ /linux-amd64$/ {print $1}')
( . "$CI_ACCOUNT_CREDS"; p=${CI_ACCOUNT_PREFIX}_ATPROTO_PASSWORD; export ATPROTO_PASSWORD=${!p}
socialweb-computer run request --state-dir ~/.tmp/rehearse-state --name promote-rehearse --image "$B/vm-images/ci-toolchain/$I@$I" \
--cpus 4 --mem 8G --expires-in 1h --exec "bash -c 'curl -fsSL $B/local/$S/src/promote-rehearse.sh -o /var/tmp/r.sh && \
sudo -n bash /var/tmp/r.sh $B/local/$S/src/src.tar.gz $(sha256sum < $d/src.tar.gz | cut -c1-64) $M $RU $RS'" \
-- --atproto-identity-mode pdsAccount --atproto-handle <handle> --atproto-pds-url https://bsky.social ) 2>&1 | tee ~/.tmp/rehearse.log
```
Pass: `==> would run:` the deploy and the ssh restart, one `==>` line per rc operator, the gate command, `==> rehearsal
done`. 2026-11-17 on main de0b91ee: passed.
## The hat-8 gate
```sh
cd tests && SWC_COMPAT_REQUESTER=sha:<previous rc commit> ./gate.sh $PWD/targets/prod.json --account bob,alice
```
As bob on hat-8; the target's `requester` set to `sha:<the rc's commit>` (plan 0040 step 14). No landing on main while it
runs.
## Iterate on a held staging network
Do not stand staging up per fix (about 8 min each). One network per build, every entry on it (owner, 2026-11-15):
scripts/promote-rehearse.shnew+19−0
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
# promote-rehearse.sh <src url> <src sha256> <main commit> <release url> <release sha256>: on a VM with the release image
# (docs/ci-debug.md "Promote, by hand"), as root: the checkout from a source tarball (its tests/ and rust/ trees are
# <main commit>'s, which release published), then promote.yml's step as `promote.sh --dry-run`.
set -euo pipefail
src=$1 src_sha=$2 commit=$3
export RELEASE_URL=$4 RELEASE_SHA256=$5
w=/root/rehearse
rm -rf "$w" && mkdir -p "$w" && cd "$w"
curl -fsSL --retry 3 -o src.tar.gz "$src"
echo "$src_sha src.tar.gz" | sha256sum -c --quiet
tar xzf src.tar.gz && rm src.tar.gz
git init -q && git add -A && git -c user.name=rehearse -c user.email=rehearse@localhost commit -qm src
id r2 >/dev/null 2>&1 || useradd -m r2
bash scripts/ci-test.sh host
install -d -o r2 /home/r2
echo "sha:$commit" > /home/r2/requester.spec
bash scripts/promote.sh --dry-run
echo "==> rehearsal done"
scripts/promote.sh+19−5
@@ -1,5 +1,7 @@
#!/usr/bin/env bash
# promote.sh [rollback]: plan 0040 step 6, on the release VM, run by the release-workload module after it moved channel rc.
# promote.sh [--dry-run] [rollback]: plan 0040's promote, on the release VM, run by the release-workload module after it
# moved channel rc. --dry-run (plan 0040 step 1) fetches and checks the binary, reads the heartbeats once, and prints the
# droplet deploys and the gate command it would run; it runs none of them and needs no secret.
# (no argument) the socialweb.computer droplets to RELEASE_URL (RELEASE_SHA256), every rc operator's bidder heartbeating
# that binary (deploy/release/rc-operators.json, within updateWithin), then the prod gate as r2
# rollback the droplets back to PREVIOUS_URL (PREVIOUS_SHA256); no previous: nothing to do
@@ -7,16 +9,24 @@
# requester spec).
set -euo pipefail
cd "$(dirname "$0")/.."
dry=0
if [ "${1:-}" = --dry-run ]; then dry=1; shift; fi
would() { echo "==> would run: $*"; }
command -v curl >/dev/null && command -v jq >/dev/null || { apt-get update -qq && apt-get install -y -qq curl jq >/dev/null; }
home=${CI_HOME:-/home/r2}
d=$(mktemp -d); trap 'rm -rf "$d"' EXIT
(umask 077 && printf '%s\n' "${PROD_DEPLOY_SSH_KEY:?PROD_DEPLOY_SSH_KEY}" > "$d/key")
if [ "$dry" = 0 ]; then (umask 077 && printf '%s\n' "${PROD_DEPLOY_SSH_KEY:?PROD_DEPLOY_SSH_KEY}" > "$d/key"); fi
unset PROD_DEPLOY_SSH_KEY
droplets() { # url sha256
curl -fsSL --retry 3 -o "$d/socialweb-computer" "$1"
echo "$2 $d/socialweb-computer" | sha256sum -c --quiet
chmod 0755 "$d/socialweb-computer"
if [ "$dry" = 1 ]; then
would "BINARY=<$1, sha256 $2 checked> SHA256=$2 SSH_KEY=<PROD_DEPLOY_SSH_KEY> bash scripts/deploy.sh"
would "ssh -p ${SSH_PORT:-1997} root@socialweb.computer systemctl restart swc-ssh-gateway.service"
return
fi
BINARY=$d/socialweb-computer SHA256=$2 SSH_KEY=$d/key bash scripts/deploy.sh
ssh -p "${SSH_PORT:-1997}" -i "$d/key" -o IdentitiesOnly=yes -o BatchMode=yes -o StrictHostKeyChecking=accept-new root@socialweb.computer \
'systemctl restart swc-ssh-gateway.service && systemctl is-active swc-ssh-gateway.service'
@@ -31,6 +41,8 @@ fi
droplets "${RELEASE_URL:?RELEASE_URL}" "${RELEASE_SHA256:?RELEASE_SHA256}"
# the entries the guest requester r2 drives (plan 0040 step 11 replaces this with the full list as bob,alice)
GATE_R2_ENTRIES="0003:run 0005:run 0006:run 0007:run 0007:restart 0008:run 0012:run 0013:run 0014:run 0014:concurrent 0014:exhausted 0014:backtoback 0015:pressure 0016:run 0016:badsha 0019:run 0020:run"
within=$(jq -r '.updateWithin' deploy/release/rc-operators.json | sed 's/m$//')
deadline=$(( $(date +%s) + within * 60 ))
for did in $(jq -r '.operators[].bidders[]' deploy/release/rc-operators.json); do
@@ -38,11 +50,16 @@ for did in $(jq -r '.operators[].bidders[]' deploy/release/rc-operators.json); d
while :; do
got=$(curl -fsS -m 20 "$pds/xrpc/com.atproto.repo.getRecord?repo=$did&collection=com.publicdomainrelay.temp.market.heartbeat&rkey=self" | jq -r '.value.version.sha256 // ""' || true)
[ "$got" = "$RELEASE_SHA256" ] && { echo "==> $did heartbeats the release"; break; }
if [ "$dry" = 1 ]; then echo "==> $did heartbeats ${got:-nothing} now; would wait ${within}m for $RELEASE_SHA256"; break; fi
[ "$(date +%s)" -lt "$deadline" ] || { echo "==> $did still heartbeats ${got:-nothing} after ${within}m" >&2; exit 1; }
sleep 20
done
done
if [ "$dry" = 1 ]; then
would "runuser -u r2 -- env ... GATE_ACCOUNTS=r2 bash tests/gate.sh <target-prod.json, requester $(cat "$home/requester.spec" 2>/dev/null || echo '<scripts/ci-test.sh binary not run>')> $GATE_R2_ENTRIES"
exit 0
fi
spec="$(cat "$home/requester.spec")"
jq --arg b "$spec" '.requester = $b | .accounts.r2 = {handle: "", did: "", guestRequester: true}' tests/targets/prod.json > "$home/target-prod.json"
if [ -n "${ATIRC_AGENT_CONFIG:-}" ]; then
@@ -53,9 +70,6 @@ fi
unset ATIRC_AGENT_CONFIG
chown r2 "$home/target-prod.json"
install -d -o r2 gate-runs
# the entries the guest requester r2 drives (the staging suite's, scripts/ci-test.sh input_default); the rest need a password
# account (alice, bob: a second requester or an owner sign-in), whose credentials never leave the deploy host
GATE_R2_ENTRIES="0003:run 0005:run 0006:run 0007:run 0007:restart 0008:run 0012:run 0013:run 0014:run 0014:concurrent 0014:exhausted 0014:backtoback 0015:pressure 0016:run 0016:badsha 0019:run 0020:run"
# as scripts/ci-test.sh runs the staging suite: as the guest requester r2, the checkout as SWC_REPO (a prebuilt test host's
# own source path is the build host's), the binary under test and meshd that ci-test.sh host and binary installed
runuser -u r2 -- env HOME=/home/r2 XDG_RUNTIME_DIR="/run/user/$(id -u r2)" SWC_REPO="$PWD" SWC_BINARY="$home/swc-under-test" \
.plans.yaml+2−2
@@ -30,5 +30,5 @@ plans:
now: "not started"
log: "none yet"
waits_on: "step 17"
status: "step 0 done (promote asked-only, landed with the plan); prod on rc174 (decision 6); no stable"
next: "step 1 (promote.sh --dry-run), step 2 (hand builds to local/)"
status: "steps 0, 1 done (promote asked-only; promote.sh --dry-run rehearsed on the release image on main de0b91ee); prod on rc174; no stable"
next: "step 2 (hand builds to local/, 0020 from its own prefix)"