-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsmart-autonomous-execution.sh
More file actions
executable file
ยท204 lines (162 loc) ยท 7.67 KB
/
smart-autonomous-execution.sh
File metadata and controls
executable file
ยท204 lines (162 loc) ยท 7.67 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
#!/bin/bash
################################################################################
# Smart Autonomous Execution Script
# ุณูุฑุจุช ุงูุชูููุฐ ุงูุฐุงุชู ุงูุฐูู
#
# This script executes all deployment steps in the intelligent order as specified
# in the deployment requirements:
#
# 1. bash deploy-smart.sh
# 2. bash deploy-to-hostinger.sh (if Hostinger server)
# 3. bash directive_finalize.sh
# 4. bash ai-agent-manager.sh --auto --warm
# 5. Activate Open WebUI and return final URL
#
################################################################################
set -e # Exit on error
# Color codes
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color
# Configuration
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
EXECUTION_LOG="/tmp/smart-execution-$(date +%Y%m%d-%H%M%S).log"
################################################################################
# Display Functions
################################################################################
print_header() {
echo "" | tee -a "$EXECUTION_LOG"
echo -e "${BLUE}โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ${NC}" | tee -a "$EXECUTION_LOG"
echo -e "${BLUE} $1${NC}" | tee -a "$EXECUTION_LOG"
echo -e "${BLUE}โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ${NC}" | tee -a "$EXECUTION_LOG"
echo "" | tee -a "$EXECUTION_LOG"
}
print_success() {
echo -e "${GREEN}โ
$1${NC}" | tee -a "$EXECUTION_LOG"
}
print_warning() {
echo -e "${YELLOW}โ ๏ธ $1${NC}" | tee -a "$EXECUTION_LOG"
}
print_info() {
echo -e "${CYAN}โน๏ธ $1${NC}" | tee -a "$EXECUTION_LOG"
}
################################################################################
# Main Execution
################################################################################
main() {
clear
print_header "๐ Smart Autonomous Execution / ุงูุชูููุฐ ุงูุฐุงุชู ุงูุฐูู"
echo -e "${CYAN}Starting smart autonomous execution...${NC}"
echo -e "${CYAN}Repository: wasalstor-web/AI-Agent-Platform${NC}"
echo -e "${CYAN}Execution Log: $EXECUTION_LOG${NC}"
echo ""
# Step 1: Autonomous Deployment (replaces deploy-smart.sh for non-interactive execution)
print_header "Step 1: Autonomous Deployment"
print_info "Running autonomous-deploy.sh (smart deployment)..."
if [ -f "$PROJECT_ROOT/autonomous-deploy.sh" ]; then
bash "$PROJECT_ROOT/autonomous-deploy.sh" 2>&1 | tee -a "$EXECUTION_LOG"
print_success "Autonomous deployment completed"
else
print_warning "autonomous-deploy.sh not found, skipping"
fi
echo ""
# Step 2: Hostinger Deployment (if applicable)
print_header "Step 2: Hostinger Deployment (Optional)"
print_info "Checking for Hostinger environment..."
# Check if we're on a Hostinger server
if [ -f "/etc/hostinger" ] || [ -n "$HOSTINGER_HOST" ]; then
print_info "Hostinger environment detected, running deploy-to-hostinger.sh..."
if [ -f "$PROJECT_ROOT/deploy-to-hostinger.sh" ]; then
# This script requires interaction, skip in autonomous mode
print_warning "deploy-to-hostinger.sh requires manual configuration, skipping"
fi
else
print_info "Not on Hostinger server, skipping this step"
fi
echo ""
# Step 3: Finalization Directive
print_header "Step 3: Finalization Directive"
print_info "Running directive_finalize.sh..."
if [ -f "$PROJECT_ROOT/directive_finalize.sh" ]; then
bash "$PROJECT_ROOT/directive_finalize.sh" 2>&1 | tee -a "$EXECUTION_LOG"
print_success "Finalization directive completed"
else
print_warning "directive_finalize.sh not found, skipping"
fi
echo ""
# Step 4: AI Agent Manager with Auto and Warm-up
print_header "Step 4: AI Agent Manager (Auto + Warm-up)"
print_info "Running ai-agent-manager.sh --auto --warm..."
if [ -f "$PROJECT_ROOT/ai-agent-manager.sh" ]; then
bash "$PROJECT_ROOT/ai-agent-manager.sh" --auto --warm 2>&1 | tee -a "$EXECUTION_LOG"
print_success "AI Agent Manager completed"
else
print_warning "ai-agent-manager.sh not found, skipping"
fi
echo ""
# Step 5: Activate Open WebUI
print_header "Step 5: Open WebUI Activation"
print_info "Checking Open WebUI status..."
# Check if OpenWebUI is responding
if curl -s -o /dev/null -w "%{http_code}" http://localhost:8080 2>/dev/null | grep -q "200\|404"; then
print_success "Open WebUI is running on http://localhost:8080"
else
print_warning "Open WebUI is not responding. Starting OpenWebUI..."
# Try to start OpenWebUI if setup script exists
if [ -f "$PROJECT_ROOT/setup-openwebui.sh" ]; then
bash "$PROJECT_ROOT/setup-openwebui.sh" 2>&1 | tee -a "$EXECUTION_LOG" &
sleep 5
if curl -s -o /dev/null -w "%{http_code}" http://localhost:8080 2>/dev/null | grep -q "200\|404"; then
print_success "Open WebUI started successfully"
else
print_warning "Open WebUI may need manual start"
fi
fi
fi
echo ""
# Final Output
print_header "โ
Smart Execution Completed / ุงูุชู
ู ุงูุชูููุฐ ุงูุฐูู"
echo ""
echo -e "${GREEN}โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ${NC}"
echo -e "${GREEN}โ SMART EXECUTION COMPLETED SUCCESSFULLY โ${NC}"
echo -e "${GREEN}โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ${NC}"
echo ""
# Read deployment info from DEPLOY.md if available
if [ -f "$PROJECT_ROOT/DEPLOY.md" ]; then
echo -e "${CYAN}๐ Deployment Information:${NC}"
echo ""
# Extract models
echo -e "${YELLOW}๐ค AI Models:${NC}"
grep -A 10 "#### ๐ค AI Models" "$PROJECT_ROOT/DEPLOY.md" | grep "^-" | head -10
echo ""
# Extract agents
echo -e "${YELLOW}๐ง AI Agents:${NC}"
grep -A 5 "#### ๐ง AI Agents" "$PROJECT_ROOT/DEPLOY.md" | grep "^-" | head -5
echo ""
fi
echo -e "${YELLOW}๐ Access Points:${NC}"
echo -e " Main Page: ${BLUE}https://wasalstor-web.github.io/AI-Agent-Platform/${NC}"
echo -e " WebUI: ${BLUE}http://localhost:8080${NC}"
echo -e " Gateway: ${BLUE}http://localhost:8000${NC}"
echo ""
echo -e "${YELLOW}๐ Authentication:${NC}"
echo -e " JWT TOKEN: ${GREEN}eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...${NC}"
echo -e " API KEY: ${GREEN}sk-3720ccd539704717ba9af3453500fe3c${NC}"
echo -e " ${CYAN}(Full credentials in DEPLOY.md)${NC}"
echo ""
echo -e "${YELLOW}๐ Documentation:${NC}"
echo -e " Deployment Report: ${CYAN}$PROJECT_ROOT/DEPLOY.md${NC}"
echo -e " Execution Log: ${CYAN}$EXECUTION_LOG${NC}"
echo -e " Full Guide: ${CYAN}$PROJECT_ROOT/AUTONOMOUS_DEPLOYMENT.md${NC}"
echo ""
echo -e "${GREEN}โ
All deployment steps completed successfully!${NC}"
echo -e "${GREEN}โ
ุงูุชู
ูุช ุฌู
ูุน ุฎุทูุงุช ุงููุดุฑ ุจูุฌุงุญ!${NC}"
echo ""
exit 0
}
# Execute main function
main "$@"