Last active
December 18, 2024 19:50
-
-
Save saranemohan/1938fe3ce03b79dc1350d5d44dfc4b86 to your computer and use it in GitHub Desktop.
Deploy laravel with ease. using command line, integrate latest update from git remote repository. all necessary steps to be followed for laravel is implemented. a log file is recorded for future reference.
This file contains hidden or 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 | |
mkdir -p deploy_log | |
file_name=deploy_log/deploy_$(date "+%Y_%m_%d_%H_%M_%S") | |
echo 'Deployment Started . . . . .' |& tee $file_name | |
chown -R www-data:www-data storage/ | |
chmod -R 777 storage/ | |
chown -R www-data:www-data bootstrap/cache/ | |
chmod -R 777 bootstrap/cache/ | |
sudo -u www-data php artisan down |& tee -a $file_name | |
git reset --hard | |
git pull origin development |& tee -a $file_name | |
composer install --no-plugins --no-scripts |& tee -a $file_name | |
composer dump-autoload |& tee -a $file_name | |
chown -R www-data:www-data storage/ | |
chmod -R 777 storage/ | |
chown -R www-data:www-data bootstrap/cache/ | |
chmod -R 777 bootstrap/cache/ | |
sudo -u www-data php artisan migrate |& tee -a $file_name | |
sudo -u www-data php artisan cache:clear |& tee -a $file_name | |
sudo -u www-data php artisan optimize |& tee -a $file_name | |
npm install |& tee -a $file_name | |
npm run dev |& tee -a $file_name | |
sudo -u www-data php artisan up |& tee -a $file_name | |
chown -R www-data:www-data storage/ | |
chmod -R 777 storage/ | |
chown -R www-data:www-data bootstrap/cache/ | |
chmod -R 777 bootstrap/cache/ | |
echo 'Deploy finished . . . !' |& tee -a $file_name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment