HAProxy Enterprise Documentation 2.2r1

Program

When you add a program section, you enable the HAProrxy Process Manager, which allows you to start external programs when HAProxy Enterprise starts. Each program keyword is followed by a label, such as www.example.com, to differentiate it from others.

program echo
   # Your configuration directives

Program configuration examples

In the following example, we run the echo program, which prints "hello, world":

program echo
   command echo "hello, world"

When you restart HAProxy Enterprise, you can see that the echo command executed:

$ sudo systemctl restart hapee-2.2-lb

systemd[1]: Starting HAPEE Load Balancer...
hapee-lb[3330]: [NOTICE] 324/184322 (3330) : New program 'echo' (3351) forked
hapee-lb[3330]: [NOTICE] 324/184322 (3330) : New worker #1 (3352) forked
systemd[1]: Started HAPEE Load Balancer.
hapee-lb[3330]: hello, world
hapee-lb[3330]: [ALERT] 324/184322 (3330) : Current program 'echo' (3351) exited with code 0 (Exit)

A common way to use this feature is to start long-running programs that augment the load balancer functionality; therefore, it makes sense to tie them to the lifetime of the load balancer's process.

For example, you can start Stream Processing Offload Agent programs such as the Traffic Mirror agent:

program mirror
   command spoa-mirror --runtime 0 --mirror-url http://test.local

Note that all flags that follow the program's name are passed directly to the program.

Add user or group

You can also specify a user and group to use when executing the command:

program mirror
   command spoa-mirror --runtime 0 --mirror-url http://test.local
   user myusername
   group mygroupname

Disable restarts

By default, HAProxy Enterprise stops and recreates child programs at reload. To disable this, add the no option start-on-reload directive to a particular program section:

program mirror
   command spoa-mirror --runtime 0 --mirror-url http://test.local
   user myusername
   group mygroupname
   no option start-on-reload

See also


Next up

Dynamic-update