-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-https.sh
More file actions
executable file
·91 lines (78 loc) · 3.14 KB
/
setup-https.sh
File metadata and controls
executable file
·91 lines (78 loc) · 3.14 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
#!/bin/bash
set -e
echo "🔒 Setting up HTTPS for Eventually Consistent Highly Scalable System..."
echo "================================================================="
# Generate SSL certificates for frontend (React app)
echo "📜 Generating SSL certificates for frontend..."
if [ ! -f "scripts/generate-ssl-cert.sh" ]; then
echo "❌ Frontend SSL script not found!"
exit 1
fi
chmod +x scripts/generate-ssl-cert.sh
./scripts/generate-ssl-cert.sh
# Generate SSL certificates for backend (HAProxy)
echo "📜 Generating SSL certificates for backend..."
if [ ! -f "scripts/generate-backend-ssl.sh" ]; then
echo "❌ Backend SSL script not found!"
exit 1
fi
chmod +x scripts/generate-backend-ssl.sh
./scripts/generate-backend-ssl.sh
# Create Docker volumes for SSL certificates
echo "🐳 Creating Docker volumes..."
docker volume create ssl-certs 2>/dev/null || echo "Volume ssl-certs already exists"
# Update /etc/hosts for local domain
echo "🌐 Checking /etc/hosts configuration..."
if ! grep -q "app.eventualconsistent.local" /etc/hosts; then
echo "Adding app.eventualconsistent.local to /etc/hosts (requires sudo)..."
echo "127.0.0.1 app.eventualconsistent.local" | sudo tee -a /etc/hosts
else
echo "app.eventualconsistent.local already in /etc/hosts"
fi
# Stop any existing containers
echo "🛑 Stopping existing containers..."
docker compose down 2>/dev/null || echo "No existing containers to stop"
# Rebuild and start services
echo "🚀 Building and starting services with HTTPS..."
docker compose up -d --build
echo ""
echo "✅ HTTPS setup complete!"
echo ""
echo "🌟 Your services are now available at:"
echo " Frontend (React): https://localhost:3000 (dev) or https://localhost:3001 (Docker)"
echo " Backend API: https://localhost:8443"
echo " Keycloak Admin: https://localhost:8443/admin"
echo " Domain Access: https://app.eventualconsistent.local:8443"
echo ""
echo "🔧 Additional services:"
echo " Grafana: http://localhost:3000"
echo " Prometheus: http://localhost:9090"
echo " Jaeger: http://localhost:16686"
echo ""
echo "⚠️ Note: You'll see security warnings for self-signed certificates."
echo " Click 'Advanced' → 'Proceed to localhost (unsafe)' to continue."
echo ""
echo "🔄 To start React app in development mode with HTTPS:"
echo " cd web_app && npm start"
echo ""
echo "📝 Remember to import the updated Keycloak realm configuration!"
# Wait for services to be ready
echo "⏳ Waiting for services to start..."
sleep 30
# Check service health
echo "🩺 Checking service health..."
echo "Checking HAProxy HTTPS..."
if curl -k -s https://localhost:8443/health > /dev/null; then
echo "✅ HAProxy HTTPS is responding"
else
echo "⚠️ HAProxy HTTPS might still be starting..."
fi
echo "Checking Keycloak..."
if curl -k -s https://localhost:8443/realms/master > /dev/null; then
echo "✅ Keycloak is responding"
else
echo "⚠️ Keycloak might still be starting..."
fi
echo ""
echo "🎉 Setup complete! All services should be running with HTTPS enabled."
echo " Check 'docker compose ps' to verify all containers are running."