2018-01-19 15:45:06 +00:00
# Haproxy web interface
2018-08-17 11:59:15 +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
2018-06-07 07:44:20 +00:00
# Donate
Support the project
2019-09-20 06:42:19 +00:00
[![Donate ](https://img.shields.io/badge/PayPal-Donate-brightgreen.svg )](https://www.paypal.me/loginovpavel) or [Patreon ](https://www.patreon.com/haproxy_wi/overview )
2018-05-16 17:15:34 +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-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
2018-04-18 05:40:49 +00:00
![alt text ](image/haproxy-wi-config-show.jpeg "Show config page" )
2018-01-15 06:53:03 +00:00
2018-04-28 14:42:38 +00:00
# Features:
1. Configure HAproxy In a jiffy with haproxy-wi
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
4. View/Analyse HAproxy logs straight from the haproxy-wi web interface
5. Create and visualise the HAproxy workflow from Web Ui.
6. Push Your changes to your HAproxy 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.
8. Add/Edit Frontend or backend servers via web interface with a click of a button.
9. Edit config of HAproxy and push changes to All Master/Slave server with a single click.
10. Add Multiple server to ensure Config Sync between servers.
11. Auto management of ports assigned to Fronted.
12. Evaluate the changes of recent configs pushed to HAproxy instances straight from web ui
13. Multiple User Roles support for privileged based Viewing and editing of Config.
14. Create Groups and add /remove servers to ensure proper identification for your HAproxy Clusters
15. Send notifications to telegram directly from haproxy-wi.
16. haproxy-wi supports high Availability to ensure uptime to all Master slave servers configured.
17. SSL certificate support.
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"
2018-01-15 06:56:57 +00:00
2018-08-04 13:58:18 +00:00
![alt text ](image/haproxy-wi-metrics.jpeg "Merics" )
2018-01-15 06:53:03 +00:00
# Install
2019-09-04 06:26:52 +00:00
## RPM
2019-09-20 06:42:19 +00:00
Install repository^
```
2019-09-14 17:05:18 +00:00
yum install https://repo.haproxy-wi.org/el7/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-09-04 06:26:52 +00:00
## Script
2018-04-25 12:23:05 +00:00
The installer will ask you a few questions
```
$ git clone https://github.com/Aidaho12/haproxy-wi.git /var/www/haproxy-wi
$ cd /var/www/haproxy-wi
2018-04-28 05:17:06 +00:00
$ chmod +x install.sh
2018-11-07 02:34:25 +00:00
$ sudo ./install.sh
2018-04-25 12:23:05 +00:00
```
2019-09-01 20:42:26 +00:00
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
```
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/
2018-08-22 03:12:03 +00:00
Or if use Debian/Ubuntu:
$ chown -R www-data:www-data haproxy-wi/
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
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-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 >
2018-04-23 06:37:23 +00:00
Options +ExecCGI
AddHandler cgi-script .py
Order deny,allow
Allow from all
< / 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 >
< Directory / var / www / haproxy-wi / keys >
Options +ExecCGI -Indexes +MultiViews
Order Deny,Allow
Deny from all
< / Directory >
< FilesMatch " \.cfg $" >
Order Deny,Allow
Deny from all
< / FilesMatch >
< FilesMatch " \.db $" >
Order Deny,Allow
Deny from all
< / FilesMatch >
2018-04-23 06:37:23 +00:00
< / VirtualHost >
```
2018-07-05 05:40:15 +00:00
# Docker
2018-06-05 18:20:10 +00:00
```
2019-09-11 20:46:47 +00:00
docker service create --detach=false --name haproxy-wi --mount type=volume,src=haproxy-wi,dst=/var/www/haproxy-wi/app -p 8080:443 aidaho/haproxy-wi
2018-06-05 18:20:10 +00:00
```
2018-08-22 03:12:03 +00:00
or
```
2019-09-11 20:46:47 +00:00
docker run -d --name haproxy-wi -v haproxy-wi:/var/www/haproxy-wi/app -p 8080:443 aidaho/haproxy-wi
2018-08-22 03:12:03 +00:00
```
# OS support
HAProxy-WI was tested on EL 7, 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
2018-04-23 16:20:19 +00:00
Default Haproxy-WI use Sqlite, if you want use MySQL enable in config, and create database:
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
```
2018-04-18 05:40:49 +00:00
![alt text ](image/haproxy-wi-overview.jpeg "Overview page" )
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
2018-04-18 05:40:49 +00:00
![alt text ](image/haproxy-wi-admin-area.jpeg "Admin area" )
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
server-state-file /etc/haproxy/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
stats admin if TRUE
2018-01-15 07:01:46 +00:00
```
2018-04-18 05:40:49 +00:00
![alt text ](image/haproxy-wi-logs.jpeg "View logs page" )
2018-01-15 06:06:30 +00:00
2018-05-01 09:00:30 +00:00
# Update
```
# cd /var/www/haproxy-wi
# ./update.sh
```
After update old config saved at /tmp/ folder. Compare new and old config, if in new no changes overwrite the new configuration with the old one, or edit new with your ENV.
2018-04-24 07:38:48 +00:00
# Update DB
```
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