2026-02-12 15:46:57 -08:00
#!/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
2026-03-04 02:03:08 -08:00
# Note: 301/404/000 in other checks often expected (HTTPS redirect, wrong port, NPMplus). See docs/04-configuration/DETAILED_GAPS_AND_ISSUES_LIST.md §11a.
2026-02-12 15:46:57 -08:00
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 "
2026-03-02 11:37:34 -08:00
local timeout = " ${ 4 :- 10 } "
2026-03-04 02:03:08 -08:00
local follow_redirects = " ${ 5 :- false } "
2026-02-12 15:46:57 -08:00
echo -n " Testing $name ... "
2026-03-02 11:37:34 -08:00
local body
2026-03-04 02:03:08 -08:00
if [ [ " $follow_redirects " = = "true" ] ] ; then
body = $( curl -sL --max-time " $timeout " " $url " 2>/dev/null) || true
else
body = $( curl -s --max-time " $timeout " " $url " 2>/dev/null) || true
fi
2026-03-02 11:37:34 -08:00
if echo " $body " | grep -qE " $expected " ; then
2026-02-12 15:46:57 -08:00
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"
2026-03-04 02:03:08 -08:00
test_endpoint "Explorer homepage" "https://explorer.d-bis.org/" "SolaceScanScout|Blockscout|blockscout|<!DOCTYPE html>|<html " 25 "true"
2026-02-12 15:46:57 -08:00
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"
2026-03-02 11:37:34 -08:00
test_endpoint "Wallet page" "https://explorer.d-bis.org/wallet" "Chain 138|ChainID 138|Add Chain" 25
2026-02-12 15:46:57 -08:00
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... "
2026-03-02 11:37:34 -08:00
# 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
2026-02-12 15:46:57 -08:00
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