dataplaneapi icon indicating copy to clipboard operation
dataplaneapi copied to clipboard

HAProxy Peers/Aggregators Auto discovery based on AWS EC2 Tags

Open dragoangel opened this issue 3 years ago • 2 comments

Now DataPlane API support EC2 autodiscovery in AWS, it would be cool to get same option for peers server directive. For example such Tagging can be used:

  1. HAProxy:Peer:Cluster = mycluster - cluster name
  2. HAProxy:Peer:Name = loadbalancer1 - server name
  3. HAProxy:Peer:Port = 10000 port to use with peering
  4. Optional HAProxy:Peer:Cetificate = /etc/ssl/certs/site.pem path to ssl cert to enable SSL on peer communication. Should be used on all EC2 in Cluster to be valid: if at least one EC2 in cluster omit this EC2 Tag then all members of cluster will be set to not work over ssl.

Each member of cluster controlled via DataPlane API could get own EC2 ID and read own tags to get own name. And then find all other EC2s that belong to cluster.

This how it will result on loadbalancer1:

    peers mycluster
       bind :10000 ssl crt /etc/ssl/certs/site.pem
       default-server ssl
       server loadbalancer1
       server loadbalancer2 192.168.1.11:10000

and on loadbalancer2:

    peers mycluster
       bind :10000 ssl crt /etc/ssl/certs/site.pem
       default-server ssl
       server loadbalancer1 192.168.1.10:10000
       server loadbalancer2

dragoangel avatar Dec 10 '21 16:12 dragoangel

We will try to incorporate this in our roadmap.

mjuraga avatar Sep 15 '22 10:09 mjuraga

FWIW, I've had pretty good success with hashicorp/go-discover to provide this functionality in our applications.

dekimsey avatar Sep 28 '22 18:09 dekimsey