HAProxy support for server-template backends (Consul, etc)
-
I am migrating an existing HAProxy install over to pfSense and enjoying the convenient configuration UI. But I could not find a way to add server-template backends. My configuration was like this (from https://learn.hashicorp.com/consul/integrations/haproxy-consul#create-the-haproxy-configuration)
frontend http_front bind *:80 default_backend http_back backend http_back balance roundrobin server-template mywebapp 10 _web._tcp.service.consul resolvers consul resolve-opts allow-dup-ip resolve-prefer ipv4 check resolvers consul nameserver consul 127.0.0.1:8600 accepted_payload_size 8192 hold valid 5s
To replicate this I need some way to add a new "resolvers" block. The existing Advanced field forces configuration into the "global" section which is inadequate. Does anyone know how to add arbitrary configuration? Or if the HAProxy module's config UI code is open source and could be patched to add this?
-
@yammering
You can add the nameserver sectionresolvers consul
to the advanced settings on the settings tab.
And add the server option 'resolvers consul' reference to the 'Per server pass thru'.. The servers do have a field to fill in a 'template count', that way it will create theserver-template
option instead of a singleserver
Though for that to work there 'must' be a globalresolver configured. Ending up with 2 resolvers on the server line.. so im not sure if it will use the proper 2nd one then..
Other option would be to not define a server in the backend, but write the template line manually in advanced section.. Though the use of a webgui looses its advantages that way.. and usage of certificates can become rather difficult.. -
That worked great. I didn't realize you could put the resolvers under global and still have it work.