We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Learn how to – How to Manage HAProxy servers from a Web Interface

Learn how to – How to Manage HAProxy servers from a Web Interface.

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.

  1. Installing it with automation script
  2. 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

Navigate to /var/www/haproxy-wi and run the installer.

cd /var/www/haproxy-wi
chmod +x install.sh
sudo ./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
2
Mysql server is (1)remote or (2)local?
2
Choose Haproxy-WI port. Default: [8080]
Enter Haproxy-wi home dir. Default: /var/www/[haproxy-wi]

This will install all dependencies and add Apache configuration file to /etc/httpd/conf.d/haproxy-wi.conf . The file looks like this:

<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

Install Docker:

How to install Docker CE on Ubuntu / CentOS

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:

Username: admin
Password: admin

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.

What next?

Watch Demo videos which demonstrate various configuration options for haproxy-wi Web dashboard.

Other HAProxy articles:

Getting Started With Secure HAProxy on Linux

Galera Cluster High Availability With HAProxy on Ubuntu 18.04 / CentOS 7

How to Setup MariaDB Galera Cluster on Ubuntu 18.04 with HAProxy

Cart

Your Cart is Empty

Back To Shop