Go to file
David Shrewsbury bbeacf30d1 Use sudo for HAProxy config file manipulation.
In a default, initial HAProxy installation on Ubuntu, the
haproxy.cfg file is owned by root. So we need escalated
permissions to be able to replace it with another config.
2012-10-02 15:44:43 -04:00
2012-09-14 12:19:33 +01:00
2012-10-01 17:08:03 -04:00
2012-09-27 17:24:06 -07:00
2012-09-26 12:02:58 -07:00
2012-09-13 16:25:53 -04:00
2012-09-27 17:03:30 -07:00

Description
-----------

A Python-based Gearman worker that handles work for the job queue named
'lbaas-<IP>'. It receives JSON data describing a load balancer, and
returns this same JSON object, but with status fields added to describe
the state of the LB.


Running Tests
-------------

Tox is the best way to run the tests. Tox, if unavailable, can be installed
via the Python pip command:

   $ pip install tox

Once it is installed, run the tests:

   $ tox


Installing the Worker
---------------------

    $ python setup.py install


Edit /etc/sudoers
-----------------

The worker needs to be able to run some commands as root without being
prompted for a password. It is suggested that you run the worker as
the `haproxy` user and `haproxy` group on Ubuntu systems. Then add the
following line to /etc/sudoers:

    %haproxy ALL = NOPASSWD: /usr/sbin/service, /bin/cp, /bin/mv

The above lets everyone in the `haproxy` group run those three commands
as root without being prompted for a password.


Running the Worker
------------------

The worker can run in either daemon or non-daemon mode. Daemon mode requires
escalated privileges so that it can behave like a proper daemon. Non-daemon
mode (--nodaemon option) is useful for testing.

Basic commands:

    # Getting help
    $ libra_worker -h

    # Start up as a daemon running as the `haproxy` user and
    # connecting to the local Gearman job server.
    $ sudo libra_worker --user haproxy --group haproxy --server 127.0.0.1:4730

    # Start up with debugging output in non-daemon mode
    $ libra_worker --debug --nodaemon

You can verify that the worker is running by using the sample Gearman
client in the bin/ directory:

    $ bin/client.py


Configuration File
------------------

It can be easier to give options via a configuration file. See the sample
configuration file etc/sample_libra.cfg for an example and further
documentation. Use the -c/--config option to specify the configuration
file to read.
Description
RETIRED, Create and manage loadbalancers
Readme 5.1 MiB