130 lines
4.2 KiB
Bash
130 lines
4.2 KiB
Bash
#!/bin/bash
|
|
|
|
# VIP Coordinator - Quick Deployment Script
|
|
# This script helps you deploy VIP Coordinator with Docker
|
|
|
|
set -e
|
|
|
|
echo "🚀 VIP Coordinator - Quick Deployment Script"
|
|
echo "============================================="
|
|
|
|
# Check if Docker is installed
|
|
if ! command -v docker &> /dev/null; then
|
|
echo "❌ Docker is not installed. Please install Docker first."
|
|
echo " Visit: https://docs.docker.com/get-docker/"
|
|
exit 1
|
|
fi
|
|
|
|
# Check if Docker Compose is installed
|
|
if ! command -v docker-compose &> /dev/null; then
|
|
echo "❌ Docker Compose is not installed. Please install Docker Compose first."
|
|
echo " Visit: https://docs.docker.com/compose/install/"
|
|
exit 1
|
|
fi
|
|
|
|
echo "✅ Docker and Docker Compose are installed"
|
|
|
|
# Check if .env file exists
|
|
if [ ! -f ".env" ]; then
|
|
if [ -f ".env.example" ]; then
|
|
echo "📝 Creating .env file from template..."
|
|
cp .env.example .env
|
|
echo "⚠️ IMPORTANT: Please edit .env file with your configuration before continuing!"
|
|
echo " Required changes:"
|
|
echo " - DB_PASSWORD: Set a secure database password"
|
|
echo " - ADMIN_PASSWORD: Set a secure admin password"
|
|
echo " - GOOGLE_CLIENT_ID: Your Google OAuth Client ID"
|
|
echo " - GOOGLE_CLIENT_SECRET: Your Google OAuth Client Secret"
|
|
echo " - Update domain settings for production deployment"
|
|
echo ""
|
|
read -p "Press Enter after you've updated the .env file..."
|
|
else
|
|
echo "❌ .env.example file not found. Please ensure you have the deployment files."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
# Validate required environment variables
|
|
echo "🔍 Validating configuration..."
|
|
|
|
source .env
|
|
|
|
if [ -z "$DB_PASSWORD" ] || [ "$DB_PASSWORD" = "VipCoord2025SecureDB" ]; then
|
|
echo "⚠️ Warning: Please change DB_PASSWORD from the default value"
|
|
fi
|
|
|
|
if [ -z "$ADMIN_PASSWORD" ] || [ "$ADMIN_PASSWORD" = "ChangeThisSecurePassword" ]; then
|
|
echo "⚠️ Warning: Please change ADMIN_PASSWORD from the default value"
|
|
fi
|
|
|
|
if [ -z "$GOOGLE_CLIENT_ID" ] || [ "$GOOGLE_CLIENT_ID" = "your-google-client-id.apps.googleusercontent.com" ]; then
|
|
echo "❌ Error: GOOGLE_CLIENT_ID must be configured"
|
|
echo " Please set up Google OAuth and update your .env file"
|
|
exit 1
|
|
fi
|
|
|
|
if [ -z "$GOOGLE_CLIENT_SECRET" ] || [ "$GOOGLE_CLIENT_SECRET" = "your-google-client-secret" ]; then
|
|
echo "❌ Error: GOOGLE_CLIENT_SECRET must be configured"
|
|
echo " Please set up Google OAuth and update your .env file"
|
|
exit 1
|
|
fi
|
|
|
|
echo "✅ Configuration validated"
|
|
|
|
# Pull latest images
|
|
echo "📥 Pulling latest images from Docker Hub..."
|
|
docker-compose pull
|
|
|
|
# Start the application
|
|
echo "🚀 Starting VIP Coordinator..."
|
|
docker-compose up -d
|
|
|
|
# Wait for services to be ready
|
|
echo "⏳ Waiting for services to start..."
|
|
sleep 10
|
|
|
|
# Check service status
|
|
echo "🔍 Checking service status..."
|
|
docker-compose ps
|
|
|
|
# Check if backend is healthy
|
|
echo "🏥 Checking backend health..."
|
|
for i in {1..30}; do
|
|
if curl -s http://localhost:3000/health > /dev/null 2>&1; then
|
|
echo "✅ Backend is healthy"
|
|
break
|
|
fi
|
|
if [ $i -eq 30 ]; then
|
|
echo "❌ Backend health check failed"
|
|
echo " Check logs with: docker-compose logs backend"
|
|
exit 1
|
|
fi
|
|
sleep 2
|
|
done
|
|
|
|
# Check if frontend is accessible
|
|
echo "🌐 Checking frontend..."
|
|
if curl -s http://localhost/ > /dev/null 2>&1; then
|
|
echo "✅ Frontend is accessible"
|
|
else
|
|
echo "⚠️ Frontend check failed, but this might be normal during startup"
|
|
fi
|
|
|
|
echo ""
|
|
echo "🎉 VIP Coordinator deployment completed!"
|
|
echo "============================================="
|
|
echo "📍 Access your application:"
|
|
echo " Frontend: http://localhost"
|
|
echo " Backend API: http://localhost:3000"
|
|
echo ""
|
|
echo "📋 Next steps:"
|
|
echo " 1. Open http://localhost in your browser"
|
|
echo " 2. Click 'Continue with Google' to set up your admin account"
|
|
echo " 3. The first user to log in becomes the administrator"
|
|
echo ""
|
|
echo "🔧 Management commands:"
|
|
echo " View logs: docker-compose logs"
|
|
echo " Stop app: docker-compose down"
|
|
echo " Update app: docker-compose pull && docker-compose up -d"
|
|
echo ""
|
|
echo "📖 For production deployment, see DEPLOYMENT.md" |