soroban-cli icon indicating copy to clipboard operation
soroban-cli copied to clipboard

network-container-start: await healthy network by default

Open chadoh opened this issue 1 year ago • 3 comments
trafficstars

What problem does your feature solve?

When I run

stellar network container start local

I always, every single time I personally do this, don't want the network to be considered "started" until it's actually healthy.

Right now, I need to manually check if it's healthy, with an ugly curl command like

curl -s -X POST "http://localhost:8000/rpc" \
  -H "Content-Type: application/json" \
  -d '{ "jsonrpc": "2.0", "id": 8675309, "method": "getHealth" }' \
  | sed 's/.*"status":"\([^"]*\)".*/\1/'

Right after stellar network container start returns me to my prompt, this command will tell me "502: Bad Gateway". Then it will tell me "data stores not yet initialized" for a minute or so. Then, finally, it just says "healthy".

What would you like to see?

I don't want to be returned to my prompt until the network is healthy.

It would be nice to have some sort of loader, and maybe a status message. "Starting http...", "Initializing data stores...".

What alternatives are there?

If there's some edge case I'm unaware of in which it would be useful for people to have a partially-started local network, then we could also provide a --no-wait flag.

chadoh avatar Nov 05 '24 16:11 chadoh

There is a health check endpoint for the local node at /getHealth

janewang avatar Jan 10 '25 17:01 janewang

There is a health check endpoint for the local node at /getHealth

I don't think the stellar-cli is using it though, which is what this issue was tracking. Have we implemented something to use it some way that isn't obvious to me?

Reopening until we confirm this.

leighmcculloch avatar Jan 13 '25 05:01 leighmcculloch

I vote for also adding a stellar network health command that is used internally by stellar network container start local as proposed in this ticket, but can also be used to verify that external network can be reached and is healthy

ifropc avatar Jan 13 '25 22:01 ifropc