TrueBlocks / trueblocks-docker

GNU General Public License v3.0
39 stars 16 forks source link

Add error message if RPC is not running or failure to connect #363

Closed CyMule closed 1 year ago

CyMule commented 2 years ago

There are no error messages indicating a failure to connect to your RPC.

With the example .env, without an RPC running on localhost:8545, I did not receive any errors when starting the container.

There should be an error message indicating the failure before the container exits.

.env

SCRAPER_ARGS=
SCRAPER_FILE=

# Configuration (trueBlocks.toml)

# General
TB_CACHEPATH=/cache
TB_INDEXPATH=/index
TB_DEFAULTCHAIN=mainnet
TB_SETTINGS_ETHERSCANKEY

# Chains
TB_CHAINS_MAINNET_CHAINID=1
TB_CHAINS_MAINNET_LOCALEXPLORER=http://localhost:1234
TB_CHAINS_MAINNET_PINGATEWAY=https://ipfs.unchainedindex.io/ipfs/
TB_CHAINS_MAINNET_REMOTEEXPLORER=https://etherscan.io
TB_CHAINS_MAINNET_RPCPROVIDER=localhost:8545
TB_CHAINS_MAINNET_SYMBOL=ETH
tjayrush commented 2 years ago

Perhaps there's something you can add somewhere in the build process for docker (Sorry -- I don't know docker well enough to even know if this makes sense).

If there is a valid RPC endpoint available at 8545, it might return something like this:

{"jsonrpc":"2.0","id":1,"result":"1"}

Note: the "result" may be different than "1", so only check for error

when given this command:

curl -s -H "Content-Type: application/json" -d '{"method":"net_version","params":[],"id":1,"jsonrpc":"2.0"}' http://localhost:8545
tjayrush commented 1 year ago

A fix for this has been posted to the next release which will be pushed shortly.