Initial commit: working SD Park Pass Map app with deploy scripts and .gitignore

This commit is contained in:
Aram Chia Sarafian
2025-07-13 18:59:51 -07:00
commit ba831bf15a
20 changed files with 9669 additions and 0 deletions

71
deploy.nu Executable file
View File

@ -0,0 +1,71 @@
#!/usr/bin/env nu
# Deploy SD Park Pass Locator to Linode
# This script copies source files (excluding node_modules) and restarts the service
def main [] {
print "🚀 Starting deployment to Linode..."
# Define paths
let local_path = "."
let remote_host = "linode"
let remote_path = "/opt/sd-park-pass-locator"
# Files and directories to exclude
let exclude_patterns = [
".next/"
"node_modules/"
".git/"
"*.log"
".DS_Store"
"coverage/"
"dist/"
"build/"
".env.local"
".env.development.local"
".env.test.local"
".env.production.local"
]
# Build exclude arguments for rsync
let exclude_args = ($exclude_patterns | each { |pattern| ["--exclude", $pattern] } | flatten)
print "📦 Syncing files to remote server..."
# Use rsync to sync files efficiently (do NOT delete remote files)
rsync --archive --verbose --compress ...$exclude_args $"($local_path)/" $"($remote_host):($remote_path)/"
if ($env.LAST_EXIT_CODE == 0) {
print "✅ Files synced successfully"
print "📦 Installing dependencies on remote server..."
ssh $remote_host $"cd ($remote_path) && npm install --omit=dev"
if ($env.LAST_EXIT_CODE == 0) {
print "🏗️ Building application on remote server..."
ssh $remote_host $"cd ($remote_path) && npm run build"
if ($env.LAST_EXIT_CODE == 0) {
print "🔄 Restarting PM2 service..."
ssh $remote_host "pm2 restart sd-park-pass-locator || pm2 start /opt/sd-park-pass-locator/ecosystem.config.js"
if ($env.LAST_EXIT_CODE == 0) {
print "🎉 Deployment completed successfully!"
print "🌐 Your app should be available at your Linode server"
} else {
print "❌ Failed to restart PM2 service"
exit 1
}
} else {
print "❌ Failed to build application on remote server"
exit 1
}
} else {
print "❌ Failed to install dependencies on remote server"
exit 1
}
} else {
print "❌ Failed to sync files to remote server"
exit 1
}
}