BLOBBO/deploy.sh
type-two ad93d55de9 Custom-assets pill in game, deploy size guard
- game.ts: a forgotten Workshop swap otherwise reads as a broken game with no
  way back; the pill says what is on and links to the Workshop. hasOverrides()
  existed in idb.ts and nothing called it.
- deploy.sh: fail if dist/ exceeds 10MB. stage-farm-assets.sh copies 43MB of
  raw GLBs into public/, vite copies public/ into dist/, and deploy rsyncs all
  of dist/ — I hit exactly this while browser-testing (47MB build).

Browser-verified end to end: stock boot clean (44 scene children, blob r=0.5,
no console errors), Workshop lists all 18 slots, real .glb drop swaps the stage,
Save writes a raw ArrayBuffer manifest, the game loads it (120k-tri boot renders
in-game), pill appears, Clear restores the stock scene exactly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-19 12:39:09 +10:00

55 lines
2.3 KiB
Bash

#!/usr/bin/env bash
# =====================================================================
# BLOBBO — Deploy to partly.party/blobbo/
# =====================================================================
# Usage: bash deploy.sh (from the BLOBBO repo root)
#
# 1. npm run build (vite, base=/blobbo/)
# 2. rsync dist/ to VPS staging
# 3. docker cp into forum-nginx web root
# 4. curl verify (cache-busted)
#
# Follows the GAMES/ deploy doctrine (see cratewars/deploy.sh template).
# Requirements: ssh humanjing@100.71.119.27 (tailscale), container forum-nginx.
# =====================================================================
set -euo pipefail
VPS="humanjing@100.71.119.27"
CONTAINER="forum-nginx"
REMOTE_WEB_ROOT="/usr/share/nginx/html/blobbo"
STAGING="/tmp/blobbo_deploy"
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
echo "[1/4] Building ..."
cd "$SCRIPT_DIR"
npm run build
# Guard: scripts/stage-farm-assets.sh copies ~43MB of raw farm GLBs into
# public/ for local Workshop testing, and vite copies public/ straight into
# dist/. Shipping those means every player downloads 43MB of background props.
# Custom models belong in the player's browser (IndexedDB) or in a decimated
# committed pack — never as an accident of local testing.
DIST_KB="$(du -sk dist | cut -f1)"
if [ "$DIST_KB" -gt 10240 ]; then
echo " ✗ dist/ is ${DIST_KB}KB (>10MB). Staged farm assets leaked into the build?"
echo " Run: rm -rf public/assets/meshes && npm run build"
exit 1
fi
echo " dist/ is ${DIST_KB}KB — ok"
echo "[2/4] Syncing dist/ to VPS staging ..."
ssh "$VPS" "rm -rf '$STAGING' && mkdir -p '$STAGING'"
rsync -az --exclude='.DS_Store' "$SCRIPT_DIR/dist/" "$VPS:$STAGING/"
echo "[3/4] Replacing container content ..."
ssh "$VPS" "docker exec $CONTAINER sh -c 'rm -rf ${REMOTE_WEB_ROOT:?}' && docker cp $STAGING/. $CONTAINER:$REMOTE_WEB_ROOT/"
echo "[4/4] Verifying live URL ..."
BUST="$(date +%s)"
CODE_HTTP="$(ssh "$VPS" "curl -s -o /dev/null -w '%{http_code}' http://localhost/blobbo/?v=$BUST")"
echo " container-local /blobbo/ -> HTTP $CODE_HTTP"
CODE_LIVE="$(curl -s -o /dev/null -w '%{http_code}' "https://partly.party/blobbo/?v=$BUST")"
echo " https://partly.party/blobbo/ -> HTTP $CODE_LIVE"
[ "$CODE_LIVE" = "200" ] || { echo " ✗ live check failed"; exit 1; }
echo " ✓ deployed."