mantl / mesos-consul

Mesos to Consul bridge for service discovery
Apache License 2.0
338 stars 95 forks source link

Fix multi ports #58

Closed jfindley closed 1 year ago

jfindley commented 8 years ago

Better support for services with multiple ports.

This PR appends -portN to the service name for ports after the first. The first port is left un-prefixed, so that this doesn't break existing use-cases.

keis commented 8 years ago

This seems really useful. I deployed an version built from this branch and I think I'm finally getting closer to get my setup to work.

:+1: from me FWIW

miry commented 8 years ago

:+1:

keis commented 8 years ago

Just noticed an error with this code. Which port gets the "-port2" suffix does not depend on which order they where defined in the task but by the ordering of the port number allocated.

darnould commented 8 years ago

This appears to be a solution for a very real problem - @ChrisAubuchon do you have any thoughts on this? Would love to see something like this pushed through.

:+1:

ChrisAubuchon commented 8 years ago

In my opinion, the proper way for mesos-consul to handle multi-port services is to register them under the same service name but with separate identifying tags. For example a web app listening on 80 and 443 would have two services registered:

This allows SRV DNS lookups to resolve:

The issue with this is that there hasn't been a way to map the dynamic port that Mesos assigns with the application port. So mesos-consul sees two ports, say 30000 and 30001, and has no way of knowing which port maps to the http service and which maps to the https service.

Mesos has a DiscoveryInfo block that addresses this (and mesos-consul uses) but it hasn't been supported in marathon until 5 days ago via Marathon PR https://github.com/mesosphere/marathon/pull/3302