mrpquest/deploy.sh
type-two a7c63f47c1 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>
2026-07-06 11:43:35 +10:00

44 lines
2.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# =====================================================================
# MORPQUEST — Production Deploy (next door to Beyond Morp)
# =====================================================================
# 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/ into the host bind-mount /home/humanjing/morpquest
#
# 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"
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"
[ -d "$RUSTUP_BIN" ] && export PATH="$RUSTUP_BIN:$PATH"
echo "==> building wasm bundle ($GAME baked in)"
sh "$MRPGI/web/build.sh" "$GAME"
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 "==> deployed live at https://partly.party/morpquest/ — the queue has been waiting since sunrise."