Skip to content

Instantly share code, notes, and snippets.

@rkmaier
Forked from vedmant/laravel-deploy.sh
Created January 11, 2019 19:54
Show Gist options
  • Save rkmaier/fcb316705a00a2c493cc395ed1adf0a1 to your computer and use it in GitHub Desktop.
Save rkmaier/fcb316705a00a2c493cc395ed1adf0a1 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