Re: HAProxy Hot Reconfiguration with s6

From: Colin Booth <cathexis_at_gmail.com>
Date: Tue, 17 May 2016 20:52:12 -0700

On Mon, May 16, 2016 at 12:57 PM, Remko Tronçon <remko_at_el-tramo.be> wrote:
> Hi,
>
> This question has probably been asked before, but I couldn't find anything.
>
> I want to run HAProxy under a system using s6. I want to make HAProxy hot
> reload its configuration to have minimal downtime on configuration updates.
> The way this is done in HAProxy is by starting a second instance, which
> takes over the port and asks the first instance to exit. However, if
> haproxy runs under s6, when the first haproxy process goes away, s6 will
> automatically restart it I assume? Is there a way around this? How is
> HAproxy generally used with s6?

I've been thinking about this same issue with HAProxy and runit for
work. The least worst solution that I've come up with so far has been
to have the reload script launch an unsupervised and daemonized copy
of HAProxy against the new config, digging out the process id via sv
status. Once the handoff happens, the script tosses the pid of the
interstitial copy into a well-known location that will get picked up
when runsv recycles the longrun version. As Laurent said, there's some
special casing that needs to be done depending on the context that the
service is being brought up.

This solution is pretty grotty and I'm not super happy about it, but
it's the least over-engineered version that I've come up with thus
far. I don't have any proof-of-concept code or anything going right
now but it shouldn't take too much work to implement. Keep in mind
that this is the runit version, an s6 implementation would be similar
though you can use other tools in the s6 suite to minimize or
eliminate any race conditions around the process handoff.

Cheers!

-- 
"If the doors of perception were cleansed every thing would appear to
man as it is, infinite. For man has closed himself up, till he sees
all things thru' narrow chinks of his cavern."
  --  William Blake
Received on Wed May 18 2016 - 03:52:12 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:44:19 UTC