TURNCRAFT/deploy/deploy.sh
jing 7975808c8a Deploy: record the real partly.party procedure (shipped 2026-07-13)
deploy.sh now matches the box: bind-mount static + turncraft-relay
container + nginx routes exist (dual-hosted on partly.party and
monsterrobot.games like the other games); a deploy is build -> rsync ->
relay restart -> curl verify. setup-relay.sh removed (one-time setup done,
documented in deploy.sh header).

Live: https://partly.party/turncraft/ (200, ws handshake 101, no CF purge
needed - hashed assets, DYNAMIC cache status).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-13 23:30:54 +10:00

38 lines
1.6 KiB
Bash
Executable File

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