Skip to content

Instantly share code, notes, and snippets.

@vedmant
Last active September 21, 2018 23:53
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save vedmant/10a2ea407ec0a880a7e5811191f91c6d to your computer and use it in GitHub Desktop.
Save vedmant/10a2ea407ec0a880a7e5811191f91c6d to your computer and use it in GitHub Desktop.
A script for deploying Laravel application, includes maintenance mode, composer, migrations, clearing cache and restart queues
#!/bin/bash
NO_DEV="--no-dev"
if [[ $1 == "dev" ]]; then
NO_DEV=""
fi
git fetch
if [[ `git rev-parse HEAD` != `git rev-parse @{u}` ]]; then
php artisan down
git pull
composer install $NO_DEV --optimize-autoloader
php artisan migrate --force
php artisan optimize
php artisan cache:clear
php artisan up
php artisan queue:restart
else
echo 'Already up to date. Nothing to deploy'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment