HAProxy¶
Content Bundle README¶
Design Philosophy¶
This content bundle is designed to provide a streamlined process for deploying and managing services. It contains all the necessary components such as profiles, pipelines, blueprints, and templates. The design leverages "Filter objects" stored in the haproxy/filters
parameter to discover "backend" nodes, which are then used to write the haproxy.cfg
file. For more detailed information on our filter operations, please refer to the Filter Documentation.
Deployment Methods¶
The content bundle is deployed as a cluster. There are two main methods to configure and deploy the service:
-
Auto Discovery: Leverage the content bundle's built-in auto discovery by setting a parameter (envisioned as
haproxy/role
, though this is defined by the filter) and defining the services and ports in use by defininghaproxy/backend/services
on the backend node. The filters are then used to find nodes, and the values from the nodes are then used to generate thehaproxy/backend/map
andhaproxy/frontend/map
, from which thehaproxy.cfg
file is rendered. -
Manual Override: Set the filter to an empty array, set
haproxy/frontend/map-override
andhaproxy/backend/map-override
which will override any discovered values, and then run the pipeline.
In both methods, you have the option to overwrite the config file by setting haproxy/config-template
parameter to the name of a template. This allows you to use the predefined parameters/pipelines, but also gives you the flexibility to fully define your own template.
How to Use the Content Bundle¶
To use the content bundle, simply choose one of the deployment methods above that best suits your needs. This design was envisioned to provide the least amount of friction when trying to consume the content bundle for building other content bundles.
Here are some examples:
Auto Discovery Example¶
This is a minimal cluster profile that leverages AutoDiscovery, with optional haproxy/backend/config
and haproxy/frontend/config
parameters:
Params:
universal/application: my-ha-cluster
universal/workflow-chain-index-override: cluster
on-complete-work-order-mode: true
cluster/wait-for-members: false
cluster/machine-types:
- load-balancer
- backend
cluster/machines:
load-balancer:
pipeline: universal-application-haproxy-server
names: ['my-ha-proxy.local.domain']
Params:
haproxy/role: load-balancer
haproxy/filters:
- Profiles=Eq(universal-application-apache-web-server) Params.haproxy/role=Eq(backend) Profiles=Eq({{ .Machine.Name }})
haproxy/frontend/config: # Optional
http:
mode: http
haproxy/backend/config: # Optional
http:
mode: http
balance: roundrobin
web-backend:
pipeline: universal-application-apache-web-server
names: ['web01.local.domain', 'web02.local.domain']
Params:
haproxy/role: backend
haproxy/backend/services:
http: 80
Manual Override Example¶
This is a minimal example of a manual override deployment, with overridden config file. These profiles and params would be assigned to a machine or a profile that is assigned to a machine.
Profiles:
- universal-application-haproxy-server
Params:
haproxy/config-template: my-haproxy.cfg.tmpl
haproxy/frontend/map-override:
http:
http: 80
ssl: [443, 80443]
haproxy/backend/map-override:
http:
- server d52-54-00-f9-6c-09.example.com 192.168.122.13:80 maxconn 32
- server d52-54-00-08-5a-04.example.com 192.168.122.14:80 maxconn 32
- server d52-54-00-96-b2-4a.example.com 192.168.122.15:80 maxconn 32
Cluster Pipeline Example¶
This is a minimal example cluster universal-application. This example is used to define a load balancer to multiple generic apache web backend using roundrobin load balancing. This configuration will provision 3 machines:
my-ha-proxy.local.domain
(load-balancer)web01.local.domain
(apache web-backend)web02.local.domain
(apache web-backend)
The configuration from the previous step is applied within the cluster/machines.load-balancer
section, which is copied to a machine when the cluster is provisioned.
Params:
universal/application: my-ha-cluster
universal/workflow-chain-index-override: cluster
on-complete-work-order-mode: true
cluster/wait-for-members: false
cluster/machine-types:
- load-balancer
- backend
cluster/machines:
load-balancer:
pipeline: universal-application-haproxy-server
names: ['my-ha-proxy.local.domain']
Params:
haproxy/role: load-balancer
haproxy/filters:
- Profiles=Eq(universal-application-apache-web-server) Params.haproxy/role=Eq(backend) Profiles=Eq({{ .Machine.Name }})
haproxy/frontend/config:
http:
mode: http
haproxy/backend/config:
http:
mode: http
balance: roundrobin
web-backend:
pipeline: universal-application-apache-web-server
names: ['web01.local.domain', 'web02.local.domain']
Params:
haproxy/role: backend
haproxy/backend/services:
http: 80