fix(scripts): verify the web interface that actually ships, on port 5000

verify_installation.sh failed every healthy install: it required the
long-removed web_interface_v2.py and looked for a listener on port 5001,
while the web interface binds 5000 (web_interface/start.py). It now
checks the files ledmatrix-web.service runs (start_web_conditionally.py,
web_interface/start.py, app.py) and port 5000. verify_web_ui.sh had the
same 5001 port in its listen check, HTTP probe and printed URLs.

Port matches are anchored so :50001 no longer counts as :5000.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Chuck
2026-09-17 08:55:45 -04:00
co-authored by Claude Opus 5
parent f7467860bb
commit 9c06feebd3
2 changed files with 39 additions and 30 deletions
+14 -9
View File
@@ -121,19 +121,24 @@ fi
echo "" echo ""
# 5. Check web interface # 5. Check web interface
# ledmatrix-web.service runs scripts/utils/start_web_conditionally.py, which
# starts web_interface/start.py; the app binds port 5000 (web_interface/start.py).
echo "=== Web Interface ===" echo "=== Web Interface ==="
if [ -f "$PROJECT_ROOT/web_interface_v2.py" ]; then WEB_PORT=5000
check_pass "web_interface_v2.py exists" for web_file in scripts/utils/start_web_conditionally.py web_interface/start.py web_interface/app.py; do
else if [ -f "$PROJECT_ROOT/$web_file" ]; then
check_fail "web_interface_v2.py is missing" check_pass "$web_file exists"
fi else
check_fail "$web_file is missing"
fi
done
# Check if web service is listening # Check if web service is listening
if systemctl is-active --quiet ledmatrix-web.service 2>/dev/null; then if systemctl is-active --quiet ledmatrix-web.service 2>/dev/null; then
if netstat -tuln 2>/dev/null | grep -q ":5001" || ss -tuln 2>/dev/null | grep -q ":5001"; then if netstat -tuln 2>/dev/null | grep -qE ":${WEB_PORT}([^0-9]|$)" || ss -tuln 2>/dev/null | grep -qE ":${WEB_PORT}([^0-9]|$)"; then
check_pass "Web interface is listening on port 5001" check_pass "Web interface is listening on port $WEB_PORT"
else else
check_warn "Web service is running but port 5001 may not be listening" check_warn "Web service is running but port $WEB_PORT may not be listening"
fi fi
else else
check_warn "Web service is not running (cannot check port)" check_warn "Web service is not running (cannot check port)"
@@ -204,7 +209,7 @@ if [ "$ALL_PASSED" = true ]; then
echo -e "${GREEN}Installation verification PASSED${NC}" echo -e "${GREEN}Installation verification PASSED${NC}"
echo "" echo ""
echo "Next steps:" echo "Next steps:"
echo "1. Access the web interface at: http://$(hostname -I | awk '{print $1}'):5001" echo "1. Access the web interface at: http://$(hostname -I | awk '{print $1}'):$WEB_PORT"
echo "2. Check service status: sudo systemctl status ledmatrix.service" echo "2. Check service status: sudo systemctl status ledmatrix.service"
echo "3. View logs: journalctl -u ledmatrix.service -f" echo "3. View logs: journalctl -u ledmatrix.service -f"
exit 0 exit 0
+25 -21
View File
@@ -8,6 +8,10 @@ echo "Web UI Verification"
echo "==========================================" echo "=========================================="
echo "" echo ""
# The web interface binds port 5000 (web_interface/start.py).
WEB_PORT=5000
PORT_PATTERN=":${WEB_PORT}([^0-9]|$)"
# Colors # Colors
GREEN='\033[0;32m' GREEN='\033[0;32m'
RED='\033[0;31m' RED='\033[0;31m'
@@ -32,25 +36,25 @@ else
fi fi
echo "" echo ""
# 2. Check if port 5001 is listening # 2. Check if port $WEB_PORT is listening
echo "2. Checking if port 5001 is listening..." echo "2. Checking if port $WEB_PORT is listening..."
if command -v ss >/dev/null 2>&1; then if command -v ss >/dev/null 2>&1; then
if ss -tuln 2>/dev/null | grep -q ":5001"; then if ss -tuln 2>/dev/null | grep -qE "$PORT_PATTERN"; then
echo -e "${GREEN}✓${NC} Port 5001 is listening" echo -e "${GREEN}✓${NC} Port $WEB_PORT is listening"
echo "" echo ""
echo "Active connections on port 5001:" echo "Active connections on port $WEB_PORT:"
ss -tuln | grep ":5001" ss -tuln | grep -E "$PORT_PATTERN"
else else
echo -e "${RED}✗${NC} Port 5001 is NOT listening" echo -e "${RED}✗${NC} Port $WEB_PORT is NOT listening"
fi fi
elif command -v netstat >/dev/null 2>&1; then elif command -v netstat >/dev/null 2>&1; then
if netstat -tuln 2>/dev/null | grep -q ":5001"; then if netstat -tuln 2>/dev/null | grep -qE "$PORT_PATTERN"; then
echo -e "${GREEN}✓${NC} Port 5001 is listening" echo -e "${GREEN}✓${NC} Port $WEB_PORT is listening"
echo "" echo ""
echo "Active connections on port 5001:" echo "Active connections on port $WEB_PORT:"
netstat -tuln | grep ":5001" netstat -tuln | grep -E "$PORT_PATTERN"
else else
echo -e "${RED}✗${NC} Port 5001 is NOT listening" echo -e "${RED}✗${NC} Port $WEB_PORT is NOT listening"
fi fi
else else
echo -e "${YELLOW}⚠${NC} Cannot check port (ss/netstat not available)" echo -e "${YELLOW}⚠${NC} Cannot check port (ss/netstat not available)"
@@ -59,15 +63,15 @@ echo ""
# 3. Test HTTP connection # 3. Test HTTP connection
echo "3. Testing HTTP connection..." echo "3. Testing HTTP connection..."
if curl -s -o /dev/null -w "%{http_code}" --max-time 5 http://localhost:5001 > /dev/null 2>&1; then if curl -s -o /dev/null -w "%{http_code}" --max-time 5 http://localhost:$WEB_PORT > /dev/null 2>&1; then
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" --max-time 5 http://localhost:5001 2>/dev/null) HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" --max-time 5 http://localhost:$WEB_PORT 2>/dev/null)
if [ "$HTTP_CODE" = "200" ] || [ "$HTTP_CODE" = "302" ] || [ "$HTTP_CODE" = "301" ]; then if [ "$HTTP_CODE" = "200" ] || [ "$HTTP_CODE" = "302" ] || [ "$HTTP_CODE" = "301" ]; then
echo -e "${GREEN}✓${NC} Web interface is responding (HTTP $HTTP_CODE)" echo -e "${GREEN}✓${NC} Web interface is responding (HTTP $HTTP_CODE)"
else else
echo -e "${YELLOW}⚠${NC} Web interface responded with HTTP $HTTP_CODE" echo -e "${YELLOW}⚠${NC} Web interface responded with HTTP $HTTP_CODE"
fi fi
else else
echo -e "${RED}✗${NC} Cannot connect to web interface on port 5001" echo -e "${RED}✗${NC} Cannot connect to web interface on port $WEB_PORT"
fi fi
echo "" echo ""
@@ -79,7 +83,7 @@ if [ -n "$IP_ADDRESSES" ]; then
echo "" echo ""
echo "Access web interface at:" echo "Access web interface at:"
for ip in $IP_ADDRESSES; do for ip in $IP_ADDRESSES; do
echo " http://$ip:5001" echo " http://$ip:$WEB_PORT"
done done
else else
echo -e "${YELLOW}⚠${NC} Could not determine IP address" echo -e "${YELLOW}⚠${NC} Could not determine IP address"
@@ -118,12 +122,12 @@ if systemctl is-active --quiet ledmatrix-web.service 2>/dev/null; then
SERVICE_RUNNING=true SERVICE_RUNNING=true
fi fi
if (ss -tuln 2>/dev/null | grep -q ":5001") || (netstat -tuln 2>/dev/null | grep -q ":5001"); then if (ss -tuln 2>/dev/null | grep -qE "$PORT_PATTERN") || (netstat -tuln 2>/dev/null | grep -qE "$PORT_PATTERN"); then
PORT_LISTENING=true PORT_LISTENING=true
fi fi
if curl -s -o /dev/null -w "%{http_code}" --max-time 5 http://localhost:5001 > /dev/null 2>&1; then if curl -s -o /dev/null -w "%{http_code}" --max-time 5 http://localhost:$WEB_PORT > /dev/null 2>&1; then
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" --max-time 5 http://localhost:5001 2>/dev/null) HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" --max-time 5 http://localhost:$WEB_PORT 2>/dev/null)
if [ "$HTTP_CODE" = "200" ] || [ "$HTTP_CODE" = "302" ] || [ "$HTTP_CODE" = "301" ]; then if [ "$HTTP_CODE" = "200" ] || [ "$HTTP_CODE" = "302" ] || [ "$HTTP_CODE" = "301" ]; then
HTTP_RESPONDING=true HTTP_RESPONDING=true
fi fi
@@ -134,7 +138,7 @@ if [ "$SERVICE_RUNNING" = true ] && [ "$PORT_LISTENING" = true ] && [ "$HTTP_RES
echo "" echo ""
echo "You can access it at:" echo "You can access it at:"
for ip in $IP_ADDRESSES; do for ip in $IP_ADDRESSES; do
echo " http://$ip:5001" echo " http://$ip:$WEB_PORT"
done done
exit 0 exit 0
elif [ "$SERVICE_RUNNING" = false ]; then elif [ "$SERVICE_RUNNING" = false ]; then
@@ -145,7 +149,7 @@ elif [ "$SERVICE_RUNNING" = false ]; then
echo " sudo systemctl enable ledmatrix-web.service # to start on boot" echo " sudo systemctl enable ledmatrix-web.service # to start on boot"
exit 1 exit 1
elif [ "$PORT_LISTENING" = false ]; then elif [ "$PORT_LISTENING" = false ]; then
echo -e "${RED}✗ Service is running but port 5001 is not listening${NC}" echo -e "${RED}✗ Service is running but port $WEB_PORT is not listening${NC}"
echo "" echo ""
echo "Check logs for errors:" echo "Check logs for errors:"
echo " sudo journalctl -u ledmatrix-web.service -f" echo " sudo journalctl -u ledmatrix-web.service -f"