mirror of https://github.com/Aidaho12/haproxy-wi
parent
5cdf827e1d
commit
aafd430cb2
26
README.md
26
README.md
|
@ -76,16 +76,17 @@ MariaDB [(none)]> grant all on haproxywi.* to 'haproxy-wi'@'localhost' IDENTIFIE
|
|||
```
|
||||
Edit $HOME_HAPROXY-WI/cgi-bin/haproxy-webintarface.config with your env
|
||||
```
|
||||
Copy ssh key on all HAproxy servers
|
||||
|
||||
Login http://haproxy-wi-server/users.py, and add: users, groups and servers. Default: admin/admin
|
||||
|
||||
![alt text](image/haproxy-wi-admin-area.jpeg "Admin area")
|
||||
|
||||
Copy ssh key on all HAproxy servers
|
||||
|
||||
For Runtime API enable state file on HAproxt servers and need install socat on all haproxy servers:
|
||||
For Runtime API enable state file on HAproxt servers and need install socat on all haproxy servers, and configre HAProxy:
|
||||
```
|
||||
global
|
||||
stats socket *:1999 level admin
|
||||
stats socket /var/run/haproxy.sock mode 600 level admin
|
||||
server-state-file /etc/haproxy/haproxy/haproxy.state
|
||||
defaults
|
||||
load-server-state-from-file global
|
||||
|
@ -97,6 +98,25 @@ For Runtime API enable state file on HAproxt servers and need install socat on a
|
|||
$ cd /var/www/haproxy-wi/cgi-bin
|
||||
$ ./update_db.py
|
||||
```
|
||||
# Troubleshooting
|
||||
If you have error:
|
||||
```
|
||||
Forbidden
|
||||
You don't have permission to access /cgi-bin/overview.py on this server.
|
||||
```
|
||||
|
||||
Check owner(must be apache, or another user for apache)
|
||||
|
||||
If at first login you have:
|
||||
```
|
||||
Internal Server Error
|
||||
```
|
||||
|
||||
Do this:
|
||||
```
|
||||
$ cd /var/www/haproxy-wi
|
||||
$ ./update_db.py
|
||||
```
|
||||
|
||||
# Further development and support
|
||||
|
||||
|
|
|
@ -40,13 +40,13 @@ def check_db():
|
|||
try:
|
||||
cur.execute(sql)
|
||||
except sqltool.Error as err:
|
||||
#print('<div class="alert alert-danger">')
|
||||
#if err.errno == errorcode.ER_ACCESS_DENIED_ERROR:
|
||||
# print("Something is wrong with your user name or password")
|
||||
#elif err.errno == errorcode.ER_BAD_DB_ERROR:
|
||||
# print("Database does not exist")
|
||||
#else:
|
||||
# print(err)
|
||||
print('<div class="alert alert-danger">')
|
||||
if err.errno == errorcode.ER_ACCESS_DENIED_ERROR:
|
||||
print("Something is wrong with your user name or password")
|
||||
elif err.errno == errorcode.ER_BAD_DB_ERROR:
|
||||
print("Database does not exist")
|
||||
else:
|
||||
print(err)
|
||||
print('</div>')
|
||||
return True
|
||||
else:
|
||||
|
|
|
@ -319,7 +319,7 @@ def ssh_connect(serv):
|
|||
def get_config(serv, cfg, **kwargs):
|
||||
if kwargs.get("keepalived"):
|
||||
os.chdir("/var/www/haproxy-wi/cgi-bin/kp_config/")
|
||||
config_path = "/etc/keepalived/keepalived.conf"
|
||||
config_path = config.get('configs', 'kp_save_configs_dir')
|
||||
else:
|
||||
os.chdir(hap_configs_dir)
|
||||
config_path = haproxy_config_path
|
||||
|
|
|
@ -45,7 +45,7 @@ print('</select>'
|
|||
'<input type="text" id="vrrp-ip" class="form-control">'
|
||||
'</td>'
|
||||
'<td>'
|
||||
'<label for="hap"></label><input type="checkbox" checked id="hap">'
|
||||
'<label for="hap"></label><input type="checkbox" id="hap">'
|
||||
'</td>'
|
||||
'<td>'
|
||||
'<a class="ui-button ui-widget ui-corner-all" id="create" title="Create HA configuration">Create</a>'
|
||||
|
|
|
@ -11,6 +11,7 @@ time_zone = UTC
|
|||
haproxy_configs_server = localhost
|
||||
#Dir where configs will be save
|
||||
haproxy_save_configs_dir = ${main:fullpath}/cgi-bin/hap_config/
|
||||
kp_save_configs_dir = ${main:fullpath}/cgi-bin/kp_config/
|
||||
|
||||
[mysql]
|
||||
#Enable MySQL DB. If default will be used Sqlite DB. Default disable
|
||||
|
|
|
@ -23,7 +23,7 @@ config = ConfigParser(interpolation=ExtendedInterpolation())
|
|||
config.read(path_config)
|
||||
|
||||
log_path = config.get('main', 'log_path')
|
||||
hap_configs_dir = config.get('configs', 'haproxy_save_configs_dir')
|
||||
kp_save_configs_dir = config.get('configs', 'kp_save_configs_dir')
|
||||
|
||||
print('<h2>Edit Running Keepalived config</h2>'
|
||||
'<center>'
|
||||
|
@ -49,7 +49,7 @@ funct.get_button("Open", value="open")
|
|||
print('</form>')
|
||||
|
||||
if serv is not None:
|
||||
cfg = '/var/www/haproxy-wi/cgi-bin/kp_config/'+ serv + '-' + funct.get_data('config') + '.conf'
|
||||
cfg = kp_save_configs_dir+ serv + '-' + funct.get_data('config') + '.conf'
|
||||
|
||||
if form.getvalue('serv') is not None and form.getvalue('open') is not None :
|
||||
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
#!/bin/bash
|
||||
yum install haproxy -y > /dev/null
|
||||
yum install haproxy socat -y > /dev/null
|
||||
|
||||
if [ -f /etc/haproxy/haproxy.cfg ];then
|
||||
echo -e "error: Haproxy alredy installed"
|
||||
exit 1
|
||||
fi
|
||||
echo "" > /etc/haproxy/haproxy.cfg
|
||||
cat << EOF > /etc/haproxy/haproxy.cfg
|
||||
global
|
||||
|
@ -13,6 +17,7 @@ global
|
|||
daemon
|
||||
stats socket /var/lib/haproxy/stats
|
||||
stats socket *:1999 level admin
|
||||
stats socket /var/run/haproxy.sock mode 600 level admin
|
||||
|
||||
defaults
|
||||
mode http
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
#!/bin/bash
|
||||
CONF=/etc/keepalived/keepalived.conf
|
||||
|
||||
if [ -f $CONF ];then
|
||||
echo -e "error: Keepalived alredy installed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
yum install keepalived -y > /dev/null
|
||||
if [ $? -eq 1 ]
|
||||
then
|
||||
|
|
|
@ -16,4 +16,5 @@ else:
|
|||
db = "haproxy-wi.db"
|
||||
import sqlite3 as sqltool
|
||||
|
||||
create_db.create_table()
|
||||
create_db.update_all()
|
Loading…
Reference in New Issue