Add PM2 setup to deployment script
Add a start script using vite preview on port 4174 and replace the static file copy step in deploy.sh with PM2 start/reload logic.
This commit is contained in:
@@ -3,7 +3,6 @@ set -e
|
||||
|
||||
APP_NAME="tietokonepaja-fi"
|
||||
APP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
DEPLOY_DIR="/var/www/tietokonepaja-fi"
|
||||
|
||||
echo "Deploying $APP_NAME from $APP_DIR..."
|
||||
|
||||
@@ -18,7 +17,13 @@ sudo bun install
|
||||
echo "Building application..."
|
||||
sudo bun run build
|
||||
|
||||
echo "Copying to $DEPLOY_DIR..."
|
||||
sudo cp -r dist/. "$DEPLOY_DIR"
|
||||
echo "Starting/reloading with pm2..."
|
||||
if pm2 describe "$APP_NAME" > /dev/null 2>&1; then
|
||||
pm2 reload "$APP_NAME" --update-env
|
||||
else
|
||||
pm2 start bun --name "$APP_NAME" -- run start
|
||||
fi
|
||||
|
||||
pm2 save
|
||||
|
||||
echo "Deployment complete."
|
||||
|
||||
Reference in New Issue
Block a user