btcpayserver-docker icon indicating copy to clipboard operation
btcpayserver-docker copied to clipboard

Exposing the bitcoind p2p and rpc ports to the host machine

Open sebastianmontero opened this issue 1 year ago • 9 comments

Hi,

I've been running a btcpayserver using docker for a while now. I want to run an electrs server along side it, the electrs server needs to connect to the p2p and rpc ports of the bitcoin node running as part of the btcpayserver, how can I expose these ports to the host machine so the electrs server can connect to them?

Thanks,

sebastianmontero avatar Aug 11 '23 18:08 sebastianmontero

The process should be similar to running EPS with BTCPay Server. RPC port is already exposed, see this for P2P. If you need anything beyond that, you can edit the setup with customized fragments.

Does this help?

dennisreimann avatar Aug 12 '23 07:08 dennisreimann

Thanks @dennisreimann. EPS is running as another docker compose service, correct? But is the RPC port exposed to the host? I want to run electrs directly on the host machine, The default rpc port is 43782 correct? when I try to connect to it from the host using: telnet localhost 43782 I get a connection refused error. Do you know why this maybe?

sebastianmontero avatar Aug 13 '23 01:08 sebastianmontero

It isn't exposed to the host, only internally to other BTCPay Server Docker containers. You can enable that via custom fragment though:

services:
  bitcoind:
    ports:
      - "43782:43782"

dennisreimann avatar Aug 14 '23 07:08 dennisreimann

Great! Thanks @dennisreimann. Just wanted to confirm that it is ok to run . ./btcpay-setup.sh -i in an already running installation?

sebastianmontero avatar Aug 14 '23 13:08 sebastianmontero

Yes it is required to update the running installation.

dennisreimann avatar Aug 14 '23 15:08 dennisreimann

Great! Thanks @dennisreimann!

sebastianmontero avatar Aug 14 '23 16:08 sebastianmontero

Thanks @dennisreimann that worked! Now I'm having another issue, electrs has to read the /.bitcoin/blocks data, but currently only the lxd user has read permissions, is there a way to configure btcpayserver so that the block data includes read permissions for all users?

sebastianmontero avatar Aug 15 '23 14:08 sebastianmontero

I couldn't find a way to do so via docker-compose and further customizing the fragment. Maybe the better option would be to integrate electrs as a proper BTCPay fragment itself and connect the containers — not sure if that's an option for you though.

dennisreimann avatar Aug 16 '23 06:08 dennisreimann