#!/usr/bin/env bash # TURNCRAFT deploy — partly.party/turncraft (games VPS humanjing@100.71.119.27) # # Infrastructure (already in place, one-time — done 2026-07-13): # - /home/humanjing/turncraft -> bind-mounted (ro) into forum-nginx # - /home/humanjing/turncraft-relay -> turncraft-relay container # (node:22-alpine, -p 100.71.119.27:8433:8433, restart unless-stopped) # - ~/forum/nginx/nginx.conf: upstream turncraft_ws + /turncraft/ + # /turncraft/ws locations in BOTH the partly.party and monsterrobot.games # server blocks (all games are dual-hosted there) # # So a deploy is just: build -> rsync -> restart relay -> verify. set -euo pipefail VPS="humanjing@100.71.119.27" echo "== build ==" npx vite build --base=/turncraft/ echo "== sync static ==" rsync -az --delete dist/ "$VPS:/home/humanjing/turncraft/" echo "== sync + restart relay ==" rsync -az --delete --exclude node_modules --exclude 'booth-state.json*' \ server/ "$VPS:/home/humanjing/turncraft-relay/" ssh "$VPS" "docker restart turncraft-relay >/dev/null && sleep 3 && docker logs --tail 2 turncraft-relay" echo "== verify live ==" curl -fsS -o /dev/null -w "static: %{http_code}\n" "https://partly.party/turncraft/?bust=$(date +%s)" curl -fsS --http1.1 -o /dev/null -w "ws: %{http_code} (expect 101)\n" \ -H 'Connection: Upgrade' -H 'Upgrade: websocket' \ -H 'Sec-WebSocket-Version: 13' -H 'Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==' \ -H 'Origin: https://partly.party' \ "https://partly.party/turncraft/ws" echo "done — https://partly.party/turncraft/" echo "note: assets are content-hashed + cf-cache-status DYNAMIC; no CF purge needed."