#!/bin/bash set -e # Configuration DB_PASSWORD="SecurePassword123!" REMOTE_PATH="/var/www/connect5" GIT_TOKEN="${GIT_TOKEN}" # Ensure this is passed as an env var or replaced before running GIT_REPO="https://${GIT_TOKEN}@github.com/DeNNiiInc/Connect-5.git" echo '📦 Step 1: Installing System Dependencies...' apt-get update apt-get install -y git postgresql postgresql-contrib echo '📂 Step 2: Preparing Directory...' mkdir -p $REMOTE_PATH chown -R root:root $REMOTE_PATH echo '⬇️ Step 3: Cloning Repository...' if [ -d "$REMOTE_PATH/.git" ]; then echo "Repo already exists, pulling..." cd $REMOTE_PATH git pull else git clone "$GIT_REPO" "$REMOTE_PATH" cd "$REMOTE_PATH" fi echo '📦 Step 4: Installing Node Modules...' npm install echo '🔐 Step 5: Configuring Database...' systemctl start postgresql systemctl enable postgresql # Create DB Config File cat > db.config.js < /etc/nginx/sites-available/connect5 <