diff --git a/deploy.sh b/deploy.sh new file mode 100644 index 0000000..f0af8a8 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,30 @@ +#!/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; } diff --git a/src/GameScene.js b/src/GameScene.js index a5e0e04..040785e 100644 --- a/src/GameScene.js +++ b/src/GameScene.js @@ -33,7 +33,9 @@ export default class GameScene extends Phaser.Scene { } preload() { - for (const key of TEXTURE_KEYS) this.load.image(key, `sprites/${key}.png`); + // BASE_URL makes assets resolve under the deploy subpath (partly.party/vinylgauntlet/) + const base = import.meta.env.BASE_URL; + for (const key of TEXTURE_KEYS) this.load.image(key, `${base}sprites/${key}.png`); } create() { diff --git a/vite.config.js b/vite.config.js new file mode 100644 index 0000000..cd36beb --- /dev/null +++ b/vite.config.js @@ -0,0 +1,6 @@ +import { defineConfig } from 'vite'; + +// Served from a subpath on partly.party, so assets must resolve under /vinylgauntlet/. +export default defineConfig({ + base: '/vinylgauntlet/', +});