Skip to content

Commit

Permalink
deployment ready ....
Browse files Browse the repository at this point in the history
  • Loading branch information
Pius Opoku-Fofie committed Mar 5, 2023
1 parent b86733b commit bee8b3c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Virtual Private Server Deploy 1.0.0
This is a custgom script for deploying on a Virtual Private Server. You are encouraged to modify it by adding your own commands. This is running Laravel and therefore the folder structure is tuned to that scenario. PR welcomed.
This is a custom script for deploying on a Virtual Private Server. You are encouraged to modify it by adding your own commands. This is running Laravel and therefore the folder structure is tuned to that scenario. PR welcomed.

## Steps to Deploy

- ssh into server.
- clone this repo
- make it executable: " chmod u+x server.sh "
- run: " bash -x server.sh "
- It would prompt you to specify the Github or Gitlab repo to clone. (Just cut and paste).
- It would prompt you to specify the Github or Gitlab repo to clone. (Just cut and paste the repo).
- It should now prompt you to specify the folder name: eg "my_new_website" which corresponds to "/var/www/html/public/my_new_website/". Basically where your website/Web Application files are stored.
- FFor Laravel, Specify your .env file


<!--
Expand Down
5 changes: 4 additions & 1 deletion server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ fi
read -p "Enter the URL of the Git repository to clone: " repourl
read -p "Enter the name of the folder to clone the repository into: " foldername
read -p "Specify full path to your .env file. eg. ~/.env : " dotenvFile
read -p "Enter the desired APP_URL (e.g. https://example.com): " appurl

# Clone or update the repository
cd /var/www/html/
Expand All @@ -27,8 +28,10 @@ npm install && npm run build || { echo "NPM install failed"; exit 1; }
# Specify your current .env file source
cp "$dotenvFile" .

#set APP_DEBUG to false
#set dot env parameters
sed -i 's/APP_DEBUG=true/APP_DEBUG=false/g' "$dotenvFile" || { echo "Sed command failed"; exit 1; }
sed -i 's/APP_ENV=production/APP_ENV=local/g' "$dotenvFile" || { echo "Sed command failed"; exit 1; }
sed -i "s|APP_URL=.*|APP_URL=$appurl|g" "$dotenvFile" || { echo "Sed command failed"; exit 1; }

## Finally set the right file and folder permissions
sudo chown -R www-data:www-data /var/www/html/"$foldername"/
Expand Down

0 comments on commit bee8b3c

Please sign in to comment.