From 7975808c8ad1a13363251f0f8488c3cd01deac99 Mon Sep 17 00:00:00 2001 From: jing Date: Mon, 13 Jul 2026 23:30:54 +1000 Subject: [PATCH] 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 --- deploy/deploy.sh | 41 +++++++++++++++++++---------------------- deploy/setup-relay.sh | 38 -------------------------------------- 2 files changed, 19 insertions(+), 60 deletions(-) delete mode 100755 deploy/setup-relay.sh diff --git a/deploy/deploy.sh b/deploy/deploy.sh index dfa1ce2..84873e8 100755 --- a/deploy/deploy.sh +++ b/deploy/deploy.sh @@ -1,40 +1,37 @@ #!/usr/bin/env bash # TURNCRAFT deploy — partly.party/turncraft (games VPS humanjing@100.71.119.27) -# Pattern per deploy-map: build -> rsync to /tmp staging -> docker cp into -# forum-nginx web root -> reload -> curl verify. Run from the repo root. # -# First-time setup (relay service + nginx routes): deploy/setup-relay.sh +# 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" -STAGE="/tmp/turncraft-stage" -NGINX_CONTAINER="forum-nginx" -# Web root inside forum-nginx — verify with: -# docker exec forum-nginx sh -c 'grep -R "root " /etc/nginx/conf.d | head' -WEBROOT="${TURNCRAFT_WEBROOT:-/usr/share/nginx/html}" echo "== build ==" npx vite build --base=/turncraft/ -echo "== stage on VPS ==" -ssh "$VPS" "rm -rf $STAGE && mkdir -p $STAGE" -rsync -az --delete dist/ "$VPS:$STAGE/turncraft/" +echo "== sync static ==" +rsync -az --delete dist/ "$VPS:/home/humanjing/turncraft/" -echo "== install into $NGINX_CONTAINER:$WEBROOT/turncraft ==" -ssh "$VPS" "docker exec $NGINX_CONTAINER rm -rf $WEBROOT/turncraft \ - && docker cp $STAGE/turncraft $NGINX_CONTAINER:$WEBROOT/turncraft \ - && docker exec $NGINX_CONTAINER nginx -s reload" - -echo "== relay code sync (server/) ==" +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 2>&1 || echo 'relay container not running — run deploy/setup-relay.sh'" +ssh "$VPS" "docker restart turncraft-relay >/dev/null && sleep 3 && docker logs --tail 2 turncraft-relay" -echo "== verify ==" +echo "== verify live ==" curl -fsS -o /dev/null -w "static: %{http_code}\n" "https://partly.party/turncraft/?bust=$(date +%s)" -curl -fsS -o /dev/null -w "ws-route: %{http_code}\n" \ +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==' \ - "https://partly.party/turncraft/ws" || true # 101/400 = route alive; 404 = missing nginx block + -H 'Origin: https://partly.party' \ + "https://partly.party/turncraft/ws" -echo "done. If Cloudflare serves a stale bundle, purge the cache." +echo "done — https://partly.party/turncraft/" +echo "note: assets are content-hashed + cf-cache-status DYNAMIC; no CF purge needed." diff --git a/deploy/setup-relay.sh b/deploy/setup-relay.sh deleted file mode 100755 index a0b892a..0000000 --- a/deploy/setup-relay.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env bash -# One-time TURNCRAFT relay setup on the games VPS. -# - runs the relay as a docker container on forum-nginx's network -# - prints the nginx location blocks to add to the partly.party server conf -set -euo pipefail - -VPS="humanjing@100.71.119.27" - -rsync -az --exclude node_modules --exclude 'booth-state.json*' \ - server/ "$VPS:/home/humanjing/turncraft-relay/" - -ssh "$VPS" bash -s <<'EOF' -set -euo pipefail -NET=$(docker inspect forum-nginx --format '{{range $k, $_ := .NetworkSettings.Networks}}{{$k}}{{end}}' | head -1) -echo "forum-nginx network: $NET" -docker rm -f turncraft-relay 2>/dev/null || true -docker run -d --name turncraft-relay --restart unless-stopped \ - --network "$NET" \ - -v /home/humanjing/turncraft-relay:/app -w /app \ - -e HOST=0.0.0.0 -e PORT=8433 \ - node:22-alpine sh -c "npm ci --omit=dev && exec node relay.mjs" -sleep 3 -docker logs --tail 5 turncraft-relay -EOF - -cat <<'NGINX' - -Add to the partly.party server block (conf.d), then nginx -s reload: - - location /turncraft/ws { - proxy_pass http://turncraft-relay:8433; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - proxy_set_header Origin $http_origin; - proxy_read_timeout 300s; - } -NGINX