📜 ⬆️ ⬇️

How to randomly write a web GUI for Haproxy

The modern world of system administrators lined us up with beautiful web-faces, that we don’t even want to install software that doesn’t have this “gui” (I feel the stones will now fly from the faithful lines), well, not all the way through it all the time, right? It would be ok if I installed the software, set it up and forgot, and what to do if you have to constantly climb, edit, and of course there is no log of all actions, do not write cp cfg cfg_back each time, you will get confused over time and forget about it .



Many years ago I became acquainted with 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 it was surprisingly not. Very popular software, besides old enough, but oh well, I thought and continued to edit the handles in my favorite vi occasionally 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 through http, and here the interesting began ...

Pens itched, eyes caught fire and I started. More precisely, I began to think on what to write, to 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, in the future, I thought it would be useful, and I started absorbing the information.
')
At the beginning of the task were not so difficult: the ability to edit configs from the web interface from one entry point, save previous versions of configs. This, not very big functionality, turned out to be implemented quite quickly, but here I was leaped into either admin laziness, or notorious perfectionism, and this of course seemed to me a little. And here began to appear such features as: a comparison of two configs, logging of all actions related to configs, the Runtime API and the addition of sections, via the web.



And how a decent UNIX administrator who lives at the expense of free software, I decided to share with the world, but would someone come in handy with one another? But for this, it was necessary to do everything so that I did not have to climb into the code, but the maximum in the config butts (Now most of the settings have moved to the database. As for me, it has become more convenient to edit and there will be no errors due to the lack of or parameter).

A month later, I laid out my crafts on Github especially not counting on anything. And in vain, the software turned out to be slightly in demand, and then the most interesting began ... Active “dopilka” has been going on for almost a year. Sometimes there is a desire to quit it all, because my needs have been covered for a long time. Well, why should I be able to deploy a “cluster” with keepalived and HAProxy through the web muzzle, if it takes me a couple of minutes at most? But it turns out that people need it, and I find it interesting, and there is something to do. Although of course there are functions I need, for example, like monitoring backend servers, are they available for Haproxy. Of course, we have corporate monitoring, but there are people there who can react for a long time, + because My department is engaged in the development and software that appears and disappears long enough to make its way through the bureaucracy.



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

Source: https://habr.com/ru/post/419865/


All Articles