2018-01-19 15:45:06 +00:00
# Haproxy web interface
2020-02-02 14:23:00 +00:00
Web interface(user-friendly web GUI, alerting, monitoring and secure) for managing HAProxy servers. Leave your [feedback ](https://github.com/Aidaho12/haproxy-wi/issues )
2018-01-15 06:06:30 +00:00
2019-05-13 20:12:11 +00:00
# Youtube
2018-08-15 08:17:57 +00:00
[Demo video ](https://www.youtube.com/channel/UCo0lCg24j-H4f0S9kMjp-_w )
2018-08-07 06:10:52 +00:00
2019-10-02 06:35:34 +00:00
# Twitter
[Twitter ](https://twitter.com/haproxy_wi ), subscribe! I will write there about all the changes and news
2019-11-10 10:51:31 +00:00
# Telegram
2020-02-02 14:23:00 +00:00
[Channel ](https://t.me/haproxy_wi ) about HAProxy-WI, talks and questions are welcome
2019-08-26 17:32:34 +00:00
# Demo site
2019-09-11 06:05:57 +00:00
[Demo site ](https://demo.haproxy-wi.org ) Login/password: admin/admin. Server resets every hour.
2019-08-26 17:32:34 +00:00
2019-11-28 16:39:24 +00:00

2018-01-15 06:53:03 +00:00
2018-04-28 14:42:38 +00:00
# Features:
2020-02-02 14:23:00 +00:00
1. Configure HAProxy and Keepalived In a jiffy with HAProxy-WI
2020-01-05 20:47:35 +00:00
2. View and analyse Status of all Frontend/backend server via HAProxy-WI from a single control panel.
2018-05-13 18:07:33 +00:00
3. Enable/disable servers through stats page without rebooting HAProxy
2020-01-05 20:47:35 +00:00
4. View/Analyse HAproxy logs straight from the HAProxy-WI web interface
2020-02-02 14:23:00 +00:00
5. Create and visualise the HAProxy workflow from Web Ui.
6. Push Your changes to your HAProxy and Keepalived servers with a single click through web interface
7. Get info on past changes, evaluate your config files and restore a previous stable config anytime with a single click straight from Web interface
2018-05-13 18:07:33 +00:00
8. Add/Edit Frontend or backend servers via web interface with a click of a button.
2020-02-02 14:23:00 +00:00
9. Edit config of HAProxy, Keepalived and push changes to All Master/Slave server with a single click
2018-05-13 18:07:33 +00:00
10. Add Multiple server to ensure Config Sync between servers.
11. Auto management of ports assigned to Fronted.
2020-02-02 14:23:00 +00:00
12. Evaluate the changes of recent configs pushed to HAProxy and Keepalived instances straight from web ui
2019-11-28 16:39:24 +00:00
13. Multiple User Roles support for privileged based Viewing and editing of Config
2020-02-02 14:23:00 +00:00
14. Create Groups and add /remove servers to ensure proper identification for your HAProxy Clusters
2019-11-28 16:39:24 +00:00
15. Send notifications to telegram directly from HAProxy-WI
16. HAProxy-WI supports high Availability to ensure uptime to all Master slave servers configured
2018-05-13 18:07:33 +00:00
17. SSL certificate support.
2020-01-05 20:47:35 +00:00
18. SSH Key support for managing multiple HAProxy Servers straight from HAProxy-WI
2018-07-17 03:22:36 +00:00
19. SYN flood protect
2018-07-23 07:08:43 +00:00
20. Alerting about changes backends state
2018-07-30 03:09:26 +00:00
21. Alerting about HAProxy service state
2018-08-03 19:17:03 +00:00
22. Metrics incoming connections
2018-08-08 12:06:23 +00:00
23. Web acceleration settings
2018-08-17 04:41:50 +00:00
24. Web application firewall
2018-11-09 02:56:12 +00:00
25. LDAP support
2018-11-26 12:55:00 +00:00
26. Keep active HAProxy service
2019-05-18 08:11:03 +00:00
27. Ability to hide parts of the config with tags for users with "guest" role: "HideBlockStart" and "HideBlockEnd"
2019-10-07 17:07:28 +00:00
28. Mobile-ready desing
2019-10-31 19:51:43 +00:00
29. REST API
2019-11-28 16:39:24 +00:00
30. Installation and Upgrading HAProxy service via HAProxy-WI
2020-02-02 14:23:00 +00:00
31. Backup HAProxy's and Keepalived's config files through HAProxy-WI
2018-01-15 06:56:57 +00:00
2019-10-06 06:54:16 +00:00

2018-08-04 13:58:18 +00:00
2018-01-15 06:53:03 +00:00
# Install
2019-09-04 06:26:52 +00:00
## RPM
2019-10-04 06:23:48 +00:00
Install repository:
2019-09-20 06:42:19 +00:00
```
2019-10-09 06:35:35 +00:00
yum install https://repo.haproxy-wi.org/haproxy-wi-release-7-1-0.noarch.rpm
2019-09-20 06:42:19 +00:00
```
After install HAProxy-WI:
```
yum install haproxy-wi
```
2019-10-09 12:25:55 +00:00
2019-12-01 17:15:09 +00:00
Supports EL7 and EL8
2019-10-10 08:16:16 +00:00
#### Before uses RPM repository you should donate to support project on [Patreon](https://www.patreon.com/haproxy_wi/overview) or on [PayPal](https://www.paypal.me/loginovpavel) and I will send you credentials for access. Actual prices you can see on [Patreon](https://www.patreon.com/haproxy_wi/overview)
2019-10-09 12:25:55 +00:00
2019-12-27 04:31:09 +00:00
### More information on the official [site](https://haproxy-wi.org/installation.py#rpm)
2018-04-25 12:23:05 +00:00
## Manual install
2018-04-25 18:38:20 +00:00
For install just clone:
2018-01-15 07:01:46 +00:00
```
2019-10-25 12:47:06 +00:00
CentOS:
2019-11-06 15:15:41 +00:00
$ sudo yum -y install git nmap-ncat net-tools python35u dos2unix python35u-pip mod_ssl httpd python35u-devel gcc-c++ openldap-devel python-devel python-jinja2 python35u-mod_wsgi ansible
2018-04-19 05:22:44 +00:00
$ cd /var/www/
2018-04-25 18:38:20 +00:00
$ git clone https://github.com/Aidaho12/haproxy-wi.git /var/www/haproxy-wi
2018-04-23 16:20:19 +00:00
$ chown -R apache:apache haproxy-wi/
2019-10-25 12:47:06 +00:00
2018-08-22 03:12:03 +00:00
Or if use Debian/Ubuntu:
2019-10-25 12:47:06 +00:00
2019-11-06 15:15:41 +00:00
$ sudo apt-get install git net-tools lshw dos2unix apache2 gcc netcat python3.5 python3.5-mod_wsgi mod_ssl python3-pip g++ freetype2-demos libatlas-base-dev openldap-dev libpq-dev python-dev libxml2-dev libxslt1-dev libldap2-dev libsasl2-dev libffi-dev python3-dev libssl-dev ansible -y
2019-11-28 16:39:24 +00:00
$ git clone https://github.com/Aidaho12/haproxy-wi.git /var/www/haproxy-wi
2018-08-22 03:12:03 +00:00
$ chown -R www-data:www-data haproxy-wi/
2020-02-09 08:07:50 +00:00
```
2019-10-25 12:47:06 +00:00
Both
2020-02-09 08:07:50 +00:00
```
2018-05-09 12:21:09 +00:00
$ pip3 install -r haproxy-wi/requirements.txt
2018-04-28 14:42:38 +00:00
$ chmod +x haproxy-wi/app/*.py
2018-10-25 03:50:30 +00:00
$ sudo ln -s /usr/bin/python3.5 /usr/bin/python3
2020-02-09 08:07:50 +00:00
$ sudo cp haproxy-wi/config_other/logrotate/* /etc/logrotate.d/
$ sudo cp haproxy-wi/config_other/syslog/* /etc/rsyslog.d/
$ sudo cp haproxy-wi/config_other/systemd/* /etc/systemd/system/
2019-10-25 12:47:06 +00:00
$ sudo systemctl daemon-reload
$ sudo systemctl restart httpd
$ sudo systemctl restart rsyslog
$ sudo systemctl restart metrics_haproxy.service
$ sudo systemctl restart checker_haproxy.service
$ sudo systemctl restart keep_alive.service
$ sudo systemctl enable metrics_haproxy.service
$ sudo systemctl enable checker_haproxy.service
$ sudo systemctl enable keep_alive.service
$ sudo mkdir /var/www/haproxy-wi/app/certs
$ sudo mkdir /var/www/haproxy-wi/keys
$ sudo mkdir /var/www/haproxy-wi/configs/
$ sudo mkdir /var/www/haproxy-wi/configs/hap_config/
$ sudo mkdir /var/www/haproxy-wi/configs/kp_config/
$ sudo mkdir /var/www/haproxy-wi/log/
2018-01-15 07:01:46 +00:00
```
2018-04-05 03:34:17 +00:00
2018-04-23 06:37:23 +00:00
For Apache do virtualhost with cgi-bin. Like this:
```
2018-04-27 13:34:11 +00:00
# vi /etc/httpd/conf.d/haproxy-wi.conf
2018-04-25 18:38:20 +00:00
< VirtualHost * :8080 >
2019-10-31 19:51:43 +00:00
WSGIDaemonProcess api display-name=%{GROUP} user=apache group=apache processes=1 threads=5
2019-10-28 18:03:14 +00:00
WSGIScriptAlias /api /var/www/haproxy-wi/api/app.wsgi
< Directory / var / www / haproxy-wi / api >
WSGIProcessGroup api
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
< / Directory >
2019-05-18 08:11:03 +00:00
SSLEngine on
SSLCertificateFile /var/www/haproxy-wi/app/certs/haproxy-wi.crt
SSLCertificateKeyFile /var/www/haproxy-wi/app/certs/haproxy-wi.key
2018-04-23 06:37:23 +00:00
ServerName haproxy-wi
ErrorLog /var/log/httpd/haproxy-wi.error.log
CustomLog /var/log/httpd/haproxy-wi.access.log combined
2018-08-22 03:12:03 +00:00
TimeOut 600
2018-11-02 12:20:55 +00:00
LimitRequestLine 16380
2018-04-23 06:37:23 +00:00
DocumentRoot /var/www/haproxy-wi
2018-04-28 14:42:38 +00:00
ScriptAlias /cgi-bin/ "/var/www/haproxy-wi/app/"
2018-04-23 06:37:23 +00:00
2018-04-30 06:04:21 +00:00
< Directory / var / www / haproxy-wi / app >
2019-12-15 07:41:24 +00:00
DirectoryIndex overview.py
2019-10-28 18:03:14 +00:00
Options +ExecCGI
AddHandler cgi-script .py
Order deny,allow
Allow from all
2018-04-23 06:37:23 +00:00
< / Directory >
2018-04-30 06:04:21 +00:00
2019-06-30 09:04:11 +00:00
< Directory / var / www / haproxy-wi / app / certs >
Options +ExecCGI -Indexes +MultiViews
Order Deny,Allow
Deny from all
< / Directory >
2019-12-15 07:41:24 +00:00
< Directory / var / www / haproxy-wi / keys >
Options +ExecCGI -Indexes +MultiViews
Order Deny,Allow
Deny from all
< / Directory >
2019-10-28 18:03:14 +00:00
2019-12-15 07:41:24 +00:00
< FilesMatch " \.cfg $" >
2019-10-28 18:03:14 +00:00
Order Deny,Allow
Deny from all
2019-12-15 07:41:24 +00:00
< / FilesMatch >
2019-10-28 18:03:14 +00:00
2019-12-15 07:41:24 +00:00
< FilesMatch " \.db $" >
Order Deny,Allow
Deny from all
< / FilesMatch >
2019-10-28 18:03:14 +00:00
2019-12-15 07:41:24 +00:00
< IfModule mod_headers . c >
Header set X-XSS-Protection: 1;
Header set X-Frame-Options: deny
Header set X-Content-Type-Options: nosniff
Header set Strict-Transport-Security: max-age=3600;
Header set Cache-Control no-cache
Header set Expires: 0
< filesMatch " . ( ico | css | js | gif | jpeg | jpg | png | svg | woff | ttf | eot ) $ " >
2019-10-28 18:03:14 +00:00
Header set Cache-Control "max-age=86400, public"
2019-12-15 07:41:24 +00:00
< / filesMatch >
2019-10-28 18:03:14 +00:00
< / IfModule >
2018-04-23 06:37:23 +00:00
< / VirtualHost >
```
2019-10-09 12:25:55 +00:00
2019-12-27 04:31:09 +00:00
### More information on the official [site](https://haproxy-wi.org/installation.py#manual)
2018-08-22 03:12:03 +00:00
# OS support
2019-12-04 05:43:03 +00:00
HAProxy-WI was tested on EL7, EL8 and all scripts too. Debian/Ubuntu OS support at 'beta' stage, may work not correct
2018-06-05 18:20:10 +00:00
2018-04-23 16:20:19 +00:00
# Database support
2018-01-26 04:08:34 +00:00
2020-02-02 14:23:00 +00:00
Default HAProxy-WI use Sqlite, if you want use MySQL enable in config, and create database:
2018-04-23 16:20:19 +00:00
2018-04-30 15:39:01 +00:00
### For MySQL support:
2018-04-23 16:20:19 +00:00
```
MariaDB [(none)]> create user 'haproxy-wi'@'%';
MariaDB [(none)]> create database haproxywi;
MariaDB [(none)]> grant all on haproxywi.* to 'haproxy-wi'@'%' IDENTIFIED BY 'haproxy-wi';
2018-04-25 18:38:20 +00:00
MariaDB [(none)]> grant all on haproxywi.* to 'haproxy-wi'@'localhost' IDENTIFIED BY 'haproxy-wi';
2018-04-23 16:20:19 +00:00
```
2019-12-27 04:31:09 +00:00
### More information on the official [site](https://haproxy-wi.org/settings.py#db_settings)
2019-10-04 06:23:48 +00:00

2018-02-10 14:20:39 +00:00
2018-01-15 06:53:03 +00:00
# Settings
2018-04-16 07:01:44 +00:00
```
2018-10-29 09:57:13 +00:00
Edit $HOME_HAPROXY-WI/app/haproxy-wi.cfg with your env
2018-04-19 05:24:14 +00:00
```
2018-04-28 07:34:45 +00:00
2019-05-18 08:11:03 +00:00
Login https://haproxy-wi-server/users.py, and add: users, groups and servers. Default: admin/admin
2018-04-16 07:01:44 +00:00
2019-10-01 05:35:05 +00:00

2018-04-16 07:01:44 +00:00
2018-08-17 04:41:50 +00:00
For Runtime API, Metrics and Alerting enable state file and stat socket on HAproxt servers and need install socat on all haproxy servers, and configre HAProxy:
2018-01-15 07:01:46 +00:00
```
2018-04-04 08:44:45 +00:00
global
2018-08-22 03:12:03 +00:00
stats socket *:1999 level admin
stats socket /var/run/haproxy.sock mode 600 level admin
2019-10-04 06:23:48 +00:00
server-state-file /etc/haproxy/haproxy.state
2018-05-30 18:09:02 +00:00
2018-04-04 08:44:45 +00:00
defaults
2018-08-22 03:12:03 +00:00
load-server-state-from-file global
2018-05-30 18:09:02 +00:00
2018-08-22 03:12:03 +00:00
listen stats
2019-12-15 07:41:24 +00:00
bind *:8085
stats enable
stats uri /stats
stats realm HAProxy-04\ Statistics
stats auth admin:password
2018-08-22 03:12:03 +00:00
stats admin if TRUE
2018-01-15 07:01:46 +00:00
```
2019-10-04 06:23:48 +00:00

2018-01-15 06:06:30 +00:00
2018-05-01 09:00:30 +00:00
2019-10-25 12:48:27 +00:00
# Create and update DB
2018-04-24 07:38:48 +00:00
```
2018-04-28 14:42:38 +00:00
$ cd /var/www/haproxy-wi/app
2018-09-23 09:16:16 +00:00
$ ./create_db.py
2018-04-24 07:38:48 +00:00
```
2018-04-28 07:34:45 +00:00
# Troubleshooting
If you have error:
```
Forbidden
2018-04-28 14:42:38 +00:00
You don't have permission to access /app/overview.py on this server.
2018-04-28 07:34:45 +00:00
```
Check owner(must be apache, or another user for apache)
If at first login you have:
```
Internal Server Error
```
Do this:
```
2018-04-28 14:42:38 +00:00
$ cd /var/www/haproxy-wi/app
2018-09-23 09:16:16 +00:00
$ ./create_db.py
2018-04-28 07:34:45 +00:00
```
2018-05-01 06:28:19 +00:00
and check executeble py files
If you see plain text, check section "Directory" in httpd conf