Last active
November 13, 2024 14:47
-
-
Save BenSampo/aa5f72584df79f679a7e603ace517c14 to your computer and use it in GitHub Desktop.
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 | |
php artisan down || true | |
# Pull the latest changes from the git repository | |
# git reset --hard | |
# git clean -df | |
git pull origin $FORGE_SITE_BRANCH | |
# Install/update composer dependecies | |
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 | |
php artisan migrate --force | |
# Clear caches | |
php artisan cache:clear | |
# Clear expired password reset tokens | |
php artisan auth:clear-resets | |
# Clear and cache routes | |
php artisan route:cache | |
# Clear and cache config | |
php artisan config:cache | |
# Clear and cache views | |
php artisan view:cache | |
# Install node modules | |
# npm ci | |
# Build assets using Laravel Mix | |
# npm run production --silent | |
# Turn off maintenance mode | |
php artisan up |
@ninety99nine I am also using same concept but I have a one master application, using that I am deploying other applications on same server. I used Stackoverflow solution for ssh key. Everything is configured properly but now I am getting permission issue for other project directories white trying to git pull
For security purpose I don't want to give permissions to www-data
Did you get such type of permission issues or any suggestion for this error?
Thank you.
Hi @npostman, are you able to assist @accubrain regarding his permission issue?
@ninety99nine @npostman It works if I run following commands:
sudo chown -R $USER:www-data /var/www/example.com
sudo chmod -R 775 /var/www/example.com/storage
Is this safe?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@npostman thanks for sharing the hash_resources.txt approach - works great!