joinmarket-webui / jam-docker

https://jamdocs.org
MIT License
14 stars 7 forks source link

Stuck on "Waiting for bitcoind to accept RPC requests..." #129

Closed btclinux closed 1 month ago

btclinux commented 1 month ago

Using local node.

docker run --rm  -it \
        --add-host=host.docker.internal:host-gateway \
        --env JM_RPC_HOST="host.docker.internal" \
        --env JM_RPC_PORT="8332" \
        --env JM_RPC_USER="satoshi" \
        --env JM_RPC_PASSWORD="satoshi" \
        --env APP_USER="satoshi" \
        --env APP_PASSWORD="satoshi" \
        --env ENSURE_WALLET="true" \
        --env REMOVE_LOCK_FILES="true" \
        --env RESTORE_DEFAULT_CONFIG="true" \
        --volume jmdatadir:/root/.joinmarket \
        --publish "8080:80" \
        ghcr.io/joinmarket-webui/jam-standalone:latest
Status: Downloaded newer image for ghcr.io/joinmarket-webui/jam-standalone:latest
Remove leftover wallet lockfiles before startup...
Waiting for bitcoind to accept RPC requests...

How to debug?

theborakompanioni commented 1 month ago

Hi @btclinux!

Hmm.. it means there is an error response by Bitcoin Core which makes Jam wait indefinitely.. Can you try to manually execute the getblockchaininfo rpc requests and see why it fails? See here: https://github.com/joinmarket-webui/jam-docker/blob/master/standalone/jam-entrypoint.sh#L88-L96

If you need further help or instructions, don't hesitate to ping me again :pray:

btclinux commented 1 month ago

It works

./bitcoin-cli -rpcconnect=127.0.0.1 -rpcuser=satoshi -rpcpassword=satoshi getblockchaininfo
{
  "chain": "main",
  "blocks": 861282,
  "headers": 861282,
  "bestblockhash": "0000000000000000000008b6220c685a0433c447aaeac1e7d8a8a7ce0f5ddf07",
  "difficulty": 92671576265161.06,
  "time": 1726314823,
  "mediantime": 1726310402,
  "verificationprogress": 0.9999941470500535,
  "initialblockdownload": false,
  "chainwork": "00000000000000000000000000000000000000008e719ce65e82ff879be760d9",
  "size_on_disk": 682478895838,
  "pruned": false,
  "warnings": ""
}
btclinux commented 1 month ago

Inside docker container:

curl --user satoshi --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getblockchaininfo", "params": []}' -H 'content-type: text/plain;' host.docker.internal:8332
Enter host password for user 'satoshi':
curl: (28) Failed to connect to host.docker.internal port 8332: Connection timed out
cat /etc/hosts
127.0.0.1       localhost
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.17.0.1      host.docker.internal
172.17.0.2      6522cb5d9768

I also bind RPC to 172.17.0.1 in bitcoin.conf and can use it from host:

./bitcoin-cli -rpcconnect=172.17.0.1 -rpcuser=satoshi -rpcpassword=satoshi getblockchaininfo
{
  "chain": "main",
  "blocks": 861285,
  "headers": 861285,
  "bestblockhash": "00000000000000000000a7ff3816c2f02ce748e6a9b9cc427c34c98c91addbd7",
  "difficulty": 92671576265161.06,
  "time": 1726317433,
  "mediantime": 1726313957,
  "verificationprogress": 0.9999974020859078,
  "initialblockdownload": false,
  "chainwork": "00000000000000000000000000000000000000008e7299c1b4854ae51bb20a92",
  "size_on_disk": 682484476473,
  "pruned": false,
  "warnings": ""
}
btclinux commented 1 month ago

Disabling firewall solves this. But I think the necessary rule should be in documentation. And binding core to docker interface

theborakompanioni commented 1 month ago

Disabling firewall solves this. But I think the necessary rule should be in documentation. And binding core to docker interface

Glad to hear that you could make it work :rocket: Yeah, documentation can and should always be improved. That'd be nice. What exactly do you want to be added/described?

btclinux commented 1 month ago

Disabling firewall solves this. But I think the necessary rule should be in documentation. And binding core to docker interface

Glad to hear that you could make it work :rocket: Yeah, documentation can and should always be improved. That'd be nice. What exactly do you want to be added/described?

  1. Firewall rule to allow docker container connect to Core, can't test now so can't say what exactly
  2. Necessary config options in Core: rpcbind=172.17.0.1
btclinux commented 1 month ago

Unfortunately, I can't get it running again

Remove leftover wallet lockfiles before startup...
Waiting for bitcoind to accept RPC requests...
Successfully waited for bitcoind to accept RPC requests.
Creating wallet jm_webui_default if missing...
Loading wallet jm_webui_default...
[  OK  ] nginx
[  OK  ] tor
[  OK  ] ob-watcher
[  OK  ] jmwalletd
[  OK  ] boot
dinit: Service jmwalletd process terminated with exit code 1
dinit: Service ob-watcher process terminated with exit code 1
dinit: Service jmwalletd process terminated with exit code 1
dinit: Service ob-watcher process terminated with exit code 1
dinit: Service jmwalletd process terminated with exit code 1
dinit: Service ob-watcher process terminated with exit code 1
dinit: Service jmwalletd process terminated with exit code 1
dinit: Service jmwalletd restarting too quickly; stopping.
dinit: Service jmwalletd restarting too quickly; stopping.
[STOPPD] jmwalletd
dinit: Service ob-watcher process terminated with exit code 1
dinit: Service ob-watcher restarting too quickly; stopping.
dinit: Service ob-watcher restarting too quickly; stopping.
[STOPPD] ob-watcher
theborakompanioni commented 1 month ago

Unfortunately, I can't get it running again

Shooting in the dark here, do you have deprecatedrpc=create_bdb in your config? https://jamdocs.org/FAQ/#jam-doesnt-work-anymore-after-updating-bitcoin-core-to-v260

Otherwise, please view the logs in the container in /var/log/jam (using docker you can mount it to a local dir if you want). https://jamdocs.org/FAQ/#how-do-i-view-the-log-file

btclinux commented 1 month ago

So, I can't reproduce yesterday's error. Now it works. Nothing has changed in bitcoin.conf

btclinux commented 1 month ago

UPD: you should have rpcallowip=172.17.0.0/16 (docker subnet) in bitcoin.conf

btclinux commented 1 month ago

The rule for UFW: sudo ufw allow in on docker0 to any port 8332 proto tcp