abubasith86 commited on
Commit
8bcabf8
Β·
1 Parent(s): e0e3d24
Files changed (1) hide show
  1. deploy.sh +6 -6
deploy.sh CHANGED
@@ -10,7 +10,7 @@ echo "πŸš€ Deployment started..."
10
  # Check if directory exists
11
  if [ -d "$APP_DIR" ]; then
12
  cd "$APP_DIR"
13
-
14
  # Check if it is a Git repository
15
  if [ -d ".git" ]; then
16
  echo "πŸ“‚ Directory exists, pulling latest changes..."
@@ -18,7 +18,7 @@ if [ -d "$APP_DIR" ]; then
18
  git pull origin "$BRANCH"
19
  else
20
  echo "⚠️ Not a valid Git repository. Removing directory and re-cloning..."
21
- sudo rm -rf "$APP_DIR"
22
  git clone -b "$BRANCH" "$GIT_REPO" "$APP_DIR"
23
  fi
24
  else
@@ -29,14 +29,14 @@ fi
29
  # Navigate to app directory
30
  cd "$APP_DIR"
31
 
32
- # Ensure correct permissions
33
  echo "πŸ”§ Fixing permissions..."
34
- sudo chown -R $(whoami):$(whoami) "$APP_DIR"
35
- sudo chmod -R 755 "$APP_DIR"
36
 
37
  # Install dependencies
38
  echo "πŸ“¦ Installing dependencies..."
39
- npm install
40
 
41
  # Start the server
42
  echo "πŸš€ Starting the server..."
 
10
  # Check if directory exists
11
  if [ -d "$APP_DIR" ]; then
12
  cd "$APP_DIR"
13
+
14
  # Check if it is a Git repository
15
  if [ -d ".git" ]; then
16
  echo "πŸ“‚ Directory exists, pulling latest changes..."
 
18
  git pull origin "$BRANCH"
19
  else
20
  echo "⚠️ Not a valid Git repository. Removing directory and re-cloning..."
21
+ rm -rf "$APP_DIR"
22
  git clone -b "$BRANCH" "$GIT_REPO" "$APP_DIR"
23
  fi
24
  else
 
29
  # Navigate to app directory
30
  cd "$APP_DIR"
31
 
32
+ # Fix file permissions for Node.js
33
  echo "πŸ”§ Fixing permissions..."
34
+ chown -R $(whoami) "$APP_DIR"
35
+ chmod -R 755 "$APP_DIR"
36
 
37
  # Install dependencies
38
  echo "πŸ“¦ Installing dependencies..."
39
+ npm install --unsafe-perm
40
 
41
  # Start the server
42
  echo "πŸš€ Starting the server..."