HAProxy Enterprise Documentation 2.0r1

Process Manager

Use the program directive to specify an external program that should run as a child process under Haproxy Enterprise.

Syntax

A program section in your configuration is a set of directives that define the program to be run, its command-line options and flags, as well as user, group, and restart options.

Run the echo command to print Hello World! when HAProxy Enterprise starts:

program echo
   command echo "Hello, World!"

A functionally equivalent example that sets the user and group directives:

program echo
   command echo "Hello, World!"
   user hapee-lb
   group hapee

When you restart HAProxy Enterprise, you can see that the echo command executed then exited without error. You can use the Process Manager to execute long-running programs that live alongside HAProxy Enterprise too. Programs will restart and reload when HAProxy Enterprise does, unless you specify no option start-on-reload.

$ sudo systemctl restart hapee-2.0-lb

$ sudo systemctl status hapee-2.0-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)

An HAProxy Enterprise program section is made up of the following directives:

Directive

Description

Required

Default

command [command string]

The command to be run, with flags and options.

yes

none

user [name]

The user to run the command as, if different than HAProxy Enterprise user.

no

HAProxy Enterprise user, e.g. hapee-lb.

group [name]

The group to run the command as, if different than HAProxy Enterprise group.

no

HAProxy Enterprise group, e.g. hapee

no option start-on-reload

HAProxy Enterprise stops and recreates child programs at reload. Disable this by setting no option start-on-reload.

no

option start-on-reload

Examples

Below we demonstrate more examples of using the Process Manager program section in your configuration.

Data Plane API

Start the Data Plane API with HAProxy Enterprise, but do not restart it when HAProxy Enterprise reloads:

program dataplaneapi
   command /usr/local/bin/dataplaneapi --host 0.0.0.0 --port 5555 --haproxy-bin /opt/hapee-2.0/sbin/hapee-lb  --config-file /etc/hapee-2.0/hapee-lb.cfg --reload-cmd "systemctl reload hapee-2.0" --reload-delay 5 --userlist haproxy-dataplaneapi
   no option start-on-reload

The directive no option start-on-reload dictates that a new instance of the program should not be started upon reload of the master.

Stream Processing Offload Agent

Start Stream Processing Offload Agent programs such as the Traffic Mirror agent:

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

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

See also


Next up

High Availability