Re: Automate backend registration

From: Holger Just <haproxy#meine-er.de>
Date: Wed, 03 Aug 2011 23:22:21 +0200


Jens,

Many people have a script that builds a working configuration file from various bits and pieces. As the actual needed configuration typically isn't something which follows a common path but depends on the environment and the actual applications and a thousand other bits, there isn't a standard here.

But it really isn't hard to throw together a small shell/perl/python whatever script which concatenates the final config file from various pieces or uses some templating language of your chosen language.

An script we use is https://github.com/finnlabs/haproxy. It consists of a python script which assembles the config file from a certain directory structure. This script is then called before a start/reload of the haproxy in the init script.

So basically, you need to create your script for generating your Haproxy configuration, hook it into your init script and then, as a post-install in your RPMs put the configuration in place for your configuration-file-creating-script and reload Haproxy.

To enable/disable previously registered backend components, you might be able to use the socket, but that usage is rather limited and mainly intended for maintenance, not for actual configuration changes.

Hope that helps and sorry if that was a bit recursive :) Holger

On 2011-08-03 22:52, Jens Bräuer wrote:
> Hi Baptiste,
>
> sorry for my wording. But you are right, with "registration" I mean
> - add ACL
> - add use_backend
> - add backend section
> so to sum it up "make haproxy aware of a new application".
>
> There might be cases there I want to "only" add a server to existing backend, but that would be the second/third step.
> The use-case is that I have HA-Proxy running and do a "yum/apt-get install" and the RPM should come with everything to integrate with HA-Proxy. I am sure that there must be some tool out there.. ;-)
>
> Cheers,
> Jens
>
>
> On 03.08.2011, at 20:24, Baptiste wrote:

>> Hi Jens,
>>
>> What do you mean by "registration"?
>> Is that "make haproxy aware of the freshly deployed application"  ?
>>
>> cheers
>>
>> On Wed, Aug 3, 2011 at 5:46 PM, Jens Bräuer <jens.braeuer#numberfour.eu> wrote:
>>> Hi HA-Proxy guys,
>>>
>>> I wonder whats the current state of the art to automate the registration of backend. My setup runs in on EC2 and I run HA-Proxy in front of local applications to easy administration. So a typical config file would be like this.
>>>
>>> frontend http
>>>    bind *:8080
>>>    acl is-auth                         path_beg /auth
>>>    acl is-core                         path_beg /core
>>>    use_backend auth                            if is-auth
>>>    use_backend core                            if is-core
>>>
>>> backend auth
>>>    server auth-1 localhost:7778 check
>>>
>>> backend core
>>>    server core-1 localhost:10000 check
>>>
>>> All applications are installed via RPMs and I would like couple the installation with the backend registration. I like to do this as want to configure everything in one place (the RPM) and the number of installed applications may vary from host to host.
>>>
>>> I'd really appreciate hint where I can find tools or whats the current state to handle this kind of task.
>>>
>>> Cheers,
>>> Jens
>>>
>>>
>>>

>
>
Received on 2011/08/03 23:22

This archive was generated by hypermail 2.2.0 : 2011/08/03 23:30 CEST