supervisor eventlistener for notifying haproxy
Project description
supervisor-haproxy
supervisor-haproxy is a supervisor event listener for notifying HaProxy when the status of programs change.
By actively notifying HaProxy we can avoid that HaProxy sends requests to servers which are down or will be down shortly for maintenance.
The event listener listens to supervisors PROCESS_STATE events and sends status updates to HaProxy via an admin-level stats socket.
Configuration
When the egg supervisor-haproxy is installed, the supervisor event listener is created as console script supervisor-haproxy. It needs to be configured in the supervisor configuration and requires the haproxy stats socket and the program infos in order to work correctly.
The program infos have the form supervisorProgram:HaProxyBackend/HaProxyServer, for example instance2:plone04/plone0402 and tell the event listener which program in supervisor is which backend server in haproxy.
First configure a stats socket in the haproxy config:
global
stats socket ipv4@127.0.0.1:8801 level admin
then configure the supervisor haproxy event listener in the supervisor config:
[eventlistener:HaProxy]
command = .../bin/supervisor-haproxy tcp://localhost:8801 instance1:plone01/plone0101 instance2:plone01/plone0102
events = PROCESS_STATE
process_name=HaProxy
Example using buildout for configuring supervisor:
[supervisor]
plugins +=
supervisor-haproxy
eventlisteners +=
HaProxy PROCESS_STATE ${buildout:bin-directory}/supervisor-haproxy [tcp://localhost:8801 instance1:plone01/plone0101 instance2:plone01/plone0102]
Development / Tests
For development and running tests you need to install:
After installing tox and docker you can clone the repository and run the tests with the tox command:
$ git clone git@github.com:4teamwork/supervisor-haproxy.git
$ cd supervisor-haproxy
$ tox
While running the tests, the haproxy in docker will be bound to the port 9902, so you need to make sure that this port is available.
Links
Copyright
This package is copyright by 4teamwork.
supervisor-haproxy is licensed under GNU General Public License, version 2.
Changelog
1.1.0 (2017-06-09)
Avoid high CPU load problem when connection to HaProxy fails. [jone]
1.0.0 (2016-09-30)
Initial implementation [jone]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.