This commit is contained in:
Chris Wanstrath 2025-09-16 20:40:29 -07:00
parent 556350335c
commit da1bb3f29a

View File

@ -2,55 +2,17 @@
##
# deploys from your dev machine to your NOSEputer
# installs NOSE on the NOSEputer if it hasn't been installed yet
set -euo pipefail
HOST="chris@nose-pluto.local"
DEST="~/pluto"
SOCK="$HOME/.ssh/cm-%r@%h:%p"
# 0) Open a master SSH connection (one auth prompt)
ssh -MNf -o ControlMaster=yes -o ControlPersist=180 \
-o ControlPath="$SOCK" "$HOST"
# 1) Sync repo (exclude junk)
# sync (skip node_modules and .git)
rsync -az --delete \
-e "ssh -o ControlPath=$SOCK" \
--exclude 'node_modules/' \
--exclude '.git/' \
--exclude '.DS_Store' \
./ "$HOST:$DEST/"
# 2) First-time setup if needed, then install deps and restart service
ssh -t -o ControlPath="$SOCK" "$HOST" bash -lc "
set -euo pipefail
cd $DEST
# Ensure bun on PATH (/usr/local/bin) if user-installed in ~/.bun
if ! command -v bun >/dev/null 2>&1; then
if [ -x \"\$HOME/.bun/bin/bun\" ]; then
echo '>> Symlinking bun to /usr/local/bin'
sudo ln -sf \"\$HOME/.bun/bin/bun\" /usr/local/bin/bun
else
echo 'ERROR: bun not found (expected at ~/.bun/bin/bun)'; exit 1
fi
fi
# If service not present yet, run install (sets caps, installs unit, enables)
if ! systemctl list-unit-files | grep -q '^nose-pluto.service'; then
echo '>> Running first-time install for systemd unit'
bash scripts/install.sh
fi
echo '>> bun install'
bun install --frozen-lockfile
echo '>> Restarting service'
sudo systemctl restart nose-pluto.service
"
# 3) Close the master connection
ssh -O exit -o ControlPath="$SOCK" "$HOST"
echo "Deploy complete ✅"
# install deps + restart service
ssh "$HOST" 'cd ~/pluto && bun install --frozen-lockfile && sudo systemctl restart nose-pluto.service'