You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
haproxy-wi/app/templates/servers.html

381 lines
15 KiB

{% extends "base.html" %}
{% block content %}
{% from 'include/input_macros.html' import input, checkbox, select %}
<style>
.container {
margin-right: 0;
}
</style>
<script src="/inc/users.js"></script>
{% include 'include/del_confirm.html' %}
<input type="hidden" id="new-group" name="new-group" value="{{ group }}">
<input type="hidden" id="new-server-group-add" name="new-server-group-add" value="{{ group }}" >
<input type="hidden" id="new-sshgroup" name="new-sshgroup" value="{{ group }}" >
{{ input('new-telegram-group-add', type='hidden', value=group) }}
<div id="tabs">
<ul>
<li><a href="#users" title="Servers: Manage users - HAProxy-WI">Users</a></li>
<li><a href="#servers" title="Servers: Manage servers - HAProxy-WI">Servers</a></li>
<li><a href="#ssh" title="Servers: Manage SSH credentials - HAProxy-WI">SSH credentials</a></li>
<li><a href="#checker" title="Servers: Manage checker - HAProxy-WI">Checker</a></li>
<li><a href="#installproxy" title="Servers: Proxy service installation - HAProxy-WI">Proxy installation</a></li>
<li><a href="#installmon" title="Servers: Monitoring service installation - HAProxy-WI">Monitoring installation</a></li>
<li><a href="#backup" title="Servers: Backup configs - HAProxy-WI">Backup</a></li>
{% include 'include/login.html' %}
</ul>
<ul id='browse_histroy'></ul>
<div id="users">
<table class="overview" id="ajax-users">
<tr class="overviewHead">
<td class="padding10 first-collumn">Login name</td>
<td style="width: 10%">Password</td>
<td style="width: 10%">Active</td>
<td style="width: 20%">Email</td>
<td style="width: 100%">Role</td>
<td></td>
<td></td>
</tr>
<tr>
{% for user in users %}
<tr id="user-{{user.0}}" class="{{ loop.cycle('odd', 'even') }}">
{% include 'include/admin_users.html' %}
<td>
<select id="role-{{user.0}}" name="role-{{user.0}}">
<option disabled selected>Choose role</option>
{% for role in roles %}
{% if role.1 != "admin" %}
{% if user.4 == role.1 %}
<option value="{{ role.1 }}" selected>{{ role.1 }}</option>
{% else %}
<option value="{{ role.1 }}">{{ role.1 }}</option>
{% endif %}
{% endif %}
{% endfor %}
</select>
</td>
<td>
<a class="add" onclick="cloneUser({{user.0}})" id="clone-{{user.0}}" title="Clone {{user.1}}" style="cursor: pointer;"></a>
</td>
<td>
<a class="delete" onclick="confirmDeleteUser({{user.0}})" title="Delete user {{user.1}}" style="cursor: pointer;"></a>
</td>
</tr>
{% endfor %}
</table>
<br /><span class="add-button" title="Add user" id="add-user-button">+ Add</span>
<br /><br />
</div>
<div id="servers">
<table class="overview" id="ajax-servers">
<tr class="overviewHead">
<th class="padding10 first-collumn" style="width: 15%">Hostname</th>
<th class="ip-field" style="width: 10%">IP</th>
<th class="checkbox-head" style="width: 5%">
<span title="SSH port">Port</span>
</th>
<th class="checkbox-head" style="width: 5%">Enable</th>
<th class="checkbox-head" style="width: 5%">
<span title="Virtual IP, something like VRRP">Virt</span>
</th>
<th class="checkbox-head" style="width: 5%">HAProxy</th>
<th class="checkbox-head" style="width: 5%">Nginx</th>
<th class="slave-field" style="width: 10%">
<span title="Actions with master config will automatically apply on slave">Slave for</span>
</th>
<th class="cred-field" style="width: 15%">Credentials</th>
<th style="width: 100%">Description</th>
<th></th>
<th></th>
</tr>
{% set ssh_group = [] %}
{% for server in servers %}
{% do ssh_group.append(server.3) %}
6 years ago
<tr id="server-{{server.0}}" class="{{ loop.cycle('odd', 'even') }}">
<td class="padding10 first-collumn" style="width: 15%">
{% set id = 'hostname-' + server.0|string() %}
{{ input(id, value=server.1, size='10') }}
</td>
<td>
<span id="ip-{{server.0}}" style="margin-right: 6px;">{{server.2}}</span>
<input type="hidden" id="servergroup-{{server.0}}" name="servergroup-{{server.0}}" value="{{ group }}" >
</td>
<td>
{% set id = 'port-' + server.0|string() %}
{{ input(id, value=server.10, size='2') }}
6 years ago
</td>
{% include 'include/admin_servers.html' %}
</tr>
{% endfor %}
</table>
<br /><span class="add-button" title="Add server" id="add-server-button">+ Add</span>
<br /><br />
<div id="checkSshConnect"></div>
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
You can read the description of all parameters <a href="https://haproxy-wi.org/description.py?description=servers" title="Servers description" target="_blank">here</a>
5 years ago
or watch video <a href="https://haproxy-wi.org/description.py?description=setup" title="How to setup servers, group and SSH credentials" target="_blank">here</a>
</div>
</div>
<div id="ssh">
<table id="ssh_enable_table" class="overview">
<tr class="overviewHead" style="width: 50%;">
<td class="padding10 first-collumn" style="width: 15%;">
<span title="It's just name alias. This alias will be userd in 'Servers' page for choose credentials">Name</span>
</td>
<td class="padding10 first-collumn" style="width: 25%;">
<span title="If enabled, the key will be used, if turned off - the password. Do not forget to download the keys to all servers or install the sudo without a password">SSH key</span>
</td>
<td style="width: 100%;">
<span title="Enter SSH user name. If SSH key disabled, enter password for ssh user">Credentials</span>
</td>
<td></td>
</tr>
{% for ssh in sshs %}
{% if ssh.5|string() == group %}
6 years ago
<tr style="width: 50%;" id="ssh-table-{{ssh.0}}" class="{{ loop.cycle('odd', 'even') }}">
<td class="first-collumn">
{% set id = 'ssh_name-' + ssh.0|string() %}
{{ input(id, value=ssh.1, size='10') }}
</td>
<td class="first-collumn" valign="top" style="padding-top: 15px;">
{% if ssh.2 == 1 %}
<label for="ssh_enable-{{ssh.0}}">Enable SSH key</label><input type="checkbox" id="ssh_enable-{{ssh.0}}" checked>
{% else %}
<label for="ssh_enable-{{ssh.0}}">Enable SSH key</label><input type="checkbox" id="ssh_enable-{{ssh.0}}">
{% endif %}
</td>
<td style="padding-top: 15px;">
<p>
{% set id = 'ssh_user-' + ssh.0|string() %}
{{ input(id, value=ssh.3, title='SSH user name') }}
</p>
{% if ssh.2 == 1 %}
<input type="password" id="ssh_pass-{{ssh.0}}" class="form-control" value="" placeholder="*****" style="display: none;" autocomplete="off" />
{% else %}
<input type="password" id="ssh_pass-{{ssh.0}}" class="form-control" value="" placeholder="*****" autocomplete="off" />
{% endif %}
<br>
</td>
<td>
<a class="delete" onclick="confirmDeleteSsh({{ssh.0}})" title="Delete this SSH credentials" style="cursor: pointer;"></a>
</td>
</tr>
{% endif %}
{% endfor %}
</table>
<br /><span class="add-button" title="Add ssh" id="add-ssh-button">+ Add</span>
<br /><br />
<table id="ssh_key">
<tr class="overviewHead" style="width: 50%;">
<td class="padding10 first-collumn" style="width: 25%;">Upload SSH Key</td>
<td>
<span title="Private key. Note: The public key must be pre-installed on all servers to which you plan to connect">Key</span>
</td>
<td></td>
</tr>
<tr style="width: 50%;">
<td class="first-collumn" valign="top" style="padding-top: 15px;">
<select id="ssh-key-name">
<option disabled selected>Choose credentials</option>
{% for ssh in sshs %}
{% if ssh.5|string() == group %}
<option value={{ssh.1}}>{{ssh.1}}</option>
{% endif %}
{% endfor %}
</select>
</td>
<td style="padding-top: 15px;">
<textarea id="ssh_cert" cols="50" rows="5"></textarea><br /><br />
<button id="ssh_key_upload" title="Upload ssh key" onclick="uploadSsh()">Upload</button>
</td>
<td></td>
</tr>
</table>
<div id="ajax-ssh"></div>
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
You can read the description of all parameters <a href="https://haproxy-wi.org/description.py?description=creds" title="Servers description" target="_blank">here</a>
5 years ago
or watch video <a href="https://haproxy-wi.org/description.py?description=setup" title="How to setup servers, group and SSH credentials" target="_blank">here</a>
</div>
</div>
<div id="checker">
<table id="checker_table" class="overview">
<tr class="overviewHead" style="width: 50%;">
<td class="padding10 first-collumn" style="width: 25%;">
<span title="Token that gave you @father_bot">Token</span>
</td>
<td style="width: 100%;">Chanel name</td>
<td></td>
<td></td>
</tr>
{% for telegram in telegrams %}
{% if telegram.3|string() == group %}
6 years ago
<tr style="width: 50%;" id="telegram-table-{{telegram.0}}" class="{{ loop.cycle('odd', 'even') }}">
<td class="padding10 first-collumn">
{% set id = 'telegram-token-' + telegram.0|string() %}
{{ input(id, value=telegram.1, size='30') }}
</td>
<td>
{% set id = 'telegram-chanel-' + telegram.0|string() %}
{{ input(id, value=telegram.2) }}
</td>
<td>
<a class="add" onclick="cloneTelegram({{telegram.0}})" id="clone-{{telegram.0}}" title="Clone {{telegram.2}}" style="cursor: pointer;"></a>
</td>
<td>
<a class="delete" onclick="confirmDeleteSsh({{telegram.0}})" style="cursor: pointer;"></a>
</td>
</tr>
{% endif %}
{% endfor %}
</table>
<br /><span class="add-button" title="Telegram channel" id="add-telegram-button">+ Add</span>
<br /><br />
<div id="ajax-telegram"></div>
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
You can read the description of all parameters <a href="https://haproxy-wi.org/description.py?description=checker" title="Servers description" target="_blank">here</a>
</div>
</div>
<div id="installproxy">
5 years ago
<table class="overview">
<caption><h3>Install HAProxy</h3></caption>
5 years ago
<tr class="overviewHead">
5 years ago
<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: 30%;">Server</td>
5 years ago
<td>SYN flood protect</td>
<td></td>
</tr>
<tr>
5 years ago
<td id="cur_hap_ver" class="padding10 first-collumn">
</td>
5 years ago
<td class="padding10 first-collumn" style="width: 20%;">
{% set values = dict() %}
{% set values = {'2.0.5-1':'2.0.5-1','2.0.6-1':'2.0.6-1', '2.0.7-1':'2.0.7-1', '2.0.9-1':'2.0.9-1', '2.0.11-1':'2.0.11-1', '2.0.12-1':'2.0.12-1', '2.0.13-1':'2.0.13-1', '2.0.14-1':'2.0.14-1'} %}
{{ select('hapver', values=values, selected='2.0.14-1', required='required') }}
5 years ago
</td>
<td class="padding10 first-collumn">
<select autofocus required name="haproxyaddserv" id="haproxyaddserv">
<option disabled selected>Choose server</option>
{% for select in servers %}
<option value="{{ select.2 }}">{{ select.1 }}</option>
{% endfor %}
</select>
</td>
<td>
{{ checkbox('syn_flood', title="Enable SYN flood protect", checked='checked') }}
5 years ago
</td>
<td>
<span class="ui-button ui-widget ui-corner-all" id="install" title="Install HAProxy">Install</span>
5 years ago
</td>
</tr>
</table>
<table>
<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: 30%;">Server</td>
<td>SYN flood protect</td>
<td></td>
</tr>
<tr>
<td id="cur_nginx_ver" class="padding10 first-collumn">
</td>
<td class="padding10 first-collumn" style="width: 20%;">
HAProxy-WI will try to install the latest Nginx version from official Nginx repository
</td>
<td class="padding10 first-collumn">
<select autofocus required name="nginxaddserv" id="nginxaddserv">
<option disabled selected>Choose server</option>
{% for select in servers %}
<option value="{{ select.2 }}">{{ select.1 }}</option>
{% endfor %}
</select>
</td>
<td>
{{ checkbox('nginx_syn_flood', title="Enable SYN flood protect", checked='checked') }}
</td>
<td>
<span class="ui-button ui-widget ui-corner-all" id="nginx_install" title="Install Nginx">Install</span>
</td>
</tr>
</table>
<div id="ajax"></div>
</div>
<div id="installmon">
{% include 'include/mon_installation.html' %}
5 years ago
</div>
<div id="backup">
{% include 'include/admin_backup.html' %}
</div>
</div>
<div id="group_error" style="display: none;">
<div class="alert alert-danger">
6 years ago
<b>Do not edit this section if your group is "ALL"!</b> Add first<a href="users.py#groups" title="Admin Area: Groups">group</a> or edit your own group at<a href="users.py#users" title="Admin Area: Users">users</a> page
</div>
</div>
{% include 'include/admins_dialogs.html' %}
{% include 'include/change_pass_form.html' %}
<script>
if($('#new-server-group-add').val() == 1) {
$('#group_error').css('display', 'block');
$('#add-user-button').css('display', 'none');
$('#add-server-button').css('display', 'none');
5 years ago
$('.passwordChange').css('display', 'none');
$('.add').css('display', 'none');
$('#add-ssh-button').css('display', 'none');
$('#ssh_key_upload').css('display', 'none');
$('#add-telegram-button').css('display', 'none');
$('input').css('color', 'rgba(0, 0, 0, 0.3)');
setTimeout(function() {
$("input[type=checkbox]").checkboxradio( "disable" );
$("select").selectmenu( "disable" );
$("button").button( "disable" );
$("input").attr( "readonly", "readonly" );
$('.delete').remove()
5 years ago
$('#hapver').selectmenu('enable');
$('#haproxyaddserv').selectmenu('enable');
$('#nginxaddserv').selectmenu('enable');
$('#haproxy_exp_addserv').selectmenu('enable');
$('#nginx_exp_addserv').selectmenu('enable');
5 years ago
$('#syn_flood').checkboxradio('enable');
$('#nginx_syn_flood').checkboxradio('enable');
}, 500 );
}
$( function() {
{% for user in users %}
$("#role-{{user.0}}" ).selectmenu({
width: 100
});
{% endfor %}
{% for server in servers %}
$("#slavefor-{{server.0}}" ).selectmenu({
width: 130
});
$("#credentials-{{server.0}}" ).selectmenu({
width: 150
});
{% endfor %}
{% for ssh in sshs %}
$("#sshgroup-{{ ssh.0}}" ).selectmenu({
width: 150
});
{% endfor %}
});
</script>
<style>
.ui-selectmenu-button.ui-button {
width: 10em;
}
.checkbox {
width: 90px;
}
</style>
5 years ago
{% endblock %}