Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Traefik Help #914

Open
littlelinkedlibrarian opened this issue Jul 26, 2024 · 6 comments
Open

Traefik Help #914

littlelinkedlibrarian opened this issue Jul 26, 2024 · 6 comments

Comments

@littlelinkedlibrarian
Copy link

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
Copy link
Author

littlelinkedlibrarian commented Jul 26, 2024

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
Copy link

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
Copy link
Author

littlelinkedlibrarian commented Aug 15, 2024

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:
- ${REVERSEPROXY_HTTP_PORT:-80}:80
- ${REVERSEPROXY_HTTPS_PORT:-443}:443
- 8080:8080
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ../Traefik/traefik.yml:/traefik.yml
- traefik_data:/data

btcpayserver:
restart: unless-stopped
container_name: generated_btcpayserver_1
image: ${BTCPAY_IMAGE:-btcpayserver/btcpayserver:1.13.5}
expose:
- 49392
environment: {}
labels:
traefik.enable: true
traefik.http.routers.btcpayserver.rule: Host(${BTCPAY_HOST})

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:
- clightning_bitcoin_datadir:/root/.lightning
- bitcoin_datadir:/etc/bitcoin
- clightning_bitcoin_rtl_datadir:/data
expose:
- 3000

lilinkedlibrarian:
image: your.amazonaws.com/lilinkedlibrarian-landing:latest
environment:
LLL_HOST: littlelinkedlibraian.com
expose:
- 3000
labels:
traefik.enable: true
traefik.http.routers.lilinkedlibrarian.rule: Host(${LLL_HOST})

Wordpreess: ...
labels:
traefik.enable: "true"
traefik.http.routers.woocommerce.rule: Host(${WOOCOMMERCE_HOST})
traefik.http.services.woocommerce.loadbalancer.server.port: 80
traefik.http.middlewares.woocommerce-headers.headers.customRequestHeaders.X-Forwarded-Proto: https
traefik.http.routers.woocommerce.middlewares: woocommerce-headers
`

@plittlefield
Copy link

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
Copy link
Author

littlelinkedlibrarian commented Aug 15, 2024

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants