We use chef and ohai which talks to AWS to calculate node counts for
servers based off tags and metadata. We then have a cookbook that generates
the haproxy.cfg every time chef runs (on a cron). If the file changes we
reload the config which seems to keep the sessions alive.

There are far simpler ways to achieve the above. For instance a really
simple bash script that echo's static content to haproxy.cfg and the amazon
command line tools feeding a for loop that prints out the server lines with
their options.

Having said all of this.. I think it would be cool to allow a file based
backend. What I mean by that is that I would prefer to generate backend
files and upon those files changing haproxy would automatically load them.
So for instance on my static backend I may update the static.servers file
which is referenced in haproxy.cfg. I believe you can do similar things
with mod_jdk and apache.

On 9 January 2013 22:47, Kevin Heatwole <ke...@heatwoles.us> wrote:

> You might be right that the best way to do dynamic configuration is to
> have a tool from a third-party (or created in house) that does monitoring
> of the backend servers and edits the config file itself and reloads haproxy.
>
> I just don't want the hassle of finding such tools or writing my own.
> Maybe haproxy could contain such a tool that is separate from haproxy but
> maintained, tested, and delivered with haproxy.  I have to admit that I
> haven't researched any of the tools you use.  I should do that, but I
> always worry about creating a new dependency on a new tool since these
> tools are usually available for free and could lose support and maintenance
> at any time.
>
> HAProxy already has some support for dynamic configuration in the health
> checks that mark down/up a server depending on the result of the health
> check.  I figure it is relatively simple to build configuration checks on
> top of the health checks since most of the hard work has already been done
> for health checks.
>
> On Jan 9, 2013, at 5:34 PM, Zachary Stern <z...@enternewmedia.com> wrote:
>
> Right, and my point is that you can make it dynamic without changing the
> way haproxy itself works. What your asking for seems like making haproxy
> itself overcomplicated, especially for people with simple deployments. But
> hey, maybe I'm 100% wrong. In fact, let's operate on that assumption.
>
>
> On Wed, Jan 9, 2013 at 5:26 PM, Kevin Heatwole <ke...@heatwoles.us> wrote:
>
>> I guess I wasn't clear again.  I'm not talking about "editing" the
>> configuration file and reloading HAProxy.
>>
>> My suggestion is simply to implement a dynamic interface to the backend
>> servers so they can change the current behavior of the HAProxy instance
>> (especially in a load balanced HAProxy backend).
>>
>> I'll leave it to the developers to figure out what can be dynamically
>> changed and if adding a server to a backend is too complex, then that won't
>> be part of the interface.
>>
>> On Jan 9, 2013, at 5:18 PM, Zachary Stern <z...@enternewmedia.com> wrote:
>>
>> I understood completely KT. It's perfectly possible to add new lines to
>> the haproxy config dynamically and automatically using things like puppet.
>>
>> E.g. my iptables configurations are dyanmically generated as I spin up
>> new servers, using puppet and the rackspace API. You could do something
>> similar, regardless of cloud or not.
>>
>> When I spin up a new server, it's connected to puppet, tagged as a
>> certain kind of server, and dynamically added as a backend to haproxy if
>> appropriate.
>>
>>
>> On Wed, Jan 9, 2013 at 5:16 PM, KT Walrus <ke...@my.walr.us> wrote:
>>
>>> I think you might have misunderstood.  By "adding new server", I mean to
>>> add it as a server in HAProxy configuration.  That is, the effect is to add
>>> the "server" line for the new server into the config file.  This has
>>> nothing to do with launching the server in the cloud.  It is the reverse of
>>> marking a server DOWN, except that the server being marked UP was not
>>> originally included in the list of servers for the HAProxy backend.
>>>
>>> On Jan 9, 2013, at 4:21 PM, Zachary Stern <z...@enternewmedia.com> wrote:
>>>
>>>
>>>
>>> On Wed, Jan 9, 2013 at 4:13 PM, Kevin Heatwole <ke...@heatwoles.us>wrote:
>>>
>>>> 4.  Adding new server to backend by having configuration check return
>>>> new server configuration.
>>>>
>>>
>>> I don't know about the other features, but this one I think violates the
>>> UNIX philosophy of "do one thing and do it well". There are already plenty
>>> of tools you can use to achieve this with HAproxy, like puppet or chef, and
>>> things like the ruby fog gem for cloud provisioning, etc.
>>>
>>>
>>> --
>>>
>>> zachary alex stern I systems architect
>>>
>>> o: 212.363.1654 x106 | f: 212.202.6488 | z...@enternewmedia.com
>>>
>>> 60-62 e. 11th street, 4th floor | new york, ny | 10003
>>>
>>> www.enternewmedia.com
>>>
>>>
>>>
>>
>>
>> --
>>
>> zachary alex stern I systems architect
>>
>> o: 212.363.1654 x106 | f: 212.202.6488 | z...@enternewmedia.com
>>
>> 60-62 e. 11th street, 4th floor | new york, ny | 10003
>>
>> www.enternewmedia.com
>>
>>
>>
>
>
> --
>
> zachary alex stern I systems architect
>
> o: 212.363.1654 x106 | f: 212.202.6488 | z...@enternewmedia.com
>
> 60-62 e. 11th street, 4th floor | new york, ny | 10003
>
> www.enternewmedia.com
>
>
>

Reply via email to