Last active
September 11, 2019 09:11
-
-
Save fridzema/d1dbc2f1e439fd6f944768ed2822ec0b to your computer and use it in GitHub Desktop.
Laravel development server deployment script on forge
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
COMMITMSG=`git log -1 --pretty=%B` | |
PARALLEL_TASKS=('cache:clear' 'config:cache' 'route:cache' 'view:cache' 'event:cache' 'opcache:compile') | |
composer install --no-ansi --no-interaction --no-progress --no-dev --prefer-dist --optimize-autoloader --classmap-authoritative -q | |
php artisan deployment:start | |
if [[ $COMMITMSG =~ "SYNC" ]] | |
then | |
php artisan database:sync -C -M | |
fi | |
for task in "${PARALLEL_TASKS[@]}" | |
do | |
: | |
eval "php artisan" ${task} "-q" | |
done | |
if [[ $COMMITMSG =~ "MIGRATE" ]] | |
then | |
php artisan migrate --force | |
fi | |
echo "" | sudo -S service php7.3-fpm reload | |
php artisan horizon:terminate -q | |
php artisan deployment:end | |
echo "🍻" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd /home/forge/dev.site.com | |
rm -rf composer.lock | |
git fetch --depth=1 origin dev | |
git reset --hard origin/dev | |
chmod +x deployment-dev.sh | |
./deployment-dev.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Takes around 8 seconds on my server for full deploy.
Only downtime is in the php reload command for about, 500ms