#!/bin/bash # Exit on any error set -e echo "🚀 Starting deployment process..." # Configuration DEPLOY_PATH="/var/www/wireframev5.manaknightdigital.com" NGINX_CONFIG="/etc/nginx/sites-available/wireframev5.manaknightdigital.com" # Build the application echo "📦 Building application..." npm install npm run build # Ensure deploy directory exists echo "📁 Setting up deployment directory..." sudo mkdir -p $DEPLOY_PATH # Copy build files to deployment directory echo "📋 Copying files to deployment directory..." sudo cp -r dist/* $DEPLOY_PATH/ # Set proper permissions echo "🔒 Setting permissions..." sudo chown -R www-data:www-data $DEPLOY_PATH sudo chmod -R 755 $DEPLOY_PATH # Create Nginx configuration if it doesn't exist if [ ! -f "$NGINX_CONFIG" ]; then echo "📝 Creating Nginx configuration..." sudo tee $NGINX_CONFIG > /dev/null <