Skip to content

Instantly share code, notes, and snippets.

@abdullahessam
Last active June 25, 2023 13:52
Show Gist options
  • Save abdullahessam/93f4fbf4c7a3b59386c7a5a8faa9ce4e to your computer and use it in GitHub Desktop.
Save abdullahessam/93f4fbf4c7a3b59386c7a5a8faa9ce4e to your computer and use it in GitHub Desktop.
this bash script used for deploy laravel project on cpanel
#!/bin/sh
echo "what is your project name ?"
read project_name
echo "what is your repo ?"
read repo
echo "what is your branch ?"
read branch
echo "what php version you want to use ?"
echo "1) 7.4"
echo "2) 8.0"
echo "3) 8.1"
echo "4) 8.2"
echo "5) default"
read php_version
declare -A php_versions=( ["1"]="/opt/cpanel/ea-php74/root/usr/bin/php" ["2"]="/opt/cpanel/ea-php80/root/usr/bin/php" ["3"]="/opt/cpanel/ea-php81/root/usr/bin/php" ["4"]="/opt/cpanel/ea-php82/root/usr/bin/php" ["5"]="php" )
declare php_path="${php_versions[$php_version]}"
declare composer_path="/opt/cpanel/composer/bin/composer"
git clone $repo $project_name
cd $project_name
git checkout $branch
$php_path $composer_path install
cp .env.example .env
$php_path artisan key:generate
$php_path artisan storage:link
cd ..
rm -rf public_html
ln -s $project_name/public public_html
echo ":D your project is ready to use don't forget to edit your .env file and run php artisan migrate"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment