btcpayserver-docker
btcpayserver-docker copied to clipboard
Changing Bind Address & Cloudflare
I wanted to install BTCPayServer on a Server of mine which has several allocated IP-Addresses, Is it possible to change the default bind address (0.0.0.0) to a different one? I already checked out the docker-compose generated file, but I don't seem to understand where I would change the bind address.
I also want to use Cloudflare to make sure that my Server's IP Address is not exposed and their DDoS Protection, how would I do that? All I've found on the documentation is the Cloudflare Tunnel, but that's not of use for me.
i havent tried but you can try setting the env var REVERSEPROXY_HTTP_PORT
to myip:80
Hey, I've tried that, but the nginx server also listens on 0.0.0.0 then. Is there a possibility to change the nginx server bind address ONLY of btcpayserver without touching anything else within nginx? (I run a website, and I wanna run btcpayserver on the same machine)
Hey, I've tried that, but the nginx server also listens on 0.0.0.0 then. Is there a possibility to change the nginx server bind address ONLY of btcpayserver without touching anything else within nginx? (I run a website, and I wanna run btcpayserver on the same machine)
It shouldn't. That env var is specifically configuring btcpay's nginx "port" binding which is really an endpoint(ip + port).
Can you try setting both REVERSEPROXY_HTTPS_PORT and REVERSEPROXY_HTTP_PORT? Please note that there are other services besides nginx that try to bind to the hosts' ips.
Did some digging and based on https://github.com/docker/compose/issues/2999#issuecomment-499358731 and https://docs.docker.com/compose/networking/#configure-the-default-network I think you clear the env vars mentioned earlier and then use the following docker compose syntax to configure the default network to explicitly use an IP.
networks:
default:
driver_opts:
com.docker.network.bridge.host_binding_ipv4: "1.2.3.4"
You can add that by following this instruction: https://github.com/btcpayserver/btcpayserver-docker#how-can-i-customize-the-generated-docker-compose-file
Oh, thanks, I will try that shortly. Could you also check out the Cloudflare part I mentioned? If it is possible to use Cloudflare with BTCPayServer as I have seen some people use it.
Alright so, I edited the generated docker compose, re-ran the setup, but without success it still fails to bind
`generated_btcpayserver_1 is up-to-date Starting nginx ... error
ERROR: for nginx Cannot start service nginx: driver failed programming external connectivity on endpoint nginx (some-stuff-here): Error starting userland proxy: listen tcp4 0.0.0.0:443: bind: address already in use
ERROR: for nginx Cannot start service nginx: driver failed programming external connectivity on endpoint nginx (some-stuff-here): Error starting userland proxy: listen tcp4 0.0.0.0:443: bind: address already in use ERROR: Encountered errors while bringing up the project. btcpayserver_litecoind is up-to-date`
Oh, I just noticed, after I run btcpay-setup or btcpay-update the networks part in the generated compose file is reset back to "network: {}"
I also tried the docker-fragments, but that results in a .NET Error being displayed.
Any solution?
Alright so, I edited the generated docker compose, re-ran the setup, but without success it still fails to bind
`generated_btcpayserver_1 is up-to-date Starting nginx ... error
ERROR: for nginx Cannot start service nginx: driver failed programming external connectivity on endpoint nginx (some-stuff-here): Error starting userland proxy: listen tcp4 0.0.0.0:443: bind: address already in use
ERROR: for nginx Cannot start service nginx: driver failed programming external connectivity on endpoint nginx (some-stuff-here): Error starting userland proxy: listen tcp4 0.0.0.0:443: bind: address already in use ERROR: Encountered errors while bringing up the project. btcpayserver_litecoind is up-to-date`
Oh, I just noticed, after I run btcpay-setup or btcpay-update the networks part in the generated compose file is reset back to "network: {}"
Yes, you cannot edit the generated docker compose as we regenerate on each update/setup run.
I also tried the docker-fragments, but that results in a .NET Error being displayed.
@hiroashikawa I just tried out my previous potential solution and it seems that the docker compose file was generated.
Here is what I did:
- Create explicit-ip-bind.custom.yml inside
docker-compose-generator\docker-fragments
. Set the contents of this file to:
networks:
default:
driver_opts:
com.docker.network.bridge.host_binding_ipv4: "1.2.3.4"
where 1.2.3.4
is the IP you want to bind to
- run `export BTCPAY_ADDITIONAL_FRAGMENTS="$BTCPAY_ADDITIONAL_FRAGMENTS;explicit-ip-bind.custom"
- run
. btcpay-setup.sh -i
- the generated file should contain the networks section with the explicit IP binding
Regarding cloudflare, I don't know as I've never set it up myself but I have seen others mention and use it successfully. I recall there were some issues around https to resolve
Hey, I just tried that, but it still doesn't seem to work.
Error starting userland proxy: listen tcp4 0.0.0.0:443: bind: address already in use
Ah, figured it out! The YAML Error had to do with Tab Indents I had, I had to use Spaces, and it isn't "BTCPAY_ADDITIONAL_FRAGMENTS" it is "BTCPAYGEN_ADDITIONAL_FRAGMENTS". It works perfectly fine now.
Great to hear! @dennisreiman do you think we should document this somewhere? It could be useful for uses that want to reuse a server as long as it has multiple ips
On Thu, Aug 25, 2022, 23:43 Hiro @.***> wrote:
Closed #698 https://github.com/btcpayserver/btcpayserver-docker/issues/698 as completed.
— Reply to this email directly, view it on GitHub https://github.com/btcpayserver/btcpayserver-docker/issues/698#event-7263022811, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAN357VD3QGM23YTW76SLWDV27SJVANCNFSM56W4WCKA . You are receiving this because you commented.Message ID: @.*** com>