interplane-forge
INTERPLANE Forge
Brought by drakestapleton
interplane-forge / infra / test / forge-redirect.sh
| 1 | #!/usr/bin/env bash |
| 2 | # www.aienos.com/forge/ redirect (one-site, 2026-11-10): rehearse hub/forge-edge-update.sh with this |
| 3 | # tree over a COPY of the hub's /etc/nginx, in a throwaway ubuntu:26.04 container, with the REAL forged |
| 4 | # binary and the real (read-only) Radicle storage behind it. Old: the deployed edge tree (default |
| 5 | # hub:/tmp/forge-infra-p23/infra, which every live forge file equals). Checks: old /forge/ proxies |
| 6 | # (negative control), the update applies with its own live checks, the redirect matrix, interplane.io |
| 7 | # answers byte-identical before and after, and forge-edge-rollback.sh restores the old files. |
| 8 | # Reads the hub; changes nothing there. |
| 9 | # Run on spark: taskset -c 2 nice -n 10 bash infra/test/forge-redirect.sh |
| 10 | set -u |
| 11 | INFRA=$(cd "$(dirname "$0")/.." && pwd) |
| 12 | FORGED=${FORGED_BIN:-$INFRA/../server/forged} |
| 13 | OLD=${OLD_TREE:-/tmp/forge-infra-p23/infra} |
| 14 | H=/home/drakestapleton |
| 15 | [ -x "$FORGED" ] || { echo "no forged binary at $FORGED (set FORGED_BIN)"; exit 2; } |
| 16 | W=$(mktemp -d /tmp/forge-redirect.XXXXXX) |
| 17 | trap 'rm -rf "$W"' EXIT |
| 18 | ssh -o BatchMode=yes hub 'sudo -n tar -C /etc -cf - --exclude=nginx/certs --exclude=nginx/sitehub-backups --exclude=nginx/forge-backups nginx' > "$W/etc-nginx.tar" \ |
| 19 | || { echo "could not read hub /etc/nginx"; exit 2; } |
| 20 | rsync -a "hub:$OLD/" "$W/old/" || { echo "could not read hub $OLD"; exit 2; } |
| 21 | echo "hub /etc/nginx copy: sha256 $(sha256sum < "$W/etc-nginx.tar" | cut -c1-16); old tree hub:$OLD; forged sha256 $(sha256sum < "$FORGED" | cut -c1-16)" |
| 22 | docker run --rm --cpuset-cpus "${REDIRECT_CPUS:-2}" \ |
| 23 | -v "$INFRA:/infra:ro" -v "$W:/w:ro" -v "$FORGED:/forged:ro" \ |
| 24 | -v "$H/.radicle/storage:$H/.radicle/storage:ro" \ |
| 25 | -v "$H/handoffs/radicle/RIDS.md:$H/handoffs/radicle/RIDS.md:ro" \ |
| 26 | ubuntu:26.04 bash /infra/test/forge-redirect-inner.sh |