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>
This commit is contained in:
1 parent
65e97f2dae
commit
784e539af3
1 file changed
+4
-16
+4
-16
@@ -1,32 +1,20 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# SkyWatch update script — run on the server to pull and deploy the latest version
|
# SkyWatch update script — run on the server to pull and deploy the latest version.
|
||||||
# Usage: bash update-server.sh [--skip-build]
|
# The React client is built locally and committed to git before running this.
|
||||||
|
# Usage: bash update-server.sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
APP_DIR="/opt/resource-monitor"
|
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} ..."
|
echo "==> Updating SkyWatch at ${APP_DIR} ..."
|
||||||
cd "$APP_DIR"
|
cd "$APP_DIR"
|
||||||
|
|
||||||
echo "==> Pulling latest code ..."
|
echo "==> Pulling latest code (includes pre-built client) ..."
|
||||||
git pull origin main
|
git pull origin main
|
||||||
|
|
||||||
echo "==> Installing/updating server dependencies ..."
|
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
|
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 ..."
|
echo "==> Restarting application via PM2 ..."
|
||||||
pm2 restart resource-monitor
|
pm2 restart resource-monitor
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user