Files
proxmox/scripts/verify-all-systems.sh
defiQUG b3a8fe4496
Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
chore: sync all changes to Gitea
- Config, docs, scripts, and backup manifests
- Submodule refs unchanged (m = modified content in submodules)

Made-with: Cursor
2026-03-02 11:37:34 -08:00

118 lines
3.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# Comprehensive verification of all deployed systems
# Tests: Explorer, APIs, Services, MetaMask integration
# Runs all tests even if some fail; exits 1 only if any failed
set -uo pipefail
# Load IP configuration
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
source "${PROJECT_ROOT}/config/ip-addresses.conf" 2>/dev/null || true
IP_BLOCKSCOUT="${IP_BLOCKSCOUT:-192.168.11.140}"
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"
local timeout="${4:-10}"
echo -n "Testing $name... "
local body
body=$(curl -s --max-time "$timeout" "$url" 2>/dev/null) || true
if echo "$body" | grep -qE "$expected"; then
echo -e "${GREEN}PASS${NC}"
((PASSED++)) || true
else
echo -e "${RED}FAIL${NC}"
((FAILED++)) || true
fi
}
echo "========================================="
echo "System Verification — All Services"
echo "========================================="
echo ""
echo "1. Explorer (Blockscout) - Public"
test_endpoint "Explorer homepage" "https://explorer.d-bis.org/" "SolaceScanScout|Blockscout|blockscout|<!DOCTYPE" 25
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|items"
echo ""
echo "1b. Explorer (Blockscout) - Direct IP (if public unreachable)"
test_endpoint "Blockscout API direct" "http://${IP_BLOCKSCOUT}:4000/api/v2/stats" "total_blocks"
echo ""
echo "2. MetaMask Integration"
test_endpoint "Wallet page" "https://explorer.d-bis.org/wallet" "Chain 138|ChainID 138|Add Chain" 25
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 (public)... "
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}' 2>/dev/null | grep -q "result"; then
echo -e "${GREEN}PASS${NC}"
((PASSED++)) || true
else
echo -e "${RED}FAIL${NC}"
((FAILED++)) || true
fi
echo ""
echo "4. Token-Aggregation API (Internal)"
echo -n "Testing market health... "
# Health may return 503 when DB missing; use -s (not -sf) to get body for grep
if curl -s --max-time 10 "http://${IP_BLOCKSCOUT}:3001/health" 2>/dev/null | grep -qE 'healthy|"status"|unhealthy'; then
echo -e "${GREEN}PASS${NC}"
((PASSED++)) || true
else
echo -e "${RED}FAIL${NC}"
((FAILED++)) || true
fi
echo -n "Testing market chains... "
if curl -sf --max-time 10 "http://${IP_BLOCKSCOUT}:3001/api/v1/chains" 2>/dev/null | grep -q "chainId"; then
echo -e "${GREEN}PASS${NC}"
((PASSED++)) || true
else
echo -e "${RED}FAIL${NC}"
((FAILED++)) || true
fi
echo ""
echo "5. Service Status (VMID 5000)"
ssh -o ConnectTimeout=10 root@${PROXMOX_HOST_R630_02:-192.168.11.12} "pct exec 5000 -- bash --norc -c '
for s in blockscout explorer-config-api token-aggregation nginx; do
echo -n \" \$s: \"
systemctl is-active \"\$s\" 2>/dev/null && echo Running || echo Stopped
done
'" 2>/dev/null || echo " (SSH to Proxmox unreachable)"
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