Explorer + Snap: nginx /snap 200, runbook, apply-nginx script, verify docs

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
defiQUG
2026-02-11 12:44:05 -08:00
parent b1415f15fc
commit 01e126a868
6 changed files with 220 additions and 7 deletions

View File

@@ -110,6 +110,52 @@ else
((FAIL++)) || true
fi
# 6) Explorer root returns 200
HTTP_CODE="$(curl -sS -o /dev/null -w "%{http_code}" --connect-timeout 10 "$BASE_URL/" 2>/dev/null || echo 000)"
if [ "$HTTP_CODE" = "200" ]; then
echo "$BASE_URL/ (explorer frontend) returns 200"
((PASS++)) || true
else
echo "$BASE_URL/ returned $HTTP_CODE (expected 200)"
((FAIL++)) || true
fi
# 7) Snap companion site /snap/ returns 200 or 301 (follow redirects for content)
SNAP_OUT="$(curl -sS -L -w '\n%{http_code}' --connect-timeout 10 "$BASE_URL/snap/" 2>/dev/null)" || true
SNAP_BODY="$(echo "$SNAP_OUT" | head -n -1)"
SNAP_CODE="$(echo "$SNAP_OUT" | tail -n 1)"
if [ "$SNAP_CODE" = "200" ] || [ "$SNAP_CODE" = "301" ]; then
echo "$BASE_URL/snap/ (Chain 138 Snap site) returns $SNAP_CODE"
((PASS++)) || true
else
echo "$BASE_URL/snap/ returned $SNAP_CODE (expected 200 or 301)"
((FAIL++)) || true
fi
# 8) /snap/ response contains Snap app content (skip if 301 — redirect may not include body)
if echo "$SNAP_BODY" | head -c 8192 | grep -qE 'Connect|template-snap|Snap|MetaMask'; then
echo "$BASE_URL/snap/ contains Snap app content"
((PASS++)) || true
elif [ "$SNAP_CODE" = "301" ]; then
echo "$BASE_URL/snap/ returned 301 (redirect); content check skipped"
else
echo "$BASE_URL/snap/ response missing expected content (Connect|Snap|MetaMask)"
((FAIL++)) || true
fi
# 9) Nginx has location /snap/ (when we can run inside VM)
if [ -n "$EXEC_PREFIX" ] || [ "$RUN_LOCAL" = true ]; then
if $EXEC_PREFIX bash -c 'grep -q "location /snap/" /etc/nginx/sites-available/blockscout 2>/dev/null'; then
echo "✅ Nginx has location /snap/"
((PASS++)) || true
else
echo "❌ Nginx config has no location /snap/"
((FAIL++)) || true
fi
else
echo "⏭ Skipping nginx /snap/ check (not inside VM and pct not used)"
fi
echo ""
echo "=============================================="
echo "Result: $PASS passed, $FAIL failed"