From bbda8db94a5bdc7d9e16c32c3c4192356520ac21 Mon Sep 17 00:00:00 2001 From: Pavel Loginov Date: Wed, 6 Jan 2021 01:05:42 +0600 Subject: [PATCH] v4.5.7.0 Changelog: https://haproxy-wi.org/changelog.py#4_5_7 --- app/hapservers.py | 6 ++++-- .../roles/haproxy/templates/logrotate.conf.j2 | 12 ++++++++++++ app/scripts/ansible/roles/renew_letsencrypt.j2 | 4 ++-- app/users.py | 11 +++++------ 4 files changed, 23 insertions(+), 10 deletions(-) create mode 100644 app/scripts/ansible/roles/haproxy/templates/logrotate.conf.j2 diff --git a/app/hapservers.py b/app/hapservers.py index 8338caf..c159180 100644 --- a/app/hapservers.py +++ b/app/hapservers.py @@ -53,8 +53,10 @@ for s, v in services_name.items(): service_name = s cmd = "rpm --query haproxy-wi-" + service_name + "-* |awk -F\"" + service_name + "\" '{print $2}' |awk -F\".noa\" '{print $1}' |sed 's/-//1' |sed 's/-/./'" service_ver, stderr = funct.subprocess_execute(cmd) - - services.append([s, service_ver[0]]) + try: + services.append([s, service_ver[0]]) + except Exception: + services.append([s, '']) haproxy_sock_port = sql.get_setting('haproxy_sock_port') servers_with_status1 = [] diff --git a/app/scripts/ansible/roles/haproxy/templates/logrotate.conf.j2 b/app/scripts/ansible/roles/haproxy/templates/logrotate.conf.j2 new file mode 100644 index 0000000..33a980b --- /dev/null +++ b/app/scripts/ansible/roles/haproxy/templates/logrotate.conf.j2 @@ -0,0 +1,12 @@ +/var/log/haproxy.log { + daily + rotate 10 + missingok + notifempty + compress + sharedscripts + postrotate + /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true + /bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true + endscript +} \ No newline at end of file diff --git a/app/scripts/ansible/roles/renew_letsencrypt.j2 b/app/scripts/ansible/roles/renew_letsencrypt.j2 index 5c6d9f9..d58e000 100644 --- a/app/scripts/ansible/roles/renew_letsencrypt.j2 +++ b/app/scripts/ansible/roles/renew_letsencrypt.j2 @@ -16,8 +16,8 @@ command+=" --non-interactive --agree-tos --email $email --http-01-port=8888" bash -c "$command" for i in $(ls -d */ |awk -F"/" '{print $1}'); do - bash -c "cat /etc/letsencrypt/live/$i/fullchain.pem /etc/letsencrypt/live/$i/privkey.pem > $path/$i.pem" + bash -c "cat /etc/letsencrypt/live/$i/fullchain.pem /etc/letsencrypt/live/$i/private.pem > $path/$i.pem" done # Reload HAProxy -sudo systemctl reload haproxy +sudo systemctl reload haproxy \ No newline at end of file diff --git a/app/users.py b/app/users.py index aec5c5e..579ce28 100644 --- a/app/users.py +++ b/app/users.py @@ -7,6 +7,9 @@ import platform env = Environment(loader=FileSystemLoader('templates/'), autoescape=True) template = env.get_template('admin.html') form = funct.form +openvpn_configs = '' +openvpn_sess = '' +openvpn = '' print('Content-type: text/html\n') @@ -21,9 +24,9 @@ try: grafana, stderr = funct.subprocess_execute("service grafana-server status |grep Active |awk '{print $1}'") services = [] - services_name = {'checker_haproxy': 'Master backends checker service', + services_name = {'checker_haproxy': 'Checker backends master service', 'keep_alive': 'Auto start service', - 'metrics_haproxy': 'Master metrics service', + 'metrics_haproxy': 'Metrics master service', 'prometheus': 'Prometheus service', 'grafana-server': 'Grafana service', 'smon': 'Simple monitoring network ports', @@ -39,10 +42,6 @@ try: service_ver, stderr = funct.subprocess_execute(cmd) services.append([s, status, v, service_ver[0]]) - openvpn_configs = '' - openvpn_sess = '' - openvpn = '' - try: os_name = platform.linux_distribution()[0] except Exception: