Skip to content

Commit b54976b

Browse files
deploy.sh: correct the docroot, guard the target, fix control socket
Three fixes found by deploying for real. Docroot is /afs/csail/group/ei/www/_site, not .../www. The original deploy was `scp -r ./_site <host>:/afs/csail/group/ei/www/`, and with no trailing slash that copies the directory in rather than its contents, so the served files sit one level below the path the old notes gave. Syncing to the parent would have written 63 files into the shared ei-group web root, which also holds data/ and ei/, and left the real site untouched. Add a target-identity check before any sync: require team/index.html to exist and index.html to mention "Algorithmic Alignment", else abort with the command to find the real docroot. This catches a wrong CSAIL_WWW before it writes anything. Fix the ControlPath: macOS $TMPDIR is a long /var/folders/... path and blew the ~104-char Unix domain socket limit, so multiplexing failed and Duo prompted per connection. Use /tmp/aag-%C. Also make the target overridable via CSAIL_WWW, and document that --delete must never be used against the shared parent directory. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018asg1b3bxs9Bckinz6Qwxz
1 parent b234384 commit b54976b

2 files changed

Lines changed: 38 additions & 6 deletions

File tree

claude.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,17 @@ Run the deploy script from the repo root:
4242
It gets a Kerberos ticket if needed, builds the site, syncs it, removes known stale
4343
files, and checks the live URLs afterwards. Duo will prompt once.
4444

45-
**Do not run `rsync --delete` against this target.** `/afs/csail/group/ei/www/` is the
46-
*shared* web root for the `ei` group and contains other sites (notably the `ei/`
47-
subtree) that this repo does not produce; `--delete` would erase them. The sync is
48-
deliberately additive, so any file this site stops publishing must be deleted by name -
49-
see the `STALE` list in `deploy.sh`.
45+
**The docroot is `/afs/csail/group/ei/www/_site`** - note the `_site` suffix. The
46+
original deploy used `scp -r ./_site <host>:/afs/csail/group/ei/www/`, and with no
47+
trailing slash that copied the *directory* in, so the served files live one level
48+
deeper than the path in the old notes suggests.
49+
50+
**Never run `rsync --delete` against the parent `/afs/csail/group/ei/www/`.** It is the
51+
shared `ei`-group web root and also contains `data/` and `ei/`, which this repo does not
52+
produce; `--delete` there would erase them. `deploy.sh` is additive and never uses
53+
`--delete`, so any file this site stops publishing must be removed by name - see the
54+
`STALE` list in the script. It also refuses to run unless the target already looks like
55+
a previous deploy of this site.
5056

5157
Use **align-3**: as of Sept 2026 `align-1` resolves but does not answer on port 22.
5258
SSH there needs two factors (Kerberos, then Duo via keyboard-interactive), so deploys

deploy.sh

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ set -euo pipefail
1414

1515
REMOTE_USER="${CSAIL_USER:-dhm}"
1616
REMOTE_HOST="${CSAIL_HOST:-align-3.csail.mit.edu}"
17-
REMOTE_DIR="/afs/csail/group/ei/www"
17+
# Override with: CSAIL_WWW=/some/other/path ./deploy.sh
18+
# NOTE the historical deploy was `scp -r ./_site <host>:/afs/csail/group/ei/www/`,
19+
# which (no trailing slash) creates a `_site` SUBDIRECTORY. Confirm where the live
20+
# site is actually served from before changing this.
21+
REMOTE_DIR="${CSAIL_WWW:-/afs/csail/group/ei/www/_site}"
1822
SITE_URL="https://algorithmicalignment.csail.mit.edu/"
1923

2024
cd "$(dirname "$0")"
@@ -75,6 +79,28 @@ ssh "${SSH_OPTS[@]}" "${REMOTE_USER}@${REMOTE_HOST}" \
7579
cleanup() { ssh "${SSH_OPTS[@]}" -O exit "${REMOTE_USER}@${REMOTE_HOST}" 2>/dev/null || true; }
7680
trap cleanup EXIT
7781

82+
# --- 3b. Confirm we are updating THIS site, not some other one --------------
83+
# The target must already look like a previous deploy of this site. Without this
84+
# check a wrong REMOTE_DIR silently dumps 63 files into someone else's web root.
85+
say "Verifying target is this site"
86+
if ssh "${SSH_OPTS[@]}" "${REMOTE_USER}@${REMOTE_HOST}" \
87+
"test -f '$REMOTE_DIR/team/index.html' && grep -q 'Algorithmic Alignment' '$REMOTE_DIR/index.html'" 2>/dev/null; then
88+
echo "OK: $REMOTE_DIR holds an existing deploy of this site"
89+
else
90+
cat >&2 <<ERR
91+
92+
ERROR: $REMOTE_DIR does not look like this site.
93+
Expected team/index.html and an index.html mentioning "Algorithmic Alignment".
94+
95+
Deploying anyway could overwrite an unrelated site. Find the real docroot first:
96+
97+
ssh ${REMOTE_USER}@${REMOTE_HOST} 'ls /afs/csail/group/ei/www/ /afs/csail/group/ei/www/_site/ 2>&1 | head -40'
98+
99+
then re-run with: CSAIL_WWW=<correct/path> $0 ${1:-}
100+
ERR
101+
exit 1
102+
fi
103+
78104
# --- 4. Sync (additive — NO --delete) ---------------------------------------
79105
if [[ $APPLY -eq 1 ]]; then
80106
say "Syncing (real)"

0 commit comments

Comments
 (0)