From a7c63f47c1bad87af53e56ba0e6bb7f563392be1 Mon Sep 17 00:00:00 2001 From: type-two Date: Mon, 6 Jul 2026 11:43:35 +1000 Subject: [PATCH] deploy: durable host bind-mount instead of ephemeral docker cp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- deploy.sh | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/deploy.sh b/deploy.sh index 8e165ac..33ef9af 100755 --- a/deploy.sh +++ b/deploy.sh @@ -5,21 +5,29 @@ # Usage: bash deploy.sh [path-to-MRPGI] # # 1. Builds the wasm bundle with this game baked in (MRPGI/web/build.sh) -# 2. Rsyncs web/dist to VPS staging -# 3. Replaces /usr/share/nginx/html/morpquest/ inside forum-nginx +# 2. rsyncs web/dist/ into the host bind-mount /home/humanjing/morpquest # -# Same VPS + container as beyondmorp's deploy.sh: -# ssh humanjing@100.71.119.27 (tailscale), container forum-nginx. -# The game then lives at /morpquest/ beside /beyondmorp/. +# The game is served at https://partly.party/morpquest/ from a *host +# bind-mount* (forum-nginx: /home/humanjing/morpquest -> .../html/morpquest, +# 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 MRPGI="${1:-$HOME/Documents/MRPGI}" GAME="$(cd "$(dirname "$0")" && pwd)" VPS="humanjing@100.71.119.27" -CONTAINER="forum-nginx" -REMOTE_WEB_ROOT="/usr/share/nginx/html/morpquest" -STAGING="/tmp/morpquest_deploy" +REMOTE_DIR="/home/humanjing/morpquest" # rustup's toolchain has the wasm target; homebrew's rust does not. 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)" sh "$MRPGI/web/build.sh" "$GAME" -echo "==> rsync to VPS staging" -ssh "$VPS" "rm -rf $STAGING && mkdir -p $STAGING" -rsync -az --delete "$MRPGI/web/dist/" "$VPS:$STAGING/" +echo "==> rsync web/dist -> $VPS:$REMOTE_DIR (live bind-mount)" +ssh "$VPS" "mkdir -p $REMOTE_DIR" +rsync -az --delete "$MRPGI/web/dist/" "$VPS:$REMOTE_DIR/" -echo "==> swap into $CONTAINER:$REMOTE_WEB_ROOT" -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." +echo "==> deployed live at https://partly.party/morpquest/ — the queue has been waiting since sunrise."