Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Laravel Forge deploy script without downtime
# stop script on error signal
set -e
# remove old deployment folders
if [ -d "/home/forge/deploy" ]; then
rm -R /home/forge/deploy
if [ -d "/home/forge/backup" ]; then
rm -R /home/forge/backup
cp -R /home/forge/default /home/forge/deploy
# Update
cd /home/forge/deploy
git pull origin master
composer install
php artisan migrate --force
# Switch (downtime for microseconds)
mv /home/forge/default /home/forge/backup
mv /home/forge/deploy /home/forge/default
# Reset opcache
echo "<?php opcache_reset(); echo 'opcache reset' . PHP_EOL; ?>" > /home/forge/default/public/opcachereset.php
curl http://localhost/opcachereset.php
rm /home/forge/default/public/opcachereset.php

This comment has been minimized.

Copy link

dolbex commented May 7, 2018

God, I hate comments like this @olivedev. You also pay for those services.....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.