deploy: durable host bind-mount instead of ephemeral docker cp
The docker-cp deploy wrote morpquest into forum-nginx's writable layer; when the container was recreated (July 5) the files vanished and the site fell through to the forum SPA fallback. Every other game there is a host bind-mount, which survives recreation — morpquest now is too: forum/docker-compose.yml: /home/humanjing/morpquest -> .../html/morpquest:ro deploy.sh now just rsyncs into that live mount (instant, no recreate). Also fixed the .wav MIME: forum nginx.conf now maps audio/wav (the chiptunes were serving as application/octet-stream). Both changes survive container recreation (bind-mounted conf + compose volume). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
e391417cf9
commit
a7c63f47c1
38
deploy.sh
38
deploy.sh
@ -5,21 +5,29 @@
|
|||||||
# Usage: bash deploy.sh [path-to-MRPGI]
|
# Usage: bash deploy.sh [path-to-MRPGI]
|
||||||
#
|
#
|
||||||
# 1. Builds the wasm bundle with this game baked in (MRPGI/web/build.sh)
|
# 1. Builds the wasm bundle with this game baked in (MRPGI/web/build.sh)
|
||||||
# 2. Rsyncs web/dist to VPS staging
|
# 2. rsyncs web/dist/ into the host bind-mount /home/humanjing/morpquest
|
||||||
# 3. Replaces /usr/share/nginx/html/morpquest/ inside forum-nginx
|
|
||||||
#
|
#
|
||||||
# Same VPS + container as beyondmorp's deploy.sh:
|
# The game is served at https://partly.party/morpquest/ from a *host
|
||||||
# ssh humanjing@100.71.119.27 (tailscale), container forum-nginx.
|
# bind-mount* (forum-nginx: /home/humanjing/morpquest -> .../html/morpquest,
|
||||||
# The game then lives at <forum-domain>/morpquest/ beside /beyondmorp/.
|
# added to forum/docker-compose.yml alongside beyondmorp/roguelike/etc.).
|
||||||
|
# Because it's a live bind-mount, an rsync is instantly live — no docker cp,
|
||||||
|
# no reload, no container recreate. (The earlier docker-cp approach wrote to
|
||||||
|
# the container's writable layer and vanished when forum-nginx was recreated;
|
||||||
|
# a bind-mount is the durable pattern every other game here uses.)
|
||||||
|
#
|
||||||
|
# One-time infra already in place on the VPS (humanjing@100.71.119.27):
|
||||||
|
# * forum/docker-compose.yml nginx volumes:
|
||||||
|
# - /home/humanjing/morpquest:/usr/share/nginx/html/morpquest:ro
|
||||||
|
# * forum/nginx/nginx.conf http{} after `include mime.types`:
|
||||||
|
# types { audio/wav wav; } # so the chiptunes serve as audio/wav
|
||||||
|
# Both survive container recreation (compose + bind-mounted conf).
|
||||||
# =====================================================================
|
# =====================================================================
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
MRPGI="${1:-$HOME/Documents/MRPGI}"
|
MRPGI="${1:-$HOME/Documents/MRPGI}"
|
||||||
GAME="$(cd "$(dirname "$0")" && pwd)"
|
GAME="$(cd "$(dirname "$0")" && pwd)"
|
||||||
VPS="humanjing@100.71.119.27"
|
VPS="humanjing@100.71.119.27"
|
||||||
CONTAINER="forum-nginx"
|
REMOTE_DIR="/home/humanjing/morpquest"
|
||||||
REMOTE_WEB_ROOT="/usr/share/nginx/html/morpquest"
|
|
||||||
STAGING="/tmp/morpquest_deploy"
|
|
||||||
|
|
||||||
# rustup's toolchain has the wasm target; homebrew's rust does not.
|
# rustup's toolchain has the wasm target; homebrew's rust does not.
|
||||||
RUSTUP_BIN="$HOME/.rustup/toolchains/stable-aarch64-apple-darwin/bin"
|
RUSTUP_BIN="$HOME/.rustup/toolchains/stable-aarch64-apple-darwin/bin"
|
||||||
@ -28,14 +36,8 @@ RUSTUP_BIN="$HOME/.rustup/toolchains/stable-aarch64-apple-darwin/bin"
|
|||||||
echo "==> building wasm bundle ($GAME baked in)"
|
echo "==> building wasm bundle ($GAME baked in)"
|
||||||
sh "$MRPGI/web/build.sh" "$GAME"
|
sh "$MRPGI/web/build.sh" "$GAME"
|
||||||
|
|
||||||
echo "==> rsync to VPS staging"
|
echo "==> rsync web/dist -> $VPS:$REMOTE_DIR (live bind-mount)"
|
||||||
ssh "$VPS" "rm -rf $STAGING && mkdir -p $STAGING"
|
ssh "$VPS" "mkdir -p $REMOTE_DIR"
|
||||||
rsync -az --delete "$MRPGI/web/dist/" "$VPS:$STAGING/"
|
rsync -az --delete "$MRPGI/web/dist/" "$VPS:$REMOTE_DIR/"
|
||||||
|
|
||||||
echo "==> swap into $CONTAINER:$REMOTE_WEB_ROOT"
|
echo "==> deployed live at https://partly.party/morpquest/ — the queue has been waiting since sunrise."
|
||||||
ssh "$VPS" "
|
|
||||||
docker exec $CONTAINER rm -rf $REMOTE_WEB_ROOT
|
|
||||||
docker cp $STAGING $CONTAINER:$REMOTE_WEB_ROOT
|
|
||||||
docker exec $CONTAINER ls $REMOTE_WEB_ROOT
|
|
||||||
"
|
|
||||||
echo "==> deployed. The queue has been waiting since sunrise."
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user