diff --git a/app/create_db.py b/app/create_db.py index 40362acc..df4b3f42 100644 --- a/app/create_db.py +++ b/app/create_db.py @@ -638,7 +638,7 @@ def update_db_v_5_4_3_1(**kwargs): def update_ver(): - query = Version.update(version='5.5.0.0') + query = Version.update(version='5.5.1.0') try: query.execute() except: diff --git a/app/funct.py b/app/funct.py index bffc7405..1b970561 100644 --- a/app/funct.py +++ b/app/funct.py @@ -829,6 +829,7 @@ def install_nginx(server_ip, **kwargs): def update_haproxy_wi(service): import distro restart_service = '' + if distro.id() == 'ubuntu': try: if service == 'roxy-wi-keep_alive': @@ -836,11 +837,13 @@ def update_haproxy_wi(service): except Exception: pass - if service == 'roxy-wi': + if service != 'roxy-wi': restart_service = ' && sudo systemctl restart ' + service cmd = 'sudo -S apt-get update && sudo apt-get install ' + service + restart_service else: + if service != 'roxy-wi': + restart_service = ' && sudo systemctl restart ' + service cmd = 'sudo -S yum -y update ' + service + restart_service output, stderr = subprocess_execute(cmd) diff --git a/app/history.py b/app/history.py index 14af51e0..8cfeff39 100644 --- a/app/history.py +++ b/app/history.py @@ -18,6 +18,7 @@ except: form = funct.form serv = funct.is_ip_or_dns(form.getvalue('serv')) service = form.getvalue('service') +user_id = form.getvalue('user_id') if service == 'nginx': @@ -41,6 +42,16 @@ elif service == 'haproxy': if funct.check_is_server_in_group(serv): server_id = sql.select_server_id_by_ip(serv) history = sql.select_action_history_by_server_id_and_service(server_id, service) +elif service == 'server': + if serv: + title = serv + ' history' + if funct.check_is_server_in_group(serv): + server_id = sql.select_server_id_by_ip(serv) + history = sql.select_action_history_by_server_id(server_id) +elif service == 'user': + if user_id: + title = 'User history' + history = sql.select_action_history_by_user_id(user_id) users = sql.select_users() diff --git a/app/options.py b/app/options.py index 93348e73..a6680a1b 100644 --- a/app/options.py +++ b/app/options.py @@ -495,9 +495,7 @@ if act == "overviewHapserverBackends": except Exception as e: funct.logging('localhost', ' Cannot generate a cfg path ' + str(e), haproxywi=1) try: - if service == 'nginx': - error = funct.get_config(serv, cfg, nginx=1) - elif service == 'keepalived': + if service == 'keepalived': error = funct.get_config(serv, cfg, keepalived=1) else: error = funct.get_config(serv, cfg) @@ -556,7 +554,7 @@ if act == "overview": import http.cookies from jinja2 import Environment, FileSystemLoader - async def async_get_overview(serv1, serv2, user_uuid): + async def async_get_overview(serv1, serv2, user_uuid, server_id): user_id = sql.get_user_id_by_uuid(user_uuid) user_services = sql.select_user_services(user_id) if '1' in user_services: @@ -587,7 +585,7 @@ if act == "overview": haproxy_process = funct.server_status(funct.subprocess_execute(cmd)) if keepalived == 1: - command = ["ps ax |grep keepalived|grep -v grep|wc -l"] + command = ["ps ax |grep keepalived|grep -v grep|wc -l|tr -d '\n'"] keepalived_process = funct.ssh_command(serv2, command) if nginx == 1: @@ -607,7 +605,8 @@ if act == "overview": keepalived, keepalived_process, nginx, - nginx_process) + nginx_process, + server_id) return server_status @@ -619,7 +618,7 @@ if act == "overview": template = env.get_template('overview.html') cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE")) user_uuid = cookie.get('uuid') - futures = [async_get_overview(server[1], server[2], user_uuid.value) for server in sql.select_servers(server=serv)] + futures = [async_get_overview(server[1], server[2], user_uuid.value, server[0]) for server in sql.select_servers(server=serv)] for i, future in enumerate(asyncio.as_completed(futures)): result = await future servers.append(result) @@ -3953,6 +3952,8 @@ if act == 'showListOfVersion': configver = form.getvalue('configver') for_delver = form.getvalue('for_delver') style = form.getvalue('style') + users = sql.select_users() + if service == 'keepalived': configs_dir = funct.get_config_var('configs', 'kp_save_configs_dir') files = funct.get_files(dir=configs_dir, format='conf') @@ -3982,6 +3983,7 @@ if act == 'showListOfVersion': configver=configver, for_delver=for_delver, configs=configs, + users=users, style=style) print(template) diff --git a/app/scripts/ansible/roles/haproxy/tasks/logs.yml b/app/scripts/ansible/roles/haproxy/tasks/logs.yml index e247dab8..96291c27 100644 --- a/app/scripts/ansible/roles/haproxy/tasks/logs.yml +++ b/app/scripts/ansible/roles/haproxy/tasks/logs.yml @@ -2,7 +2,7 @@ template: src: /var/www/haproxy-wi/app/scripts/ansible/roles/haproxy/templates/haproxy_rsyslog.conf.j2 dest: /etc/rsyslog.d/49-haproxy.conf - force: no + force: yes ignore_errors: yes notify: restart rsyslog diff --git a/app/scripts/ansible/roles/haproxy/templates/haproxy.cfg.j2 b/app/scripts/ansible/roles/haproxy/templates/haproxy.cfg.j2 index cc2d9590..9516b094 100644 --- a/app/scripts/ansible/roles/haproxy/templates/haproxy.cfg.j2 +++ b/app/scripts/ansible/roles/haproxy/templates/haproxy.cfg.j2 @@ -30,7 +30,11 @@ defaults maxconn 3000 listen stats - bind *:{{STAT_PORT}} + bind *:{{STAT_PORT}} + {% if ansible_os_family == "RedHat" and HAPVER != '2.5.1-1' %} + option http-use-htx + http-request use-service prometheus-exporter if { path /metrics } + {% endif %} stats enable stats uri /stats stats realm HAProxy-04\ Statistics diff --git a/app/templates/admin.html b/app/templates/admin.html index 1685d644..1cf5c60c 100644 --- a/app/templates/admin.html +++ b/app/templates/admin.html @@ -144,7 +144,6 @@ {% include 'include/admins_dialogs.html' %} -{% include 'include/change_pass_form.html' %}
diff --git a/app/templates/ajax/overview.html b/app/templates/ajax/overview.html index 93034473..a0cf4617 100644 --- a/app/templates/ajax/overview.html +++ b/app/templates/ajax/overview.html @@ -1,37 +1,39 @@ -{% for service in service_status %} -