Skip to content

feat(near): report the sync status through the healthcheck - #126

Open
3alpha wants to merge 1 commit into
mainfrom
feat/node-status-report
Open

3alpha wants to merge 1 commit into
mainfrom
feat/node-status-report

Conversation

@3alpha

@3alpha 3alpha commented Nov 30, 2026

Copy link
Copy Markdown
Member

Context

The dappmanager dashboard is gaining a status card for every node package, not only Ethereum staking clients. For a node it has no built-in knowledge of, the package itself says whether the node is synced, how far along it is and what it is doing, through its Docker healthcheck. The dappmanager adds what is the same for every chain: stall detection, time left and waiting on a required node. The contract and the dappmanager side are in dappnode/DNP_DAPPMANAGER#2520; the shared shell helpers are released in staker-package-scripts v0.1.3 (dappnode/staker-package-scripts#12).

The dappmanager does not display status-report nodes yet: #2520 reads reports from Ethereum execution clients only. This package ships the declaration and the healthcheck ahead of that, which is safe: current dappmanagers ignore both.

Approach

  • Manifest: nodes declares the near service as a node on network near with the status-report probe, maxHeadAgeSeconds: 120 and report: healthcheck.
  • Healthcheck: neard_image/node-status.sh reads the JSON-RPC status and network_info and, while syncing, the metrics on the same port, and prints one JSON line. It exits 0 while starting or syncing.
  • Entrypoint: start_near.sh leaves a marker under /tmp/node-status while it initialises the node and while it runs the snapshot step, so the healthcheck can say what is happening before neard serves its RPC. The marker is trusted only while that script's process is alive, and what the script does is unchanged.
  • Image: adds node_status_tools.sh from the v0.1.3 release and the script as /usr/local/bin/node-status.
  • The repo had no README; this adds one with a short section on the status report.

What it reports

Checked against the nearcore source at 2.14.1.

Report Signal
starting, with "Initializing node" or "Downloading snapshot" The RPC does not answer; phase from the entrypoint's marker
synced sync_info.syncing is false and the latest block is at most 120 s old
syncing "Waiting for peers", "Downloading epoch sync proof", "Downloading block headers", "Downloading state" or "Applying state", "Downloading blocks" The near_sync_status gauge, with near_state_sync_stage per shard and the header head as the target for block download
syncing "Catching up" neard says it is not syncing but its latest block is stale

Blocks come about every 0.6 s and neard's own /health fails after 20 s without one; 120 s leaves a margin for short stalls.

Test instructions

  • sh test/node_status_test.sh (220 checks). Passes under dash, bash, bash --posix, busybox and inside the built image.
  • shellcheck is clean on the script and the test.
  • The built image was run under supervisord with the healthcheck: the report moved through "Initializing node" and "Downloading snapshot" to plain starting, and Docker showed the container healthy.
  • The script was run on real status and network_info replies from the public mainnet RPC (2.14.1) and reported synced with height and peers.

Not run against a local synced node: neard crashes with "Illegal instruction" on the development machine, whose CPU has no AVX.

Found on the way, not changed here

  • The snapshot download does nothing: the FastNEAR script the entrypoint calls was retired in June 2025 and exits immediately, so DOWNLOAD_SNAPSHOT=true has no effect and a new node syncs from scratch.
  • The validator secret key is passed as a plain environment variable.
  • neard ping --protocol-version 76 is below the minimum supported version.
  • With ACCOUNT_ID empty, init gets --account-id=.pool.near.

The healthcheck prints a status report that says whether the node is
synced and what it is doing, declared in the manifest `nodes` field
with the status-report probe.
@tropibot

tropibot Bot commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Dappnode bot has built and pinned the built packages to an IPFS node, for commit: c57972f

This is a development version and should only be installed for testing purposes.

  1. Package near.dnp.dappnode.eth

Install link

Hash: /ipfs/QmT7DP1dcvS1WQVkQNPpmKXUwARnNzujiaVRFCWJtwY8QF

(by dappnodebot/build-action)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant