Welcome to my blog — place for ideas, comments, interesting hacks and boring personal stuff. Enjoy!
20 Nov 2014 10:02
After the recent load balancer upgrade at Wikidot people asked me about the magic behind automatic HAProxy configuration — namely, how do we solve dynamical addition and removal of backend servers. It's not that complex, we use Chef.
Below I will tell you how we do it.
- We have a working Chef server.
- All nodes run Ubuntu, but it's not really important.
- All nodes run chef-client periodically (in our case, every 3 minutes).
- All web nodes have role web.
As a result will develop a minimal haproxy cookbook to be run on the HAProxy node that:
- Will set up HAproxy service.
- Will discover and connect to all backend servers.
Tags: chef haproxy wikidot