How to accidentally write a Web-GUI for Haproxy

The modern world of system administrators has made us lazy with beautiful web-faces, that it’s not even a desire to install software where there is no this very “guy” (I feel now stones will fly from orthodox scribblers), well, it’s not always climbing there through the line, 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 matter .

How to accidentally write a Web-GUI for Haproxy

Many years ago I met such a wonderful balancer as Haproxy. Everything is wonderful and beautiful. I had 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 continued to occasionally edit the handles 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 this is where the interesting began ...

My hands itched, my eyes lit up and I started. More precisely, I began to think about what to write on, to remember the long-forgotten PHP, somehow I didn’t feel like it, 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 the absorption of information began.

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. It was possible to implement this, not very large functionality quite quickly, but then either admin laziness or the notorious perfectionism jumped in me, and of course this seemed to me not enough. And then such features began to appear as: comparing two configs, logging all actions related to configs, Runtime API and adding sections via web.

How to accidentally write a Web-GUI for Haproxy

And as a decent UNIX administrator living off free software, I decided to share it with the world, and someone else will come in handy? But for this it was necessary to do everything so that you didn’t have to climb into the code, but at most into the config butts (Now most of the settings have moved to the database. As for me, it has become more convenient to edit them and there will be no errors during the update due to the lack of some kind of configuration in the config or parameter).

A month later, I posted my craft on Github without really counting on anything. And in vain, the software turned out to be slightly in demand, and then the most interesting thing began ... Active "finishing" has been going on for almost a year. Sometimes there is a desire to quit all this, because. My needs have been covered for a long time. Well, why do I need the opportunity to deploy a "cluster" with keepalived and HAProxy through the web face, if it takes me a couple of minutes at most? And it turns out that people need it, and I’m interested, and there is something to do. Although, of course, there are functions that I need, for example, how to monitor backend servers, whether they are available for Haproxy. Of course, we have corporate monitoring, but there are people who can react for quite a long time, + because my department is developing and software comes and goes long enough to get through the bureaucracy.

How to accidentally write a Web-GUI for Haproxy

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

Source: habr.com

Add a comment