HAProxy is a fast and reliable open source solution offering load balancing, high availability, and proxying for both HTTP and TCP-based applications. HAProxy is de-facto standard in Open source powered load balancing solutions out there.
The standard way of managing HAProxy is by manually editing configuration files or using a configuration management tool such as Ansible, Puppet or Chef to push changes. This works fine but not for all users. In this blog post, we will look at how you can use a third party tool haproxy-wi to manage your HAProxy servers from a Web interface.
Disclaimer: This software is still new and doesn’t have a large community supporting it. Do thorough testing before using it to manage Production servers.
Features of haproxy-wi web interface
This HAProxy web interface allows you to:
- Enable/disable servers through stats page without rebooting HAProxy
- View/Analyse HAproxy logs straight from a web interface
- Easily push Your changes to your HAproxy servers
- Evaluate your config files and restore a previous stable config anytime
- Add/Edit Frontend or backend servers
- Manage Server groups and User Roles
- It supports high Availability to ensure uptime to all Master slave servers configured
- SSL certificate and SSH Key support
- SYN flood protection
- Metrics collection and alerting on changes
- LDAP support
- and much more.
Installing HAProxy Web Interface
There are two methods you can use to install
haproxy-wi web interface for HAProxy.
- Installing it with automation script
- Running it in a Docker container
Install haproxy-wi with a script
Perform this action on a newly installed CentOS 7 or Ubuntu 18.04 server. I’m doing my installation on a fresh CentOS 7 server installation.
Ensure git is installed.
# On CentOS 7
$ sudo yum -y install git wget
# On Ubuntu 18.04
$ sudo apt -y install git wget
Once git is installed, download the script.
sudo su -
sudo git clone https://github.com/Aidaho12/haproxy-wi.git /var/www/haproxy-wi
/var/www/haproxy-wi and run the installer.
chmod +x install.sh
On running the script, you’ll be asked to choose Database to use and set other variables.
$ sudo ./install.sh
Choose DB: (1)Sqlite or (2)Mysql? Default: Sqlite
Mysql server is (1)remote or (2)local?
Choose Haproxy-WI port. Default: 
Enter Haproxy-wi home dir. Default: /var/www/[haproxy-wi]
This will install all dependencies and add Apache configuration file
<VirtualHost *:8080> ServerName haprox-wi.example.com ErrorLog /var/log/httpd/haproxy-wi.error.log CustomLog /var/log/httpd/haproxy-wi.access.log combined TimeOut 600 LimitRequestLine 16380 DocumentRoot /var/www/haproxy-wi ScriptAlias /cgi-bin/ "/var/www/haproxy-wi/app/" <Directory /var/www/haproxy-wi/app> Options +ExecCGI AddHandler cgi-script .py Order deny,allow Allow from all </Directory> <FilesMatch "\.config$"> Order Deny,Allow Deny from all </FilesMatch> </VirtualHost>
Edit the file and set correct
ServerName then restart httpd service.
sudo systemctl restart httpd
Running haproxy-wi on Docker Container
Then run haproxy-wi container
docker run -d --name haproxy-wi -v haproxy-wi:/var/www/haproxy-wi/app \
-p 8080:80 aidaho/haproxy-wi
Using haproxy-wi Web Dashboard
To access Web interface, use server name configured or IP address on port 8080.
Default login credentials are:
Overview window will show next.
Reset admin and other user’s password on Admin>Users area.
To add HAproxy server, head over to Admin area.
But first add host group add SSH credentials to use.
Add server by providing required information.
Added server should should show on Overview section.
Watch Demo videos which demonstrate various configuration options for haproxy-wi Web dashboard.
Other HAProxy articles: