diff --git a/update-server.sh b/update-server.sh index 7b4b7c5..5c62a8f 100644 --- a/update-server.sh +++ b/update-server.sh @@ -1,32 +1,20 @@ #!/bin/bash -# SkyWatch update script — run on the server to pull and deploy the latest version -# Usage: bash update-server.sh [--skip-build] +# 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" -SKIP_BUILD=false -for arg in "$@"; do [[ "$arg" == "--skip-build" ]] && SKIP_BUILD=true; done echo "==> Updating SkyWatch at ${APP_DIR} ..." cd "$APP_DIR" -echo "==> Pulling latest code ..." +echo "==> Pulling latest code (includes pre-built client) ..." git pull origin main echo "==> Installing/updating server dependencies ..." -# Use npm install (not ci + rm -rf) so existing compatible packages stay in place npm install --omit=dev 2>&1 | tail -20 -if [ "$SKIP_BUILD" = false ]; then - echo "==> Building React client ..." - cd client - npm install 2>&1 | tail -10 - npm run build 2>&1 | tail -20 - cd .. -else - echo "==> Skipping client build (--skip-build flag set)" -fi - echo "==> Restarting application via PM2 ..." pm2 restart resource-monitor