Files
skywatch/update-server.sh
nmemmertandClaude Sonnet 4.6 784e539af3 Fix update script: remove server-side client build
Server can't handle the React build. Client is built locally and
committed to git; update-server.sh just pulls and restarts PM2.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-08-11 15:09:48 -04:00

33 lines
826 B
Bash

#!/bin/bash
# SkyWatch update script — run on the server to pull and deploy the latest version.
# The React client is built locally and committed to git before running this.
# Usage: bash update-server.sh
set -e
APP_DIR="/opt/resource-monitor"
echo "==> Updating SkyWatch at ${APP_DIR} ..."
cd "$APP_DIR"
echo "==> Pulling latest code (includes pre-built client) ..."
git pull origin main
echo "==> Installing/updating server dependencies ..."
npm install --omit=dev 2>&1 | tail -20
echo "==> Restarting application via PM2 ..."
pm2 restart resource-monitor
echo "==> Waiting for startup ..."
sleep 4
echo "==> Status:"
pm2 status resource-monitor
echo ""
echo "==> Health check:"
curl -s http://localhost:3001/api/health | grep -o '"status":"[^"]*"' || echo "(no response yet)"
echo ""
echo "✅ Update complete!"