diff --git a/README.md b/README.md index e9fd6d79..78ff8334 100644 --- a/README.md +++ b/README.md @@ -155,7 +155,7 @@ Edit $HOME_HAPROXY-WI/app/haproxy-wi.cfg with your env Login https://haproxy-wi-server/users.py, and add: users, groups and servers. Default: admin/admin -![alt text](image/haproxy-wi-admin-area.jpeg "Admin area") +![alt text](image/haproxy-wi-admin-area.png "Admin area") 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: ``` diff --git a/app/create_db.py b/app/create_db.py index 9038e2ab..840ec235 100644 --- a/app/create_db.py +++ b/app/create_db.py @@ -161,6 +161,7 @@ def update_db_v_31(**kwargs): sql.append("INSERT INTO settings (param, value, section, `desc`) values('syslog_server', '0', 'logs', 'IP address syslog server');") sql.append("INSERT INTO settings (param, value, section, `desc`) values('log_time_storage', '14', 'logs', 'Time of storage of logs of user activity, in days');") sql.append("INSERT INTO settings (param, value, section, `desc`) values('restart_command', 'systemctl restart haproxy', 'haproxy', 'Command for restart HAproxy service');") + sql.append("INSERT INTO settings (param, value, section, `desc`) values('reload_command', 'systemctl reload haproxy', 'haproxy', 'Command for reload HAproxy service');") sql.append("INSERT INTO settings (param, value, section, `desc`) values('status_command', 'systemctl status haproxy', 'haproxy', 'Command for status check HAproxy service');") sql.append("INSERT INTO settings (param, value, section, `desc`) values('stats_user', 'admin', 'haproxy', 'Username for Stats web page HAproxy');") sql.append("INSERT INTO settings (param, value, section, `desc`) values('stats_password', 'password', 'haproxy', 'Password for Stats web page HAproxy');") @@ -337,7 +338,7 @@ def update_db_v_3_4_1(**kwargs): except sqltool.Error as e: if kwargs.get('silent') != 1: if e.args[0] == 'duplicate column name: activeuser' or e == " 1060 (42S21): Duplicate column name 'activeuser' ": - print('Updating... go to version 3.4.5.2') + print('Updating... go to version 3.4.9.5') else: print("An error occurred:", e) return False @@ -398,9 +399,28 @@ def update_db_v_3_4_7(**kwargs): con.close() +def update_db_v_3_4_9_5(**kwargs): + con, cur = get_cur() + sql = """INSERT INTO settings (param, value, section, `desc`) values('reload_command', 'systemctl reload haproxy', 'haproxy', 'Command for reload HAproxy service'); """ + try: + cur.execute(sql) + con.commit() + except sqltool.Error as e: + if kwargs.get('silent') != 1: + if e.args[0] == 'duplicate column name: param' or e == "1060 (42S21): Duplicate column name 'param' ": + print('DB was update to 3.4.9.5') + else: + print("DB was update to 3.4.9.5") + return False + else: + return True + cur.close() + con.close() + + def update_ver(**kwargs): con, cur = get_cur() - sql = """update version set version = '3.4.9.4'; """ + sql = """update version set version = '3.4.9.5'; """ try: cur.execute(sql) con.commit() @@ -451,6 +471,7 @@ def update_all(): if funct.check_ver() is None: update_db_v_3_4_5_22() update_db_v_3_4_7() + update_db_v_3_4_9_5() update_to_hash() update_ver() @@ -469,6 +490,7 @@ def update_all_silent(): if funct.check_ver() is None: update_db_v_3_4_5_22() update_db_v_3_4_7(silent=1) + update_db_v_3_4_9_5(silent=1) update_to_hash() update_ver() diff --git a/app/funct.py b/app/funct.py index cd7e0c53..ef30c5bc 100644 --- a/app/funct.py +++ b/app/funct.py @@ -434,6 +434,8 @@ def upload_and_restart(serv, cfg, **kwargs): commands = [ "sudo haproxy -q -c -f " + tmp_file + "&& sudo rm -f " + tmp_file ] elif kwargs.get("just_save") == "save": commands = [ "sudo haproxy -q -c -f " + tmp_file + "&& sudo mv -f " + tmp_file + " " + sql.get_setting('haproxy_config_path') ] + elif kwargs.get("just_save") == "reload": + commands = [ "sudo haproxy -q -c -f " + tmp_file + "&& sudo mv -f " + tmp_file + " " + sql.get_setting('haproxy_config_path') + " && sudo " + sql.get_setting('reload_command') ] else: commands = [ "sudo haproxy -q -c -f " + tmp_file + "&& sudo mv -f " + tmp_file + " " + sql.get_setting('haproxy_config_path') + " && sudo " + sql.get_setting('restart_command') ] if sql.get_setting('firewall_enable') == "1": diff --git a/app/hapservers.py b/app/hapservers.py index 3d315e4e..42defb2d 100644 --- a/app/hapservers.py +++ b/app/hapservers.py @@ -7,7 +7,7 @@ env = Environment(loader=FileSystemLoader('templates/')) template = env.get_template('hapservers.html') print('Content-type: text/html\n') - +funct.check_login() try: cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE")) @@ -42,7 +42,7 @@ for s in servers: servers_with_status.append(out1) servers_with_status1.append(servers_with_status) -# print(servers_with_status1) + template = template.render(h2 = 1, autorefresh = 1, diff --git a/app/templates/add.html b/app/templates/add.html index 94ff7f65..b058ead0 100644 --- a/app/templates/add.html +++ b/app/templates/add.html @@ -44,7 +44,8 @@ Create SSL Listen
- Create HTTPS Proxy with the SSL termination on HAProxy and SSL offload. HAProxy will send to backends HTTP traffic. You need have uploaded a PEM certificat + Create HTTPS Proxy with the SSL termination on HAProxy and SSL offload. + HAProxy will send to backends HTTP traffic. You need have uploaded a PEM certificat
@@ -68,6 +69,7 @@
A "frontend" section describes a set of listening sockets accepting client connections. And forwards them to backend +
diff --git a/app/templates/admin.html b/app/templates/admin.html index 9bf9e83b..d8adfcbd 100644 --- a/app/templates/admin.html +++ b/app/templates/admin.html @@ -179,16 +179,16 @@ Hostname IP - Port(?) + Port Group Enable - Virt(?) - Alert(?) - Metrics(?) - Start(?) - Slave for (?) + Virt + Alert + Metrics + Start + Slave for Credentials - Desciption + Description @@ -201,7 +201,7 @@ - + @@ -296,6 +296,9 @@
+ Add

+
+ You can read the description of all parameters here +
diff --git a/app/templates/ajax/config_show.html b/app/templates/ajax/config_show.html index d8bcf189..21ca8c06 100644 --- a/app/templates/ajax/config_show.html +++ b/app/templates/ajax/config_show.html @@ -128,6 +128,7 @@ +
Note: If you reconfigure Master server, Slave will reconfigured automatically
diff --git a/app/templates/ajax/new_server.html b/app/templates/ajax/new_server.html index 2ed12e9a..777812a8 100644 --- a/app/templates/ajax/new_server.html +++ b/app/templates/ajax/new_server.html @@ -10,7 +10,7 @@ {% endif %} - + {% if page != "servers.py" %} diff --git a/app/templates/ajax/overview.html b/app/templates/ajax/overview.html index 39cf798f..942f8c3e 100644 --- a/app/templates/ajax/overview.html +++ b/app/templates/ajax/overview.html @@ -6,7 +6,6 @@ {% else %} DOWN {% endif %} - {{ service.0 }} {% if service.4.0.0|int() >= 1 %} @@ -18,8 +17,6 @@ {% endif %} width=18 style="padding-left: 5px; margin-bottom: -3px;"> {% endif %} - - diff --git a/app/templates/config.html b/app/templates/config.html index f7dc98ab..334282e1 100644 --- a/app/templates/config.html +++ b/app/templates/config.html @@ -62,6 +62,7 @@ +

{% if note %} diff --git a/app/templates/hapservers.html b/app/templates/hapservers.html index 8a0503ba..baec9466 100644 --- a/app/templates/hapservers.html +++ b/app/templates/hapservers.html @@ -32,7 +32,7 @@ {{s.3}} {% if s.5.0 is defined %}
- {{s.5.0.0}} {{s.5.0.1}} + {{s.5.0.0}} {{s.5.0.1}} {{s.5.0.2}}
IP: {{s.2}} {% endif %} diff --git a/app/templates/login.html b/app/templates/login.html index c94e0632..91dbe323 100644 --- a/app/templates/login.html +++ b/app/templates/login.html @@ -33,8 +33,8 @@ body, .container { {{db_create}}
- - + +

diff --git a/app/templates/sections.html b/app/templates/sections.html index 6aa97359..6c431dd1 100644 --- a/app/templates/sections.html +++ b/app/templates/sections.html @@ -40,6 +40,7 @@ +

{% if note %} diff --git a/app/templates/servers.html b/app/templates/servers.html index 8c4ca164..65ecbf3d 100644 --- a/app/templates/servers.html +++ b/app/templates/servers.html @@ -96,13 +96,13 @@ Hostname IP - Port(?) + Port Enable - Virt(?) - Alert(?) - Metrics(?) - Start(?) - Slave for (?) + Virt + Alert + Metrics + Start + Slave for Credentials Desciption @@ -119,7 +119,7 @@ - + @@ -202,6 +202,9 @@
+ Add

+
+ You can read the description of all parameters here +
@@ -547,6 +550,24 @@ }, 500 ); } + $( function() { + {% for user in users %} + $("#role-{{user.0}}" ).selectmenu({ + width: 100 + }); + {% endfor %} + {% for server in servers %} + $("#slavefor-{{server.0}}" ).selectmenu({ + width: 130 + }); + $("#credentials-{{server.0}}" ).selectmenu({ + width: 150 + }); + if($('#new-server-group-add').val() == 1) { + $('#clone-{{server.0}}').css('display', 'none') + } + {% endfor %} + }); {% endblock %} \ No newline at end of file diff --git a/app/templates/settings.html b/app/templates/settings.html index ce7f0757..dde8254e 100644 --- a/app/templates/settings.html +++ b/app/templates/settings.html @@ -21,7 +21,9 @@ {% endif %} {% set section.section = set.2 %} - {{set.0}} + + {{set.0}} + {% if set.0 == 'ldap_password' %} {% if set.1 == 'None' %} diff --git a/image/haproxy-wi-admin-area.jpeg b/image/haproxy-wi-admin-area.jpeg deleted file mode 100644 index 086f2dab..00000000 Binary files a/image/haproxy-wi-admin-area.jpeg and /dev/null differ diff --git a/image/haproxy-wi-admin-area.png b/image/haproxy-wi-admin-area.png new file mode 100644 index 00000000..55b28c21 Binary files /dev/null and b/image/haproxy-wi-admin-area.png differ diff --git a/inc/style.css b/inc/style.css index 33a8de3c..9c479955 100644 --- a/inc/style.css +++ b/inc/style.css @@ -344,6 +344,7 @@ pre { } .checkbox { min-width: 30px; + padding-top: 5px; } .checkbox-head { padding: 0; @@ -352,13 +353,13 @@ pre { width: 100px; } .group-field, .slave-field { - width: 10%; + min-width: 5%; } .slave-field { padding-left: 10px; } .cred-field { - width: 17%; + min-width: 214px; } .overviewTr { margin: 0; @@ -618,7 +619,7 @@ caption { td,th { padding: 0; text-align: left; - min-width: 30px; + min-width: 25px; } .row { @@ -741,7 +742,7 @@ label { margin-right: 0 !important; } #left-collumn, #middle-collumn, #right-collumn { - width: 30%; + /* width: 30%; */ float: left; } .ajax-server { @@ -768,4 +769,32 @@ label { } .span-link { cursor: pointer; -} \ No newline at end of file +} +#logo_span { + float: left; + margin-left: 8%; + border-right: 3px solid #ddd; + height: 270px; +} +#logo_span img { + margin-top: -40px; + margin-bottom: -40px; + padding-left: 70px; +} +@media (max-width: 1024px) { + #logo_span { + margin-left: -5%; + } +} +@media (max-width: 667px) { + #logo_span { + margin-left: -12%; + border: none; + } +} +@media (max-width: 768px) { + #logo_span { + margin-left: -12%; + border: none; + } +}