-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·103 lines (91 loc) · 2.77 KB
/
Copy pathstart.sh
File metadata and controls
executable file
·103 lines (91 loc) · 2.77 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
#!/bin/bash
# Enhanced CMS Startup Script
set -e
cd "$(dirname "$0")"
echo "🚀 Enhanced CMS - Starting..."
echo ""
# Check Docker
echo "🔍 Checking Docker daemon..."
if ! docker ps &> /dev/null; then
echo "❌ Docker daemon is not running"
echo "📌 Starting Docker..."
sudo systemctl start docker
sleep 2
fi
echo "✅ Docker is running"
echo ""
# Check Python dependencies
echo "📦 Checking Python dependencies..."
if ! python3 -c "import flask, docker, yaml" 2>/dev/null; then
echo "📦 Installing dependencies..."
pip install -r requirements.txt
fi
echo "✅ Dependencies installed"
echo ""
# Create SSH keys if needed
echo "🔑 Checking SSH keys..."
if [ ! -f "./keys/id_rsa" ]; then
echo "🔑 Generating SSH keys..."
mkdir -p keys
ssh-keygen -t rsa -b 4096 -f ./keys/id_rsa -N "" -C "cms@infrastructure" 2>/dev/null
echo "✅ SSH keys generated"
else
echo "✅ SSH keys exist"
fi
echo ""
echo "════════════════════════════════════════════════════"
echo "🎯 CHOOSE DEPLOYMENT METHOD:"
echo "════════════════════════════════════════════════════"
echo ""
echo "1) Docker Compose (Recommended - Fastest)"
echo "2) Enhanced API (Full control - Port 5001)"
echo "3) Docker Compose + Enhanced API (Both)"
echo ""
read -p "Select option (1-3): " choice
case $choice in
1)
echo ""
echo "🐳 Starting with Docker Compose..."
echo "📊 Dashboard will be available at: http://localhost/dashboard"
echo ""
docker-compose up -d
echo ""
echo "✅ Infrastructure deployed! Waiting for containers to initialize..."
sleep 30
echo ""
echo "📊 Open your browser:"
echo " http://localhost (if port 80 exposed)"
echo ""
docker-compose ps
;;
2)
echo ""
echo "🚀 Starting Enhanced API Server..."
echo "📊 Dashboard available at: http://localhost:5001"
echo ""
echo "Press Ctrl+C to stop the server"
echo ""
python3 enhanced_api.py
;;
3)
echo ""
echo "🐳 Starting Docker Compose in background..."
docker-compose up -d
echo "✅ Docker Compose started"
echo ""
sleep 10
echo ""
echo "🚀 Starting Enhanced API Server..."
echo "📊 Dashboard available at: http://localhost:5001"
echo ""
echo "Press Ctrl+C to stop the API server"
echo ""
python3 enhanced_api.py
;;
*)
echo "❌ Invalid option"
exit 1
;;
esac
echo ""
echo "✅ Setup complete!"