btcpayserver / btcpayserver-docker

Docker resources for hosting BTCPayServer easily
MIT License
573 stars 352 forks source link

Exposing the bitcoind p2p and rpc ports to the host machine #824

Open sebastianmontero opened 1 year ago

sebastianmontero commented 1 year ago

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,

dennisreimann commented 1 year ago

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?

sebastianmontero commented 1 year ago

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?

dennisreimann commented 1 year ago

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"
sebastianmontero commented 1 year ago

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

dennisreimann commented 1 year ago

Yes it is required to update the running installation.

sebastianmontero commented 1 year ago

Great! Thanks @dennisreimann!

sebastianmontero commented 1 year ago

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?

dennisreimann commented 1 year ago

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.

Meisterzunge commented 4 weeks ago

@dennisreimann I tried to connect to my bitcoin node (from my local network), too - without success.

Followed this topic on exposing internal node, gave various tries on custom fragments, etc. Already tried to expose ports 43782, 8333, 8332 (disabled firewalls for testing).

My best guess is that bitcoind whitelists remote connections to it?!

My goal is to able to get sparrow connected when using it in my local network. Used a TOR connection so far. But meanwhile the connection via TOR fails, too?!:

Could not connect:
SOCKS server general failure

Thanks in advance