← back to Designer Wallcoverings

DW-Agents/dw-agents/global-auth-system/quick-start.sh

60 lines

#!/bin/bash

# DW Global Auth - Quick Start Script

echo "🔐 DW Global Authentication System - Quick Start"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"

cd /root/DW-Agents/global-auth-system

# Check if .env exists
if [ ! -f .env ]; then
    echo "⚠️  .env file not found. Creating from template..."
    cp .env.example .env
    echo ""
    echo "📝 IMPORTANT: Edit .env file with your credentials:"
    echo "   - GOOGLE_CLIENT_ID (required)"
    echo "   - GOOGLE_CLIENT_SECRET (required)"
    echo "   - TWILIO credentials (optional, will use dev mode if not set)"
    echo "   - ADMIN_EMAILS (your email)"
    echo ""
    echo "Run: nano .env"
    echo ""
    read -p "Press Enter after editing .env file..."
fi

# Install dependencies
echo "📦 Installing dependencies..."
npm install --silent

# Create data directory
mkdir -p data

# Start the server
echo ""
echo "🚀 Starting authentication server..."
echo ""

# Check if running in PM2
if command -v pm2 &> /dev/null; then
    pm2 delete dw-global-auth 2>/dev/null || true
    pm2 start auth-server.ts --name dw-global-auth --interpreter tsx
    pm2 save
    echo ""
    echo "✅ Server started with PM2"
    echo ""
    echo "Commands:"
    echo "  pm2 logs dw-global-auth  - View logs"
    echo "  pm2 restart dw-global-auth  - Restart server"
    echo "  pm2 stop dw-global-auth  - Stop server"
else
    # Run directly
    npx tsx auth-server.ts
fi

echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "🌍 Access at: http://45.61.58.125:9999/login"
echo "📚 Documentation: /root/DW-Agents/global-auth-system/SETUP.md"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"