CiscoCloud / haproxy-consul

Dynamic haproxy configuration using consul
Apache License 2.0
168 stars 85 forks source link

Zero downtime on reload #8

Closed eirslett closed 8 years ago

eirslett commented 9 years ago

Haproxy suffers from the issue where reloading the configuration leads to TCP connections being dropped, and requests failing. There's a number of workarounds for the problem, for example: http://engineeringblog.yelp.com/2015/04/true-zero-downtime-haproxy-reloads.html

It would be nice if this haproxy-consul Docker image could have inbuilt support for zero-downtime reloads!

langston-barrett commented 9 years ago

@eirslett If you can only run one proccess within a Docker container, how would you reload Haproxy anyway? If I'm not mistaken, the Haproxy reload process involves creating a new instance of Haproxy and switching over the port binding, which seems impossible in Docker without some kind of process management. But I could totally be off base.

stevendborrelli commented 9 years ago

@siddharthist consul template restarts haproxy inside the container, so restarts are doable.

@eirslett wondering how we could implement the queueing and firewalling in the container. Any ideas?

eirslett commented 9 years ago

You can only run one parent process in Docker, so you'll need a process manager that can launch child processes. (for example consul-template)

I have no idea how to solve it practically, looks like many of the guides are meant for host machines and not designed to work inside containers.

Another option is to replace haproxy with nginx, which supports in-process reloading of configuration; then this wouldn't be a problem in the first place. I'm not sure about any new problems that could introduce.

lalarsson commented 8 years ago

This is achieved in PR #37.