**Motivations:** - Export Signet and mining wallet backups to git with only 2 versions kept - Document and add backup/restore scripts for signet and mining wallet **Correctifs:** - Backup-to-git uses SSH URL for passwordless cron; copy timestamped files only; prune to 2 versions; remove *-latest from backup repo **Evolutions:** - data/backup-to-git-cron.sh: daily export to git.4nkweb.com/4nk/backup - save-signet-datadir-backup.sh, restore-signet-from-backup.sh, export-mining-wallet.sh, import-mining-wallet.sh - features/backup-to-git-daily-cron.md, docs/MAINTENANCE.md backup section - .gitignore: data/backup-to-git.log **Pages affectées:** - .gitignore, data/backup-to-git-cron.sh, docs/MAINTENANCE.md, features/backup-to-git-daily-cron.md - save-signet-datadir-backup.sh, restore-signet-from-backup.sh, export-mining-wallet.sh, import-mining-wallet.sh - Plus autres fichiers modifiés ou non suivis déjà présents dans le working tree
118 lines
5.3 KiB
Bash
Executable File
118 lines
5.3 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Verify that https://dashboard.certificator.4nkweb.com/ shows the custom signet
|
|
# (~11535 blocks). Run on the machine bitcoin (192.168.1.105).
|
|
#
|
|
# Checks:
|
|
# 1. Node RPC (127.0.0.1:38332) returns getblockchaininfo with ~11535 blocks
|
|
# 2. Dashboard service (signet-dashboard) is running and uses same RPC
|
|
# 3. Dashboard API /api/blockchain/info returns blocks
|
|
#
|
|
# Usage: ./verify-dashboard-signet.sh
|
|
#
|
|
# Author: 4NK Team
|
|
# Date: 2026-02-02
|
|
|
|
set -e
|
|
|
|
RPC_HOST="${BITCOIN_RPC_HOST:-127.0.0.1}"
|
|
RPC_PORT="${BITCOIN_RPC_PORT:-38332}"
|
|
RPC_USER="${BITCOIN_RPC_USER:-bitcoin}"
|
|
RPC_PASS="${BITCOIN_RPC_PASSWORD:-bitcoin}"
|
|
DASHBOARD_URL="${DASHBOARD_URL:-http://localhost:3020}"
|
|
EXPECTED_MIN="${EXPECTED_HEIGHT_MIN:-11000}"
|
|
EXPECTED_MAX="${EXPECTED_HEIGHT_MAX:-12000}"
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
cd "$SCRIPT_DIR"
|
|
|
|
echo "=== Verify dashboard shows custom signet ==="
|
|
echo "RPC: $RPC_HOST:$RPC_PORT Dashboard: $DASHBOARD_URL"
|
|
echo ""
|
|
|
|
# 0. One node only: bitcoin-signet-instance on 38332 (same as Mempool host.docker.internal:38332)
|
|
echo "0. Checking single node (bitcoin-signet-instance = Mempool host.docker.internal:$RPC_PORT)..."
|
|
if command -v docker &>/dev/null && docker ps --format '{{.Names}}' 2>/dev/null | grep -q '^bitcoin-signet-instance$'; then
|
|
if ss -tlnp 2>/dev/null | grep -q ":${RPC_PORT}"; then
|
|
echo " OK: Port $RPC_PORT in use; bitcoin-signet-instance is running (same node as Mempool)."
|
|
else
|
|
echo " WARN: bitcoin-signet-instance running but port $RPC_PORT not found in ss (check mapping)."
|
|
fi
|
|
# Prefer named volume signet-bitcoin-data (same as restore-signet-from-backup.sh and update-signet.sh)
|
|
if docker inspect bitcoin-signet-instance --format '{{range .Mounts}}{{.Name}} {{end}}' 2>/dev/null | grep -q 'signet-bitcoin-data'; then
|
|
echo " OK: Container uses volume signet-bitcoin-data (persistent chain)."
|
|
else
|
|
echo " WARN: Container not using volume signet-bitcoin-data (chain may be lost on container replace). Run update-signet.sh or restore-signet-from-backup.sh for correct config."
|
|
fi
|
|
else
|
|
echo " WARN: bitcoin-signet-instance not running; another process may be on $RPC_PORT (verify it is the signet node)."
|
|
fi
|
|
echo ""
|
|
|
|
# 1. Test RPC (same node as Mempool / Dashboard)
|
|
echo "1. Testing node RPC ($RPC_HOST:$RPC_PORT)..."
|
|
RPC_JSON=$(curl -s --user "$RPC_USER:$RPC_PASS" \
|
|
--data-binary '{"jsonrpc":"1.0","id":"test","method":"getblockchaininfo","params":[]}' \
|
|
-H "content-type: text/plain;" "http://${RPC_HOST}:${RPC_PORT}/" 2>/dev/null || true)
|
|
BLOCKS=$(echo "$RPC_JSON" | grep -o '"blocks"[[:space:]]*:[[:space:]]*[0-9]*' | head -1 | grep -o '[0-9]*$' || echo "")
|
|
if [ -z "$BLOCKS" ]; then
|
|
echo " FAIL: Cannot reach node at $RPC_HOST:$RPC_PORT (dashboard will show '-').
|
|
Ensure: bitcoin-signet-instance or bitcoind is running and listening on 38332."
|
|
exit 1
|
|
fi
|
|
echo " Node: blocks=$BLOCKS (expected ~11535)"
|
|
if [ "$BLOCKS" -ge "$EXPECTED_MIN" ] && [ "$BLOCKS" -le "$EXPECTED_MAX" ]; then
|
|
echo " OK: Height in expected range (custom signet, same as Mempool)."
|
|
else
|
|
echo " WARN: Height outside [$EXPECTED_MIN..$EXPECTED_MAX]. Dashboard will show this height."
|
|
fi
|
|
echo ""
|
|
|
|
# 2. Dashboard service
|
|
echo "2. Checking signet-dashboard service..."
|
|
if systemctl is-active --quiet signet-dashboard 2>/dev/null; then
|
|
echo " OK: signet-dashboard is running."
|
|
else
|
|
echo " FAIL: signet-dashboard is not running.
|
|
Start: sudo systemctl start signet-dashboard"
|
|
exit 1
|
|
fi
|
|
echo ""
|
|
|
|
# 3. Dashboard API
|
|
echo "3. Checking Dashboard API ($DASHBOARD_URL/api/blockchain/info)..."
|
|
TMP_JSON="$SCRIPT_DIR/.verify-dashboard-$$.json"
|
|
trap 'rm -f "$TMP_JSON"' EXIT
|
|
DASH_HTTP=$(curl -s -o "$TMP_JSON" -w "%{http_code}" "$DASHBOARD_URL/api/blockchain/info" 2>/dev/null || echo "000")
|
|
if [ "$DASH_HTTP" = "200" ]; then
|
|
DASH_BLOCKS=$(grep -o '"blocks"[[:space:]]*:[[:space:]]*[0-9]*' "$TMP_JSON" | head -1 | grep -o '[0-9]*$' || echo "")
|
|
if [ -n "$DASH_BLOCKS" ]; then
|
|
echo " OK: Dashboard API returns blocks=$DASH_BLOCKS."
|
|
if [ "$DASH_BLOCKS" -ge "$EXPECTED_MIN" ] && [ "$DASH_BLOCKS" -le "$EXPECTED_MAX" ]; then
|
|
echo " OK: Height in expected range (custom signet)."
|
|
else
|
|
echo " WARN: Height $DASH_BLOCKS outside [$EXPECTED_MIN..$EXPECTED_MAX]."
|
|
fi
|
|
else
|
|
echo " WARN: Could not parse blocks from Dashboard API."
|
|
fi
|
|
else
|
|
if [ "$DASH_HTTP" = "403" ]; then
|
|
echo " INFO: Dashboard returned 403 (ALLOWED_SOURCE_IP: call from proxy or allowed host).
|
|
From proxy: curl https://dashboard.certificator.4nkweb.com/api/blockchain/info"
|
|
else
|
|
echo " FAIL: Dashboard API returned HTTP $DASH_HTTP.
|
|
Check: sudo journalctl -u signet-dashboard -n 50"
|
|
exit 1
|
|
fi
|
|
fi
|
|
echo ""
|
|
|
|
echo "=== Summary ==="
|
|
echo "For https://dashboard.certificator.4nkweb.com/ to show the custom signet:"
|
|
echo " - Proxy nginx: dashboard.certificator.4nkweb.com -> 192.168.1.105:3020 (configure-nginx-proxy.sh)"
|
|
echo " - Machine 105: signet-dashboard listening on 192.168.1.105:3020, BITCOIN_RPC_HOST=127.0.0.1, BITCOIN_RPC_PORT=38332"
|
|
echo " - Node on 105: listening on 0.0.0.0:38332 (bitcoin.conf: signet=1, rpcbind=0.0.0.0:38332)"
|
|
echo " - Run fix: ./fix-dashboard-anchor-chain.sh (tests RPC, restarts dashboard and anchorage)"
|
|
echo ""
|