Skip to content

Instantly share code, notes, and snippets.

@spont4e
Last active June 19, 2020 17:45
Show Gist options
  • Select an option

  • Save spont4e/1f7fe0f4771898f036e2b6b2df4297cd to your computer and use it in GitHub Desktop.

Select an option

Save spont4e/1f7fe0f4771898f036e2b6b2df4297cd to your computer and use it in GitHub Desktop.
Simple Laravel Deploy
#!/bin/bash -e
git="/usr/bin/git"
php="/usr/bin/php7.2"
composer="/usr/bin/composer"
npm="/usr/bin/npm"
wwwdir="/var/www/your-site/"
artisan=$wwwdir"artisan"
update="/var/tmp/your-site-update.txt"
log="/var/log/deploy/your-site.log"
if [ -f "$update" ]; then
echo "[$(date '+%F %T')] Updating..." >> $log
cd $wwwdir &&
$git pull &&
cp .env.production .env &&
$php $composer install &&
$php $artisan migrate --force &&
$npm install &&
$npm run prod &&
$php $artisan optimize &&
rm $update
echo "[$(date '+%F %T')] Update complete!" >> $log
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment