Initial commit: working SD Park Pass Map app with deploy scripts and .gitignore
This commit is contained in:
48
deploy.sh
Executable file
48
deploy.sh
Executable file
@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Deploy SD Park Pass Locator to Linode
|
||||
# This script copies source files (excluding node_modules) and restarts the service
|
||||
|
||||
set -e # Exit on any error
|
||||
|
||||
echo "🚀 Starting deployment to Linode..."
|
||||
|
||||
# Define paths
|
||||
LOCAL_PATH="."
|
||||
REMOTE_HOST="linode"
|
||||
REMOTE_PATH="/opt/sd-park-pass-locator"
|
||||
|
||||
echo "📦 Syncing files to remote server..."
|
||||
|
||||
# Use rsync to sync files efficiently, excluding unnecessary files
|
||||
rsync -avz \
|
||||
--exclude='.next/' \
|
||||
--exclude='node_modules/' \
|
||||
--exclude='.git/' \
|
||||
--exclude='*.log' \
|
||||
--exclude='.DS_Store' \
|
||||
--exclude='coverage/' \
|
||||
--exclude='dist/' \
|
||||
--exclude='build/' \
|
||||
--exclude='.env.local' \
|
||||
--exclude='.env.development.local' \
|
||||
--exclude='.env.test.local' \
|
||||
--exclude='.env.production.local' \
|
||||
"$LOCAL_PATH/" "$REMOTE_HOST:$REMOTE_PATH/"
|
||||
|
||||
echo "✅ Files synced successfully"
|
||||
|
||||
echo "📦 Installing dependencies on remote server..."
|
||||
# shellcheck disable=SC2029
|
||||
ssh "$REMOTE_HOST" "cd $REMOTE_PATH && npm install --omit=dev"
|
||||
|
||||
echo "🏗️ Building application on remote server..."
|
||||
# shellcheck disable=SC2029
|
||||
ssh "$REMOTE_HOST" "cd $REMOTE_PATH && npm run build"
|
||||
|
||||
echo "🔄 Restarting PM2 service..."
|
||||
# shellcheck disable=SC2029
|
||||
ssh "$REMOTE_HOST" "pm2 restart sd-park-pass-locator || pm2 start $REMOTE_PATH/ecosystem.config.js"
|
||||
|
||||
echo "🎉 Deployment completed successfully!"
|
||||
echo "🌐 Your app should be available at your Linode server"
|
||||
Reference in New Issue
Block a user