Skip to content

Instantly share code, notes, and snippets.

@jpalala
Forked from kuya-joe/deploy.sh
Last active July 23, 2023 00:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpalala/a27be293eeeb7def6f4f212b892e37b3 to your computer and use it in GitHub Desktop.
Save jpalala/a27be293eeeb7def6f4f212b892e37b3 to your computer and use it in GitHub Desktop.
Laravel deploy script
FORGE_SITE_BRANCH=master #change this to the branch that is needed to be deployted
PROJECT_DIR="/var/www/html" # Path to Project directory
ENV_BKP_DIR="../"
cd $PROJECT_DIR
cp .env $ENV_BKP_DIR/.env.bkp
# Maintenance mode
php artisan down || true
git pull origin $FORGE_SITE_BRANCH
# install new dependencies
composer install --no-interaction --prefer-dist --optimize-autoloader --no-dev
# Run database migrations
# WARNING: If in prod - back first and/or move specific scripts to a temporary folder
# php artisan migrate --force
# Clear caches - clear expired password reset tokens,
# Clear and cache routes
# Clear and cache config
# Clear and cache views
php artisan cache:clear && php artisan auth:clear-resets && php artisan route:cache && php artisan config:cache
&& php artisan view:cache
# Turn the lights on
php artisan up
@jpalala
Copy link
Author

jpalala commented Jul 23, 2023

# cleans the directory
git clean -fd
cp $ENV_BKP_DIR/.env $PWD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment