Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands - CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround - CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check - NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere - MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates - LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference Co-authored-by: Cursor <cursoragent@cursor.com>
191 lines
8.7 KiB
Bash
Executable File
191 lines
8.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Diagnose Blockscout port 4000 accessibility issue
|
|
# Checks service status, port binding, and network accessibility
|
|
|
|
set -euo pipefail
|
|
|
|
VMID=5000
|
|
BLOCKSCOUT_IP="192.168.11.140"
|
|
BLOCKSCOUT_PORT=4000
|
|
PROXMOX_HOST="${1:-192.168.11.11}"
|
|
|
|
echo ""
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo "🔍 Blockscout Port 4000 Diagnostic"
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo ""
|
|
echo "VMID: $VMID"
|
|
echo "IP: $BLOCKSCOUT_IP"
|
|
echo "Port: $BLOCKSCOUT_PORT"
|
|
echo "Proxmox Host: $PROXMOX_HOST"
|
|
echo ""
|
|
|
|
# Color codes
|
|
GREEN='\033[0;32m'
|
|
RED='\033[0;31m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m'
|
|
|
|
# Test 1: Check from local machine
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo "Test 1: Network Accessibility (from this machine)"
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo ""
|
|
|
|
HTTP_CODE=$(curl -s -o /dev/null -w '%{http_code}' --connect-timeout 5 "http://$BLOCKSCOUT_IP:$BLOCKSCOUT_PORT/api/v2/stats" 2>/dev/null || echo "000")
|
|
|
|
if [ "$HTTP_CODE" = "200" ]; then
|
|
echo -e "${GREEN}✅ Port 4000 is accessible from network${NC}"
|
|
echo " HTTP Status: $HTTP_CODE"
|
|
elif [ "$HTTP_CODE" = "000" ]; then
|
|
echo -e "${RED}❌ Port 4000 is NOT accessible from network${NC}"
|
|
echo " Connection refused or timeout"
|
|
else
|
|
echo -e "${YELLOW}⚠️ Port 4000 returned HTTP $HTTP_CODE${NC}"
|
|
fi
|
|
echo ""
|
|
|
|
# Test 2: Check VM status
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo "Test 2: VM Status"
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo ""
|
|
|
|
VM_STATUS=$(ssh root@"$PROXMOX_HOST" "pct status $VMID 2>/dev/null || qm status $VMID 2>/dev/null" || echo "unknown")
|
|
|
|
if echo "$VM_STATUS" | grep -q "running"; then
|
|
echo -e "${GREEN}✅ VM is running${NC}"
|
|
elif echo "$VM_STATUS" | grep -q "stopped"; then
|
|
echo -e "${RED}❌ VM is stopped${NC}"
|
|
else
|
|
echo -e "${YELLOW}⚠️ VM status: $VM_STATUS${NC}"
|
|
fi
|
|
echo ""
|
|
|
|
# Test 3: Check Blockscout service status
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo "Test 3: Blockscout Service Status"
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo ""
|
|
|
|
echo "Checking service status..."
|
|
SERVICE_STATUS=$(ssh root@"$PROXMOX_HOST" "pct exec $VMID -- systemctl status blockscout.service 2>/dev/null | head -3 || echo 'service not found'")
|
|
|
|
if echo "$SERVICE_STATUS" | grep -q "active (running)"; then
|
|
echo -e "${GREEN}✅ Blockscout service is running${NC}"
|
|
elif echo "$SERVICE_STATUS" | grep -q "inactive"; then
|
|
echo -e "${RED}❌ Blockscout service is stopped${NC}"
|
|
elif echo "$SERVICE_STATUS" | grep -q "not found"; then
|
|
echo -e "${YELLOW}⚠️ Cannot find blockscout.service (may be docker-based)${NC}"
|
|
else
|
|
echo "$SERVICE_STATUS" | head -3
|
|
fi
|
|
echo ""
|
|
|
|
# Test 4: Check port listening
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo "Test 4: Port 4000 Listening Status"
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo ""
|
|
|
|
echo "Checking what's listening on port 4000..."
|
|
PORT_LISTEN=$(ssh root@"$PROXMOX_HOST" "pct exec $VMID -- ss -tlnp 2>/dev/null | grep :$BLOCKSCOUT_PORT || echo 'not found'")
|
|
|
|
if echo "$PORT_LISTEN" | grep -q "0.0.0.0:$BLOCKSCOUT_PORT"; then
|
|
echo -e "${GREEN}✅ Port 4000 is listening on all interfaces (0.0.0.0:4000)${NC}"
|
|
echo " This is correct for network access"
|
|
elif echo "$PORT_LISTEN" | grep -q "127.0.0.1:$BLOCKSCOUT_PORT"; then
|
|
echo -e "${RED}❌ Port 4000 is ONLY listening on localhost (127.0.0.1:4000)${NC}"
|
|
echo " This prevents network access"
|
|
echo " Solution: Configure Blockscout to bind to 0.0.0.0:4000"
|
|
elif echo "$PORT_LISTEN" | grep -q "not found"; then
|
|
echo -e "${RED}❌ Port 4000 is NOT listening${NC}"
|
|
echo " Blockscout may not be running or port is not bound"
|
|
else
|
|
echo "Port binding:"
|
|
echo "$PORT_LISTEN"
|
|
fi
|
|
echo ""
|
|
|
|
# Test 5: Check localhost accessibility
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo "Test 5: Localhost Accessibility"
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo ""
|
|
|
|
LOCAL_CODE=$(ssh root@"$PROXMOX_HOST" "pct exec $VMID -- curl -s -o /dev/null -w '%{http_code}' --connect-timeout 3 'http://127.0.0.1:$BLOCKSCOUT_PORT/api/v2/stats' 2>/dev/null || echo '000'")
|
|
|
|
if [ "$LOCAL_CODE" = "200" ]; then
|
|
echo -e "${GREEN}✅ Blockscout responds on localhost:4000${NC}"
|
|
echo " Service is running but may not be network-accessible"
|
|
elif [ "$LOCAL_CODE" = "000" ]; then
|
|
echo -e "${RED}❌ Blockscout does not respond on localhost:4000${NC}"
|
|
echo " Service may not be running"
|
|
else
|
|
echo -e "${YELLOW}⚠️ Localhost returned HTTP $LOCAL_CODE${NC}"
|
|
fi
|
|
echo ""
|
|
|
|
# Test 6: Check Docker containers (if applicable)
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo "Test 6: Docker Containers (if applicable)"
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo ""
|
|
|
|
DOCKER_PS=$(ssh root@"$PROXMOX_HOST" "pct exec $VMID -- docker ps 2>/dev/null | grep -i blockscout || echo 'no docker'")
|
|
|
|
if echo "$DOCKER_PS" | grep -q "blockscout"; then
|
|
echo "Docker containers found:"
|
|
echo "$DOCKER_PS"
|
|
echo ""
|
|
echo "Checking port bindings..."
|
|
DOCKER_PORTS=$(ssh root@"$PROXMOX_HOST" "pct exec $VMID -- docker ps --format 'table {{.Names}}\t{{.Ports}}' 2>/dev/null | grep -i blockscout || echo 'not found'")
|
|
echo "$DOCKER_PORTS"
|
|
|
|
if echo "$DOCKER_PORTS" | grep -q "0.0.0.0:4000"; then
|
|
echo -e "${GREEN}✅ Docker port binding includes 0.0.0.0:4000${NC}"
|
|
elif echo "$DOCKER_PORTS" | grep -q "127.0.0.1:4000"; then
|
|
echo -e "${RED}❌ Docker port binding is 127.0.0.1:4000 (localhost only)${NC}"
|
|
echo " Update docker-compose.yml to use 0.0.0.0:4000:4000"
|
|
fi
|
|
else
|
|
echo "No Blockscout Docker containers found (may be running as systemd service)"
|
|
fi
|
|
echo ""
|
|
|
|
# Summary and Recommendations
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo "📋 Summary and Recommendations"
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo ""
|
|
|
|
if [ "$HTTP_CODE" = "000" ] || [ "$HTTP_CODE" != "200" ]; then
|
|
echo -e "${RED}❌ ISSUE DETECTED: Port 4000 is not accessible${NC}"
|
|
echo ""
|
|
echo "Possible causes:"
|
|
echo " 1. Blockscout service not running"
|
|
echo " 2. Port 4000 only bound to localhost (127.0.0.1)"
|
|
echo " 3. Firewall blocking port 4000"
|
|
echo " 4. Docker port binding incorrect"
|
|
echo ""
|
|
echo "Next steps:"
|
|
echo " 1. If localhost works but network doesn't:"
|
|
echo " - Update Blockscout to bind to 0.0.0.0:4000"
|
|
echo " - For Docker: Update docker-compose.yml port binding"
|
|
echo " - For systemd: Update service environment variables"
|
|
echo ""
|
|
echo " 2. If service is not running:"
|
|
echo " - Start Blockscout: pct exec $VMID -- systemctl start blockscout.service"
|
|
echo " - Or restart Docker containers if using Docker"
|
|
echo ""
|
|
echo " 3. Check firewall:"
|
|
echo " - pct exec $VMID -- iptables -L -n | grep 4000"
|
|
echo " - pct exec $VMID -- ufw status | grep 4000"
|
|
echo ""
|
|
else
|
|
echo -e "${GREEN}✅ Port 4000 is accessible - direct route should work${NC}"
|
|
echo ""
|
|
echo "Next step: Verify NPMplus is routing to port 4000 (not 80)"
|
|
fi
|
|
echo ""
|