deploy: ship both live homes — monsterrobot.games/games/toastsim needs its own base
The partly.party build (base=/toastsim/) had been copied into the monsterrobot.games bind-mount path, where /toastsim/* resolves to the lander's HTML fallback → module-script MIME outage. Deploy now builds twice (one base per home) and verifies both live URLs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
1ae593bbd5
commit
02ccf9e800
@ -10,16 +10,16 @@ REMOTE_WEB_ROOT="/usr/share/nginx/html/toastsim"
|
||||
STAGING="/tmp/toastsim_deploy"
|
||||
REPO="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
|
||||
echo "[1/4] Building (base=/toastsim/)..."
|
||||
echo "[1/6] Building (base=/toastsim/)..."
|
||||
cd "$REPO"
|
||||
./node_modules/.bin/tsc --noEmit
|
||||
./node_modules/.bin/vite build --base=/toastsim/
|
||||
|
||||
echo "[2/4] Rsync dist → $VPS:$STAGING ..."
|
||||
echo "[2/6] Rsync dist → $VPS:$STAGING ..."
|
||||
ssh "$VPS" "rm -rf '$STAGING' && mkdir -p '$STAGING'"
|
||||
rsync -az dist/ "$VPS:$STAGING/"
|
||||
|
||||
echo "[3/4] Merge into $CONTAINER:$REMOTE_WEB_ROOT ..."
|
||||
echo "[3/6] Merge into $CONTAINER:$REMOTE_WEB_ROOT ..."
|
||||
# ADDITIVE on purpose — no rm, no gap. The old flow (rm -rf, then docker cp)
|
||||
# had a downtime window, and worse: any browser/CDN holding yesterday's
|
||||
# index.html pointed at hashed bundles the rm had just deleted → the classic
|
||||
@ -30,13 +30,30 @@ echo "[3/4] Merge into $CONTAINER:$REMOTE_WEB_ROOT ..."
|
||||
ssh "$VPS" "docker exec '$CONTAINER' mkdir -p '$REMOTE_WEB_ROOT' \
|
||||
&& docker cp '$STAGING/.' '$CONTAINER:$REMOTE_WEB_ROOT/'"
|
||||
|
||||
echo "[4/4] Verify the page AND the bundle it references..."
|
||||
page=$(curl -s "https://partly.party/toastsim/?cb=$(date +%s)")
|
||||
src=$(printf '%s' "$page" | grep -oE 'src="[^"]*\.js"' | sed 's/src="//;s/"//' | head -1)
|
||||
[ -n "$src" ] || { echo "NOT DEPLOYED (no script tag in live index.html)"; exit 1; }
|
||||
ctype=$(curl -so /dev/null -w '%{content_type}' "https://partly.party$src")
|
||||
echo "https://partly.party/toastsim/ → script $src → $ctype"
|
||||
case "$ctype" in
|
||||
application/javascript*|text/javascript*) echo "done." ;;
|
||||
*) echo "NOT DEPLOYED (bundle served as $ctype — stale index or missing asset)"; exit 1 ;;
|
||||
esac
|
||||
echo "[4/6] Rebuild for monsterrobot.games (base=/games/toastsim/)..."
|
||||
# Second live home: https://monsterrobot.games/games/toastsim/ — served by
|
||||
# forum-nginx via the host bind mount, so writing the host path IS the deploy.
|
||||
# It needs its own build: the CF tunnel route for monsterrobot.games answers
|
||||
# /toastsim/* with the lander's HTML fallback, so a /toastsim/-based build
|
||||
# there = "module script served as text/html" (2026-09-01 outage). Rsync is
|
||||
# additive (no --delete) for the same stale-HTML reason as step 3.
|
||||
./node_modules/.bin/vite build --base=/games/toastsim/
|
||||
|
||||
echo "[5/6] Rsync dist → monsterrobot.games host path..."
|
||||
rsync -az dist/ "$VPS:/home/humanjing/monsterrobot.games/games/toastsim/"
|
||||
|
||||
echo "[6/6] Verify both pages AND the bundles they reference..."
|
||||
ok=1
|
||||
for url in "https://partly.party/toastsim/" "https://monsterrobot.games/games/toastsim/"; do
|
||||
page=$(curl -s "$url?cb=$(date +%s)")
|
||||
src=$(printf '%s' "$page" | grep -oE 'src="[^"]*\.js"' | sed 's/src="//;s/"//' | head -1)
|
||||
host=$(printf '%s' "$url" | sed -E 's|(https://[^/]+).*|\1|')
|
||||
[ -n "$src" ] || { echo "$url NOT DEPLOYED (no script tag in live index.html)"; ok=0; continue; }
|
||||
ctype=$(curl -so /dev/null -w '%{content_type}' "$host$src")
|
||||
echo "$url → script $src → $ctype"
|
||||
case "$ctype" in
|
||||
application/javascript*|text/javascript*) ;;
|
||||
*) echo "$url NOT DEPLOYED (bundle served as $ctype — stale index or missing asset)"; ok=0 ;;
|
||||
esac
|
||||
done
|
||||
[ "$ok" = 1 ] && echo "done." || exit 1
|
||||
|
||||
Loading…
Reference in New Issue
Block a user