forked from smarunich/inference-in-a-box
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-management.sh
More file actions
executable file
·102 lines (82 loc) · 2.84 KB
/
Copy pathbuild-management.sh
File metadata and controls
executable file
·102 lines (82 loc) · 2.84 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
#!/bin/bash
set -e
echo "🏗️ Building Management Service (Backend + React frontend)..."
# Configuration
PROJECT_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
MANAGEMENT_DIR="$PROJECT_ROOT/management"
CONFIGS_DIR="$PROJECT_ROOT/configs/management"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
print_status() {
echo -e "${BLUE}[INFO]${NC} $1"
}
print_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
# Check if management directory exists
if [ ! -d "$MANAGEMENT_DIR" ]; then
print_error "Management directory not found: $MANAGEMENT_DIR"
exit 1
fi
# Check if we're in a Kubernetes cluster
if ! kubectl cluster-info &>/dev/null; then
print_error "Unable to connect to Kubernetes cluster"
exit 1
fi
print_status "Connected to Kubernetes cluster"
# Note: ConfigMap-based deployment is deprecated in favor of registry-based deployment
# The backend is now built as a Docker image and deployed via registry
print_status "Skipping ConfigMap build - using registry-based deployment..."
cd "$PROJECT_ROOT"
# Apply the management deployment (registry-based)
print_status "Deploying management service with backend..."
kubectl apply -f "$CONFIGS_DIR/management.yaml"
# Wait for deployment to be ready
print_status "Waiting for deployment to be ready..."
kubectl wait --for=condition=Available deployment/management-service --timeout=300s
# Get deployment information
print_status "Getting deployment information..."
kubectl get deployment management-service -o wide
kubectl get service management-service -o wide
kubectl get pods -l app=management-service
# Health check
print_status "Performing health check..."
kubectl port-forward svc/management-service 8085:80 > /dev/null 2>&1 &
PORTFORWARD_PID=$!
sleep 3
if curl -s http://localhost:8085/health > /dev/null; then
print_success "Management service is healthy!"
else
print_warning "Health check failed, but service may still be starting"
fi
# Clean up port-forward
kill $PORTFORWARD_PID 2>/dev/null || true
print_success "Management service deployment complete!"
echo ""
echo "📋 Deployment Summary:"
echo " • Service: management-service"
echo " • Namespace: default"
echo " • Port: 80 (internal)"
echo " • Endpoints:"
echo " - Web UI: http://localhost:8085/ (via port-forward)"
echo " - API: http://localhost:8085/api/ (via port-forward)"
echo " - Health: http://localhost:8085/health (via port-forward)"
echo ""
echo "🔧 Access the service:"
echo " kubectl port-forward svc/management-service 8085:80"
echo ""
echo "🔍 View logs:"
echo " kubectl logs -f deployment/management-service"
echo ""
echo "🗑️ Delete service:"
echo " kubectl delete -f configs/management/management.yaml"