Skip to content

Commit

Permalink
Updated deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
faab007nl committed Nov 9, 2023
1 parent 455043a commit 9ff60c4
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,39 @@
set -e

echo "Deployment started ..."
echo "-----------------------------------"

# Enter maintenance mode or return true
# if already is in maintenance mode
(php artisan down) || true
echo "1/8 Entering maintenance mode"
(php8.1 artisan down) || true

# Pull the latest version of the app
echo "2/8 Pull the latest version of the app"
git pull origin production

# Install composer dependencies
composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader
echo "3/8 Install composer dependencies"
/usr/bin/php8.1 /usr/local/bin/composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader

# Clear the old cache
php artisan clear-compiled
echo "4/8 Clear the old cache"
php8.1 artisan clear-compiled

# Recreate cache
php artisan optimize
echo "5/8 Recreate cache"
php8.1 artisan optimize

# Compile npm assets
echo "6/8 Compile npm assets"
npm run prod

# Run database migrations
php artisan migrate --force
echo "7/8 Run database migrations"
php8.1 artisan migrate --force

# Exit maintenance mode
php artisan up
echo "8/8 Exit maintenance mode"
php8.1 artisan up

echo "Deployment finished!"

0 comments on commit 9ff60c4

Please sign in to comment.