btcpayserver / btcpayserver-docker

Docker resources for hosting BTCPayServer easily
MIT License
583 stars 358 forks source link

Traefik Help #914

Open littlelinkedlibrarian opened 2 months ago

littlelinkedlibrarian commented 2 months ago

Is it possible to use the tools provided by the scripts without customizing the Traefik configuration? Where does the custom.yml go? I put it in Traefik/ dir and the Generated/ dir and I am not getting other hosts to register, the traefik dashboard is not much help. Will the custom.yml allow me to point to libpatreon and the woocommerce WordPress hosts? Traefik is working for the BTC pay server, but when I create policies for apps, like libpatreon I get 404. Any details are appreciated. I will venture down using Traefik documentation with commands and labels.

littlelinkedlibrarian commented 2 months ago

My Bad, user error. added labels to the required backend resources, and it mostly worked; some work to get WooCommerce, which is not complete yet, but the resources and documentation exist out there. the custom.yml was a red herring and not related to optional services, only the btcpay server. Once the labels are created on other services,Traefik picks them up, However, read the documentation on the internet to understand Traefik's intricacies. The BTCpay server works as expected; plugins and stuff are up to you and are pretty straight forward if you read the Traefik documentation. Your time and diligence are greatly appreciated.

plittlefield commented 2 months ago

Oooo, I am trying to go the other way and get BTCPay working with my existing Traefik on my VPS.

Perhaps I should consider this method and letting BTCPay control the Traefik instead and ADD some more sites and rules.

Would you kind enough to post your yml and config files (sanitised!) please?

Honestly, I know Traefik and looking at the API dashboard it seems simple enough but can I get BTCPay to work with my existing Traefik? Nope.

It even mentions in the BTCPay documentation about 'running your own proxy' but I just can't crack it!

All the built-in Traefik is doing is routing from :443 to the docker container IP and port - e.g. http://172.18.0.10:49392

image

I just can't get it to work my OWN traefik!

Can anyone help?

Paully

littlelinkedlibrarian commented 2 months ago

Howdy! I have seen blogs of people doing it this way. It should work as my docker-compose.generated.yml does nothing special for the Btcpay server. The traekic.yml provided is the default, except I added TLS version pinning. I see nothing outstanding. I did get WooCommerce WordPress to work, but I had to use the Traefik Loadbalancer because WordPress works with 80 443 and is configured by the Btcpay configurator's image. It's Commented out right now because my server is too small to manage all the services. I added my straightforward landing page instead of WordPress, which is just a simple node markdown app. I set Traefik to debug logging, which was a little helpful; one thing that did not pop out that I was fighting was I had configured multiple domains for the Btcpay server, so I was getting this weird loop where is sometimes sent to one URL or btc pay app and then another, I had to turn all my btcpay apps off(remove domain routing policies) so I could "see" Hope this helps.

` traefik: restart: unless-stopped image: traefik:v2.6 container_name: traefik ports:

btcpayserver: restart: unless-stopped container_name: generated_btcpayserver_1 image: ${BTCPAY_IMAGE:-btcpayserver/btcpayserver:1.13.5} expose:

bitcoin_rtl: image: shahanafarooqui/rtl:0.15.0 restart: unless-stopped environment: LN_IMPLEMENTATION: CLN labels: traefik.enable: true traefik.http.routers.bitcoin_rtl.rule: Host(${BTCPAY_HOST}) && (Path(/rtl) || PathPrefix(/rtl/)) volumes:

lilinkedlibrarian: image: your.amazonaws.com/lilinkedlibrarian-landing:latest environment: LLL_HOST: littlelinkedlibraian.com expose:

plittlefield commented 2 months ago

Thanks @littlelinkedlibrarian for your comments and config.

This looks the same as mine.

I reckon I should be able to get BTCPay Server working with MY traefik.

I have the "bit between my teeth" now and I'll be damned if it's going to beat me.

I'm really surprised that an internet search for "btcpay +traefik" does not come up with a winning solution.

It's just doing some routing!

I have asked a couple of Traefik gurus to see if they would be willing to help, and I'm even happy to spin up an AWS EC2 with Docker and let someone play to get this working.

Honestly, I know I am so close.

If I crack it, I shall add it to my Wiki and paste the link here.

https://wiki.indie-it.com/wiki/Docker#BTCPay_Server

Cheers for now.

Paully

littlelinkedlibrarian commented 2 months ago

I noticed you were using the load balancer in your Traefik dashboard; I imagine BTCpay requires TLS. You may also need to set btcpay for HTTP traffic vs. HTTPS. If it is not set, it defaults to HTTPS? https://bowtieddevil.com/post/btcpayserver/ Were you able to see this guy's config? I swear I saw a medium post where a guy did it just like you. export BTCPAY_PROTOCOL="http" export BTCPAYGEN_REVERSEPROXY="none"

Imagine you have these set?

plittlefield commented 2 months ago

Yes, I did see that page and copied his config with http and none. That stopped nginx and correctly exposed port 49392 running in the 'btcpayserver-generated' docker container. I then started my traefik container and tested this was working with both the api dashboard and a simple nginx container. I then added this rules yaml file to declare a new router pointing to the 'btcpayserver-generated' docker container port 49392 ...

http:
  routers:
    btcpay:
      entrypoints:
        - "websecure"
      rule: "Host(`btcpay.mydomain.me.uk`)"
      service: "btcpay"
  services:
    btcpay:
      loadbalancer:
        servers:
          - url: "http://172.18.0.10:49392"

In fact, I tried it 2 ways - as an 'url' and as a 'service port' but nothing worked.

I tested with curl on the server and from a web browser.

I am obviously doing something wrong but cannot figure out what!

I am so close, I know it.

Paully