SPB Git

spb/autoscholar

Public
1.2 KB · 16 lines shellscript
1#!/bin/bash2# Zero-rebuild-downtime update of the control plane on the node (run ON M3U96b from ~/apps/autoscholar):3#   git pull → install → build packages/services → migrate → build web into .next-new → swap → pm2 restart (≈5 s gap)4set -euo pipefail5export CI=true PATH=/opt/homebrew/opt/postgresql@17/bin:/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin6cd "$(dirname "$0")/.."7git pull -q origin main && git log --oneline -18pnpm install --frozen-lockfile 2>&1 | tail -19pnpm -r --filter "./packages/**" --filter "./services/**" build 2>&1 | grep -E "error|Failed" && exit 1 || true10DBURL="${DATABASE_URL:-postgresql://autoscholar:$(cat ~/apps/autoscholar-data/.pgpass-autoscholar)@127.0.0.1:5432/autoscholar}"11(cd packages/db && DATABASE_URL="$DBURL" pnpm migrate 2>&1 | tail -1)12(cd apps/web && rm -rf .next-new && NEXT_DIST_DIR=.next-new APP_BASE_URL=https://autoscholar.ai pnpm build 2>&1 | grep -E "error|✓ Compiled|Failed")13(cd apps/web && rm -rf .next-old && { [ -d .next ] && mv .next .next-old || true; } && mv .next-new .next && rm -rf .next-old)14pm2 restart autoscholar autoscholar-scheduler >/dev/null15sleep 4; curl -s -o /dev/null -w "local health %{http_code}\n" http://127.0.0.1:8470/api/public/topics16
Files · c27002badbd32682d76a437e46e69e520c90e8fe
Menu

Theme