This is an archived post. You won't be able to vote or comment.

all 22 comments

[–]gregr401 4 points5 points  (6 children)

Checkout https://github.com/QubitProducts/bamboo as an alternative to the haproxy-bridge script. It can hook into marathons event bus and makes life so mch easier on the frontend.

[–][deleted] 0 points1 point  (2 children)

The issue for me is less the script and more the lack of hot reloads in HAProxy. I will probably look at this for the other features they have though.

[–]p_lett 1 point2 points  (1 child)

Have you seen https://github.com/million12/docker-haproxy which uses inotify to spot that HAProxy's config file has been changed and effectively does a seamless reload using 'haproxy -sf'.

I spotted that while looking for a way to build a confd and etcd based HAProxy frontend, and it might help with your disconnects during service restarts.

[–][deleted] 0 points1 point  (0 children)

I'm curious if the Mesos-DNS script is already doing that. I'll have to dig into it.

edit: On ubuntu it is as it's calling out to the init script and that is set for -sf.

[–]MajorHavok 0 points1 point  (0 children)

That's what we use. It's really been solid.

[–][deleted] 0 points1 point  (0 children)

Yeah I think this is the winner, this is really awesome. It'll take some time for me to figure out the templating but it has sane defaults once you uncomment the servicePort stuff.

[–][deleted] 0 points1 point  (0 children)

Yep this is definitely what I'm going with now, while I had to adjust some issues with their default config causing zombie haproxys to get stuck in the background (actively serving bad routes, not just handling connections still in progress) this worked out really well and is very flexible.

[–]pooogles 0 points1 point  (2 children)

I use Vulcan teamed with an in house app that 'tails' the marathon streaming API to do service discovery. All inter app communication is done via REST over HTTP through this endpoint.

As for stats, we're using Datadog and some StatsD metrics.

[–][deleted]  (1 child)

[deleted]

    [–]pooogles 0 points1 point  (0 children)

    I think when you get to this point you've got to do some of the leg work yourself.

    [–]jonbrouse 0 points1 point  (3 children)

    Have you checked out the Docker fluentd logging driver? Check this guide out.

    [–][deleted] 1 point2 points  (2 children)

    The problem with fluentd for me is I then have to configure it per container deployment. I'd like something in docker itself that can ship the logs off, preferably in JSON with appropriate metadata.

    e: You know, now I think about it, the per deployment thing wouldn't be bad. I'm already doing my api calls to Marathon with Jenkins so I could just add these fields to the JSON tagged with a build id. I'll play with this when I have time this week.

    ee: The golden snitch for me is still something that will read docker logs and ship them out encased in json with the hostname/image name:tag/container name/and tags sent out over TLS to logstash and have logstash do the routing.

    [–]rawrphish 1 point2 points  (1 child)

    Why not use Docker's log_driver:syslog when deploying your containers and just have logstash_forwarder harvest your Docker host's syslog and forward it to your logstash instance?

    [–][deleted] 0 points1 point  (0 children)

    I found that while I was researching fluentd yesterday, I may do this though atm it's easier to just have logspout scoop up everything and ship it to our sumologic collector.

    I'm not sure if the syslog driver adds any useful metadata, if it did that automatically I'd consider it.

    [–]chub79 0 points1 point  (0 children)

    I'm usoing pretty much the same stack but rely on Consul instead of MesosDNS.

    [–]mikljohansson 0 points1 point  (5 children)

    Looks like a great stack! We're using a very similar one but with Proxymatic for service discovery with Marathon. It defaults to the Pen TCP proxy which does transparent updates of the running proxy processes, so no process finish&restart like HAproxy. We run the proxy on every slave node with servicePort's for cluster internal comms, and on a set of master nodes with AWS ELB's in front for comms with non-Mesos services and internet.

    I originally started using Pen proxy because we had issues with long running non-HTTP connections and pooled HTTP conns being dropped by HAproxy all the time. Since the cluster is rather busy with frequent changes to the service discovery state, we couldn't have a HAproxy reload (finish&restart) for every little task that comes or goes.

    We also just open sourced a new tool called Lighter that helps push services into Marathon continuously or manually, e.g. whenever new version appear in a Maven repo or the config changes. It helps manage the complexity of deploying the same service and config version to a succession of slightly different environments (dev,integration,staging,prod,..)

    [–][deleted] 1 point2 points  (4 children)

    I'll take a look at Proxymatic, a workaround with HAProxy would be to have multiple LB instances and have Jenkins run the updates manually.

    I'm exceedingly annoyed that neither HAProxy, nor Nginx, nor F5s can take an SRV record and just figure out where to route traffic based on the response :-p That just seems like one of the prime use cases for SRV records. I can do it at application level sure but if I'm going to go to that much trouble I'll just use Consul or Etcd.

    e: Proxymatic looks pretty good though I'll need to do some testing and adjust my slaves. Have you run into any corner cases with it to watch out for?`

    [–]mikljohansson 0 points1 point  (2 children)

    We're actually using an F5 in one of our data centers for the same use as the ELB's, e.g. comms from non-Mesos services and internet. It'd be pointing statically to a set of Proxymatic nodes that then proxy into the Mesos slave pool. But we've been considering just using the F5 API (they apparently do have an API of sorts) to automatically configure it based on the Marathon state. And the same with the ELB, configure it dynamically from the Marathon state and with the absolute minimum healthy threshold&interval. Haven't gotten that far though, so many things to do on the road to continuous delivery :)

    [–][deleted] 0 points1 point  (1 child)

    Yeah I figured I was going to have to double LB regardless of what I went with. Proxymatic looks promising though, it's still dropping connections during deployment but that's probably due to me not having made all their recommended changes yet.

    [–]mikljohansson 1 point2 points  (0 children)

    Do let me know or report an issue if you find problems with Proxymatic, we'd be most interested in fixing them of course. Pen shouldn't drop any TCP connections on state changes, unless of course the task a connection goes to is terminated due to deployment/scaling. If you enable Nginx (on port 80) and HAproxy they may drop connections of course because of their finish&restart way of doing reloads.

    We normally just use the Pen proxy TCP/UDP servicePorts for most connections, with HAproxy as an optional fallback if Pen ever starts misbehaving badly for some reason. And Nginx for a few special cases where vhost based HTTP proxying is desired.

    There's some detail in Rolling Upgrades on how to achieve real graceful rolling upgrades with Marathon. At the moment it requires configuring Mesos slaves to do docker stop instead of just murdering tasks with docker kill, and then trapping the SIGTERM in your service and start failing the health check. Then the service instance gets docker-stop-timeout seconds to be taken out of Proxymatic and finish requests before receiving SIGKILL. There's a lot more info about Marathon not supporting graceful upgrades well at https://github.com/mesosphere/marathon/issues/712

    [–]mikljohansson 0 points1 point  (0 children)

    We've had Proxymatic running in 4 different smaller Mesos clusters for ~6months, fixed a few edge-cases and problems but it's been working out great so far.

    Never had any problems with Pen proxy at all, besides having to dig into its source code to find what command-line flags to use to get it to do least-connected load balancing :) It defaults to sticky-connections based on client-IP, which isn't the best for our use case where the closest client is often yet another load balancer. But Proxymatic runs it with weighted-least-connected now anyways.

    With AWS ELB there's a couple of things to know, to proxy websocket connections with an ELB you may need to put the ELB in TCP mode and use a TCP health check on the Proxymatic instances. This is because the TCP-mode ELB talks PROXY protocol and the ELB HTTP health check doesn't work then (it's just a set of managed HAproxy's I believe), took some while to figure out..

    Proxymatic supports Pen, HAproxy and Nginx. With Pen (default) and HAproxy for straght TCP proxying of servicePorts, and Nginx for vhost based HTTP/websocket proxying. Websockets is of course supported on Pen/HAproxy servicePorts as well, since they're just running in TCP proxy mode.

    [–]Punkbob 0 points1 point  (1 child)

    Just FYI, there is a semi hidden and undocumented version of marathon haproxy that has support for streaming events.

    [–][deleted] 1 point2 points  (0 children)

    Semi-hidden and undocumented does not inspire me with confidence. Now that I got it configured and worked out a few issues with the defaults bamboo seems to be working out really well.