Open alexturek opened 10 years ago
I just realized.. I'm probably going to have to change docker-gen for this as well, right?
EDIT: Scratch that, I just have to change the template
Turns out I did need to make a change to docker-gen.
https://github.com/jwilder/docker-gen/pull/29 adds a template function to convert e.g.
quay.io/yourcompany/dockerimage
to
quay.io-yourcompany-dockerimage"
Thanks for this! This seems like a reasonable approach. I need to test it out a bit first though.
Alright. I'm totally new to HAProxy myself, so I'm not sure if '-'s are a good character to use in the config, or even what the ideal config looks like
@alexturek @jwilder is there any news, or maybe there is better approach to this task described in http://jasonwilder.com/blog/2014/07/15/docker-service-discovery/ ?
@RuslanZavacky I've since moved on from the company where I was working on this, but here's roughly what we did:
On our CoreOS fleet, we left docker-discovery and docker-register (my fork supporting multiple TCP ports) running at all times. We just made a global list of ports (we only had a half dozen services or so) and we reserved each port for a specific service/port tuple. I.e. FooService:8080 is always exposed on port 7300 locally
.
We then configured our services (via docker environment variable config) to talk to a specific IP:port combo.
In other words we did almost exactly what Jason had in his blog post.
If I were doing this again from scratch I'd probably start with Vulcan. It's a higher level proxy that is HTTP based. For TCP though, your best bet is probably running something similar to above.
Hey Jason,
I think these two projects (docker-register and docker-discover) are filling a really useful niche for my company, and I'd like to add support for multiple TCP ports. I just wanted to walk through the fix to make sure it was a change you agreed with.
Since docker-discover already exposes a service with etcd keys like this:
I was thinking we could just suffix with the port used by the process-in-the-container. E.g. if you have a
docker ps
likeYou could expose it in etcd with these keys:
effectively treating a service with two ports like two separate services from the HAProxy perspective. This wouldn't require changing docker-discover at all.