I built a revproxy with caddy webserver and docker-gen which works great!
Now I need a TCP Loadbalancer, but the container should register during start automatically to the LB by container label / exposed port.
Is there an example / guide how this could be done?
There’s a similar project in rancher catalog called traefik, I believe it’s on github and open sourced, you will probably find your answers there. It does exactly what you are trying to achieve but with its own LB service layer, but all based on rancher events somehow.
I’m currently using a tcp load balancer to caddy (to proxy my https2 traffic), caddy then forwards traffic to an internal load balancer that then does what its supposed to do.
I should also mention that its considerably faster than regular https haproxy that comes with rancher – at least it feels like it. That might just be the http2 talking though…
I created a caddy image which could be used as webserver or reverse proxy (stack with a prepared docker-gen image, caddy image is just tagged with “revproxy” because of needed reload…). Works fine for me…
Here is my docker-compose from the generated stack. It should work out of the box as global service (multi host).