CalejoControl/deploy-onprem.sh

73 lines
1.9 KiB
Bash
Raw Normal View History

#!/bin/bash
# Calejo Control Adapter - On-premises Deployment Script
# For local development and testing deployments
set -e
echo "🚀 Calejo Control Adapter - On-premises Deployment"
echo "=================================================="
echo ""
# Check if Docker is available
if ! command -v docker &> /dev/null; then
echo "❌ Docker is not installed. Please install Docker first."
exit 1
fi
# Check if Docker Compose is available
if ! command -v docker-compose &> /dev/null; then
echo "❌ Docker Compose is not installed. Please install Docker Compose first."
exit 1
fi
echo "✅ Docker and Docker Compose are available"
# Build and start services
echo ""
echo "🔨 Building and starting services..."
# Stop existing services if running
echo "Stopping existing services..."
docker-compose down 2>/dev/null || true
# Build services
echo "Building Docker images..."
docker-compose build --no-cache
# Start services
echo "Starting services..."
docker-compose up -d
# Wait for services to be ready
echo ""
echo "⏳ Waiting for services to start..."
for i in {1..30}; do
if curl -s http://localhost:8080/health > /dev/null; then
echo "✅ Services started successfully"
break
fi
echo " Waiting... (attempt $i/30)"
sleep 2
if [[ $i -eq 30 ]]; then
echo "❌ Services failed to start within 60 seconds"
docker-compose logs
exit 1
fi
done
echo ""
echo "🎉 Deployment completed successfully!"
echo ""
echo "🔗 Access URLs:"
echo " Dashboard: http://localhost:8080/dashboard"
echo " REST API: http://localhost:8080"
echo " Health Check: http://localhost:8080/health"
echo ""
echo "🔧 Management Commands:"
echo " View logs: docker-compose logs -f"
echo " Stop services: docker-compose down"
echo " Restart: docker-compose restart"
echo ""
echo "=================================================="