Got this working for all my apps now except one: qBittorrent. That’s using Gluetun for VPN access, which I’m sure is where the problem lies. When I’d added Traefik labels to the qbittorrent (where I currently have the Caddy labels), it worked, but Caddy complains about qbittorrent not being on the proxy network (which of course it isn’t). Thoughts on what I’d need to change here? Compose files below:
For remote-access VPN, I agree, and have done so. But that doesn’t really address “send this traffic over a VPN, so as to obscure its origin,” which is what I’m trying to do (and have been doing) with qBittorrent.
What’s posted above has worked perfectly for me for several months, with Traefik labels for qBittorrent rather than Caddy ones (and obviously with credentials added for Gluetun).
Well, at first I wanted to answer for this particular case, but then I saw the VPN access thing and changed my mind. Now I changed my mind again.
As I said, I’ve never managed to make gluetun work. Ended up with shadowsocks/shadowsocks-libev:v3.3.5. Its client container is acting like a socks5 proxy, so the other containers can use it with something like:
First off, excellent VPN choice, Gluetun has been an amazing solution for years. While I don’t know much about using a reverse proxy I do recommend making one compose file to rule them all and not specifying the network within the compose file. I’ll share a shortened compose file below and you’ll see a reference for creating a separate network but that is because I need containers behind the VPN to be able to talk to plex (not behind it). This was in the Gluetun docs. I believe the combination of using separate compose files and not specifying your Proxy network on QBT is potentially the cause of your issue. That said, why did it work on Traefik and not Caddy? No idea. Maybe you can take something from my compose and retrofit it to Caddy.
I use this for connecting the VPN to the containers:
network_mode: "service:gluetun"
The only other suggestion I have is to use the below on any containers that need to be behind the VPN. This is like a killswitch if the VPN is not working properly.
Thanks for the suggestions, @swc-phil, @usergiven, and @mistermanko. I was wanting to keep things as similar as possible to previously, because it’d been working without issue previously. The solution I’ve found was to bring the gluetun container into the qBittorrent stack, like this:
This wouldn’t be ideal if other services were depending on the VPN, but this is the only one that is.
It still isn’t clear to me why the previous configuration worked with Traefik (including having the Traefik labels on the qbittorrent container) and not with Caddy, but this nonetheless works.
I started using qbittorrent with gluetun before I migrated to TrueNAS, and your solution above is exactly how I made it work (and the only way I made it work). I combine both containers into the same stack and use network_mode: service:gluetun
to “glue” them together, as opposed to network_mode: container:gluetun
I haven’t worked with Caddy yet, but after seeing your recent article on setting it up, I’ll probably tackle this soon. Thanks for showing your work!