Could someone please explain how on earth do I get useBindPortIP = true
working with swarmMode = true
& swam modes required traefik.http.services.selfservice.loadbalancer.server.port
?
Preferably with an actual working docker compose example so that I can compare what I've tried vs how it's actually supposed to look cause I genuinely cannot figure it out
A number of my backend services use a custom signed certificate which works fine, I can easily get it working using the file config along the lines of:
http:
routers:
selfservice:
entryPoints:
- https
service: selfservice
rule: "Host(`myaccount.publicnet`)"
tls:
certResolver: cloudflare
services:
selfservice:
loadBalancer:
servers:
- url: https://192.168.0.10:6089
- url: https://192.168.0.15:6089
When deploying it this way everything works as expected, traefik has the CA configured so internal certificates are all trusted, public facing myaccount.publicnet just works taking advantage of the letsencrypt certificates, absolutely no hassle setting it up this way
But trying to get it working within a swarm compose stack has been exceedingly infuriating
It breaks because the custom certificate the service uses expects either 192.168.0.10/15/20/25/30 (accounting for all the swarm nodes this service can run on) or myaccount.localnet (which resolves to the same IP's) for the backend https connection, instead it is seeing the internal container ip (172.128.38.47) which means the cert isn't trusted resulting in myaccount.publicnet giving me a big fat middle finger in the form of an internal server error page
No matter what I try, the backend service connection ALWAYS sets itself to the internal container IP and I always get:
msg="Unable to find a binding for container \"auth_selfservice.1\", falling back on its internal IP/Port." providerName=docker container=auth-selfservice-h61jknxn07501ynqa1kpklzhj serviceName=selfservice
I've tried using multiple variations of examples shown in the documentation (which could really use some extra clarification. Maybe a real world example as I don't think I understand how it's supposed to be used?) in various places of the compose and I've spent the last few hours trying to search various sources how the hell to get it working without much luck pinpointing what I'm missing
I suppose I could opt for using insecureskipverify=true
but I shouldn't have to fall back on using that, I'd rather get it working correctly
I've attempted too many variations to include all of them but I'll list some of the more obvious ones I've tried:
---
version: "3.7"
x-logging:
&default-logging
driver: "gelf"
options:
gelf-address: "tcp://192.168.0.99:12201"
tag: "Auth"
networks:
traefik_proxy:
external: true
services:
selfservice:
container_name: selfservice
hostname: selfservice
image: selfservice-webapp:local
networks:
- traefik_proxy
ports:
- 6089:8443 # Tried multiple variations of this such as long syntax and x.x.x.x:6089:8443 methods
volumes:
- /mnt/GFSVol01/AppData/selfservice:/config
deploy:
mode: replicated
replicas: 1
placement:
constraints:
- node.platform.arch == x86_64
labels:
- traefik.enable=true
- traefik.docker.network=traefik_proxy
#- traefik.port=6089 # Tried multiple variations of this, didn't take note of the source but some site said to try using it, maybe I misinterpreted the use case
- traefik.http.routers.selfservice.rule=Host(`myaccount.publicnet`)
- traefik.http.routers.selfservice.tls=true
- traefik.http.routers.selfservice.tls.certresolver=cloudflare
- traefik.http.routers.selfservice.entrypoints=https
- traefik.http.routers.selfservice.service=selfservice
- traefik.http.services.selfservice.loadbalancer.passhostheader=true
- traefik.http.services.selfservice.loadbalancer.server.scheme=https
- traefik.http.services.selfservice.loadbalancer.server.port=8443 # Tried with and without this, tried using 6089 instead
logging: *default-logging