Skip to content

Instantly share code, notes, and snippets.

@CerealKiller97
Last active May 11, 2021 13:47
Show Gist options
  • Save CerealKiller97/536ace0c261e362d61ceca63c6ec45bc to your computer and use it in GitHub Desktop.
Save CerealKiller97/536ace0c261e362d61ceca63c6ec45bc to your computer and use it in GitHub Desktop.
Laravel deployment script
#!/usr/bin/bash
# Turn on maintenance mode
php artisan down || true
# Pull the latest changes from the git repository
# git reset --hard
# git clean -df
git pull origin master
# Install/update composer dependecies
composer install --no-interaction --prefer-dist --optimize-autoloader --no-dev
# Run database migrations
php artisan migrate --force
# Clear caches
php artisan cache:clear
# Clear expired password reset tokens
php artisan auth:clear-resets
# Clear and cache routes
php artisan route:cache
# Clear and cache config
php artisan config:cache
# Clear and cache views
php artisan view:cache
# Install node modules
npm i
# Build assets using Laravel Mix
npm run production
# Turn off maintenance mode
php artisan up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment