- deploy/deploy.sh: build --base=/turncraft/ -> stage -> docker cp into forum-nginx -> reload -> curl verify; syncs relay code + restarts it. - deploy/setup-relay.sh: one-time relay container on forum-nginx's docker network + the nginx location block for /turncraft/ws. - relay: MAX_EDITS=400k grief ceiling (unbounded diff map could reach ~550MB if a bot painted the whole booth). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
39 lines
1.3 KiB
Bash
Executable File
39 lines
1.3 KiB
Bash
Executable File
#!/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
|