sandoniette/deploy.sh
type-two 4f4b31b914 Deploy to partly.party/sandoniette
- vite.config.ts: dev base '/', build base '/sandoniette/' (subpath deploy).
- Asset loads use import.meta.env.BASE_URL so paths resolve at the subpath
  regardless of trailing slash. vite-env.d.ts for the env types.
- deploy.sh: build -> rsync dist/ -> docker cp into forum-nginx web root
  /usr/share/nginx/html/sandoniette (matches the partly.party games pattern).
- Verified LIVE: index+JS 200, JS served as application/javascript (not the
  HTML-fallback failure), PNGs image/png, title screen renders in-browser.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-17 21:55:56 +10:00

40 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# サンドニエット SANDONIETTE — deploy to partly.party/sandoniette/
# Games VPS: humanjing@100.71.119.27 (tailscale), docker container forum-nginx,
# nginx serves /usr/share/nginx/html/<game>/ at partly.party/<game>/.
#
# Usage: bash deploy.sh (builds fresh, then ships dist/)
set -euo pipefail
VPS="humanjing@100.71.119.27"
CONTAINER="forum-nginx"
WEB_ROOT="/usr/share/nginx/html/sandoniette"
STAGING="/tmp/sandoniette_deploy"
DIR="$(cd "$(dirname "$0")" && pwd)"
echo "[1/5] Building (base=/sandoniette/) ..."
( cd "$DIR" && npm run build >/dev/null )
echo " ✓ dist/ ready"
echo "[2/5] Rsync dist/ → VPS staging ..."
ssh "$VPS" "rm -rf '$STAGING' && mkdir -p '$STAGING'"
rsync -az --delete "$DIR/dist/" "$VPS:$STAGING/"
echo " ✓ synced"
echo "[3/5] Reset container web root ..."
ssh "$VPS" "docker exec $CONTAINER sh -c 'rm -rf ${WEB_ROOT:?} && mkdir -p ${WEB_ROOT:?}'"
echo "[4/5] Copy bundle into container ..."
ssh "$VPS" "docker cp $STAGING/. $CONTAINER:$WEB_ROOT/"
ssh "$VPS" "rm -rf '$STAGING'"
echo " ✓ live files in place"
echo "[5/5] Verify ..."
code=$(curl -s -o /dev/null -w '%{http_code}' https://partly.party/sandoniette/ || true)
js=$(curl -s https://partly.party/sandoniette/ | grep -o '/sandoniette/assets/[^"]*\.js' | head -1)
jscode=$(curl -s -o /dev/null -w '%{http_code}' "https://partly.party$js" || true)
echo " index: $code $js: $jscode"
echo ""
echo "✓ Live at https://partly.party/sandoniette/ (Cloudflare-fronted; purge cache after big changes)"