#!/usr/bin/env bash # Vinyl Gauntlet — deploy to partly.party/vinylgauntlet # Build the Vite app, ship dist/ into the forum-nginx container. # Requires: SSH humanjing@100.71.119.27 (tailscale), docker container forum-nginx. set -euo pipefail VPS="humanjing@100.71.119.27" CONTAINER="forum-nginx" WEB_ROOT="/usr/share/nginx/html/vinylgauntlet" STAGING="/tmp/vinylgauntlet_deploy" SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" echo "[1/5] Building ..." ( cd "$SCRIPT_DIR" && npm run build >/dev/null ) echo " ✓ dist/ built" echo "[2/5] Rsync dist/ -> VPS staging ..." ssh "$VPS" "rm -rf '$STAGING' && mkdir -p '$STAGING'" rsync -az --delete "$SCRIPT_DIR/dist/" "$VPS:$STAGING/" 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/ && rm -rf '$STAGING'" echo "[5/5] Verify ..." code=$(curl -s -o /dev/null -w '%{http_code}' "https://partly.party/vinylgauntlet/?cb=$RANDOM") echo " https://partly.party/vinylgauntlet/ -> $code" [ "$code" = "200" ] && echo " ✓ live" || { echo " ✗ not 200 — check nginx routing"; exit 1; }