Changelog: https://roxy-wi.org/changelog.py#6
pull/321/head
Pavel Loginov 2022-04-20 11:08:36 +03:00
parent c72f5b97b9
commit 56a634ef60
19 changed files with 96 additions and 58 deletions

View File

@ -37,7 +37,7 @@ if service == 'keepalived':
servers = sql.get_dick_permit(keepalived=1)
elif service == 'nginx':
if funct.check_login(service=2):
title = "Working with Nginx configuration files"
title = "Working with NGINX configuration files"
action = "config.py?service=nginx"
configs_dir = funct.get_config_var('configs', 'nginx_save_configs_dir')
file_format = 'conf'
@ -77,7 +77,7 @@ if serv is not None and form.getvalue('open') is not None and form.getvalue('new
elif service == 'nginx':
error = funct.get_config(serv, cfg, nginx=1, config_file_name=config_file_name)
try:
funct.logging(serv, " Nginx config has been opened ")
funct.logging(serv, " NGINX config has been opened ")
except Exception:
pass
elif service == 'apache':

View File

@ -57,19 +57,19 @@ def default_values():
{'param': 'apache_log_path', 'value': '/var/log/'+apache_dir+'/', 'section': 'logs', 'desc': 'Path to Apache logs',
'group': '1'},
{'param': 'nginx_path_logs', 'value': '/var/log/nginx/', 'section': 'nginx',
'desc': 'The path for Nginx logs', 'group': '1'},
{'param': 'nginx_stats_user', 'value': 'admin', 'section': 'nginx', 'desc': 'Username for accessing Nginx stats page',
'desc': 'The path for NGINX logs', 'group': '1'},
{'param': 'nginx_stats_user', 'value': 'admin', 'section': 'nginx', 'desc': 'Username for accessing NGINX stats page',
'group': '1'},
{'param': 'nginx_stats_password', 'value': 'password', 'section': 'nginx',
'desc': 'Password for Stats web page Nginx', 'group': '1'},
{'param': 'nginx_stats_port', 'value': '8086', 'section': 'nginx', 'desc': 'Stats port for web page Nginx',
'desc': 'Password for Stats web page NGINX', 'group': '1'},
{'param': 'nginx_stats_port', 'value': '8086', 'section': 'nginx', 'desc': 'Stats port for web page NGINX',
'group': '1'},
{'param': 'nginx_stats_page', 'value': 'stats', 'section': 'nginx', 'desc': 'URI Stats for web page Nginx',
{'param': 'nginx_stats_page', 'value': 'stats', 'section': 'nginx', 'desc': 'URI Stats for web page NGINX',
'group': '1'},
{'param': 'nginx_dir', 'value': '/etc/nginx/', 'section': 'nginx',
'desc': 'Path to the Nginx directory with config files', 'group': '1'},
'desc': 'Path to the NGINX directory with config files', 'group': '1'},
{'param': 'nginx_config_path', 'value': '/etc/nginx/nginx.conf', 'section': 'nginx',
'desc': 'Path to the main Nginx configuration file', 'group': '1'},
'desc': 'Path to the main NGINX configuration file', 'group': '1'},
{'param': 'ldap_enable', 'value': '0', 'section': 'ldap', 'desc': 'Enable LDAP (1 - yes, 0 - no)',
'group': '1'},
{'param': 'ldap_server', 'value': '', 'section': 'ldap', 'desc': 'IP address of the LDAP server', 'group': '1'},
@ -167,6 +167,23 @@ def default_values():
except Exception as e:
print(str(e))
data_source = [
{'service_id': 1, 'service': 'HAProxy'},
{'service_id': 2, 'service': 'NGINX'},
{'service_id': 3, 'service': 'Keepalived'},
{'service_id': 4, 'service': 'Apache'},
]
try:
Services.insert_many(data_source).on_conflict_ignore().execute()
except Exception as e:
print(str(e))
try:
Groups.insert(name='All', description='All servers are included in this group by default').on_conflict_ignore().execute()
except Exception as e:
print(str(e))
data_source = [
{'code': 'RW', 'name': 'Rwanda'},
{'code': 'SO', 'name': 'Somalia'},
@ -554,7 +571,7 @@ def update_db_v_5_3_0(**kwargs):
try:
data_source = [
{'param': 'nginx_container_name', 'value': 'nginx', 'section': 'nginx',
'desc': 'Docker container name for Nginx service',
'desc': 'Docker container name for NGINX service',
'group': g.group_id},
{'param': 'haproxy_container_name', 'value': 'haproxy', 'section': 'haproxy',
'desc': 'Docker container name for HAProxy service',

View File

@ -23,7 +23,7 @@ keep_alive, stderr = funct.subprocess_execute(cmd)
if service == 'nginx':
if funct.check_login(service=2):
title = 'Nginx servers overview'
title = 'NGINX servers overview'
if serv:
if funct.check_is_server_in_group(serv):
servers = sql.select_servers(server=serv)

View File

@ -39,7 +39,7 @@ except Exception:
if service == 'nginx':
if funct.check_login(service=2):
title = "Nginx`s logs"
title = "NGINX`s logs"
servers = sql.get_dick_permit(nginx=1)
elif service == 'apache':
if funct.check_login(service=4):

View File

@ -27,7 +27,7 @@ try:
else:
if service == 'nginx':
if funct.check_login(service=2):
title = "Nginx`s metrics"
title = "NGINX`s metrics"
servers = sql.select_nginx_servers_metrics_for_master()
else:
if funct.check_login(service=1):

View File

@ -2479,13 +2479,14 @@ if form.getvalue('getuserservices'):
user_id = form.getvalue('getuserservices')
groups = []
u_g = sql.select_user_groups(user_id)
services = sql.select_services()
for g in u_g:
groups.append(g.user_group_id)
from jinja2 import Environment, FileSystemLoader
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True)
template = env.get_template('/show_user_services.html')
template = template.render(user_services=sql.select_user_services(user_id), id=user_id)
template = template.render(user_services=sql.select_user_services(user_id), id=user_id, services=services)
print(template)
if form.getvalue('getusergroups'):

25
app/sql.py Normal file → Executable file
View File

@ -160,19 +160,19 @@ def add_setting_for_new_group(group_id):
{'param': 'haproxy_sock_port', 'value': '1999', 'section': 'haproxy', 'desc': 'Socket port for HAProxy',
'group': group_id},
{'param': 'nginx_path_logs', 'value': '/var/log/nginx/', 'section': 'nginx',
'desc': 'Nginx error log', 'group': group_id},
{'param': 'nginx_stats_user', 'value': 'admin', 'section': 'nginx', 'desc': 'Username for accessing Nginx stats page',
'desc': 'NGINX error log', 'group': group_id},
{'param': 'nginx_stats_user', 'value': 'admin', 'section': 'nginx', 'desc': 'Username for accessing NGINX stats page',
'group': group_id},
{'param': 'nginx_stats_password', 'value': 'password', 'section': 'nginx',
'desc': 'Password for accessing Nginx stats page', 'group': group_id},
{'param': 'nginx_stats_port', 'value': '8086', 'section': 'nginx', 'desc': 'Stats port for web page Nginx',
'desc': 'Password for accessing NGINX stats page', 'group': group_id},
{'param': 'nginx_stats_port', 'value': '8086', 'section': 'nginx', 'desc': 'Stats port for web page NGINX',
'group': group_id},
{'param': 'nginx_stats_page', 'value': 'stats', 'section': 'nginx', 'desc': 'URI Stats for web page Nginx',
{'param': 'nginx_stats_page', 'value': 'stats', 'section': 'nginx', 'desc': 'URI Stats for web page NGINX',
'group': group_id},
{'param': 'nginx_dir', 'value': '/etc/nginx/', 'section': 'nginx',
'desc': 'Path to the Nginx directory with config files', 'group': group_id},
'desc': 'Path to the NGINX directory with config files', 'group': group_id},
{'param': 'nginx_config_path', 'value': '/etc/nginx/nginx.conf', 'section': 'nginx',
'desc': 'Path to the main Nginx configuration file', 'group': group_id},
'desc': 'Path to the main NGINX configuration file', 'group': group_id},
{'param': 'ldap_enable', 'value': '0', 'section': 'ldap', 'desc': 'Enable LDAP (1 - yes, 0 - no)',
'group': group_id},
{'param': 'ldap_server', 'value': '', 'section': 'ldap', 'desc': 'IP address of the LDAP server', 'group': group_id},
@ -3122,3 +3122,14 @@ def select_os_info(server_id):
return
else:
return query_res
def select_services():
query = Services.select()
try:
query_res = query.execute()
except Exception as e:
out_error(e)
return
else:
return query_res

View File

@ -66,7 +66,7 @@ u:hover div.tips {visibility:visible;}
<tr class="titre">
<th class="pxname" style="background-color: rgb(93, 156, 235); width: 100%; padding-top: 4px; padding-bottom: 4px; border-color: rgb(221, 221, 221);">
<a name="status">
<a class="px" href="#stats" style="color: rgb(255, 255, 255);">Nginx status</a>
<a class="px" href="#stats" style="color: rgb(255, 255, 255);">NGINX status</a>
</th>
</tr>
@ -121,6 +121,6 @@ u:hover div.tips {visibility:visible;}
</tr>
</table>
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
You can read the description about statuses <a href="https://roxy-wi.org/description.py?description=nginx_status" title="Nginx status page description" target="_blank">here</a>
You can read the description about statuses <a href="https://roxy-wi.org/description.py?description=nginx_status" title="NGINX status page description" target="_blank">here</a>
</div>
{% endfor %}

View File

@ -18,12 +18,12 @@
</td>
<td class="padding10 first-collumn">
{% if service.8|int() == 0 %}
<span class="serverNone server-status" title="Nginx is not installed"
<span class="serverNone server-status" title="NGINX is not installed"
{% else %}
{% if service.9|int() >= 1 %}
<span class="serverUp server-status" title="Nginx is running"
<span class="serverUp server-status" title="NGINX is running"
{% else %}
<span class="serverDown server-status" title="Nginx is down"
<span class="serverDown server-status" title="NGINX is down"
{% endif %}
{% endif %}
style="margin-left: 4px !important;" id="nginx_{{service.10}}"></span>

View File

@ -54,7 +54,7 @@
{% if s.dockerized != '' and s.setting == 'dockerized' %}
<tr>
<td class="padding20 help_cursor" style="width: 70%"
title="If you use Nginx inside Docker, check this. Roxy-WI is starting managing it as Docker container">Nginx dockerized</td>
title="If you use NGINX inside Docker, check this. Roxy-WI is starting managing it as Docker container">NGINX dockerized</td>
<td>
{% if s.value == '1' and s.setting == 'dockerized' %}
{{ checkbox('nginx_dockerized', checked='checked', title='This service is running inside a Docker container') }}
@ -68,7 +68,7 @@
{% else %}
<tr>
<td class="padding20 help_cursor" style="width: 70%"
title="If you use Nginx inside Docker, check this. Roxy-WI is starting managing it as Docker container">Nginx dockerized</td>
title="If you use NGINX inside Docker, check this. Roxy-WI is starting managing it as Docker container">NGINX dockerized</td>
<td>
{{ checkbox('nginx_dockerized', title='This server will be used as Docker container') }}
</td>

View File

@ -52,17 +52,16 @@
border-color: #aaa;
}
</style>
{% set services = {'1': 'HAProxy', '2': 'Nginx', '4': 'Apache', '3': 'Keepalived' } %}
<table class="overview">
<tr style="border: none;">
<td class="padding20" style="width: 40%;"><b>Select one or more services</b></td>
<td>
<select id="userservice-{{id}}" name="userservice-{{id}}" multiple class="select-css">
{% for key, value in services.items() %}
{% if key in user_services %}
<option value="{{ key }}" selected>{{ value }}</option>
{% for s in services %}
{% if s.service_id|string() in user_services %}
<option value="{{ s.service_id }}" selected>{{ s.service }}</option>
{% else %}
<option value="{{ key }}">{{ value }}</option>
<option value="{{ s.service_id }}">{{ s.service }}</option>
{% endif %}
{% endfor %}
</select>

View File

@ -80,14 +80,14 @@
{% endif %}
{% if '2' in user_services %}
<li class="p_menu">
<a title="Actions with Nginx" class="nginx-menu">Nginx</a>
<a title="Actions with NGINX" class="nginx-menu">NGINX</a>
<ul class="v_menu">
<li><a href="/app/hapservers.py?service=nginx" title="Overview Nginx servers" class="overview-link head-submenu">Overview</a></li>
<li><a href="/app/config.py?service=nginx" title="Working with Nginx configs" class="edit head-submenu">Configs</a></li>
<li><a href="/app/viewsttats.py?service=nginx" title="Nginx statistics" class="stats head-submenu">Stats</a></li>
<li><a href="/app/metrics.py?service=nginx" title="Nginx's metrics" class="metrics head-submenu">Metrics</a></li>
<li><a href="/app/hapservers.py?service=nginx" title="Overview NGINX servers" class="overview-link head-submenu">Overview</a></li>
<li><a href="/app/config.py?service=nginx" title="Working with NGINX configs" class="edit head-submenu">Configs</a></li>
<li><a href="/app/viewsttats.py?service=nginx" title="NGINX statistics" class="stats head-submenu">Stats</a></li>
<li><a href="/app/metrics.py?service=nginx" title="NGINX's metrics" class="metrics head-submenu">Metrics</a></li>
{% if role <= 3 %}
<li><a href="/app/versions.py?service=nginx" title="Working with versions Nginx configs" class="version head-submenu">Versions</a></li>
<li><a href="/app/versions.py?service=nginx" title="Working with versions NGINX configs" class="version head-submenu">Versions</a></li>
<li><a href="/app/add.py?service=nginx#ssl" title="Add proxy: Upload SSL certificates - Roxy-WI" class="cert head-submenu" id="add3">SSL</a></li>
{% endif %}
</ul>

View File

@ -49,8 +49,8 @@
<td class="checkbox-head">SYN-flood protection</td>
<td class="checkbox-head help_cursor" style="padding: 10px 10px 10px 0;"><span title="Roxy-WI will try to install HAProxy">HAProxy</span></td>
<td class="checkbox-head help_cursor" style="display: none" id="haproxy_docker_td_header"><span title="Roxy-WI will install HAProxy as Docker container">Docker</span></td>
<td class="checkbox-head help_cursor"><span title="Roxy-WI will try to install Nginx">Nginx</span></td>
<td class="checkbox-head help_cursor" style="display: none" id="nginx_docker_td_header"><span title="Roxy-WI will install Nginx as Docker container">Docker</span></td>
<td class="checkbox-head help_cursor"><span title="Roxy-WI will try to install NGINX">NGINX</span></td>
<td class="checkbox-head help_cursor" style="display: none" id="nginx_docker_td_header"><span title="Roxy-WI will install NGINX as Docker container">Docker</span></td>
<td></td>
<td></td>
</tr>
@ -61,8 +61,8 @@
<td class="syn-flood-protection-field">{{ checkbox('syn_flood') }}</td>
<td class="checkbox help_cursor" style="padding: 10px 10px 10px 15px;">{{ checkbox('hap', title='Roxy-WI will try to install HAProxy') }}</td>
<td class="checkbox help_cursor" style="display: none" id="haproxy_docker_td">{{ checkbox('hap_docker', title='Roxy-WI will install HAProxy as a Docker container') }}</td>
<td class="checkbox help_cursor">{{ checkbox('nginx', title='Roxy-WI will try to install Nginx') }}</td>
<td class="checkbox help_cursor" style="display: none" id="nginx_docker_td">{{ checkbox('nginx_docker', title='Roxy-WI will install Nginx as a Docker container') }}</td>
<td class="checkbox help_cursor">{{ checkbox('nginx', title='Roxy-WI will try to install NGINX') }}</td>
<td class="checkbox help_cursor" style="display: none" id="nginx_docker_td">{{ checkbox('nginx_docker', title='Roxy-WI will install NGINX as a Docker container') }}</td>
<td>
<button id="create" title="Create HA cluster">Create</button>
</td>
@ -124,8 +124,8 @@
<li id="creating-haproxy-slave" class="server-creating">Installing Slave Haproxy...</li>
</div>
<div id="nginx_installing_div" style="display: none">
<li id="creating-nginx-master" class="server-creating">Installing Master Nginx...</li>
<li id="creating-nginx-slave" class="server-creating">Installing Slave Nginx...</li>
<li id="creating-nginx-master" class="server-creating">Installing Master NGINX...</li>
<li id="creating-nginx-slave" class="server-creating">Installing Slave NGINX...</li>
</div>
</ul>
<div id="wait-mess"></div>

View File

@ -27,7 +27,7 @@
<td>{{ checkbox('typeip') }}</td>
</tr>
<tr>
<td class="padding20 help_cursor" title="Scan the server for HAProxy, Nginx, Keepalived and Firewalld services">Scan the server</td>
<td class="padding20 help_cursor" title="Scan the server for HAProxy, NGINX, Keepalived and Firewalld services">Scan the server</td>
<td>{{ checkbox('scan_server', checked='checked') }}</td>
</tr>
<tr class="services_for_scan" style="display: none">
@ -35,7 +35,7 @@
<td>{{ checkbox('haproxy') }} </td>
</tr>
<tr class="services_for_scan" style="display: none">
<td class="padding20" title="Is there Nginx?">Nginx</td>
<td class="padding20" title="Is there NGINX?">NGINX</td>
<td>{{ checkbox('nginx') }}</td>
</tr>
<tr class="services_for_scan" style="display: none">

View File

@ -63,7 +63,7 @@
</tr>
</table>
<table>
<caption><h3>Install Nginx Exporter</h3></caption>
<caption><h3>Install NGINX Exporter</h3></caption>
<tr class="overviewHead">
<td class="padding10 first-collumn">Current installation</td>
<td class="padding10 first-collumn" style="width: 30%;">Available Versions</td>
@ -89,7 +89,7 @@
</select>
</td>
<td>
<span class="ui-button ui-widget ui-corner-all" id="nginx_exp_install" title="Install Nginx Exporter">Install</span>
<span class="ui-button ui-widget ui-corner-all" id="nginx_exp_install" title="Install NGINX Exporter">Install</span>
</td>
</tr>
</table>

View File

@ -34,8 +34,8 @@
</a>
</td>
<td class="padding10">
<a href="/app/hapservers.py?service=nginx" title="Nginx servers overview" class="logs_link">
Nginx
<a href="/app/hapservers.py?service=nginx" title="NGINX servers overview" class="logs_link">
NGINX
</a>
</td>
<td class="padding10">

View File

@ -82,12 +82,12 @@
</tr>
</table>
<table>
<caption><h3>Install Nginx</h3></caption>
<caption><h3>Install NGINX</h3></caption>
<tr class="overviewHead">
<td class="padding10 first-collumn">Current version</td>
<td class="padding10 first-collumn" style="width: 30%;">Available Versions</td>
<td class="padding10 first-collumn" style="width: 20%;">Server</td>
<td class="help_cursor" title="Install Nginx service as a Docker container" >Use Docker</td>
<td class="help_cursor" title="Install NGINX service as a Docker container" >Use Docker</td>
<td>SYN-flood protection</td>
<td></td>
</tr>
@ -95,7 +95,7 @@
<td id="cur_nginx_ver" class="padding10 first-collumn">
</td>
<td class="padding10 first-collumn" style="width: 20%;">
Roxy-WI will try to install the latest Nginx version from an official Nginx repository
Roxy-WI will try to install the latest NGINX version from an official NGINX repository
</td>
<td class="padding10 first-collumn">
<select autofocus required name="nginxaddserv" id="nginxaddserv">
@ -106,13 +106,13 @@
</select>
</td>
<td style="padding-left: 25px;">
{{ checkbox('nginx_docker', title="Install Nginx service as a Docker container") }}
{{ checkbox('nginx_docker', title="Install NGINX service as a Docker container") }}
</td>
<td class="syn-flood-protection-field">
{{ checkbox('nginx_syn_flood', title="Enable SYN-flood protection", checked='checked') }}
</td>
<td>
<span class="ui-button ui-widget ui-corner-all" id="nginx_install" title="Install Nginx">Install</span>
<span class="ui-button ui-widget ui-corner-all" id="nginx_install" title="Install NGINX">Install</span>
</td>
</tr>
</table>

View File

@ -38,10 +38,17 @@ if service == 'keepalived':
elif service == 'nginx':
if funct.check_login(service=2):
configs_dir = funct.get_config_var('configs', 'nginx_save_configs_dir')
title = "Working with versions Nginx configs"
title = "Working with versions NGINX configs"
conf_format = 'conf'
servers = sql.get_dick_permit(nginx=1)
action = 'versions.py?service=nginx'
elif service == 'apache':
if funct.check_login(service=4):
configs_dir = funct.get_config_var('configs', 'apache_save_configs_dir')
title = "Working with versions Apache configs"
conf_format = 'conf'
servers = sql.get_dick_permit(apache=1)
action = 'versions.py?service=apache'
else:
service = 'haproxy'
if funct.check_login(service=1):
@ -92,6 +99,9 @@ if serv is not None and form.getvalue('config') is not None:
elif service == 'nginx':
config_file_name = sql.select_remote_path_from_version(server_ip=serv, service=service, local_path=configver)
stderr = funct.master_slave_upload_and_restart(serv, configver, just_save=save, nginx=1, config_file_name=config_file_name)
elif service == 'apache':
config_file_name = sql.select_remote_path_from_version(server_ip=serv, service=service, local_path=configver)
stderr = funct.master_slave_upload_and_restart(serv, configver, just_save=save, apache=1, config_file_name=config_file_name)
else:
stderr = funct.master_slave_upload_and_restart(serv, configver, just_save=save)

View File

@ -12,7 +12,7 @@ funct.check_login()
if service == 'nginx':
if funct.check_login(service=2):
title = 'Nginx stats page'
title = 'NGINX stats page'
else:
if funct.check_login(service=1):
title = 'HAProxy stats page'