#!/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."