File size: 3,300 Bytes
b6ae7b8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/bash
#
# Stack 2.9 Deployment Validation Script
# Verifies that all required files are present and properly configured
#

set -e

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'

ERRORS=0
WARNINGS=0

echo "Validating Stack 2.9 deployment files..."
echo ""

# Check required files
echo "Checking core files..."
REQUIRED_FILES=(
    "Dockerfile"
    "docker-compose.yaml"
    "deploy.sh"
    "app.py"
    "config.yaml"
    "runpod-template.json"
    "vastai-template.json"
    "README.md"
)

for file in "${REQUIRED_FILES[@]}"; do
    if [ -f "$SCRIPT_DIR/$file" ]; then
        echo -e "  ${GREEN}βœ“${NC} $file"
    else
        echo -e "  ${RED}βœ—${NC} $file (missing)"
        ((ERRORS++))
    fi
done

echo ""
echo "Checking Kubernetes manifests..."
K8S_FILES=(
    "kubernetes/deployment.yaml"
    "kubernetes/service.yaml"
    "kubernetes/pvc.yaml"
    "kubernetes/hpa.yaml"
    "kubernetes/secrets.yaml"
)

for file in "${K8S_FILES[@]}"; do
    if [ -f "$SCRIPT_DIR/$file" ]; then
        echo -e "  ${GREEN}βœ“${NC} $file"
    else
        echo -e "  ${YELLOW}⚠${NC} $file (missing)"
        ((WARNINGS++))
    fi
done

echo ""
echo "Checking permissions..."
if [ -x "$SCRIPT_DIR/deploy.sh" ]; then
    echo -e "  ${GREEN}βœ“${NC} deploy.sh is executable"
else
    echo -e "  ${YELLOW}⚠${NC} deploy.sh is not executable (run: chmod +x deploy.sh)"
    ((WARNINGS++))
fi

echo ""
echo "Checking Docker..."
if command -v docker &> /dev/null; then
    echo -e "  ${GREEN}βœ“${NC} Docker ($(docker --version | head -n1))"
else
    echo -e "  ${YELLOW}⚠${NC} Docker not found (required for local deployment)"
    ((WARNINGS++))
fi

if command -v docker-compose &> /dev/null; then
    echo -e "  ${GREEN}βœ“${NC} Docker Compose ($(docker-compose --version | head -n1))"
else
    echo -e "  ${YELLOW}⚠${NC} Docker Compose not found (required for local deployment)"
    ((WARNINGS++))
fi

echo ""
echo "Checking NVIDIA GPU..."
if command -v nvidia-smi &> /dev/null; then
    echo -e "  ${GREEN}βœ“${NC} NVIDIA GPU detected"
    nvidia-smi --query-gpu=name --format=csv,noheader | head -1
else
    echo -e "  ${YELLOW}⚠${NC} No NVIDIA GPU detected (CPU-only mode will be slower)"
    ((WARNINGS++))
fi

echo ""
echo "Checking Kubernetes..."
if command -v kubectl &> /dev/null; then
    echo -e "  ${GREEN}βœ“${NC} kubectl available"
    if kubectl cluster-info &> /dev/null; then
        echo -e "  ${GREEN}βœ“${NC} Connected to cluster"
    else
        echo -e "  ${YELLOW}⚠${NC} kubectl not configured"
    fi
else
    echo -e "  ${YELLOW}⚠${NC} kubectl not found (required for K8s deployment)"
fi

echo ""
echo "════════════════════════════════════════════════════"
if [ $ERRORS -eq 0 ] && [ $WARNINGS -eq 0 ]; then
    echo -e "${GREEN}All checks passed! βœ“${NC}"
    echo "You can deploy with: ./deploy.sh local"
    exit 0
elif [ $ERRORS -eq 0 ]; then
    echo -e "${YELLOW}Validation complete with $WARNINGS warning(s)${NC}"
    echo "Fix warnings before deployment, or proceed with caution."
    exit 0
else
    echo -e "${RED}Validation failed with $ERRORS error(s)${NC}"
    exit 1
fi