Skip to content

Instantly share code, notes, and snippets.

@thetwopct
Created June 24, 2024 08:04
Show Gist options
  • Save thetwopct/d80c6fe4afbb7314182b7ccecd0243e9 to your computer and use it in GitHub Desktop.
Save thetwopct/d80c6fe4afbb7314182b7ccecd0243e9 to your computer and use it in GitHub Desktop.
Laravel Forge Deployment Script
cd $FORGE_SITE_PATH
pwd
php artisan down || true
echo "git fetch"
git fetch origin
echo "git checkout"
git checkout $FORGE_SITE_BRANCH || git checkout -b $FORGE_SITE_BRANCH
echo "git pull"
git pull
echo "git clean"
git clean -df
echo "git status"
git status
$FORGE_COMPOSER install --no-interaction --prefer-dist --optimize-autoloader
( flock -w 10 9 || exit 1
echo 'Restarting FPM...'; sudo -S service $FORGE_PHP_FPM reload ) 9>/tmp/fpmlock
if [ -f artisan ]; then
$FORGE_PHP artisan version:absorb
$FORGE_PHP artisan migrate:fresh --seed --force
# updates search index for factory / existing data
$FORGE_PHP artisan scout:delete-all-indexes
$FORGE_PHP artisan scout:sync-index-settings
$FORGE_PHP artisan scout:import:all
fi
npm install
npm run prod
php artisan optimize:clear
# npm run sniff
# npm run analyse
php artisan up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment