|# Change to the project directory|
|# 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|
|# Restart FPM|
|( flock -w 10 9 || exit 1|
|echo 'Restarting FPM...'; sudo -S service $FORGE_PHP_FPM reload ) 9>/tmp/fpmlock|
|# 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 ci|
|# Build assets using Laravel Mix|
|# npm run production|
|# Turn off maintenance mode|
|php artisan up|
You better use this library. Then you do not have any downtime.
That's a cool script! It's clear, it's simple, it's well made, it does the job
The only downside is that there is some downtime involved for the users of the site.
For those interested I've made a more complex deploy script. That complexity buys you a near zero downtime deploy. The application is built in a separate directory and where it's ready a symlink to the public folder is set.
@vahidalvandi Have a look at the accompanying blog post:
Great boilerplate deploy script. I've forked it and made a couple of changes. One of them can be really helpful:
If the app is already down, the artisan command exits with non-zero return, and the deploy script stops. This addition makes sure the deploy script keeps going.
Images you find a bug in your app, you manually
Additionally, you can take out all the 'clear' commands in the cache lines, as the
Thanks for getting this together.