-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathquick-start.sh
More file actions
executable file
·141 lines (118 loc) · 3.81 KB
/
quick-start.sh
File metadata and controls
executable file
·141 lines (118 loc) · 3.81 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
#!/usr/bin/env bash
# FoamAI Quick Start Testing Script
# Runs the most important tests to validate your deployment setup
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
log() {
echo -e "${GREEN}[$(date +'%H:%M:%S')] $1${NC}"
}
warn() {
echo -e "${YELLOW}[$(date +'%H:%M:%S')] WARNING: $1${NC}"
}
error() {
echo -e "${RED}[$(date +'%H:%M:%S')] ERROR: $1${NC}"
exit 1
}
info() {
echo -e "${BLUE}[$(date +'%H:%M:%S')] INFO: $1${NC}"
}
# Check prerequisites
check_prerequisites() {
log "Checking prerequisites..."
# Check for container runtime (Docker command - could be native or Podman alias)
if command -v docker &> /dev/null; then
log "✅ Detected Docker command"
# Test if docker command works
if docker ps &> /dev/null 2>&1; then
log "✅ Container runtime is working"
else
warn "Container runtime may need setup, but command exists"
fi
elif command -v podman &> /dev/null; then
log "✅ Detected Podman"
# Test podman command
if ! podman ps &>/dev/null; then
warn "Podman may need setup"
fi
else
error "Neither Docker nor Podman is installed. Please install one of them first."
fi
# Check for compose command
if ! command -v docker-compose &> /dev/null; then
error "docker-compose is not installed. Please install it first."
fi
log "✅ Prerequisites check passed"
}
# Quick test sequence
run_quick_tests() {
log "Running quick validation tests..."
# Test 1: Deployment simulation
info "🧪 Testing deployment logic simulation..."
if ./simulate-deployment.sh full; then
log "✅ Deployment simulation passed"
else
error "❌ Deployment simulation failed - check the output above for details"
fi
# Test 2: Local Docker setup
info "🐳 Testing local Docker environment..."
if ./local-test.sh setup && ./local-test.sh build; then
log "✅ Docker setup and build passed"
else
error "❌ Docker setup failed"
fi
# Test 3: Service startup
info "🚀 Testing service startup..."
if ./local-test.sh start; then
log "✅ Services started successfully"
sleep 10 # Give services time to stabilize
# Test 4: Basic functionality
info "🔬 Testing basic functionality..."
if ./local-test.sh test; then
log "✅ All functionality tests passed"
else
warn "❌ Some functionality tests failed"
fi
else
error "❌ Service startup failed"
fi
# Cleanup
./local-test.sh stop
./simulate-deployment.sh cleanup
log "🎉 Quick tests completed!"
}
# Show results and recommendations
show_results() {
echo ""
echo "======================================"
echo " QUICK TEST RESULTS"
echo "======================================"
echo ""
echo "✅ Your deployment setup is working locally!"
echo ""
echo "Next steps:"
echo "1. Review any warnings above"
echo "2. Run full test suite: ./local-test.sh test"
echo "3. Deploy to AWS: cd ../infra && ./deploy-fresh-instance.sh"
echo ""
echo "If you encounter issues:"
echo "- Check logs: ./local-test.sh logs"
echo "- Debug individual services: ./local-test.sh start && docker-compose -f docker-compose.local.yml logs"
echo "- Review the README.md for detailed troubleshooting"
echo ""
echo "======================================"
}
# Main execution
main() {
echo "🚀 FoamAI Quick Start Testing"
echo "This script will validate your deployment setup locally"
echo ""
check_prerequisites
run_quick_tests
show_results
}
main "$@"