HAProxy Enterprise Documentation 2.3r1

Docker

The HAProxy Enterprise Docker image lets you run the load balancer as a container.

Install the HAProxy Enterprise Docker image

The haproxy-enterprise Docker image hosts HAProxy Enterprise and the HAProxy Data Plane API. Follow these steps to install it:

  1. Log into the hapee-registry.haproxy.com Docker registry, using the key you were given when you registered as the username and password.

    $ sudo docker login https://hapee-registry.haproxy.com
  2. Pull the HAProxy Enterprise image.

    $ sudo docker pull hapee-registry.haproxy.com/haproxy-enterprise:2.3r1
  3. Create an HAProxy Enterprise configuration file (i.e. hapee-lb.cfg) that defines your load balancer settings.

    Tip

    You can run a container temporarily, just to get the HAProxy Enterprise configuration file from

    it to use as a starting point.

    $ sudo docker run --rm -d --name hapee hapee-registry.haproxy.com/haproxy-enterprise:2.3r1
    $ sudo docker cp hapee:/etc/hapee-2.3 ./
    $ sudo docker stop hapee
  4. Start the Docker container, referencing the directory containing your configuration file as a volume by using the -v flag.

    $ sudo docker run \
        --name hapee-2.3 \
        -d \
        -p 80:80 \
        -p 443:443 \
        -p 5555:5555 \
        -v $(pwd):/etc/hapee-2.3  \
        --restart=unless-stopped \
        hapee-registry.haproxy.com/haproxy-enterprise:2.3r1

    The Data Plane API listens at port 5555. However, you must include a userlist section in your configuration to set up the Basic authentication credentials to use when calling the API.

    userlist hapee-dataplaneapi
       user admin insecure-password adminpwd

    Then you can verify that the API is working by calling the info function:

    $ curl -X GET --user admin:adminpwd http://localhost:5555/v2/info
    
    {"api":{"build_date":"2021-06-01T21:18:15.000Z","version":"v2.3.2-ee2 8fdcfba"},"system":{}}

Reload the services

When you change your hapee-lb.cfg configuration file, you will need to reload the service for the changes to take effect. We use s6-overlay to run HAProxy Enterprise and the HAProxy Data Plane API as services.

  1. Make sure that the following line is included in the global section of your HAProxy Enterprise configuration file. It ensures that you can perform a hitless reload, which means no traffic is dropped.

    global
       stats socket /var/run/hapee-2.3/hapee-lb.sock user hapee-lb group hapee mode 660 level admin expose-fd listeners
  2. Reload the HAProxy Enterprise process with this command:

    $ sudo docker exec hapee-2.3 s6-svc -2 /var/run/s6/services/haproxy

    You can also perform a hard restart by using this command:

    $ docker exec hapee-2.3 s6-svc -t /var/run/s6/services/haproxy

    To restart the Data Plane API, use this command:

    $ sudo docker exec hapee-2.3 s6-svc -t /var/run/s6/services/dataplaneapi

Next up

Kubernetes