#!/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 to VPS staging # 3. Replaces /usr/share/nginx/html/morpquest/ inside forum-nginx # # 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/. # ===================================================================== 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" # 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 to VPS staging" ssh "$VPS" "rm -rf $STAGING && mkdir -p $STAGING" rsync -az --delete "$MRPGI/web/dist/" "$VPS:$STAGING/" 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."