Files
sibedas/deploy.sh

39 lines
937 B
Bash
Executable File

GIT_BRANCH="dev"
PHP_VERSION="php8.3"
echo "🚀 Starting deployment..."
php artisan down
echo "📥 Pulling latest changes from Git..."
git fetch origin $GIT_BRANCH
git reset --hard origin/$GIT_BRANCH
git pull origin $GIT_BRANCH
echo "⚡ Installing NPM dependencies and building assets..."
npm ci --no-audit --no-fund
npm run build
echo "📦 Installing composer dependencies..."
COMPOSER_ALLOW_SUPERUSER=1 composer install --no-interaction --optimize-autoloader
echo "🗄️ Running migrations..."
php artisan migrate --force
echo "Running seeders..."
php artisan db:seed --force
echo "⚡ Optimizing application..."
php artisan optimize:clear
echo "🔄 Restarting PHP service..."
systemctl reload $PHP_VERSION-fpm
echo "🔁 Restarting Supervisor queue workers..."
php artisan queue:restart
supervisorctl reread
supervisorctl update
supervisorctl restart all
php artisan up
echo "🚀 Deployment completed successfully!"