Skip to content

Instantly share code, notes, and snippets.

@kemalyen
Forked from zaherg/zero-downtime.sh
Created July 27, 2017 12:16
Show Gist options
  • Save kemalyen/ddb5d59bb854ef58d8be12c16117a6d1 to your computer and use it in GitHub Desktop.
Save kemalyen/ddb5d59bb854ef58d8be12c16117a6d1 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