How to accidentally write a Web GUI for Haproxy

4 min readMar 17, 2021

The modern world of system administrators has lazed us with beautiful web-faces, that we don’t even want to install software where there is no such “gui” (I feel now stones will be flying from the faithful scribblers), well, it’s not through the line to constantly climb there, right? Everything would be fine if the software was installed, configured and forgotten, but what to do if you need to constantly climb there, edit, and of course there is no log of all actions, do not write cp cfg cfg_back every time, over time you will get confused and forget about this business …

HAProxy-WI Overview

Many years ago I met such a wonderful balancer as Haproxy. Everything is wonderful and beautiful. I got a lot of them and I thought about finding a GUI for it, but surprisingly it was not there. Very popular software, besides, quite old, but oh well I thought, and occasionally continued to edit the pens in my favorite vi and have a bunch of open tabs with statistics of all active servers. But the time has come and I had to satisfy the “Wishlist” of people who wrote software to work via http, and here the interesting began …

The pens were combed, the eyes lit up and I started. More precisely, I began to think about what to write on, remember the long-forgotten PHP, somehow I did not want to, and it seemed that it was not quite suitable for this business. As a result, the choice fell on Python, I thought it would definitely come in handy in the future and began to absorb information.

At the beginning, the tasks were not so difficult: the ability to edit configs from the web interface from one entry point, save previous versions of configs. This, not particularly large, functionality turned out to be implemented quickly enough, but then either admin laziness or the notorious perfectionism leaped into me, and of course it seemed to me not enough. And then such features began to appear: comparison of two configs, logging of all actions related to configs, Runtime API and adding sections via the web.

HAProxy Overview

And as a decent UNIX administrator who lives at the expense of free software, I decided to share it with the world, but will someone come in handy as a friend? But for this it was necessary to do everything so that you did not have to climb into the code, but maximum to the config butts (Now most of the settings have been moved to the base. As for me, it became more convenient to edit them and there will be no errors during the update due to the lack of any or parameter).

A month later, I posted my work on Github, not really counting on anything. But in vain, the software turned out to be slightly in demand, and then the most interesting thing began … Active “dopilka” has been going on for almost a year. Sometimes there is a desire to give up all this, because my needs have been covered for a long time. Well, why should I be able to deploy a “cluster” with Keepalived and HAProxy via the web muzzle, if it takes me a couple of minutes? And it turns out that people need it, and I’m interested, and there is something to do. Although, of course, there are functions I need, for example, monitoring backend servers, whether they are available for Haproxy. Of course, we have corporate monitoring, but there are people who can react for a long time. my department is engaged in development and the software appears and disappears long enough to break through the bureaucracy.

HAProxy-WI Add sections page

In general, I decided to share, because it turns out that this is the only free GUI. What if someone will come in handy?