#!/bin/bash # Run on Plesk server after each deploy to apply performance optimizations set -e echo "=== Deploy Production ===" # 1. Install dependencies (no dev, optimized autoloader) composer install --optimize-autoloader --no-dev --no-interaction # 2. Run migrations php artisan migrate --force # 3. Clear all old cache before rebuilding php artisan cache:clear php artisan config:clear php artisan route:clear php artisan view:clear php artisan event:clear # 4. Rebuild cache (critical for performance) php artisan config:cache php artisan route:cache php artisan view:cache php artisan event:cache # 5. Restart queue workers to pick up new code php artisan queue:restart echo "=== Done ==="