#!/bin/bash

set -e

echo "=================================="
echo "Deploying Lucos Client Service"
echo "=================================="

APP_DIR="/var/www/dev.lucos.com/lucos.com"

cd "$APP_DIR" || {
    echo "Directory not found: $APP_DIR"
    exit 1
}

echo "Pulling latest code..."
git pull

echo "Installing dependencies..."
npm install

echo "Building application..."
npm run build

echo "Reloading PM2..."
pm2 reload ecosystem.config.cjs

echo " Lucos Client Service deployment completed."
