diff --git a/app/config.py b/app/config.py index 9a6e5f16..498f063d 100644 --- a/app/config.py +++ b/app/config.py @@ -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': diff --git a/app/create_db.py b/app/create_db.py index d2ccd459..7b895bbd 100644 --- a/app/create_db.py +++ b/app/create_db.py @@ -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', diff --git a/app/hapservers.py b/app/hapservers.py index 229ee6a5..ce37d443 100644 --- a/app/hapservers.py +++ b/app/hapservers.py @@ -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) diff --git a/app/logs.py b/app/logs.py index 1d051364..17abfa8f 100644 --- a/app/logs.py +++ b/app/logs.py @@ -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): diff --git a/app/metrics.py b/app/metrics.py index 9b5317d8..6c6cdcb5 100644 --- a/app/metrics.py +++ b/app/metrics.py @@ -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): diff --git a/app/options.py b/app/options.py index 677da913..ef2a3aa2 100644 --- a/app/options.py +++ b/app/options.py @@ -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'): diff --git a/app/sql.py b/app/sql.py old mode 100644 new mode 100755 index 2119189d..5cdf9e42 --- a/app/sql.py +++ b/app/sql.py @@ -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 diff --git a/app/templates/ajax/nginx_stats.html b/app/templates/ajax/nginx_stats.html index cb87f6b9..77baac2f 100644 --- a/app/templates/ajax/nginx_stats.html +++ b/app/templates/ajax/nginx_stats.html @@ -66,7 +66,7 @@ u:hover div.tips {visibility:visible;} - Nginx status + NGINX status @@ -121,6 +121,6 @@ u:hover div.tips {visibility:visible;}
- You can read the description about statuses here + You can read the description about statuses here
{% endfor %} diff --git a/app/templates/ajax/overview.html b/app/templates/ajax/overview.html index 8a4de95b..a4eccb4d 100644 --- a/app/templates/ajax/overview.html +++ b/app/templates/ajax/overview.html @@ -18,12 +18,12 @@ {% if service.8|int() == 0 %} - = 1 %} - diff --git a/app/templates/ajax/show_service_settings.html b/app/templates/ajax/show_service_settings.html index 721419a1..276a88ec 100644 --- a/app/templates/ajax/show_service_settings.html +++ b/app/templates/ajax/show_service_settings.html @@ -54,7 +54,7 @@ {% if s.dockerized != '' and s.setting == 'dockerized' %} Nginx dockerized + title="If you use NGINX inside Docker, check this. Roxy-WI is starting managing it as Docker container">NGINX dockerized {% 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 %} Nginx dockerized + title="If you use NGINX inside Docker, check this. Roxy-WI is starting managing it as Docker container">NGINX dockerized {{ checkbox('nginx_dockerized', title='This server will be used as Docker container') }} diff --git a/app/templates/ajax/show_user_services.html b/app/templates/ajax/show_user_services.html index 82e82b0c..dac23ab3 100644 --- a/app/templates/ajax/show_user_services.html +++ b/app/templates/ajax/show_user_services.html @@ -52,17 +52,16 @@ border-color: #aaa; } -{% set services = {'1': 'HAProxy', '2': 'Nginx', '4': 'Apache', '3': 'Keepalived' } %} - - + + @@ -61,8 +61,8 @@ - - + + @@ -124,8 +124,8 @@
  • Installing Slave Haproxy...
  • diff --git a/app/templates/include/admin_add_server.html b/app/templates/include/admin_add_server.html index d3c4548d..8e953df2 100644 --- a/app/templates/include/admin_add_server.html +++ b/app/templates/include/admin_add_server.html @@ -27,7 +27,7 @@ - + @@ -35,7 +35,7 @@ - + diff --git a/app/templates/include/mon_installation.html b/app/templates/include/mon_installation.html index 4d534a34..30f448d8 100644 --- a/app/templates/include/mon_installation.html +++ b/app/templates/include/mon_installation.html @@ -63,7 +63,7 @@
    Select one or more services diff --git a/app/templates/base.html b/app/templates/base.html index b849d4ec..7837b393 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -80,14 +80,14 @@ {% endif %} {% if '2' in user_services %}
  • - Nginx + NGINX diff --git a/app/templates/ha.html b/app/templates/ha.html index 8d93326b..72a448cb 100644 --- a/app/templates/ha.html +++ b/app/templates/ha.html @@ -49,8 +49,8 @@
  • SYN-flood protection HAProxy NginxNGINX
    {{ checkbox('syn_flood') }} {{ checkbox('hap', title='Roxy-WI will try to install HAProxy') }} {{ checkbox('nginx', title='Roxy-WI will try to install Nginx') }}{{ checkbox('nginx', title='Roxy-WI will try to install NGINX') }} {{ checkbox('typeip') }}
    Scan the serverScan the server {{ checkbox('scan_server', checked='checked') }}
    - + @@ -89,7 +89,7 @@

    Install Nginx Exporter

    Install NGINX Exporter

    Current installation Available Versions - Install + Install
    diff --git a/app/templates/ovw.html b/app/templates/ovw.html index 3332fa92..ed566236 100644 --- a/app/templates/ovw.html +++ b/app/templates/ovw.html @@ -34,8 +34,8 @@ - - Nginx + + NGINX diff --git a/app/templates/servers.html b/app/templates/servers.html index cfd283f9..5172a8bd 100644 --- a/app/templates/servers.html +++ b/app/templates/servers.html @@ -82,12 +82,12 @@ - + - + @@ -95,7 +95,7 @@

    Install Nginx

    Install NGINX

    Current version Available Versions ServerUse DockerUse Docker SYN-flood protection
    - 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 - {{ checkbox('nginx_docker', title="Install Nginx service as a Docker container") }} + {{ checkbox('nginx_docker', title="Install NGINX service as a Docker container") }} {{ checkbox('nginx_syn_flood', title="Enable SYN-flood protection", checked='checked') }} - Install + Install
    diff --git a/app/versions.py b/app/versions.py index fb886507..0421bce8 100644 --- a/app/versions.py +++ b/app/versions.py @@ -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) diff --git a/app/viewsttats.py b/app/viewsttats.py index e392730f..4446573d 100644 --- a/app/viewsttats.py +++ b/app/viewsttats.py @@ -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'