All 27 shipped GLBs run through gltf-transform (meshopt + webp + 1024 textures). Measured per-asset, no failures: 27,304 KB -> 7,132 KB (74% off) with PBR intact. The biggest wins are the wave-1/wave-2 assets that shipped raw (artifact-bottler 1453->329, chroma-keyer 1928->301, mv-extractor 1376->190); the six baked through the new farm script were already lean and barely moved, which is the check that the farm-side step is doing its job. tools/optimize-assets.mjs: idempotent gate wired into deploy.sh BEFORE vite build. Skips anything already carrying EXT_meshopt_compression (so it costs ~0s when nothing is new) and FAILS THE BUILD on any asset over 900 KB — a farm regression that emits trellis2-dense meshes now stops the deploy instead of shipping 36 MB. deploy.sh verify gap closed: it tested exactly one .js file, so a deploy that shipped ZERO models would have reported success. Now checks the JS bundle, a real GLB endpoint, and asserts live model count == built model count. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
49 lines
2.4 KiB
Bash
49 lines
2.4 KiB
Bash
#!/usr/bin/env bash
|
|
# Deploy WIMVEE GLYTCH to https://partly.party/glytch/
|
|
# /glytch/ -> FKTRY (the factory game, vite build)
|
|
# /glytch/match.html -> the original match-the-glitch prototype (single file)
|
|
# Pattern per deploy-map: bundle -> rsync to /tmp staging -> docker cp into
|
|
# forum-nginx -> curl verify (cache-busted). Cloudflare fronts partly.party:
|
|
# purge cache after major changes.
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")"
|
|
|
|
VPS=humanjing@100.71.119.27
|
|
CONTAINER=forum-nginx
|
|
WEBROOT=/usr/share/nginx/html
|
|
|
|
echo "— optimize assets (idempotent; skips anything already meshopt-compressed) —"
|
|
node fktry/tools/optimize-assets.mjs
|
|
|
|
echo "— build —"
|
|
(cd fktry && npx vite build --base=./)
|
|
cp index.html fktry/dist/match.html
|
|
|
|
echo "— stage —"
|
|
rsync -az --delete fktry/dist/ "$VPS:/tmp/glytch-stage/"
|
|
|
|
echo "— swap into container —"
|
|
ssh "$VPS" "docker exec $CONTAINER rm -rf $WEBROOT/glytch \
|
|
&& docker cp /tmp/glytch-stage $CONTAINER:$WEBROOT/glytch \
|
|
&& rm -rf /tmp/glytch-stage"
|
|
|
|
echo "— verify (cache-busted) —"
|
|
curl -fsS -o /dev/null -w '%{http_code} https://partly.party/glytch/\n' "https://partly.party/glytch/?v=$(date +%s)"
|
|
curl -fsS -o /dev/null -w '%{http_code} https://partly.party/glytch/match.html\n' "https://partly.party/glytch/match.html?v=$(date +%s)"
|
|
# Data-endpoint checks, not just the index (classic nginx-routing failure mode).
|
|
# Round-7 fix: this used to test ONE js file, so a deploy that shipped zero models
|
|
# still reported success. Now the JS bundle, a real GLB, and the model COUNT.
|
|
ASSET=$(ls fktry/dist/assets | grep -m1 '\.js$')
|
|
curl -fsS -o /dev/null -w "%{http_code} assets/$ASSET\n" "https://partly.party/glytch/assets/$ASSET?v=$(date +%s)"
|
|
|
|
MODELS_LOCAL=$(ls fktry/dist/assets/models/*.glb 2>/dev/null | wc -l | tr -d ' ')
|
|
MODEL=$(basename "$(ls fktry/dist/assets/models/*.glb 2>/dev/null | head -1)")
|
|
if [ -z "$MODEL" ] || [ "$MODELS_LOCAL" -eq 0 ]; then
|
|
echo "FAIL: build produced no GLB models" >&2; exit 1
|
|
fi
|
|
curl -fsS -o /dev/null -w "%{http_code} assets/models/$MODEL\n" "https://partly.party/glytch/assets/models/$MODEL?v=$(date +%s)"
|
|
MODELS_LIVE=$(ssh "$VPS" "docker exec $CONTAINER sh -c 'ls $WEBROOT/glytch/assets/models/*.glb 2>/dev/null | wc -l'" | tr -d ' ')
|
|
echo "models: $MODELS_LIVE live / $MODELS_LOCAL built"
|
|
[ "$MODELS_LIVE" = "$MODELS_LOCAL" ] || { echo "FAIL: model count mismatch" >&2; exit 1; }
|
|
echo "done. If this was a major change: purge Cloudflare cache for partly.party."
|