Changelog: https://roxy-wi.org/changelog#6_3_6
pull/355/head
Aidaho 2 years ago
parent f9c324da13
commit 810a9d9460

@ -998,7 +998,7 @@ def update_db_v_6_3_5():
def update_ver():
try:
Version.update(version='6.3.5.0').execute()
Version.update(version='6.3.6.0').execute()
except Exception:
print('Cannot update version')

@ -578,6 +578,16 @@ class ServiceStatus(BaseModel):
constraints = [SQL('UNIQUE (server_id, service_id, service_check)')]
class KeepaliveRestart(BaseModel):
server_id = ForeignKeyField(Server, on_delete='Cascade')
service = CharField()
restarted = IntegerField(constraints=[SQL('DEFAULT 1')])
class Meta:
table_name = 'keepaplive_restarted'
constraints = [SQL('UNIQUE (server_id, service)')]
def create_tables():
with conn:
conn.create_tables([User, Server, Role, Telegram, Slack, UUID, Token, ApiToken, Groups, UserGroups, ConfigVersion,
@ -585,4 +595,4 @@ def create_tables():
PortScannerSettings, PortScannerPorts, PortScannerHistory, ProvidersCreds, ServiceSetting,
ProvisionedServers, MetricsHttpStatus, SMON, WafRules, Alerts, GeoipCodes, NginxMetrics,
SystemInfo, Services, UserName, GitSetting, CheckerSetting, ApacheMetrics, ProvisionParam,
WafNginx, ServiceStatus])
WafNginx, ServiceStatus, KeepaliveRestart])

@ -2242,7 +2242,7 @@ def select_keepalived_alert(**kwargs):
def select_keep_alive():
query = Server.select(Server.ip, Server.groups).where(Server.active == 1)
query = Server.select(Server.ip, Server.groups, Server.server_id).where(Server.active == 1)
try:
query_res = query.execute()
except Exception as e:
@ -2252,7 +2252,7 @@ def select_keep_alive():
def select_nginx_keep_alive():
query = Server.select(Server.ip, Server.groups).where(Server.nginx_active == 1)
query = Server.select(Server.ip, Server.groups, Server.server_id).where(Server.nginx_active == 1)
try:
query_res = query.execute()
except Exception as e:
@ -2262,7 +2262,7 @@ def select_nginx_keep_alive():
def select_apache_keep_alive():
query = Server.select(Server.ip, Server.groups).where(Server.apache_active == 1)
query = Server.select(Server.ip, Server.groups, Server.server_id).where(Server.apache_active == 1)
try:
query_res = query.execute()
except Exception as e:
@ -2272,7 +2272,7 @@ def select_apache_keep_alive():
def select_keepalived_keep_alive():
query = Server.select(Server.ip, Server.port, Server.groups).where(Server.keepalived_active == 1)
query = Server.select(Server.ip, Server.port, Server.groups, Server.server_id).where(Server.keepalived_active == 1)
try:
query_res = query.execute()
except Exception as e:
@ -2290,6 +2290,26 @@ def select_keepalived(serv):
return keepalived
def select_update_keep_alive_restart(server_id: int, service: str) -> int:
try:
restarted = KeepaliveRestart.get(
(KeepaliveRestart.server_id == server_id) &
(KeepaliveRestart.service == service)
).restarted
except Exception as e:
out_error(e)
else:
return restarted or 0
def update_keep_alive_restart(server_id: int, service: str, restarted: int) -> None:
query = KeepaliveRestart.insert(server_id=server_id, service=service, restarted=restarted).on_conflict('replace')
try:
query.execute()
except Exception as e:
out_error(e)
def update_keepalived(serv):
query = Server.update(keepalived='1').where(Server.ip == serv)
try:

@ -1,5 +1,6 @@
global
log 127.0.0.1 local2
log 127.0.0.2 local0
log 127.0.0.1 local1 notice
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 4000
@ -31,9 +32,7 @@ defaults
listen stats
bind *:{{STAT_PORT}}
{% if ansible_os_family == "RedHat" %}
http-request use-service prometheus-exporter if { path /metrics }
{% endif %}
stats enable
stats uri /stats
stats realm HAProxy-04\ Statistics

@ -7,10 +7,8 @@ module(load="builtin:omfile")
if $programname startswith 'haproxy' then {
if $syslogseverity == 6 then
action(type="omfile" file="/var/log/haproxy/access.log")
stop
if $syslogseverity <= 3 then
action(type="omfile" file="/var/log/haproxy/error.log")
stop
if $syslogseverity <= 5 then
action(type="omfile" file="/var/log/haproxy/status.log")
stop

@ -156,4 +156,10 @@
{% endfor %}
</td>
{% endfor %}
{% endif %}
{% endif %}
<style>
.overview-wi {
min-width: 50px;
width: 445px;
}
</style>

@ -13,7 +13,7 @@
data-something_wrong="{{lang.words.something_wrong}}" data-check_logs="{{lang.words.check_logs}}" data-wait_mess="{{lang.phrases.wait_mess}}"
data-just_save="{{lang.words.just|title()}} {{lang.words.save}}" data-upload_and_restart="{{lang.phrases.upload_and_restart|title()}}"
data-are_you_sure="{{lang.phrases.are_you_sure}}" data-upload_and_reload="{{lang.phrases.upload_and_reload|title()}}" data-select_server="{{lang.errors.select_server}}"
data-empty_name="{{lang.errors.empty_name}}" data-edit="{{lang.words.edit|title()}}" data-close="{{lang.words.close|title()}}"
data-empty_name="{{lang.errors.empty_name}}" data-edit="{{lang.words.edit|title()}}" data-close="{{lang.words.close|title()}}" data-server_info="{{lang.phrases.server_info}}"
data-generated_config="{{lang.words.generated|title()}} {{lang.words.config}}" />
{% if title == 'Login page' %}
<meta name="viewport" content="width=device-width, user-scalable=1">

@ -54,7 +54,7 @@
<td id="cur_haproxy_exp_ver" class="padding10 first-collumn"></td>
<td class="padding10 first-collumn" style="width: 20%;">
{% set values = dict() %}
{% set values = {'0.8.0':'0.8.0', '0.9.0':'0.9.0', '0.10.0':'0.10.0', '0.11.0':'0.11.0', '0.12.0':'0.12.0', '0.13.0':'0.13.0', '0.14.0':'0.14.0'} %}
{% set values = {'0.9.0':'0.9.0', '0.10.0':'0.10.0', '0.11.0':'0.11.0', '0.12.0':'0.12.0', '0.13.0':'0.13.0', '0.14.0':'0.14.0', '0.15.0':'0.15.0'} %}
{{ select('hapexpver', values=values, selected='0.14.0') }}
</td>
<td class="padding10 first-collumn">

@ -231,6 +231,7 @@
%}
{% set phrases = dict() %}
{% set phrases = {
"config_file_name": "Config file name",
"no_events_added": "No events added yet.",
"upload_and_restart": "Upload and restart",
"upload_and_reload": "Upload and reload",
@ -290,6 +291,7 @@
"how_to_install": "how to install",
"port_check": "port check",
"possible_service_name": "Possible service name",
"server_info": "Server info",
}
%}
{% set roles = {
@ -503,7 +505,7 @@
"creds2": "credentials",
"settings": "settings",
"settings2": "settings",
"installat": "installat",
"install": "install",
"installation": "installation",
"installing": "installing",
"proxy": "proxy",

@ -231,6 +231,7 @@
%}
{% set phrases = dict() %}
{% set phrases = {
"config_file_name": "Имя конфиг файла",
"no_events_added": "События еще не добавлены.",
"upload_and_restart": "Загрузить и перезагрузить",
"upload_and_reload": "Загрузить и перезапустить",
@ -292,6 +293,7 @@
"how_to_install": "как установить",
"port_check": "проверка порта",
"possible_service_name": "Возможное название службы",
"server_info": "Информация о сервере",
}
%}
{% set roles = {
@ -817,5 +819,6 @@
"rule_name": "Название правила",
"rule": "правило",
"rules": "правила",
"send": "отправить",
}
%}

@ -2833,6 +2833,8 @@ function updateServerInfo(ip, id) {
} );
}
function showServerInfo(id, ip) {
var close_word = $('#translate').attr('data-close');
var server_info = $('#translate').attr('data-server_info');
$.ajax({
url: "options.py",
data: {
@ -2851,14 +2853,15 @@ function showServerInfo(id, ip) {
$("#dialog-server-info").dialog({
resizable: false,
height: "auto",
width: 1250,
width: 1000,
modal: true,
title: "Server info (" + ip + ")",
buttons: {
Close: function () {
title: server_info + " (" + ip + ")",
buttons: [{
text: close_word,
click: function () {
$(this).dialog("close");
}
}
}]
});
$.getScript(awesome);
}

Loading…
Cancel
Save