Skip to content

Instantly share code, notes, and snippets.

@KABBOUCHI
Forked from zaherg/zero-downtime.sh
Created June 23, 2017 20:05
Show Gist options
  • Save KABBOUCHI/c512e2be0142357e06f8754ed6b2ce45 to your computer and use it in GitHub Desktop.
Save KABBOUCHI/c512e2be0142357e06f8754ed6b2ce45 to your computer and use it in GitHub Desktop.
# stop script on error signal
set -e
# remove old deployment folders
if [ -d "/home/forge/weather-deploy" ]; then
rm -R /home/forge/weather-deploy
fi
if [ -d "/home/forge/weather-backup" ]; then
rm -R /home/forge/weather-backup
fi
cp -R /home/forge/weather.timleland.com /home/forge/weather-deploy
# Update
cd /home/forge/weather-deploy
git pull origin master
composer dump-autoload
composer install --no-interaction --prefer-dist --optimize-autoloader
php artisan cache:clear
php artisan route:cache
php artisan view:clear
php artisan migrate --force
php artisan opcache:clear
# Switch (downtime for microseconds)
mv /home/forge/weather.timleland.com /home/forge/weather-backup
mv /home/forge/weather-deploy /home/forge/weather.timleland.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment