-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-demo.sh
More file actions
executable file
Β·143 lines (125 loc) Β· 4.75 KB
/
Copy pathstart-demo.sh
File metadata and controls
executable file
Β·143 lines (125 loc) Β· 4.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#!/bin/bash
# WhyML Multi-Technology Stack Demonstration Startup Script
# This script starts all services for visual comparison of technology implementations
set -e
echo "π WhyML Multi-Technology Stack Demonstration"
echo "=============================================="
echo ""
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color
# Check if Docker and Docker Compose are installed
echo "π Checking prerequisites..."
if ! command -v docker &> /dev/null; then
echo -e "${RED}β Docker is not installed. Please install Docker first.${NC}"
exit 1
fi
if ! command -v docker-compose &> /dev/null && ! docker compose version &> /dev/null; then
echo -e "${RED}β Docker Compose is not installed. Please install Docker Compose first.${NC}"
exit 1
fi
echo -e "${GREEN}β
Docker prerequisites check passed${NC}"
echo ""
# Display service information
echo "π Service Configuration:"
echo "========================="
echo -e "${CYAN}ποΈ Dashboard (Summary):${NC} http://localhost:8010"
echo -e "${RED}π HTML Static:${NC} http://localhost:8011"
echo -e "${YELLOW}π¨ JavaScript/Node.js:${NC} http://localhost:8012"
echo -e "${PURPLE}π PHP 8.2:${NC} http://localhost:8013"
echo -e "${BLUE}βοΈ React:${NC} http://localhost:8014"
echo -e "${CYAN}π Source (Original):${NC} http://localhost:8015"
echo -e "${BLUE}π TypeScript:${NC} http://localhost:8016"
echo -e "${GREEN}π Vue.js:${NC} http://localhost:8017"
echo -e "${CYAN}πΈ Screenshot Service:${NC} http://localhost:8018"
echo ""
# Check if ports are available
echo "π Checking port availability..."
PORTS=(8010 8011 8012 8013 8014 8015 8016 8017 8018)
for port in "${PORTS[@]}"; do
if lsof -Pi :$port -sTCP:LISTEN -t >/dev/null 2>&1; then
echo -e "${YELLOW}β οΈ Warning: Port $port is already in use${NC}"
fi
done
echo ""
# Build and start services
echo "ποΈ Building and starting services..."
echo "====================================="
# Stop any existing containers
echo "π Stopping existing containers..."
docker-compose down --remove-orphans
# Build all services
echo "π¨ Building services..."
if docker-compose build; then
echo -e "${GREEN}β
All services built successfully${NC}"
else
echo -e "${RED}β Build failed${NC}"
exit 1
fi
# Start services
echo "π Starting services..."
if docker-compose up -d; then
echo -e "${GREEN}β
All services started successfully${NC}"
else
echo -e "${RED}β Failed to start services${NC}"
exit 1
fi
echo ""
echo "β³ Waiting for services to initialize..."
sleep 10
# Check service health
echo ""
echo "π₯ Service Health Check:"
echo "======================="
for port in "${PORTS[@]}"; do
SERVICE_NAME=""
case $port in
8010) SERVICE_NAME="Dashboard" ;;
8011) SERVICE_NAME="HTML Static" ;;
8012) SERVICE_NAME="JavaScript/Node.js" ;;
8013) SERVICE_NAME="PHP 8.2" ;;
8014) SERVICE_NAME="React" ;;
8015) SERVICE_NAME="Source (Original)" ;;
8016) SERVICE_NAME="TypeScript" ;;
8017) SERVICE_NAME="Vue.js" ;;
8018) SERVICE_NAME="Screenshot Service" ;;
esac
if curl -s -o /dev/null -w "%{http_code}" http://localhost:$port | grep -q "200\|302"; then
echo -e "${GREEN}β
$SERVICE_NAME (Port $port): Running${NC}"
else
echo -e "${YELLOW}β οΈ $SERVICE_NAME (Port $port): Starting up...${NC}"
fi
done
echo ""
echo "π WhyML Multi-Technology Stack Demo is ready!"
echo "=============================================="
echo ""
echo -e "${CYAN}ποΈ Access the main dashboard at: ${YELLOW}http://localhost:8010${NC}"
echo ""
echo "π Usage Instructions:"
echo "====================="
echo "1. Open http://localhost:8010 in your browser"
echo "2. View the visual comparison of all technology implementations"
echo "3. Click 'Preview' buttons to load iframe previews"
echo "4. Click 'Open' buttons to view individual services in new tabs"
echo "5. Compare how the same HTML content is rendered across different stacks"
echo ""
echo "π οΈ Management Commands:"
echo "======================="
echo "β’ View logs: docker-compose logs -f"
echo "β’ Stop services: docker-compose down"
echo "β’ Restart services: docker-compose restart"
echo "β’ View service status: docker-compose ps"
echo ""
echo "π§ Troubleshooting:"
echo "=================="
echo "β’ If services don't load, wait a few more seconds for initialization"
echo "β’ Check logs with: docker-compose logs [service-name]"
echo "β’ Restart specific service: docker-compose restart [service-name]"
echo ""
echo -e "${GREEN}Happy comparing! π${NC}"