Incorporating VPN services in all your compose file.
See I'm behind a CGNAT and have tried to open ports using Gluetun VPN only 80 and 443 and tried to link all the other services to Gluetun VPN This works the ports get open without me exposing ports in my router. But for some reason if there is a port already occupied by a radar instance and another Radarr 4K instance wished to be passed through the VPN then how to get this working? And all this in conjunction with traefik.
Honestly, I don't know. The radarr container uses port 7878 by default, so if you have two of them, that's going to be a problem.
What I would try if I were you:
On the 4k radarr instance, rename the router and service from radarr to radarr4k. Change the port to 7874 (just to be different from 7878). Then add the port to the config. Like this:
radarr:
image: lscr.io/linuxserver/radarr:latest
container_name: radarr
restart: unless-stopped
<<: [*networks-proxy, *environment]
volumes:
- /etc/localtime:/etc/localtime:ro
- ./config/radarr:/config
- $MEDIADIR:/data
labels:
<<: *proxy-labels
traefik.http.routers.radarr.entrypoints: "http"
traefik.http.routers.radarr.rule: "Host(`radarr.${PRIVATE_HOSTNAME}`)"
traefik.http.middlewares.radarr-https-redirect.redirectscheme.scheme: "https"
traefik.http.routers.radarr.middlewares: "radarr-https-redirect,secured@file"
traefik.http.routers.radarr-secure.entrypoints: "https"
traefik.http.routers.radarr-secure.rule: "Host(`radarr.${PRIVATE_HOSTNAME}`)"
traefik.http.routers.radarr-secure.tls: "true"
traefik.http.routers.radarr-secure.service: "radarr"
traefik.http.services.radarr.loadbalancer.server.port: "7878"
pull_policy: always
radarr4k:
image: lscr.io/linuxserver/radarr:latest
container_name: radarr4k
restart: unless-stopped
<<: [*networks-proxy, *environment]
volumes:
- /etc/localtime:/etc/localtime:ro
- ./config/radarr4k:/config
- $MEDIADIR:/data
ports:
- 7874:7878
labels:
<<: *proxy-labels
traefik.http.routers.radarr4k.entrypoints: "http"
traefik.http.routers.radarr4k.rule: "Host(`radarr4k.${PRIVATE_HOSTNAME}`)"
traefik.http.middlewares.radarr4k-https-redirect.redirectscheme.scheme: "https"
traefik.http.routers.radarr4k.middlewares: "radarr4k-https-redirect,secured@file"
traefik.http.routers.radarr4k-secure.entrypoints: "https"
traefik.http.routers.radarr4k-secure.rule: "Host(`radarr4k.${PRIVATE_HOSTNAME}`)"
traefik.http.routers.radarr4k-secure.tls: "true"
traefik.http.routers.radarr4k-secure.service: "radarr4k"
traefik.http.services.radarr4k.loadbalancer.server.port: "7874"
pull_policy: always
Note that the radarr4k container forwards port 7874 from outside the host to port 7878, the default port the web service listens on.
I don't know if that will work, but it might. You have essentially set up two separate containers that use the same image. Both containers have a web service on 7878 but you're telling the radarr4k instance to listen on 7874.
But additionally adding a vpn container.
I'll post my config here, I'm busy with work for the time. But please thanks for the help.
Yes, please post your config! I can only offer limited help as I do not currently pay for any VPN service that I can test with. I've never used a VPN service with Docker Compose before, let alone with Traefik.
I'm sure it's just a matter of finding some examples to emulate, activate lower levels of logging like DEBUG, and trial and error with the VPN config.
I believe that you would normally include a VPN container, add it to a specific docker network, and add your containers to the same docker network as the VPN container, but the containers are already on the proxy network with Traefik, so I don't know what that would look like...two networks per container/service? That doesn't seem right.