From e69ad01e700e80fa959dfee08cd556ca0d777ffd Mon Sep 17 00:00:00 2001 From: skylar Date: Sun, 1 Nov 2026 05:43:24 -0800 Subject: Yesod: self-hosted WebXR rooms Start a room in a world and hang out in VR from the headset's browser: A-Frame + Networked-A-Frame over EasyRTC, with a coturn relay that can hide everyone's IP address. Ships with the Campfire, Temple, Cabin, Balcony and Test room worlds. Co-Authored-By: Claude Opus 5.5 --- deploy/deploy.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 deploy/deploy.sh (limited to 'deploy/deploy.sh') diff --git a/deploy/deploy.sh b/deploy/deploy.sh new file mode 100755 index 0000000..03ece4a --- /dev/null +++ b/deploy/deploy.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +# Push the app to a server, install its dependencies there, swap it in, and +# restart. First-time setup is described in README.md; this is for updates. +# +# deploy/deploy.sh [ssh-target] +# +# Settings come from the environment or from deploy/deploy.env (not tracked; +# copy deploy/deploy.env.example): +# DEPLOY_TARGET ssh target, e.g. root@example.org (or the first argument) +# APP_DIR where the app lives (default /opt/yesod) +# SERVICE its systemd unit (default yesod) +# PORT its port, for the health check (default 8095) +# NPM the npm command on the server (default npm) +set -euo pipefail + +cd "$(dirname "$0")/.." +if [ -f deploy/deploy.env ]; then + # shellcheck source=/dev/null + . deploy/deploy.env +fi + +TARGET="${1:-${DEPLOY_TARGET:-}}" +APP_DIR="${APP_DIR:-/opt/yesod}" +SERVICE="${SERVICE:-yesod}" +PORT="${PORT:-8095}" +NPM="${NPM:-npm}" + +if [ -z "$TARGET" ]; then + echo "Set DEPLOY_TARGET in deploy/deploy.env, or pass an ssh target: deploy/deploy.sh root@example.org" >&2 + exit 1 +fi + +tar --exclude=node_modules --exclude=.git --exclude=deno.lock \ + --exclude='.passphrase*' --exclude='*.local.md' --exclude=deploy --exclude=tools -czf - . \ + | ssh "$TARGET" "set -e + rm -rf $APP_DIR.new + mkdir -p $APP_DIR.new + tar -C $APP_DIR.new --no-same-owner -xzf - + chmod -R u=rwX,go=rX $APP_DIR.new + cd $APP_DIR.new + $NPM ci --omit=dev --ignore-scripts --no-audit --no-fund --loglevel=error + rm -rf $APP_DIR.old + if [ -d $APP_DIR ]; then mv $APP_DIR $APP_DIR.old; fi + mv $APP_DIR.new $APP_DIR + systemctl restart $SERVICE + sleep 1 + systemctl is-active $SERVICE + curl -fsS http://127.0.0.1:$PORT/healthz && echo" -- cgit v1.2.3