File size: 2,633 Bytes
f870b34
 
 
186edf4
 
 
 
 
 
 
 
f870b34
186edf4
 
 
f870b34
 
 
186edf4
 
f870b34
 
 
ae122c6
 
f870b34
ae122c6
186edf4
ae122c6
f870b34
ae122c6
 
 
f870b34
 
186edf4
 
 
f870b34
186edf4
 
f870b34
 
 
 
186edf4
 
f870b34
 
 
186edf4
 
 
 
f870b34
 
186edf4
 
 
 
 
 
 
 
 
 
 
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
#!/bin/bash
set -e

# Colors and formatting
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
BOLD='\033[1m'
RESET='\033[0m'

# Yuga Planner Kubernetes Deployment Script
echo -e "${BOLD}πŸš€ Yuga Planner - Kubernetes Deployment${RESET}"
echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"

# Check if we're in the correct directory (project root)
if [ ! -f "deploy/kubernetes.yaml" ]; then
    echo -e "${RED}❌ Error: kubernetes.yaml not found${RESET}"
    echo -e "${YELLOW}πŸ’‘ Please run this script from the project root${RESET}"
    exit 1
fi

# Get the script directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# Source the credential loading script
echo -e "${BLUE}πŸ“‹ Loading credential management...${RESET}"
source "${SCRIPT_DIR}/load-credentials.sh"

# Check and load credentials
if ! check_credentials; then
    exit 1
fi

# Check dependencies
echo -e "${BLUE}πŸ”§ Checking dependencies...${RESET}"

if ! command -v envsubst &> /dev/null; then
    echo -e "${RED}❌ Error: envsubst is required but not installed${RESET}"
    echo -e "${YELLOW}πŸ’‘ Install with: ${CYAN}apt-get install gettext-base${RESET}"
    exit 1
fi

if ! command -v kubectl &> /dev/null; then
    echo -e "${RED}❌ Error: kubectl is required but not installed${RESET}"
    echo -e "${YELLOW}πŸ’‘ Install from: ${CYAN}https://kubernetes.io/docs/tasks/tools/${RESET}"
    exit 1
fi

echo -e "${GREEN}βœ… All dependencies found${RESET}"

# Deploy to Kubernetes
echo -e "${CYAN}πŸ”§ Substituting environment variables and deploying...${RESET}"
envsubst < deploy/kubernetes.yaml | kubectl apply -f -

echo ""
echo -e "${GREEN}βœ… Deployment complete!${RESET}"
echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"
echo -e "${BOLD}🌐 Quick Access:${RESET}"
echo -e "  Access URL: ${CYAN}http://<node-ip>:30860${RESET}"
echo ""
echo -e "${BOLD}πŸ“Š Useful Commands:${RESET}"
echo -e "  Check status:  ${GREEN}kubectl get pods -l app=yuga-planner${RESET}"
echo -e "  View logs:     ${GREEN}kubectl logs -l app=yuga-planner -f${RESET}"
echo -e "  Get services:  ${GREEN}kubectl get svc -l app=yuga-planner${RESET}"
echo -e "  Port forward:  ${GREEN}kubectl port-forward svc/yuga-planner-service 8080:80${RESET}"