Closed motin closed 7 years ago
@motin I don't think it is an easy job to add the dynamic port support feature. The port here is key to generate frontend , backend, ACLs, etc. We have to replace the placeholder with the actual port before running the entire script.
However, the publish port detection is sort of difficult. I don't think docker itself has the API to do it directly. What's more, the current script support three modes: legacy link mode, dockercloud mode, swarm mode. We have to write different codes for each scenario. And, personally, I've know idea how to do it.
If there are multiple VIRTUAL_HOST with different ports in the linked applications, how to map the port to the placeholder is another issue to solve.
Please add ability to use placeholder for haproxy's published port in VIRTUAL_HOST env var.
We have a production setup that uses dockercloud-haproxy which we would like to replicate locally for local dev. However, since the VIRTUAL_HOST setting needs to include haproxy's published port, the haproxy can't currently be published on a dynamic port, meaning that we need to assign fixed ports to all separate instances of haproxy that we want to run locally. This makes it cumbersome to spin up stacks for acceptance tests which would benefit from being able to use a free dynamic port.
Here are example configs to illustrate the problem.
Working config - uses fixed port:
Not working config - uses dynamic port:
Since haproxy can be reconfigured on runtime, would it be possible to have a placeholder like %HAPROXY_PUBLIC_PORT% (or something shorter :)) in the config that is replaced with the published port of the haproxy service?
Related: https://github.com/docker/docker/issues/3778