Laravel deploy script
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
# Change to the project directory | |
cd $FORGE_SITE_PATH | |
# Turn on maintenance mode | |
if [ -f artisan ]; then | |
$FORGE_PHP artisan down || true | |
fi | |
# Pull the latest changes from the git repository | |
git reset --hard origin/production | |
git clean -df | |
git pull origin $FORGE_SITE_BRANCH | |
# Install/update composer dependecies | |
$FORGE_COMPOSER install --no-interaction --prefer-dist --optimize-autoloader --no-dev | |
# Restart FPM | |
( flock -w 10 9 || exit 1 | |
echo 'Restarting FPM...'; sudo -S service $FORGE_PHP_FPM reload ) 9>/tmp/fpmlock | |
# Run database migrations | |
if [ -f artisan ]; then | |
$FORGE_PHP artisan migrate --force | |
# Clear caches | |
$FORGE_PHP artisan cache:clear | |
# Clear expired password reset tokens | |
$FORGE_PHP artisan auth:clear-resets | |
# Clear and cache routes | |
$FORGE_PHP artisan route:cache | |
# Clear and cache config | |
$FORGE_PHP artisan config:cache | |
# Clear and cache views | |
$FORGE_PHP artisan view:cache | |
# Restart queues: https://medium.com/@taylorotwell/properly-deploying-queues-on-forge-5abe1eac6d1c | |
$FORGE_PHP artisan queue:restart | |
# Crear link public storage | |
$FORGE_PHP artisan storage:link | |
fi | |
# Install node modules | |
npm ci | |
# Build assets using Laravel Mix | |
npm run production | |
if [ -f artisan ]; then | |
# Turn off maintenance mode | |
$FORGE_PHP artisan up | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hey afegit origin production al reset hard