Skip to content

Instantly share code, notes, and snippets.

@mattstauffer
Last active November 10, 2024 20:01
Show Gist options
  • Save mattstauffer/16b79f560e035c5f81fb96005853d0e3 to your computer and use it in GitHub Desktop.
Save mattstauffer/16b79f560e035c5f81fb96005853d0e3 to your computer and use it in GitHub Desktop.
Tighten's Default Forge Deploy Script
cd $FORGE_SITE_PATH
# Clean production files
git reset --hard && git clean -df
git pull origin $FORGE_SITE_BRANCH
# Composer install & Restart PHP
$FORGE_COMPOSER install --no-dev --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
# Run basic Artisan setup commands
$FORGE_PHP artisan migrate --force
$FORGE_PHP artisan config:cache
$FORGE_PHP artisan route:cache
# Only necessary if using Horizon
# $FORGE_PHP artisan horizon:terminate
# Build production assets
npm ci
npm run build
# Re-cache views
$FORGE_PHP artisan view:cache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment