mirror of https://github.com/Aidaho12/haproxy-wi
parent
0054f25da7
commit
be142bd8f3
|
@ -424,6 +424,12 @@ def create_server(hostname, ip, group, typeip, enable, master, cred, port, desc,
|
||||||
|
|
||||||
if sql.add_server(hostname, ip, group, typeip, enable, master, cred, port, desc, haproxy, nginx, apache, firewall):
|
if sql.add_server(hostname, ip, group, typeip, enable, master, cred, port, desc, haproxy, nginx, apache, firewall):
|
||||||
try:
|
try:
|
||||||
|
try:
|
||||||
|
sql.insert_new_checker_setting_for_server(ip)
|
||||||
|
except Exception as e:
|
||||||
|
roxywi_common.logging(f'Cannot insert Checker settings for {hostname}', str(e), roxywi=1)
|
||||||
|
raise Exception(f'error: Cannot insert Checker settings for {hostname} {e}')
|
||||||
|
|
||||||
if scan_server == '1':
|
if scan_server == '1':
|
||||||
nginx_config_path = sql.get_setting('nginx_config_path')
|
nginx_config_path = sql.get_setting('nginx_config_path')
|
||||||
haproxy_config_path = sql.get_setting('haproxy_config_path')
|
haproxy_config_path = sql.get_setting('haproxy_config_path')
|
||||||
|
@ -454,12 +460,6 @@ def create_server(hostname, ip, group, typeip, enable, master, cred, port, desc,
|
||||||
roxywi_common.logging(f'Cannot scan a new server {hostname}', str(e), roxywi=1)
|
roxywi_common.logging(f'Cannot scan a new server {hostname}', str(e), roxywi=1)
|
||||||
raise Exception(f'error: Cannot scan a new server {hostname} {e}')
|
raise Exception(f'error: Cannot scan a new server {hostname} {e}')
|
||||||
|
|
||||||
try:
|
|
||||||
sql.insert_new_checker_setting_for_server(ip)
|
|
||||||
except Exception as e:
|
|
||||||
roxywi_common.logging(f'Cannot insert Checker settings for {hostname}', str(e), roxywi=1)
|
|
||||||
raise Exception(f'error: Cannot insert Checker settings for {hostname} {e}')
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
get_system_info(ip)
|
get_system_info(ip)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
@ -20,17 +20,14 @@ except Exception as e:
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
form = common.form
|
form = common.form
|
||||||
|
servbackend = form.getvalue('servbackend')
|
||||||
try:
|
serv = form.getvalue('serv')
|
||||||
servbackend = form.getvalue('servbackend')
|
if servbackend is None:
|
||||||
serv = form.getvalue('serv')
|
|
||||||
if servbackend is None:
|
|
||||||
servbackend = ""
|
servbackend = ""
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
|
|
||||||
rendered_template = template.render(
|
rendered_template = template.render(
|
||||||
h2=0, title="RunTime API", role=user_params['role'], user=user_params['user'], select_id="serv",
|
h2=0, title="RunTime API", role=user_params['role'], user=user_params['user'], select_id="serv",
|
||||||
selects=user_params['servers'], token=user_params['token'], user_services=user_params['user_services'], servbackend=servbackend
|
selects=user_params['servers'], token=user_params['token'], user_services=user_params['user_services'],
|
||||||
|
servbackend=servbackend, lang=user_params['lang']
|
||||||
)
|
)
|
||||||
print(rendered_template)
|
print(rendered_template)
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
{% block title %}{{lang.menu_links.add_proxy|title()}}{% endblock %}
|
||||||
|
{% block h2 %}{{lang.menu_links.add_proxy|title()}}{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% from 'include/input_macros.html' import input, checkbox, select %}
|
{% from 'include/input_macros.html' import input, checkbox, select %}
|
||||||
{% set balance_params = dict() %}
|
{% set balance_params = dict() %}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block title %}{{lang.menu_links.add_proxy.title}}{% endblock %}
|
{% block title %}{{lang.menu_links.add_proxy|title()}}{% endblock %}
|
||||||
{% block h2 %}{{lang.menu_links.add_proxy.title}}{% endblock %}
|
{% block h2 %}{{lang.menu_links.add_proxy|title()}}{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% from 'include/input_macros.html' import input, checkbox, select %}
|
{% from 'include/input_macros.html' import input, checkbox, select %}
|
||||||
{% set balance_params = dict() %}
|
{% set balance_params = dict() %}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block title %}{{ lang.menu_links.ha.title }} {% endblock %}
|
{% block title %}{{ lang.menu_links.ha|title() }} {% endblock %}
|
||||||
{% block h2 %}{{ lang.menu_links.ha.title }} {% endblock %}
|
{% block h2 %}{{ lang.menu_links.ha|title() }} {% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% from 'include/input_macros.html' import input, checkbox %}
|
{% from 'include/input_macros.html' import input, checkbox %}
|
||||||
<script src="/inc/users.js"></script>
|
<script src="/inc/users.js"></script>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{% from 'include/input_macros.html' import copy_to_clipboard %}
|
{% from 'include/input_macros.html' import copy_to_clipboard %}
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block title %}{{ lang.menu_links.history.title }} {{ lang.words[service] }}{% endblock %}
|
{% block title %}{{ lang.menu_links.history|title() }} {{ lang.words[service] }}{% endblock %}
|
||||||
{% block h2 %}{{ lang.menu_links.history.title }} {{ lang.words[service] }}{% endblock %}
|
{% block h2 %}{{ lang.menu_links.history|title() }} {{ lang.words[service] }}{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% if user_status == 0 or user_plan == 'user' %}
|
{% if user_status == 0 or user_plan == 'user' %}
|
||||||
{% include 'include/no_sub.html' %}
|
{% include 'include/no_sub.html' %}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block title %}{{lang.menu_links.overview.title}}{% endblock %}
|
{% block title %}{{lang.menu_links.overview|title()}}{% endblock %}
|
||||||
{% block h2 %}{{lang.menu_links.overview.h2}}{% endblock %}
|
{% block h2 %}{{lang.menu_links.overview.h2}}{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<link href="/inc/css/chart.min.css" rel="stylesheet">
|
<link href="/inc/css/chart.min.css" rel="stylesheet">
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
{% block title %}Runtime API{% endblock %}
|
||||||
|
{% block h2 %}Runtime API{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% from 'include/input_macros.html' import input, checkbox %}
|
{% from 'include/input_macros.html' import input, checkbox %}
|
||||||
<link href="/inc/css/table.css" rel="stylesheet" type="text/css">
|
<link href="/inc/css/table.css" rel="stylesheet" type="text/css">
|
||||||
|
@ -8,11 +10,11 @@
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#runtimeapi" title="Runtime API - Roxy-WI">Runtime API</a></li>
|
<li><a href="#runtimeapi" title="Runtime API - Roxy-WI">Runtime API</a></li>
|
||||||
{% if role <= 3 %}
|
{% if role <= 3 %}
|
||||||
<li><a href="#maxconn" title="Runtime API: Changing Maxconn - Roxy-WI">Change Maxconn</a></li>
|
<li><a href="#maxconn" title="Runtime API: {{lang.words.change|title()}} Maxconn - Roxy-WI">{{lang.words.change|title()}} Maxconn</a></li>
|
||||||
<li><a href="#ip" title="Runtime API: Changing IP and Port for backend servers - Roxy-WI">Change IP and Port</a></li>
|
<li><a href="#ip" title="Runtime API: {{lang.words.change|title()}} IP {{lang.words.and}} {{lang.words.port}} {{lang.words.backend}} {{lang.words.servers}} - Roxy-WI">{{lang.words.change|title()}} IP {{lang.words.and}} {{lang.words.port}}</a></li>
|
||||||
<li><a href="#table" title="Runtime API: Stick Table - Roxy-WI">Stick Table</a></li>
|
<li><a href="#table" title="Runtime API: Stick Table - Roxy-WI">Stick Table</a></li>
|
||||||
<li><a href="#lists" title="Runtime API: Change dynamically whitelist and blacklist - Roxy-WI">Lists</a></li>
|
<li><a href="#lists" title="Runtime API: {{lang.words.change|title()}} {{lang.words.dynamically}}} whitelist {{lang.words.and}} blacklist - Roxy-WI">{{lang.words.lists|title()}}</a></li>
|
||||||
<li><a href="#sessions" title="Runtime API: Sessions - Roxy-WI">Sessions</a></li>
|
<li><a href="#sessions" title="Runtime API: {{lang.words.sessions|title()}}} - Roxy-WI">{{lang.words.sessions|title()}}</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% include 'include/login.html' %}
|
{% include 'include/login.html' %}
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -20,11 +22,11 @@
|
||||||
<div id="runtimeapi">
|
<div id="runtimeapi">
|
||||||
<table class="overview">
|
<table class="overview">
|
||||||
<tr class="overviewHead">
|
<tr class="overviewHead">
|
||||||
<td class="padding10 first-collumn">Server</td>
|
<td class="padding10 first-collumn">{{lang.words.server|title()}}</td>
|
||||||
<td>Disable/Enable server or output any information</td>
|
<td>{{lang.words.action|title()}}</td>
|
||||||
<td>Command</td>
|
<td>{{lang.words.command|title()}}</td>
|
||||||
{% if role <= 3 %}
|
{% if role <= 3 %}
|
||||||
<td class="checkbox-head">Save change</td>
|
<td class="checkbox-head">{{lang.words.save|title()}} {{lang.words.change}}</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -35,7 +37,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td style="width: 30%;">
|
<td style="width: 30%;">
|
||||||
<select required name="servaction" id="servaction">
|
<select required name="servaction" id="servaction">
|
||||||
<option disabled>Choose action</option>
|
<option disabled>{{lang.words.select|title()}} {{lang.words.action}}</option>
|
||||||
{% if role <= 3 %}
|
{% if role <= 3 %}
|
||||||
<option value="disable">Disable</option>
|
<option value="disable">Disable</option>
|
||||||
<option value="shutdown">Shutdown</option>
|
<option value="shutdown">Shutdown</option>
|
||||||
|
@ -57,7 +59,7 @@
|
||||||
</td>
|
</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<td>
|
<td>
|
||||||
<button type="submit" name="Enter" value="Enter" id="enter">Enter</button>
|
<button type="submit" name="Enter" value="Enter" id="enter">{{lang.words.enter|title()}}</button>
|
||||||
</td>
|
</td>
|
||||||
</form>
|
</form>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -74,15 +76,15 @@
|
||||||
</script>
|
</script>
|
||||||
<div id="ajaxruntime"></div>
|
<div id="ajaxruntime"></div>
|
||||||
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
|
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
|
||||||
You can read the description of all Run Time API <a href="https://roxy-wi.org/description/runtimeapi#commands" title="Run Time API description" target="_blank">here</a>
|
You can read the description of all Run Time API <a href="https://roxy-wi.org/description/runtimeapi#commands" title="Runtime API {{lang.words.desc}}" target="_blank">{{lang.words.here}}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% if role <= 3 %}
|
{% if role <= 3 %}
|
||||||
<div id="maxconn">
|
<div id="maxconn">
|
||||||
<table class="overview">
|
<table class="overview">
|
||||||
<tr class="overviewHead">
|
<tr class="overviewHead">
|
||||||
<td class="padding10 first-collumn">Server</td>
|
<td class="padding10 first-collumn">{{lang.words.server|title()}}</td>
|
||||||
<td>Choose Frontend</td>
|
<td>{{lang.words.select|title()}} {{lang.words.frontend|title()}}</td>
|
||||||
<td>Maxconn</td>
|
<td>Maxconn</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -101,28 +103,28 @@
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{ input('maxconnint', title='Enter maxconn', type="number", required='required') }}
|
{{ input('maxconnint', title=lang.words.enter|title() + ' maxconn', type="number", required='required') }}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button type="submit" name="Enter" value="Enter" id="enter">Enter</button>
|
<button type="submit" name="Enter" value="Enter" id="enter">{{lang.words.enter|title()}}</button>
|
||||||
</td>
|
</td>
|
||||||
</form>
|
</form>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<div id="ajaxmaxconn"></div>
|
<div id="ajaxmaxconn"></div>
|
||||||
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
|
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
|
||||||
You can read how it works <a href="https://roxy-wi.org/description/runtimeapi#maxconn" title="Change Maxconn" target="_blank">here</a>
|
{{lang.phrases.read_how_it_works}} <a href="https://roxy-wi.org/description/runtimeapi#maxconn" title="Change Maxconn" target="_blank">{{lang.words.here}}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="ip">
|
<div id="ip">
|
||||||
<table class="overview">
|
<table class="overview">
|
||||||
<tr class="overviewHead">
|
<tr class="overviewHead">
|
||||||
<td class="padding10 first-collumn">Server</td>
|
<td class="padding10 first-collumn">{{lang.words.server|title()}}</td>
|
||||||
<td>Choose Backend</td>
|
<td>{{lang.words.select|title()}} {{lang.words.backend|title()}}</td>
|
||||||
<td>Choose Server</td>
|
<td>{{lang.words.select|title()}} {{lang.words.server}}</td>
|
||||||
<td>New IP</td>
|
<td>{{lang.words.new|title()}} IP</td>
|
||||||
<td>New Port</td>
|
<td>{{lang.words.new|title()}} {{lang.words.port}}</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -144,10 +146,10 @@
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{ input('backend_ip', title='Set new server IP', required='required', size='16') }}
|
{{ input('backend_ip', title=lang.words.set|title()+' '+lang.words.new + ' ' + lang.words.server + ' IP', required='required', size='16') }}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{ input('backend_port', title='Set new server Port', type="number", required='required', size='6') }}
|
{{ input('backend_port', title=lang.words.set|title()+' '+lang.words.new + ' ' + lang.words.server + ' ' + lang.words.port, type="number", required='required', size='6') }}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button type="submit" name="Enter" value="Enter" id="enter">Enter</button>
|
<button type="submit" name="Enter" value="Enter" id="enter">Enter</button>
|
||||||
|
@ -157,14 +159,14 @@
|
||||||
</table>
|
</table>
|
||||||
<div id="ajaxip"></div>
|
<div id="ajaxip"></div>
|
||||||
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
|
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
|
||||||
You can read how it works <a href="https://roxy-wi.org/description/runtimeapi#ip" title="Change IP and Port" target="_blank">here</a>
|
{{lang.phrases.read_how_it_works}} <a href="https://roxy-wi.org/description/runtimeapi#ip" title="Change IP and Port" target="_blank">{{lang.words.here}}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="table">
|
<div id="table">
|
||||||
<table class="overview">
|
<table class="overview">
|
||||||
<tr class="overviewHead">
|
<tr class="overviewHead">
|
||||||
<td class="padding10 first-collumn">Server</td>
|
<td class="padding10 first-collumn">{{lang.words.server|title()}}</td>
|
||||||
<td>Choose Table</td>
|
<td>{{lang.words.select|title()}} {{lang.words.table}}</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -182,21 +184,21 @@
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button type="submit" name="Enter" value="Enter" id="enter">Get table</button>
|
<button type="submit" name="Enter" value="Enter" id="enter">{{lang.words.w_get|title()}} {{lang.words.table}}</button>
|
||||||
</td>
|
</td>
|
||||||
</form>
|
</form>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<div id="ajaxtable"></div>
|
<div id="ajaxtable"></div>
|
||||||
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
|
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
|
||||||
You can read how it works <a href="https://roxy-wi.org/description/runtimeapi#ip" title="Change IP and Port" target="_blank">here</a>
|
{{lang.phrases.read_how_it_works}} <a href="https://roxy-wi.org/description/runtimeapi#ip" title="{{lang.words.change|title()}} IP {{lang.words.and}} {{lang.words.port}}" target="_blank">{{lang.words.here}}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="lists">
|
<div id="lists">
|
||||||
<table class="overview">
|
<table class="overview">
|
||||||
<tr class="overviewHead">
|
<tr class="overviewHead">
|
||||||
<td class="padding10 first-collumn">Server</td>
|
<td class="padding10 first-collumn">{{lang.words.server|title()}}</td>
|
||||||
<td>Choose List</td>
|
<td>{{lang.words.select|title()}} {{lang.words.list}}</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -214,20 +216,20 @@
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button type="submit" name="Enter" value="Enter" id="enter">Get list</button>
|
<button type="submit" name="Enter" value="Enter" id="enter">{{lang.words.w_get|title()}} {{lang.words.list}}</button>
|
||||||
</td>
|
</td>
|
||||||
</form>
|
</form>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<div id="ajaxlist"></div>
|
<div id="ajaxlist"></div>
|
||||||
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
|
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
|
||||||
You can read how it works <a href="https://roxy-wi.org/description.py/runtimeapi#lists" title="Manage lists" target="_blank">here</a>
|
{{lang.phrases.read_how_it_works}} <a href="https://roxy-wi.org/description.py/runtimeapi#lists" title="{{lang.words.manage|title()}} {{lang.words.lists}}" target="_blank">{{lang.words.here}}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="sessions">
|
<div id="sessions">
|
||||||
<table class="overview">
|
<table class="overview">
|
||||||
<tr class="overviewHead">
|
<tr class="overviewHead">
|
||||||
<td class="padding10 first-collumn">Server</td>
|
<td class="padding10 first-collumn">{{lang.words.server|title()}}</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -241,15 +243,12 @@
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button type="submit" name="Enter" value="Enter" id="enter">Get sessions</button>
|
<button type="submit" name="Enter" value="Enter" id="enter">{{lang.words.w_get|title()}} {{lang.words.sessions}}</button>
|
||||||
</td>
|
</td>
|
||||||
</form>
|
</form>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<div id="ajaxsessions"></div>
|
<div id="ajaxsessions"></div>
|
||||||
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
|
|
||||||
You can read how it works <a href="https://roxy-wi.org/description/runtimeapi#lists" title="Manage lists" target="_blank">here</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue