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.
Source Distribution
File details
Details for the file supervisor-haproxy-1.1.0.tar.gz
.
File metadata
- Download URL: supervisor-haproxy-1.1.0.tar.gz
- Upload date:
- Size: 15.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96b4c9d553ac6bcc66ff2b9e99164f79f74e04de8fd7bd9328f754931e97f63d |
|
MD5 | 9fc93a2a0f86c9c78b54ec44fb5c7997 |
|
BLAKE2b-256 | e3af7910f3d6b7a37de8f8e78b427e97b0f205b6ef19f9b3ef858f7831f8dd14 |