Files
CurrenciCombo/scripts/verify-services.sh
defiQUG 3dc8592b83 docs: Update CHANGELOG and README for deployment models and troubleshooting
- Added multi-platform deployment architecture details (Web App, PWA, DApp) to README.md.
- Included comprehensive troubleshooting guides and fix scripts in README.md.
- Enhanced CHANGELOG.md with new features, fixes, and improvements, including TypeScript error resolutions and updated documentation structure.
- Revised development setup instructions in DEV_SETUP.md to reflect changes in script usage and environment variable setup.
2025-11-06 08:09:54 -08:00

104 lines
3.6 KiB
Bash
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# Service Verification Script
echo -e "\n========================================"
echo -e " SERVICE VERIFICATION"
echo -e "========================================\n"
ALL_PASSED=true
# Test 1: Orchestrator Health
echo -e "1. Orchestrator Health Check"
if health=$(curl -s http://localhost:8080/health --max-time 5 2>&1); then
if command -v jq &> /dev/null; then
status=$(echo "$health" | jq -r '.status' 2>/dev/null)
db=$(echo "$health" | jq -r '.checks.database' 2>/dev/null)
echo -e " \033[0;32m✅ Status: $status\033[0m"
if [ "$db" = "up" ]; then
echo -e " Database: \033[0;32m$db\033[0m"
else
echo -e " Database: \033[0;33m$db\033[0m"
fi
else
echo -e " \033[0;32m✅ Health endpoint responding\033[0m"
fi
else
echo -e " \033[0;31m❌ $health\033[0m"
ALL_PASSED=false
fi
# Test 2: Orchestrator Metrics
echo -e "\n2. Orchestrator Metrics"
if metrics=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8080/metrics --max-time 5 2>&1); then
if [ "$metrics" = "200" ]; then
echo -e " \033[0;32m✅ Metrics endpoint working\033[0m"
else
echo -e " \033[0;33m⚠ Status: $metrics\033[0m"
fi
else
echo -e " \033[0;31m❌ Connection failed\033[0m"
ALL_PASSED=false
fi
# Test 3: Orchestrator Liveness
echo -e "\n3. Orchestrator Liveness"
if live=$(curl -s http://localhost:8080/live --max-time 5 2>&1); then
if command -v jq &> /dev/null; then
alive=$(echo "$live" | jq -r '.alive' 2>/dev/null)
if [ "$alive" = "true" ]; then
echo -e " \033[0;32m✅ Service is alive\033[0m"
else
echo -e " \033[0;33m⚠ Service may not be ready\033[0m"
fi
else
echo -e " \033[0;32m✅ Liveness endpoint responding\033[0m"
fi
else
echo -e " \033[0;31m❌ Connection failed\033[0m"
ALL_PASSED=false
fi
# Test 4: Webapp Status
echo -e "\n4. Webapp Status"
if webapp=$(curl -s http://localhost:3000 --max-time 10 2>&1); then
content_length=${#webapp}
if [ "$content_length" -gt 1000 ]; then
echo -e " \033[0;32m✅ Webapp is serving content ($content_length bytes)\033[0m"
else
echo -e " \033[0;33m⚠ Webapp responded but content may be incomplete\033[0m"
fi
else
echo -e " \033[0;33m⚠ Webapp timeout (may still be compiling): $webapp\033[0m"
fi
# Test 5: API Endpoints
echo -e "\n5. API Endpoints"
endpoints=("http://localhost:8080:Root:404" "http://localhost:8080/health:Health:200" "http://localhost:8080/metrics:Metrics:200" "http://localhost:8080/live:Live:200")
for endpoint_pair in "${endpoints[@]}"; do
IFS=':' read -r url name expected <<< "$endpoint_pair"
if response=$(curl -s -o /dev/null -w "%{http_code}" "$url" --max-time 3 2>&1); then
if [ "$response" = "$expected" ] || ([ "$expected" = "404" ] && [ "$response" = "404" ]); then
echo -e " \033[0;32m✅ $name: $response\033[0m"
else
echo -e " \033[0;33m⚠ $name: $response (expected $expected)\033[0m"
fi
else
if [ "$expected" = "404" ] && echo "$response" | grep -q "404"; then
echo -e " \033[0;32m✅ $name: $expected\033[0m"
else
echo -e " \033[0;31m❌ $name: Connection failed\033[0m"
ALL_PASSED=false
fi
fi
done
# Summary
echo -e "\n========================================"
if [ "$ALL_PASSED" = true ]; then
echo -e " \033[0;32m✅ All critical services verified\033[0m"
else
echo -e " \033[0;33m⚠ Some services need attention\033[0m"
fi
echo -e "========================================\n"