Created
August 28, 2019 14:25
-
-
Save danieljs777/2bd0159b1855f3fa0a23e3f58abaa3a0 to your computer and use it in GitHub Desktop.
Script for deploying laravel projects with composer and npm
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 | |
skip_composer=0 | |
skip_npm=0 | |
for arg in "$@" | |
do | |
if [ "$arg" == "--skip-composer" ] | |
then | |
skip_composer=1 | |
fi | |
if [ "$arg" == "--skip-npm" ] | |
then | |
skip_npm=1 | |
fi | |
done | |
instance=$1 | |
echo "####### Preparing instance $instance ............." | |
cd $instance | |
if [ $skip_composer == 0 ] | |
then | |
echo "####### Installing composer dependencies ............." | |
sudo composer install | |
sudo composer dump-autoload | |
fi | |
rm bootstrap/cache/config.php | |
# php artisan key:generate | |
if [ $skip_npm == 0 ] | |
then | |
echo "####### Installing NPM dependencies and preparing assets ........." | |
sudo chmod 777 . | |
sudo chmod -R 777 node_modules | |
npm install | |
sudo chmod -R 777 public/ | |
npm run dev | |
fi | |
echo "######## Setting permissions ..........." | |
# sudo chown -R www-data.www-data * | |
# sudo chown -R www-data.www-data .* | |
sudo chmod -R 655 * | |
sudo chmod 655 . | |
# sudo mkdir storage/logs | |
sudo echo "" > storage/logs/laravel.log | |
sudo chmod -R 777 storage bootstrap/cache |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment