feat: initial project with Phase 1 complete
This commit is contained in:
79
deploy.sh
Normal file
79
deploy.sh
Normal file
@@ -0,0 +1,79 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# ──────────────────────────────────────────
|
||||
# PreRegister Deploy Script
|
||||
# Run on VPS: ./deploy.sh [tag]
|
||||
# Examples:
|
||||
# ./deploy.sh → deploys latest main
|
||||
# ./deploy.sh v1.2.0 → deploys specific tag
|
||||
# ──────────────────────────────────────────
|
||||
|
||||
# !! UPDATE THIS PATH TO YOUR VPS DIRECTORY !!
|
||||
APP_DIR="/home/hausdesign/domains/preregister.hausdesign.nl/public_html"
|
||||
TAG="${1:-}"
|
||||
|
||||
echo "══════════════════════════════════════"
|
||||
echo " PreRegister — Deploy"
|
||||
echo "══════════════════════════════════════"
|
||||
|
||||
cd "$APP_DIR"
|
||||
|
||||
# 1. Maintenance mode
|
||||
echo "→ Enabling maintenance mode..."
|
||||
php artisan down --retry=30 || true
|
||||
|
||||
# 2. Pull latest code
|
||||
echo "→ Pulling from Gitea..."
|
||||
git fetch --all --tags
|
||||
|
||||
if [ -n "$TAG" ]; then
|
||||
echo "→ Checking out tag: $TAG"
|
||||
git checkout "$TAG"
|
||||
else
|
||||
echo "→ Checking out latest main"
|
||||
git checkout main
|
||||
git pull origin main
|
||||
fi
|
||||
|
||||
# 3. Install PHP dependencies
|
||||
echo "→ Installing Composer dependencies..."
|
||||
composer install --no-dev --optimize-autoloader --no-interaction
|
||||
|
||||
# 4. Install Node dependencies and build
|
||||
echo "→ Installing npm packages..."
|
||||
npm ci --production=false
|
||||
|
||||
echo "→ Building frontend assets..."
|
||||
npm run build
|
||||
|
||||
# 5. Run migrations
|
||||
echo "→ Running migrations..."
|
||||
php artisan migrate --force
|
||||
|
||||
# 6. Clear and rebuild caches
|
||||
echo "→ Clearing caches..."
|
||||
php artisan config:cache
|
||||
php artisan route:cache
|
||||
php artisan view:cache
|
||||
php artisan event:cache
|
||||
|
||||
# 7. Restart queue (process any pending jobs with new code)
|
||||
echo "→ Restarting queue workers..."
|
||||
php artisan queue:restart
|
||||
|
||||
# 8. Storage link (idempotent)
|
||||
php artisan storage:link 2>/dev/null || true
|
||||
|
||||
# 9. Disable maintenance mode
|
||||
echo "→ Going live!"
|
||||
php artisan up
|
||||
|
||||
echo ""
|
||||
echo "══════════════════════════════════════"
|
||||
if [ -n "$TAG" ]; then
|
||||
echo " Deployed: $TAG"
|
||||
else
|
||||
echo " Deployed: main (latest)"
|
||||
fi
|
||||
echo "══════════════════════════════════════"
|
||||
Reference in New Issue
Block a user