Question - How does this tie/connect to the Consul service
Opened this issue · 7 comments
This is not an issue but a question, I don't understand how this bridge connects to consul, where do i specify the host/port of consul for this bridge to connect? I don't see any environment variables to do this?
It connects to a Consul agent that is running on the same node that the service is running on. It gets that address from the Mesos task information. Because of how service registration with Consul works, this is the only way to properly register the services. Registering a service with a centralized Consul server causes that Consul server to manage the service. If that service fails, then the Consul server is marked as failing instead of the node running the service.
@ChrisAubuchon I am also attempting to use the haproxy-consul container as well with this mesos-consul bridge. So are you saying there is another dependency on running a consul agent on each mesos slave?
There is. The consul agent doesn't have to be a server though. It can be a client.
I'm not sure that the haproxy-consul container works with the data that mesos-consul puts in Consul. I'm fairly certain that you need to run marathon-consul for the haproxy bit to work.
ok thanks, will have to do some more digging. In regards to marathon-consul, I already got that working with the haproxy-consul along with a consul service and I don't recall having to install the consul agents for my particular configuration because marathon-consul offers the environment variable to connect to the consul server.
I now wanted to see what mesos-consul offers instead of using the marathon-consul bridge. I actually thought haproxy-consul would work with either marathon-consul or mesos-consul, but you have some doubts.
@sarlindo you can set haproxy-consul to run either against marathon or consul data stores by setting an environment variable. It supports both.
The key difference that your running into here is that marathon-consul doesn't register services with Consul. It writes the Mesos task information into the Consul K/V store which the haproxy-consul container parses via consul-template. Because it's not registering a service, it can write to any consul server.
Mesos-consul registers the Mesos task as a service within Consul and thus needs to register the service with an agent running on the same node as the task.
Thanks guys for the info.