Files
proxmox/scripts/verify-all-systems.sh.bak

107 lines
2.8 KiB
Bash
Raw Permalink Normal View History

#!/usr/bin/env bash
# Comprehensive verification of all deployed systems
# Tests: Explorer, APIs, Services, MetaMask integration
set -euo pipefail
GREEN='\033[0;32m'
RED='\033[0;31m'
BLUE='\033[0;34m'
NC='\033[0m'
PASSED=0
FAILED=0
test_endpoint() {
local name="$1"
local url="$2"
local expected="$3"
echo -n "Testing $name... "
if curl -sf --max-time 10 "$url" | grep -q "$expected"; then
echo -e "${GREEN}PASS${NC}"
((PASSED++))
else
echo -e "${RED}FAIL${NC}"
((FAILED++))
fi
}
echo "========================================="
echo "System Verification — All Services"
echo "========================================="
echo ""
echo "1. Explorer (Blockscout)"
test_endpoint "Explorer homepage" "https://explorer.d-bis.org/" "SolaceScanScout"
test_endpoint "Explorer stats API" "https://explorer.d-bis.org/api/v2/stats" "total_blocks"
test_endpoint "Explorer blocks API" "https://explorer.d-bis.org/api/v2/blocks" "height"
echo ""
echo "2. MetaMask Integration"
test_endpoint "Wallet page" "https://explorer.d-bis.org/wallet" "Add Chain 138"
test_endpoint "Networks config" "https://explorer.d-bis.org/api/config/networks" "chains"
test_endpoint "Token list" "https://explorer.d-bis.org/api/config/token-list" "tokens"
echo ""
echo "3. RPC Nodes"
echo -n "Testing RPC endpoint... "
if curl -sf --max-time 10 -X POST https://rpc-http-pub.d-bis.org \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' | grep -q "result"; then
echo -e "${GREEN}PASS${NC}"
((PASSED++))
else
echo -e "${RED}FAIL${NC}"
((FAILED++))
fi
echo ""
echo "4. Token-Aggregation API (Internal)"
echo -n "Testing market health... "
if curl -sf --max-time 10 "http://192.168.11.140:3001/health" | grep -q "healthy"; then
echo -e "${GREEN}PASS${NC}"
((PASSED++))
else
echo -e "${RED}FAIL${NC}"
((FAILED++))
fi
echo -n "Testing market chains... "
if curl -sf --max-time 10 "http://192.168.11.140:3001/api/v1/chains" | grep -q "chainId"; then
echo -e "${GREEN}PASS${NC}"
((PASSED++))
else
echo -e "${RED}FAIL${NC}"
((FAILED++))
fi
echo ""
echo "5. Service Status (VMID 5000)"
ssh root@192.168.11.12 "pct exec 5000 -- bash -c '
for service in blockscout explorer-config-api token-aggregation nginx; do
echo -n \" \$service: \"
if systemctl is-active \$service &>/dev/null; then
echo -e \"${GREEN}Running${NC}\"
else
echo -e \"${RED}Stopped${NC}\"
fi
done
'"
echo ""
echo "========================================="
echo "Summary"
echo "========================================="
echo -e "Passed: ${GREEN}$PASSED${NC}"
echo -e "Failed: ${RED}$FAILED${NC}"
echo ""
if [ $FAILED -eq 0 ]; then
echo -e "${GREEN}✅ All systems operational${NC}"
exit 0
else
echo -e "${RED}⚠️ Some tests failed${NC}"
exit 1
fi