Aidaho 2024-06-16 08:02:08 +03:00
parent e3ad7e86ae
commit 4e16398f2a
109 changed files with 450 additions and 714 deletions

View File

@ -86,8 +86,8 @@ def index():
'keepalived/<id,hostname,ip>/config': 'get Keepalived config from a server by id or hostname or ip. METHOD: GET', 'keepalived/<id,hostname,ip>/config': 'get Keepalived config from a server by id or hostname or ip. METHOD: GET',
'keepalived/<id,hostname,ip>/config': 'upload Keepalived config to a server by id or hostname or ip. Headers: action: save/reload/restart. Body must consist a whole Keepalived config. METHOD: POST', 'keepalived/<id,hostname,ip>/config': 'upload Keepalived config to a server by id or hostname or ip. Headers: action: save/reload/restart. Body must consist a whole Keepalived config. METHOD: POST',
'ha': 'HA clusters list. METHOD: GET', 'ha': 'HA clusters list. METHOD: GET',
'ha': 'Create HA cluster. Body must be JSON: name: str, desc: str, cluster_id: 0, router_id: "", vip: str, servers: {server_id: dict:{eth: str, ip: str, name: str, master: int}}, service: dict: {{haproxy: int, docker: int}, {nginx: int, docker: int}}, virt_server: int, syn_flood: int, return_to_master: int. METHOD: POST', 'ha': 'Create HA cluster. Body must be JSON: name: str, desc: str, cluster_id: 0, router_id: "", vip: str, servers: {server_id: dict:{eth: str, ip: str, name: str, master: int}}, service: dict: {{haproxy: int, docker: int}, {nginx: int, docker: int}}, virt_server: int, syn_flood: int, return_to_master: int, use_src: int. METHOD: POST',
'ha': 'Edit HA cluster. Body must be JSON: name: str, desc: str, cluster_id: int, router_id: "", vip: str, servers: {server_id: dict:{eth: str, ip: str, name: str, master: int}}, service: dict: {{haproxy: int, docker: int}, {nginx: int, docker: int}}, virt_server: int, syn_flood: int, return_to_master: int. METHOD: PUT', 'ha': 'Edit HA cluster. Body must be JSON: name: str, desc: str, cluster_id: int, router_id: "", vip: str, servers: {server_id: dict:{eth: str, ip: str, name: str, master: int}}, service: dict: {{haproxy: int, docker: int}, {nginx: int, docker: int}}, virt_server: int, syn_flood: int, return_to_master: int, use_src: int. METHOD: PUT',
'ha': 'Delete HA cluster. Body must be JSON: cluster_id: int. METHOD: DELETE', 'ha': 'Delete HA cluster. Body must be JSON: cluster_id: int. METHOD: DELETE',
} }
return dict(help=data) return dict(help=data)

View File

@ -467,38 +467,6 @@ def update_db_v_4_3_0():
print("An error occurred:", e) print("An error occurred:", e)
def update_db_v_6_3_11():
cursor = conn.cursor()
sql = """
ALTER TABLE `smon` ADD COLUMN pd_channel_id integer default 0;
"""
try:
cursor.execute(sql)
except Exception as e:
if e.args[0] == 'duplicate column name: pd_channel_id' or str(e) == '(1060, "Duplicate column name \'pd_channel_id\'")':
print('Updating... DB has been updated to version 6.3.11')
else:
print("An error occurred:", e)
else:
print("Updating... DB has been updated to version 6.3.11")
def update_db_v_6_3_13():
cursor = conn.cursor()
sql = """
ALTER TABLE `smon` ADD COLUMN check_type VARCHAR ( 64 ) DEFAULT 'tcp';
"""
try:
cursor.execute(sql)
except Exception as e:
if e.args[0] == 'duplicate column name: check_type' or str(e) == '(1060, "Duplicate column name \'check_type\'")':
print('Updating... DB has been updated to version 6.3.13')
else:
print("An error occurred:", e)
else:
print("Updating... DB has been updated to version 6.3.13")
def update_db_v_6_3_13_1(): def update_db_v_6_3_13_1():
try: try:
SmonTcpCheck.insert_from( SmonTcpCheck.insert_from(
@ -656,7 +624,6 @@ def update_db_v_7_2_0_1():
print("Updating... DB has been updated to version 7.2.0-1") print("Updating... DB has been updated to version 7.2.0-1")
def update_db_v_7_2_3(): def update_db_v_7_2_3():
try: try:
if mysql_enable: if mysql_enable:
@ -676,9 +643,26 @@ def update_db_v_7_2_3():
print("An error occurred:", e) print("An error occurred:", e)
def update_db_v_7_3_1():
try:
if mysql_enable:
migrate(
migrator.add_column('ha_cluster_vips', 'use_src', IntegerField(default=0)),
)
else:
migrate(
migrator.add_column('ha_cluster_vips', 'use_src', IntegerField(constraints=[SQL('DEFAULT 0')])),
)
except Exception as e:
if e.args[0] == 'duplicate column name: use_src' or str(e) == '(1060, "Duplicate column name \'use_src\'")':
print('Updating... DB has been updated to version 7.3.1')
else:
print("An error occurred:", e)
def update_ver(): def update_ver():
try: try:
Version.update(version='7.3.0.0').execute() Version.update(version='7.3.1.0').execute()
except Exception: except Exception:
print('Cannot update version') print('Cannot update version')
@ -696,8 +680,6 @@ def update_all():
if check_ver() is None: if check_ver() is None:
update_db_v_3_4_5_22() update_db_v_3_4_5_22()
update_db_v_4_3_0() update_db_v_4_3_0()
update_db_v_6_3_11()
update_db_v_6_3_13()
update_db_v_6_3_13_1() update_db_v_6_3_13_1()
update_db_v_6_3_13_2() update_db_v_6_3_13_2()
update_db_v_6_3_13_3() update_db_v_6_3_13_3()
@ -710,6 +692,7 @@ def update_all():
update_db_v_7_2_0() update_db_v_7_2_0()
update_db_v_7_2_0_1() update_db_v_7_2_0_1()
update_db_v_7_2_3() update_db_v_7_2_3()
update_db_v_7_3_1()
update_ver() update_ver()

View File

@ -728,6 +728,7 @@ class HaClusterVip(BaseModel):
router_id = ForeignKeyField(HaClusterRouter, on_delete='Cascade') router_id = ForeignKeyField(HaClusterRouter, on_delete='Cascade')
return_master = IntegerField(constraints=[SQL('DEFAULT "0"')]) return_master = IntegerField(constraints=[SQL('DEFAULT "0"')])
vip = CharField() vip = CharField()
use_src = IntegerField(constraints=[SQL('DEFAULT "0"')])
class Meta: class Meta:
table_name = 'ha_cluster_vips' table_name = 'ha_cluster_vips'

View File

@ -40,23 +40,16 @@ def select_clusters_virts():
out_error(e) out_error(e)
def select_cluster_vips(cluster_id: int) -> object: def select_cluster_vips(cluster_id: int) -> HaClusterVip:
try: try:
return HaClusterVip.select().where(HaClusterVip.cluster_id == cluster_id).execute() return HaClusterVip.select().where(HaClusterVip.cluster_id == cluster_id).execute()
except Exception as e: except Exception as e:
out_error(e) out_error(e)
def select_clusters_vip(cluster_id: int, router_id: int): def select_cluster_vip(cluster_id: int, router_id: int) -> HaClusterVip:
try: try:
return HaClusterVip.get((HaClusterVip.cluster_id == cluster_id) & (HaClusterVip.router_id == router_id)).vip return HaClusterVip.get((HaClusterVip.cluster_id == cluster_id) & (HaClusterVip.router_id == router_id))
except Exception as e:
out_error(e)
def select_clusters_vip_return_master(cluster_id: int, router_id: int):
try:
return HaClusterVip.get((HaClusterVip.cluster_id == cluster_id) & (HaClusterVip.router_id == router_id)).return_master
except Exception as e: except Exception as e:
out_error(e) out_error(e)
@ -160,6 +153,13 @@ def get_router_id(cluster_id: int, default_router=0) -> int:
out_error(e) out_error(e)
def get_router(router_id: int) -> HaClusterRouter:
try:
return HaClusterRouter.get(HaClusterRouter.id == router_id)
except Exception as e:
out_error(e)
def create_ha_router(cluster_id: int) -> int: def create_ha_router(cluster_id: int) -> int:
""" """
Create HA Router Create HA Router
@ -211,9 +211,9 @@ def update_cluster(cluster_id: int, name: str, desc: str, syn_flood: int) -> Non
out_error(e) out_error(e)
def update_ha_cluster_vip(cluster_id: int, router_id: int, vip: str, return_master: int) -> None: def update_ha_cluster_vip(cluster_id: int, router_id: int, vip: str, return_master: int, use_src: int) -> None:
try: try:
HaClusterVip.update(vip=vip, return_master=return_master).where((HaClusterVip.cluster_id == cluster_id) & (HaClusterVip.router_id == router_id)).execute() HaClusterVip.update(vip=vip, return_master=return_master, use_src=use_src).where((HaClusterVip.cluster_id == cluster_id) & (HaClusterVip.router_id == router_id)).execute()
except Exception as e: except Exception as e:
out_error(e) out_error(e)

View File

@ -71,40 +71,35 @@ def backup(serv, rpath, time, backup_type, rserver, cred, deljob, update, descri
def s3_backup(server, s3_server, bucket, secret_key, access_key, time, deljob, description) -> str: def s3_backup(server, s3_server, bucket, secret_key, access_key, time, deljob, description) -> str:
script = 's3_backup.sh'
tag = 'add'
full_path = '/var/www/haproxy-wi/app'
if deljob: if deljob:
time = '' time = ''
secret_key = '' secret_key = ''
access_key = '' access_key = ''
tag = 'delete' tag = 'delete'
else: else:
tag = 'add'
if backup_sql.check_exists_s3_backup(server): if backup_sql.check_exists_s3_backup(server):
raise Exception(f'error: Backup job for {server} already exists') raise Exception(f'error: Backup job for {server} already exists')
os.system(f"cp {full_path}/scripts/{script} {full_path}/{script}") inv = {"server": {"hosts": {}}}
inv["server"]["hosts"]["localhost"] = {
commands = [ "SERVER": server,
f"chmod +x {full_path}/{script} && {full_path}/{script} SERVER={server} S3_SERVER={s3_server} BUCKET={bucket} " "S3_SERVER": s3_server,
f"SECRET_KEY={secret_key} ACCESS_KEY={access_key} TIME={time} TAG={tag}" "BUCKET": bucket,
] "SECRET_KEY": secret_key,
"ACCESS_KEY": access_key,
return_out = server_mod.subprocess_execute_with_rc(commands[0]) "TIME": time,
"action": tag
}
try: try:
os.remove(f'{full_path}/{script}') installation_mod.run_ansible(inv, [], 's3_backup')
except Exception: except Exception as e:
pass raise Exception(f'error: {e}')
if not deljob: if not deljob:
try:
if installation_mod.show_installation_output(return_out['error'], return_out['output'], 'S3 backup', rc=return_out['rc']):
try: try:
backup_sql.insert_s3_backup_job(server, s3_server, bucket, secret_key, access_key, time, description) backup_sql.insert_s3_backup_job(server, s3_server, bucket, secret_key, access_key, time, description)
except Exception as e:
raise Exception(f'error: {e}')
except Exception as e: except Exception as e:
raise Exception(e) raise Exception(e)
roxywi_common.logging('backup ', f' a new S3 backup job for server {server} has been created', roxywi=1, login=1) roxywi_common.logging('backup ', f' a new S3 backup job for server {server} has been created', roxywi=1, login=1)

View File

@ -72,7 +72,7 @@ def create_cluster(cluster: json, group_id: int) -> str:
return str(cluster_id) return str(cluster_id)
def update_cluster(cluster: json, group_id: int) -> str: def update_cluster(cluster: json, group_id: int) -> None:
cluster_id = int(cluster['cluster_id']) cluster_id = int(cluster['cluster_id'])
syn_flood = int(cluster['syn_flood']) syn_flood = int(cluster['syn_flood'])
cluster_name = common.checkAjaxInput(cluster['name']) cluster_name = common.checkAjaxInput(cluster['name'])
@ -114,8 +114,6 @@ def update_cluster(cluster: json, group_id: int) -> str:
roxywi_common.logging(cluster_id, f'Cluster {cluster_name} has been updated', keep_history=1, roxywi=1, service='HA cluster') roxywi_common.logging(cluster_id, f'Cluster {cluster_name} has been updated', keep_history=1, roxywi=1, service='HA cluster')
return 'ok'
def delete_cluster(cluster_id: int) -> str: def delete_cluster(cluster_id: int) -> str:
router_id = ha_sql.get_router_id(cluster_id, default_router=1) router_id = ha_sql.get_router_id(cluster_id, default_router=1)
@ -136,11 +134,12 @@ def delete_cluster(cluster_id: int) -> str:
def update_vip(cluster_id: int, router_id: int, json_data: json, group_id: int) -> None: def update_vip(cluster_id: int, router_id: int, json_data: json, group_id: int) -> None:
return_master = int(json_data['return_to_master']) return_master = int(json_data['return_to_master'])
use_src = int(json_data['use_src'])
vip = common.is_ip_or_dns(json_data['vip']) vip = common.is_ip_or_dns(json_data['vip'])
vip_id = ha_sql.select_clusters_vip_id(cluster_id, router_id) vip_id = ha_sql.select_clusters_vip_id(cluster_id, router_id)
try: try:
ha_sql.update_ha_cluster_vip(cluster_id, router_id, vip, return_master) ha_sql.update_ha_cluster_vip(cluster_id, router_id, vip, return_master, use_src)
except Exception as e: except Exception as e:
raise Exception(f'error: Cannot update VIP: {e}') raise Exception(f'error: Cannot update VIP: {e}')

View File

@ -17,24 +17,6 @@ import app.modules.roxywi.common as roxywi_common
from app.modules.server.ssh import return_ssh_keys_path from app.modules.server.ssh import return_ssh_keys_path
def show_installation_output(error: str, output: list, service: str, rc=0):
if error and "WARNING" not in error:
roxywi_common.logging('Roxy-WI server', error, roxywi=1)
raise Exception('error: ' + error)
else:
if rc != 0:
for line in output:
if any(s in line for s in ("Traceback", "FAILED", "error", "ERROR", "UNREACHABLE")):
try:
correct_out = line.split('=>')
correct_out = json.loads(correct_out[1])
except Exception:
raise Exception(f'error: {output} for {service}')
else:
raise Exception(f'error: {correct_out["msg"]} for {service}')
return True
def generate_udp_inv(listener_id: int, action: str) -> object: def generate_udp_inv(listener_id: int, action: str) -> object:
inv = {"server": {"hosts": {}}} inv = {"server": {"hosts": {}}}
server_ips = [] server_ips = []
@ -97,6 +79,7 @@ def generate_kp_inv(json_data: json, installed_service) -> object:
routers[router_id] = {} routers[router_id] = {}
routers[router_id].setdefault('return_master', vip.return_master) routers[router_id].setdefault('return_master', vip.return_master)
routers[router_id].setdefault('vip', vip.vip) routers[router_id].setdefault('vip', vip.vip)
routers[router_id].setdefault('use_src', vip.use_src)
slaves = ha_sql.select_cluster_slaves_for_inv(router_id) slaves = ha_sql.select_cluster_slaves_for_inv(router_id)
for slave in slaves: for slave in slaves:
slave_ip = server_sql.select_server_ip_by_id(str(slave.server_id)) slave_ip = server_sql.select_server_ip_by_id(str(slave.server_id))
@ -144,12 +127,9 @@ def generate_haproxy_inv(json_data: json, installed_service: str) -> object:
stats_password = sql.get_setting('haproxy_stats_password') stats_password = sql.get_setting('haproxy_stats_password')
haproxy_dir = sql.get_setting('haproxy_dir') haproxy_dir = sql.get_setting('haproxy_dir')
container_name = sql.get_setting('haproxy_container_name') container_name = sql.get_setting('haproxy_container_name')
haproxy_ver = '' haproxy_ver = '2.9.6-1'
is_docker = json_data['services']['haproxy']['docker'] is_docker = json_data['services']['haproxy']['docker']
if haproxy_ver == '':
haproxy_ver = '2.8.1-1'
for k, v in json_data['servers'].items(): for k, v in json_data['servers'].items():
if not v['master']: if not v['master']:
slaves.append(v['ip']) slaves.append(v['ip'])
@ -346,10 +326,10 @@ def service_actions_after_install(server_ips: str, service: str, json_data) -> N
def install_service(service: str, json_data: str) -> object: def install_service(service: str, json_data: str) -> object:
try: # try:
json_data = json.loads(json_data) # json_data = json.loads(json_data)
except Exception as e: # except Exception as e:
roxywi_common.handle_exceptions(e, 'Roxy-WI server', 'Cannot parse JSON', roxywi=1) # roxywi_common.handle_exceptions(e, 'Roxy-WI server', 'Cannot parse JSON', roxywi=1)
generate_functions = { generate_functions = {
'haproxy': generate_haproxy_inv, 'haproxy': generate_haproxy_inv,
@ -368,7 +348,7 @@ def install_service(service: str, json_data: str) -> object:
def _install_ansible_collections(): def _install_ansible_collections():
old_ansible_server = '' old_ansible_server = ''
collections = ('community.general', 'ansible.posix', 'community.docker', 'community.grafana') collections = ('community.general', 'ansible.posix', 'community.docker', 'community.grafana', 'ansible.netcommon')
trouble_link = 'Read <a href="https://roxy-wi.org/troubleshooting#ansible_collection" target="_blank" class="link">troubleshooting</a>' trouble_link = 'Read <a href="https://roxy-wi.org/troubleshooting#ansible_collection" target="_blank" class="link">troubleshooting</a>'
for collection in collections: for collection in collections:
if not os.path.isdir(f'/usr/share/httpd/.ansible/collections/ansible_collections/{collection.replace(".", "/")}'): if not os.path.isdir(f'/usr/share/httpd/.ansible/collections/ansible_collections/{collection.replace(".", "/")}'):

View File

@ -1,7 +1,6 @@
import json
from flask import render_template, g, request, jsonify from flask import render_template, g, request, jsonify
from flask_login import login_required from flask_login import login_required
from playhouse.shortcuts import model_to_dict
from app.routes.ha import bp from app.routes.ha import bp
from app.middleware import get_user_params, check_services from app.middleware import get_user_params, check_services
@ -36,25 +35,27 @@ def cluster_function(service):
return render_template('ha_cluster.html', **kwargs) return render_template('ha_cluster.html', **kwargs)
elif request.method == 'PUT': elif request.method == 'PUT':
cluster = json.loads(request.form.get('jsonData')) cluster = request.get_json()
try: try:
return ha_cluster.update_cluster(cluster, group_id) ha_cluster.update_cluster(cluster, group_id)
return jsonify({'status': 'updated'})
except Exception as e: except Exception as e:
return f'{e}' return jsonify({'status': 'failed', 'error': f'Cannot update the cluster: {e}'})
elif request.method == 'POST': elif request.method == 'POST':
cluster = json.loads(request.form.get('jsonData')) cluster = request.get_json()
try: try:
return ha_cluster.create_cluster(cluster, group_id) cluster_id = ha_cluster.create_cluster(cluster, group_id)
return jsonify({'status': 'created', 'cluster_id': cluster_id})
except Exception as e: except Exception as e:
return f'{e}' return jsonify({'status': 'failed', 'error': f'Cannot create a cluster: {e}'})
elif request.method == 'DELETE': elif request.method == 'DELETE':
cluster_id = int(request.form.get('cluster_id')) cluster_id = int(request.form.get('cluster_id'))
try: try:
return ha_cluster.delete_cluster(cluster_id) return ha_cluster.delete_cluster(cluster_id)
except Exception as e: except Exception as e:
return f'{e}' return jsonify({'status': 'failed', 'error': f'Cannot delete the cluster: {e}'})
@bp.route('/<service>/get/<int:cluster_id>') @bp.route('/<service>/get/<int:cluster_id>')
@ -87,17 +88,16 @@ def get_cluster_settings(service, cluster_id):
router_id = ha_sql.get_router_id(cluster_id, default_router=1) router_id = ha_sql.get_router_id(cluster_id, default_router=1)
slaves = ha_sql.select_cluster_slaves(cluster_id, router_id) slaves = ha_sql.select_cluster_slaves(cluster_id, router_id)
cluster_services = ha_sql.select_cluster_services(cluster_id) cluster_services = ha_sql.select_cluster_services(cluster_id)
vip = ha_sql.select_clusters_vip(cluster_id, router_id) vip = ha_sql.select_cluster_vip(cluster_id, router_id)
return_master = ha_sql.select_clusters_vip_return_master(cluster_id, router_id) is_virt = ha_sql.check_ha_virt(vip.id)
vip_id = ha_sql.select_clusters_vip_id(cluster_id, router_id)
is_virt = ha_sql.check_ha_virt(vip_id)
for cluster in clusters: for cluster in clusters:
settings.setdefault('name', cluster.name) settings.setdefault('name', cluster.name)
settings.setdefault('desc', cluster.desc) settings.setdefault('desc', cluster.desc)
settings.setdefault('return_to_master', return_master) settings.setdefault('return_to_master', vip.return_master)
settings.setdefault('syn_flood', cluster.syn_flood) settings.setdefault('syn_flood', cluster.syn_flood)
settings.setdefault('vip', vip) settings.setdefault('vip', vip.vip)
settings.setdefault('virt_server', is_virt) settings.setdefault('virt_server', is_virt)
settings.setdefault('use_src', vip.use_src)
for slave in slaves: for slave in slaves:
if slave[31]: if slave[31]:
@ -219,10 +219,10 @@ def get_masters(service):
@check_services @check_services
def get_vip_settings(service, cluster_id, router_id): def get_vip_settings(service, cluster_id, router_id):
settings = {} settings = {}
return_master = ha_sql.select_clusters_vip_return_master(cluster_id, router_id) vip = ha_sql.select_cluster_vip(cluster_id, router_id)
vip_id = ha_sql.select_clusters_vip_id(cluster_id, router_id) is_virt = ha_sql.check_ha_virt(vip.id)
is_virt = ha_sql.check_ha_virt(vip_id) settings.setdefault('return_to_master', vip.return_master)
settings.setdefault('return_to_master', return_master) settings.setdefault('use_src', vip.use_src)
settings.setdefault('virt_server', is_virt) settings.setdefault('virt_server', is_virt)
return jsonify(settings) return jsonify(settings)
@ -233,35 +233,37 @@ def get_vip_settings(service, cluster_id, router_id):
def ha_vip(service, cluster_id): def ha_vip(service, cluster_id):
user_params = g.user_params user_params = g.user_params
group_id = user_params['group_id'] group_id = user_params['group_id']
json_data = json.loads(request.form.get('jsonData')) json_data = request.get_json()
if request.method == 'PUT': if request.method == 'PUT':
router_id = int(json_data['router_id']) router_id = int(json_data['router_id'])
try: try:
ha_cluster.update_vip(cluster_id, router_id, json_data, group_id) ha_cluster.update_vip(cluster_id, router_id, json_data, group_id)
except Exception as e: except Exception as e:
return f'{e}' return jsonify({'status': 'failed', 'error': f'Cannot update VIP: {e}'})
return 'ok' return jsonify({'status': 'updated'})
elif request.method == 'POST': elif request.method == 'POST':
try: try:
ha_cluster.insert_vip(cluster_id, json_data, group_id) ha_cluster.insert_vip(cluster_id, json_data, group_id)
except Exception as e: except Exception as e:
return f'{e}' return jsonify({'status': 'failed', 'error': f'Cannot create VIP: {e}'})
return 'ok' return jsonify({'status': 'created'})
elif request.method == 'DELETE': elif request.method == 'DELETE':
router_id = int(json_data['router_id']) router_id = int(json_data['router_id'])
router = ha_sql.get_router(router_id)
if router.default:
return jsonify({'status': 'failed', 'error': 'You cannot delete default VIP'})
try: try:
ha_sql.delete_ha_router(router_id) ha_sql.delete_ha_router(router_id)
return 'ok' return jsonify({'status': 'deleted'})
except Exception as e: except Exception as e:
return f'error: Cannot delete VIP: {e}' return jsonify({'status': 'failed', 'error': f'Cannot delete VIP: {e}'})
@bp.route('/<service>/<int:cluster_id>/vips', methods=['GET']) @bp.route('/<service>/<int:cluster_id>/vips', methods=['GET'])
@check_services @check_services
@get_user_params() @get_user_params()
def get_vips(service, cluster_id): def get_vips(service, cluster_id):
from playhouse.shortcuts import model_to_dict
if request.method == 'GET': if request.method == 'GET':
vips = ha_sql.select_cluster_vips(cluster_id) vips = ha_sql.select_cluster_vips(cluster_id)
vips = [model_to_dict(vip) for vip in vips] vips = [model_to_dict(vip) for vip in vips]

View File

@ -1,4 +1,4 @@
from flask import render_template, request, g from flask import render_template, request, g, jsonify
from flask_login import login_required from flask_login import login_required
from app.routes.install import bp from app.routes.install import bp
@ -35,11 +35,11 @@ def install_monitoring():
@bp.post('/<service>') @bp.post('/<service>')
@check_services @check_services
def install_service(service): def install_service(service):
json_data = request.form.get('jsonData') json_data = request.get_json()
try: try:
return service_mod.install_service(service, json_data) return service_mod.install_service(service, json_data)
except Exception as e: except Exception as e:
return f'{e}' return jsonify({'status': 'failed', 'error': f'{e}'})
@bp.route('/<service>/version/<server_ip>') @bp.route('/<service>/version/<server_ip>')
@ -55,17 +55,18 @@ def get_service_version(service, server_ip):
@bp.post('/exporter/<exporter>') @bp.post('/exporter/<exporter>')
def install_exporter(exporter): def install_exporter(exporter):
server_ip = common.is_ip_or_dns(request.form.get('server_ip')) json_data = request.get_json()
ver = common.checkAjaxInput(request.form.get('exporter_v')) server_ip = common.is_ip_or_dns(json_data['server_ip'])
ext_prom = common.checkAjaxInput(request.form.get('ext_prom')) ver = common.checkAjaxInput(json_data['exporter_v'])
ext_prom = common.checkAjaxInput(json_data['ext_prom'])
if exporter not in ('haproxy', 'nginx', 'apache', 'keepalived', 'node'): if exporter not in ('haproxy', 'nginx', 'apache', 'keepalived', 'node'):
return 'error: Wrong exporter' return jsonify({'status': 'failed', 'error': 'Wrong exporter'})
try: try:
return exp_installation.install_exporter(server_ip, ver, ext_prom, exporter) return exp_installation.install_exporter(server_ip, ver, ext_prom, exporter)
except Exception as e: except Exception as e:
return f'{e}' return jsonify({'status': 'failed', 'error': f'Cannot install {exporter.title()} exporter: {e}'})
@bp.route('/exporter/<exporter>/version/<server_ip>') @bp.route('/exporter/<exporter>/version/<server_ip>')
@ -90,41 +91,42 @@ def install_waf(service, server_ip):
try: try:
inv, server_ips = service_mod.generate_waf_inv(server_ip, service) inv, server_ips = service_mod.generate_waf_inv(server_ip, service)
except Exception as e: except Exception as e:
return f'error: Cannot create inventory: {e}' return jsonify({'status': 'failed', 'error': f'Cannot create inventory: {e}'})
try: try:
ansible_status = service_mod.run_ansible(inv, server_ips, f'waf_{service}'), 201 ansible_status = service_mod.run_ansible(inv, server_ips, f'waf_{service}'), 201
except Exception as e: except Exception as e:
return f'error: Cannot install WAF: {e}' return jsonify({'status': 'failed', 'error': f'Cannot install WAF: {e}'})
if service == 'haproxy': if service == 'haproxy':
try: try:
waf_sql.insert_waf_metrics_enable(server_ip, "0") waf_sql.insert_waf_metrics_enable(server_ip, "0")
waf_sql.insert_waf_rules(server_ip) waf_sql.insert_waf_rules(server_ip)
except Exception as e: except Exception as e:
return str(e) return jsonify({'status': 'failed', 'error': f'Cannot enable WAF: {e}'})
elif service == 'nginx': elif service == 'nginx':
try: try:
waf_sql.insert_nginx_waf_rules(server_ip) waf_sql.insert_nginx_waf_rules(server_ip)
waf_sql.insert_waf_nginx_server(server_ip) waf_sql.insert_waf_nginx_server(server_ip)
except Exception as e: except Exception as e:
return str(e) return jsonify({'status': 'failed', 'error': f'Cannot enable WAF: {e}'})
else: else:
return 'error: Wrong service' return jsonify({'status': 'failed', 'error': 'Wrong service'})
return ansible_status return ansible_status
@bp.post('/geoip') @bp.post('/geoip')
def install_geoip(): def install_geoip():
server_ip = common.is_ip_or_dns(request.form.get('server_ip')) json_data = request.get_json()
geoip_update = common.checkAjaxInput(request.form.get('update')) server_ip = common.is_ip_or_dns(json_data['server_ip'])
service = request.form.get('service') geoip_update = common.checkAjaxInput(json_data['update'])
service = common.checkAjaxInput(json_data['service'])
try: try:
inv, server_ips = service_mod.generate_geoip_inv(server_ip, service, geoip_update) inv, server_ips = service_mod.generate_geoip_inv(server_ip, service, geoip_update)
return service_mod.run_ansible(inv, server_ips, f'{service}_geoip'), 201 return service_mod.run_ansible(inv, server_ips, f'{service}_geoip'), 201
except Exception as e: except Exception as e:
return f'{e}' return jsonify({'status': 'failed', 'error': f'Cannot install GeoIP: {e}'})
@bp.route('/geoip/<service>/<server_ip>') @bp.route('/geoip/<service>/<server_ip>')
@ -141,9 +143,10 @@ def check_geoip(service, server_ip):
@bp.post('/udp') @bp.post('/udp')
def install_udp(): def install_udp():
listener_id = int(request.form.get('listener_id')) json_data = request.get_json()
listener_id = int(json_data['listener_id'])
try: try:
inv, server_ips = service_mod.generate_udp_inv(listener_id, 'install') inv, server_ips = service_mod.generate_udp_inv(listener_id, 'install')
return service_mod.run_ansible(inv, server_ips, f'udp'), 201 return service_mod.run_ansible(inv, server_ips, f'udp'), 201
except Exception as e: except Exception as e:
return f'{e}' return jsonify({'status': 'failed', 'error': f'Cannot create listener: {e}'})

View File

@ -91,7 +91,7 @@
service: service:
name: keepalived name: keepalived
daemon_reload: yes daemon_reload: yes
state: started state: restarted
enabled: yes enabled: yes
ignore_errors: yes ignore_errors: yes

View File

@ -59,6 +59,20 @@ vrrp_instance VI_{{router}} {
virtual_ipaddress { virtual_ipaddress {
{{vip.vip}} {{vip.vip}}
} }
{% if vip.use_src|string() == "1" %}
virtual_routes {
{% for k, slave in vip.items() %}
{% if k == ansible_host and slave is mapping %}
{{ (ansible_facts[slave.eth]["ipv4"]["address"] + "/" + ansible_facts[slave.eth]["ipv4"]["netmask"]) | ipaddr("0") }} dev {{ slave.eth }} src {{ vip.vip }} scope link table ha_cluster_{{ router }}
{% endif %}
{% endfor %}
}
virtual_rules {
from {{vip.vip}}/32 table ha_cluster_{{ router }} priority 100
}
{% endif %}
} }
{% endfor %} {% endfor %}
# Managed by Roxy-WI do not edit this file. Use HA cluster configuration instead # Managed by Roxy-WI do not edit this file. Use HA cluster configuration instead

View File

@ -1,4 +1,4 @@
- hosts: 127.0.0.1 - hosts: localhost
connection: local connection: local
become: yes become: yes
become_method: sudo become_method: sudo
@ -34,6 +34,7 @@
- hap_config - hap_config
- nginx_config - nginx_config
- apache_config - apache_config
when: action == "add"
- name: Delete S3 Job - name: Delete S3 Job
tags: delete tags: delete
@ -47,3 +48,4 @@
- hap_config - hap_config
- nginx_config - nginx_config
- apache_config - apache_config
when: action == "delete"

View File

@ -1,33 +0,0 @@
#!/bin/bash
for ARGUMENT in "$@"
do
KEY=$(echo $ARGUMENT | cut -f1 -d=)
VALUE=$(echo $ARGUMENT | cut -f2 -d=)
case "$KEY" in
SERVER) SERVER=${VALUE} ;;
S3_SERVER) S3_SERVER=${VALUE} ;;
BUCKET) BUCKET=${VALUE} ;;
SECRET_KEY) SECRET_KEY=${VALUE} ;;
ACCESS_KEY) ACCESS_KEY=${VALUE} ;;
TAG) TAG=${VALUE} ;;
TIME) TIME=${VALUE} ;;
*)
esac
done
export ANSIBLE_HOST_KEY_CHECKING=False
export ANSIBLE_DISPLAY_SKIPPED_HOSTS=False
export ACTION_WARNINGS=False
export LOCALHOST_WARNING=False
export COMMAND_WARNINGS=False
PWD=/var/www/haproxy-wi/app/scripts/ansible/
ansible-playbook $PWD/roles/s3_backup.yml -e "SERVER=$SERVER S3_SERVER=$S3_SERVER BUCKET=$BUCKET SECRET_KEY=$SECRET_KEY ACCESS_KEY=$ACCESS_KEY TIME=$TIME" -t $TAG -i $PWD/$HOST
if [ $? -gt 0 ]
then
echo "error: Cannot create a S3 backup job"
exit 1
fi

View File

@ -1,17 +0,0 @@
module "aws_module" {
source = "github.com/hap-wi/haproxy-wi-terraform-modules?ref=aws"
region = var.region
instance_type = var.instance_type
public_ip = var.public_ip
floating_ip = var.floating_ip
volume_size = var.volume_size
volume_type = var.volume_type
delete_on_termination = var.delete_on_termination
name = var.name
os = var.os
ssh_key_name = var.ssh_key_name
firewall = var.firewall
AWS_ACCESS_KEY = var.AWS_ACCESS_KEY
AWS_SECRET_KEY = var.AWS_SECRET_KEY
}

View File

@ -1,16 +0,0 @@
module "do_module" {
source = "github.com/hap-wi/haproxy-wi-terraform-modules?ref=digitalocean"
region = var.region
size = var.size
private_networking = var.private_networking
floating_ip = var.floating_ip
ssh_key_name = var.ssh_key_name
name = var.name
os = var.os
ssh_ids = var.ssh_ids
firewall = var.firewall
backup = var.backup
monitoring = var.monitoring
token = var.token
}

View File

@ -1,18 +0,0 @@
module "gcore_module" {
source = "github.com/hap-wi/haproxy-wi-terraform-modules?ref=gcore"
region = var.region
instance_type = var.instance_type
network_type = var.network_type
network_name = var.network_name
volume_size = var.volume_size
delete_on_termination = var.delete_on_termination
volume_type = var.volume_type
name = var.name
os = var.os
ssh_key_name = var.ssh_key_name
firewall = var.firewall
username = var.username
password = var.password
project = var.project
}

View File

@ -1 +0,0 @@
localhost

View File

@ -1,17 +0,0 @@
region = "{{region}}"
instance_type = "{{size}}"
public_ip = {% if public_ip == 'true' %}true{%else%}false{%endif%}
floating_ip = {% if floating_ip == 'true' %}true{%else%}false{%endif%}
delete_on_termination = {% if delete_on_termination == 'true' %}true{%else%}false{%endif%}
volume_size = {{volume_size}}
volume_type = "{{volume_type}}"
name = "{{server_name}}"
os = "{{os}}"
ssh_key_name = "{{ssh_name}}"
firewall = {% if firewall == 'true' %}true{%else%}false{%endif%}
AWS_ACCESS_KEY = "{{AWS_ACCESS_KEY}}"
AWS_SECRET_KEY = "{{AWS_SECRET_KEY}}"

View File

@ -1,21 +0,0 @@
region = "{{region}}"
size = "{{size}}"
private_networking = {% if privet_net == 'true' %}true{%else%}false{%endif%}
floating_ip = {% if floating_ip == 'true' %}true{%else%}false{%endif%}
name = "{{server_name}}"
os = "{{os}}"
ssh_key_name = "{{ssh_name}}"
ssh_ids = [{% if ssh_ids != 'None' %}{% for s in ssh_ids.split(',') %}{% if s != '' %}"{{s}}",{% endif %}{% endfor %}{% endif %}]
firewall = {% if firewall == 'true' %}true{%else%}false{%endif%}
backup = {% if backup == 'true' %}true{%else%}false{%endif%}
privet_net = {% if privet_net == 'true' %}true{%else%}false{%endif%}
monitoring = {% if monitoring == 'true' %}true{%else%}false{%endif%}
token = "{{token}}"

View File

@ -1,17 +0,0 @@
region = {{region}}
instance_type = "{{size}}"
project = "{{project}}"
network_name = "{{network_name}}"
network_type = "{{network_type}}"
delete_on_termination = {% if delete_on_termination == 'true' %}true{%else%}false{%endif%}
volume_size = {{volume_size}}
volume_type = "{{volume_type}}"
name = "{{server_name}}"
os = "{{os}}"
ssh_key_name = "{{ssh_name}}"
firewall = {% if firewall == 'true' %}true{%else%}false{%endif%}
username = "{{username}}"
password = "{{pass}}"

View File

@ -1,26 +0,0 @@
- hosts: localhost
gather_facts: no
connection: local
tasks:
- name: Create vars directory
file:
path: vars
state: directory
- name: Create aws var file
template:
src: templates/aws_vars_template.j2
dest: "vars/{{server_name}}_{{group}}_{{cloud}}.tfvars"
when: cloud == "aws"
- name: Create do var file
template:
src: templates/do_vars_template.j2
dest: "vars/{{server_name}}_{{group}}_{{cloud}}.tfvars"
when: cloud == "do"
- name: Create gcore var file
template:
src: templates/gcore_vars_template.j2
dest: "vars/{{server_name}}_{{group}}_{{cloud}}.tfvars"
when: cloud == "gcore"

View File

@ -1,70 +0,0 @@
variable "region" {}
variable "project" {
default = "123"
}
variable "username" {
type = string
default = "123"
}
variable "password" {
type = string
default = "123"
}
variable "instance_type" {
default = "123"
}
variable "network_type" {
type = string
default = "any_subnet"
}
variable "network_name" {
type = string
default = ""
}
variable "public_ip" {
default = false
}
variable "floating_ip" {
default = false
}
variable "volume_size" {
default = "123"
}
variable "delete_on_termination" {
default = false
}
variable "volume_type" {
default = "standard"
}
variable "name" {}
variable "os" {}
variable "ssh_key_name" {}
variable "firewall" {}
variable "AWS_ACCESS_KEY" {
default = "123"
}
variable "AWS_SECRET_KEY" {
default = "123"
}
variable "size" {
default = "123"
}
variable "private_networking" {
default = false
}
variable "ssh_ids" {
default = ""
}
variable "backup" {
default = false
}
variable "privet_net" {
default = false
}
variable "monitoring" {
default = false
}
variable "token" {
default = "123"
}

View File

@ -1,8 +0,0 @@
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "3.28.0"
}
}
}

View File

@ -203,9 +203,6 @@ function addS3Backup(dialog_id) {
} else if (data.indexOf('warning: ') != '-1') { } else if (data.indexOf('warning: ') != '-1') {
toastr.clear(); toastr.clear();
toastr.warning(data); toastr.warning(data);
} else if (data.indexOf('error: ') != '-1') {
toastr.clear();
toastr.error(data);
} else { } else {
common_ajax_action_after_success(dialog_id, 'newbackup', 'ajax-backup-s3-table', data); common_ajax_action_after_success(dialog_id, 'newbackup', 'ajax-backup-s3-table', data);
$("select").selectmenu(); $("select").selectmenu();

View File

@ -1,3 +1,4 @@
var cancel_word = $('#translate').attr('data-cancel');
$( function() { $( function() {
$("select").selectmenu({ $("select").selectmenu({
width: 180 width: 180
@ -35,14 +36,6 @@ $( function() {
get_interface($(this), server_ip); get_interface($(this), server_ip);
}); });
}); });
function showProvisioningError(data, step_id, wait_mess, error_id) {
$(wait_mess).hide();
$(error_id).append(data);
$(error_id).show();
$(step_id).removeClass('proccessing');
$(step_id).addClass('processing_error');
$.getScript("/app/static/js/fontawesome.min.js");
}
function cleanProvisioningProccess(div_id, success_div, error_id, warning_id, progres_id) { function cleanProvisioningProccess(div_id, success_div, error_id, warning_id, progres_id) {
$(div_id).empty(); $(div_id).empty();
$(success_div).empty(); $(success_div).empty();
@ -59,7 +52,6 @@ function cleanProvisioningProccess(div_id, success_div, error_id, warning_id, pr
} }
function confirmDeleteCluster(cluster_id) { function confirmDeleteCluster(cluster_id) {
var delete_word = $('#translate').attr('data-delete'); var delete_word = $('#translate').attr('data-delete');
var cancel_word = $('#translate').attr('data-cancel');
$("#dialog-confirm").dialog({ $("#dialog-confirm").dialog({
resizable: false, resizable: false,
height: "auto", height: "auto",
@ -97,9 +89,8 @@ function deleteCluster(cluster_id) {
}); });
} }
function createHaClusterStep1(edited=false, cluster_id=0, clean=true) { function createHaClusterStep1(edited=false, cluster_id=0, clean=true) {
var cancel_word = $('#translate').attr('data-cancel'); let next_word = $('#translate').attr('data-next');
var next_word = $('#translate').attr('data-next'); let tabel_title = $("#create-ha-cluster-step-1-overview").attr('title');
var tabel_title = $("#create-ha-cluster-step-1-overview").attr('title');
if (clean) { if (clean) {
clearClusterDialog(edited); clearClusterDialog(edited);
$.ajax({ $.ajax({
@ -163,6 +154,11 @@ function createHaClusterStep1(edited=false, cluster_id=0, clean=true) {
} else { } else {
$('#virt_server').prop('checked', false); $('#virt_server').prop('checked', false);
} }
if (clusterSettings.use_src) {
$('#use_src').prop('checked', true);
} else {
$('#use_src').prop('checked', false);
}
$( "input[type=checkbox]" ).checkboxradio("refresh"); $( "input[type=checkbox]" ).checkboxradio("refresh");
} }
}); });
@ -238,7 +234,6 @@ function createHaClusterStep1(edited=false, cluster_id=0, clean=true) {
dialog_div.dialog('open'); dialog_div.dialog('open');
} }
function createHaClusterStep2(edited=false, cluster_id=0, jsonData='') { function createHaClusterStep2(edited=false, cluster_id=0, jsonData='') {
var cancel_word = $('#translate').attr('data-cancel');
var back_word = $('#translate').attr('data-back'); var back_word = $('#translate').attr('data-back');
var save_word = $('#translate').attr('data-save'); var save_word = $('#translate').attr('data-save');
var apply_word = $('#translate').attr('data-apply'); var apply_word = $('#translate').attr('data-apply');
@ -293,6 +288,7 @@ function saveCluster(jsonData, cluster_id=0, edited=0, reconfigure=0) {
let virt_server = 0; let virt_server = 0;
let return_to_master = 0; let return_to_master = 0;
let syn_flood = 0; let syn_flood = 0;
let use_src = 0;
let hap = 0; let hap = 0;
let hap_docker = 0; let hap_docker = 0;
let nginx = 0; let nginx = 0;
@ -311,6 +307,9 @@ function saveCluster(jsonData, cluster_id=0, edited=0, reconfigure=0) {
if ($('#syn_flood').is(':checked')) { if ($('#syn_flood').is(':checked')) {
syn_flood = '1'; syn_flood = '1';
} }
if ($('#use_src').is(':checked')) {
use_src = '1';
}
if ($('#hap').is(':checked')) { if ($('#hap').is(':checked')) {
hap = '1'; hap = '1';
} }
@ -333,6 +332,7 @@ function saveCluster(jsonData, cluster_id=0, edited=0, reconfigure=0) {
jsonData['virt_server'] = virt_server; jsonData['virt_server'] = virt_server;
jsonData['return_to_master'] = return_to_master; jsonData['return_to_master'] = return_to_master;
jsonData['syn_flood'] = syn_flood; jsonData['syn_flood'] = syn_flood;
jsonData['use_src'] = use_src;
jsonData['services'] = {'haproxy': {'enabled': hap, 'docker': hap_docker}}; jsonData['services'] = {'haproxy': {'enabled': hap, 'docker': hap_docker}};
jsonData['services']['nginx'] = {'enabled': nginx, 'docker': nginx_docker}; jsonData['services']['nginx'] = {'enabled': nginx, 'docker': nginx_docker};
jsonData['services']['apache'] = {'enabled': apache, 'docker': 0}; jsonData['services']['apache'] = {'enabled': apache, 'docker': 0};
@ -341,15 +341,14 @@ function saveCluster(jsonData, cluster_id=0, edited=0, reconfigure=0) {
url: "/app/ha/cluster", url: "/app/ha/cluster",
type: req_method, type: req_method,
async: false, async: false,
data: { data: JSON.stringify(jsonData),
jsonData: JSON.stringify(jsonData), contentType: "application/json; charset=utf-8",
},
success: function (data) { success: function (data) {
if (data.indexOf('error:') != '-1') { if (data.status === 'failed') {
toastr.error(data); toastr.error(data.error);
} else { } else {
if (!edited) { if (!edited) {
cluster_id = data; cluster_id = data.cluster_id;
getHaCluster(cluster_id, true); getHaCluster(cluster_id, true);
} else { } else {
getHaCluster(cluster_id); getHaCluster(cluster_id);
@ -396,7 +395,6 @@ function Reconfigure(jsonData, cluster_id) {
} }
}); });
server_creating.dialog('open'); server_creating.dialog('open');
let li_id = 'creating-'
let progress_step = 100 / total_installation; let progress_step = 100 / total_installation;
$.when(installServiceCluster(jsonData, 'keepalived', progress_step, cluster_id)).done(function () { $.when(installServiceCluster(jsonData, 'keepalived', progress_step, cluster_id)).done(function () {
if (servers['services']['haproxy']['enabled']) { if (servers['services']['haproxy']['enabled']) {
@ -452,11 +450,10 @@ function installServiceCluster(jsonData, service, progress_step, cluster_id) {
jsonData: JSON.stringify(servers), jsonData: JSON.stringify(servers),
}, },
success: function (data) { success: function (data) {
try { if (data.status === 'failed') {
if (data.indexOf('error:') != '-1') { toastr.error(data.error);
toastr.error(data); toastr.error(data);
} } else {
} catch (e) {
checkInstallResp(data, servers['cluster_id'], progress_step, servers["name"], li_id, nice_service_name[service]); checkInstallResp(data, servers['cluster_id'], progress_step, servers["name"], li_id, nice_service_name[service]);
} }
} }
@ -506,7 +503,6 @@ function increaseProgressValue(progress_step) {
$(progress_id).css('width', new_progress+'%'); $(progress_id).css('width', new_progress+'%');
} }
function add_vip_ha_cluster(cluster_id, cluster_name, router_id='', vip='', edited=0) { function add_vip_ha_cluster(cluster_id, cluster_name, router_id='', vip='', edited=0) {
var cancel_word = $('#translate').attr('data-cancel');
var save_word = $('#translate').attr('data-save'); var save_word = $('#translate').attr('data-save');
var delete_word = $('#translate').attr('data-delete'); var delete_word = $('#translate').attr('data-delete');
var tabel_title = $("#add-vip-table").attr('title'); var tabel_title = $("#add-vip-table").attr('title');
@ -529,6 +525,11 @@ function add_vip_ha_cluster(cluster_id, cluster_name, router_id='', vip='', edit
} else { } else {
$('#vrrp-ip-add-virt_server').prop('checked', false); $('#vrrp-ip-add-virt_server').prop('checked', false);
} }
if (clusterSettings.use_src) {
$('#vrrp-ip-add-use_src').prop('checked', true);
} else {
$('#vrrp-ip-add-use_src').prop('checked', false);
}
$( "input[type=checkbox]" ).checkboxradio("refresh"); $( "input[type=checkbox]" ).checkboxradio("refresh");
} }
}); });
@ -631,17 +632,22 @@ function add_vip_ha_cluster(cluster_id, cluster_name, router_id='', vip='', edit
} }
function saveVip(jsonData, cluster_id, dialog_id, cluster_name, edited, router_id='', vip='', deleted=false) { function saveVip(jsonData, cluster_id, dialog_id, cluster_name, edited, router_id='', vip='', deleted=false) {
let req_type = 'POST' let req_type = 'POST'
var return_to_master = 0 let return_to_master = 0
var virt_server = 0 let virt_server = 0
let use_src = 0
if ($('#vrrp-ip-add-return_to_master').is(':checked')) { if ($('#vrrp-ip-add-return_to_master').is(':checked')) {
return_to_master = '1'; return_to_master = '1';
} }
if ($('#vrrp-ip-add-virt_server').is(':checked')) { if ($('#vrrp-ip-add-virt_server').is(':checked')) {
virt_server = '1'; virt_server = '1';
} }
if ($('#vrrp-ip-add-use_src').is(':checked')) {
use_src = '1';
}
jsonData['vip'] = $('#vrrp-ip-add').val(); jsonData['vip'] = $('#vrrp-ip-add').val();
jsonData['return_to_master'] = return_to_master; jsonData['return_to_master'] = return_to_master;
jsonData['virt_server'] = virt_server; jsonData['virt_server'] = virt_server;
jsonData['use_src'] = use_src;
jsonData['name'] = cluster_name; jsonData['name'] = cluster_name;
if (edited) { if (edited) {
req_type = 'PUT'; req_type = 'PUT';
@ -653,13 +659,12 @@ function saveVip(jsonData, cluster_id, dialog_id, cluster_name, edited, router_i
} }
$.ajax({ $.ajax({
url: "/app/ha/cluster/" + cluster_id + "/vip", url: "/app/ha/cluster/" + cluster_id + "/vip",
data: { data: JSON.stringify(jsonData),
jsonData: JSON.stringify(jsonData), contentType: "application/json; charset=utf-8",
},
type: req_type, type: req_type,
success: function (data) { success: function (data) {
if (data.indexOf('error:') != '-1') { if (data.status === 'failed') {
toastr.error(data); toastr.error(data.error);
} else { } else {
getHaCluster(cluster_id); getHaCluster(cluster_id);
dialog_id.dialog('destroy'); dialog_id.dialog('destroy');
@ -673,9 +678,6 @@ function get_interface(input_id, server_ip) {
source: function (request, response) { source: function (request, response) {
$.ajax({ $.ajax({
url: "/app/server/show/if/" + server_ip, url: "/app/server/show/if/" + server_ip,
// data: {
// token: $('#token').val()
// },
success: function (data) { success: function (data) {
data = data.replace(/\s+/g, ' '); data = data.replace(/\s+/g, ' ');
if (data.indexOf('error:') != '-1' || data.indexOf('Failed') != '-1') { if (data.indexOf('error:') != '-1' || data.indexOf('Failed') != '-1') {
@ -693,10 +695,6 @@ function get_interface(input_id, server_ip) {
function get_keepalived_ver(div_id, server_ip) { function get_keepalived_ver(div_id, server_ip) {
$.ajax({ $.ajax({
url: "/app/install/keepalived/version/" + server_ip, url: "/app/install/keepalived/version/" + server_ip,
// data: {
// token: $('#token').val()
// },
// type: "POST",
success: function (data) { success: function (data) {
data = data.replace(/^\s+|\s+$/g, ''); data = data.replace(/^\s+|\s+$/g, '');
if (data.indexOf('error:') != '-1') { if (data.indexOf('error:') != '-1') {
@ -704,7 +702,6 @@ function get_keepalived_ver(div_id, server_ip) {
toastr.error(p_err); toastr.error(p_err);
} else if (data.indexOf('keepalived:') != '-1') { } else if (data.indexOf('keepalived:') != '-1') {
div_id.text('Keepalived has not installed'); div_id.text('Keepalived has not installed');
// $('#create').attr('title', 'Create HA cluster');
} else { } else {
div_id.text(data); div_id.text(data);
div_id.css('font-weight', 'bold'); div_id.css('font-weight', 'bold');
@ -734,22 +731,22 @@ function addCheckToStatus(server_id, server_ip) {
$.getScript('/app/static/js/ha.js'); $.getScript('/app/static/js/ha.js');
} }
function removeCheckFromStatus(server_id, server_ip) { function removeCheckFromStatus(server_id, server_ip) {
var hostname = $('#remove_check-' + server_id).attr('data-name'); let hostname = $('#remove_check-' + server_id).attr('data-name');
var add_word = $('#translate').attr('data-add'); let add_word = $('#translate').attr('data-add');
var service_word = $('#translate').attr('data-service'); let service_word = $('#translate').attr('data-service');
var length_tr = $('#all_services tbody tr').length; let length_tr = $('#all_services tbody tr').length;
var tr_class = 'odd'; let tr_class = 'odd';
if (length_tr % 2 != 0) { if (length_tr % 2 != 0) {
tr_class = 'even'; tr_class = 'even';
} }
var html_tag = '<div class="' + tr_class + ' all-checks" id="add_check-' + server_id + '" data-name="' + hostname + '">' + let html_tag = '<div class="' + tr_class + ' all-checks" id="add_check-' + server_id + '" data-name="' + hostname + '">' +
'<div class="check-name">' + hostname + '</div>' + '<div class="check-name">' + hostname + '</div>' +
'<div class="add_user_group check-button" onclick="addCheckToStatus(' + server_id + ', \'' + server_ip + '\')" title="' + add_word + ' ' + service_word + '">+</div></div>'; '<div class="add_user_group check-button" onclick="addCheckToStatus(' + server_id + ', \'' + server_ip + '\')" title="' + add_word + ' ' + service_word + '">+</div></div>';
$('#remove_check-' + server_id).remove(); $('#remove_check-' + server_id).remove();
$("#all-checks").append(html_tag); $("#all-checks").append(html_tag);
} }
function createJsonCluster(div_id) { function createJsonCluster(div_id) {
var jsonData = {}; let jsonData = {};
jsonData = {'servers': {}}; jsonData = {'servers': {}};
jsonData['servers'][1] = { jsonData['servers'][1] = {
'eth': $('#ha-cluster-master-interface').val(), 'eth': $('#ha-cluster-master-interface').val(),
@ -758,25 +755,25 @@ function createJsonCluster(div_id) {
'master': 1 'master': 1
}; };
$(div_id).each(function () { $(div_id).each(function () {
var this_id = $(this).attr('id').split('-')[1]; let this_id = $(this).attr('id').split('-')[1];
var eth = $('#slave_int-' + this_id).val(); let eth = $('#slave_int-' + this_id).val();
var ip = $('#slave_int_div-' + this_id).attr('data-ip'); let ip = $('#slave_int_div-' + this_id).attr('data-ip');
var name = $('#slave_int_div-' + this_id).parent().text().replace('\n','').replace('\t','').trim(); let name = $('#slave_int_div-' + this_id).parent().text().replace('\n','').replace('\t','').trim();
jsonData['servers'][this_id] = {'eth': eth, 'ip': ip, 'name': name, 'master': 0}; jsonData['servers'][this_id] = {'eth': eth, 'ip': ip, 'name': name, 'master': 0};
}); });
return jsonData; return jsonData;
} }
function createJsonVip(div_id) { function createJsonVip(div_id) {
var jsonData = {}; let jsonData = {};
jsonData = {'servers': {}}; jsonData = {'servers': {}};
$(div_id).each(function () { $(div_id).each(function () {
var this_id = $(this).attr('id').split('-')[1]; let this_id = $(this).attr('id').split('-')[1];
var eth1 = $('#slave_int-' + this_id).val(); let eth1 = $('#slave_int-' + this_id).val();
var ip1 = $('#slave_int_div-' + this_id).attr('data-ip'); let ip1 = $('#slave_int_div-' + this_id).attr('data-ip');
var name1 = $('#slave_int_div-' + this_id).parent().text().replace('\n','').replace('\t','').trim(); let name1 = $('#slave_int_div-' + this_id).parent().text().replace('\n','').replace('\t','').trim();
var eth = $('#master_int-' + this_id).val(); let eth = $('#master_int-' + this_id).val();
var ip = $('#master_int_div-' + this_id).attr('data-ip'); let ip = $('#master_int_div-' + this_id).attr('data-ip');
var name = $('#master_int_div-' + this_id).parent().text().replace('\n','').replace('\t','').trim(); let name = $('#master_int_div-' + this_id).parent().text().replace('\n','').replace('\t','').trim();
if (eth) { if (eth) {
jsonData['servers'][this_id] = {'eth': eth, 'ip': ip, 'name': name, 'master': 1}; jsonData['servers'][this_id] = {'eth': eth, 'ip': ip, 'name': name, 'master': 1};
} else { } else {
@ -812,6 +809,7 @@ function clearClusterDialog(edited=0) {
$('#cur_master_ver').text(''); $('#cur_master_ver').text('');
$('#virt_server').prop('checked', true); $('#virt_server').prop('checked', true);
$('#return_to_master').prop('checked', true); $('#return_to_master').prop('checked', true);
$('#use_src').prop('checked', false);
$('#hap').prop('checked', false); $('#hap').prop('checked', false);
$('#hap_docker').prop('checked', false); $('#hap_docker').prop('checked', false);
$('#nginx').prop('checked', false); $('#nginx').prop('checked', false);

View File

@ -1,3 +1,10 @@
let nice_names = {
'haproxy': 'HAProxy',
'nginx': 'NGINX',
'apache': 'Apache',
'node': 'Node',
'keepalived': 'Keepalived'
};
$( function() { $( function() {
$('#install').click(function () { $('#install').click(function () {
installService('haproxy') installService('haproxy')
@ -13,16 +20,12 @@ $( function() {
$("#ajaxmon").html(wait_mess); $("#ajaxmon").html(wait_mess);
$.ajax({ $.ajax({
url: "/app/install/grafana", url: "/app/install/grafana",
// data: {
// token: $('#token').val()
// },
// type: "POST",
success: function (data) { success: function (data) {
data = data.replace(/\s+/g, ' '); data = data.replace(/\s+/g, ' ');
$("#ajaxmon").html(''); $("#ajaxmon").html('');
if (data.indexOf('FAILED') != '-1' || data.indexOf('UNREACHABLE') != '-1' || data.indexOf('ERROR') != '-1') { if (data.indexOf('FAILED') != '-1' || data.indexOf('UNREACHABLE') != '-1' || data.indexOf('ERROR') != '-1') {
toastr.clear(); toastr.clear();
var p_err = show_pretty_ansible_error(data); let p_err = show_pretty_ansible_error(data);
toastr.error(p_err); toastr.error(p_err);
} else if (data.indexOf('success') != '-1') { } else if (data.indexOf('success') != '-1') {
toastr.clear(); toastr.clear();
@ -87,28 +90,27 @@ $( function() {
} }
}); });
$("#geoip_install").click(function () { $("#geoip_install").click(function () {
var updating_geoip = 0; let updating_geoip = 0;
if ($('#updating_geoip').is(':checked')) { if ($('#updating_geoip').is(':checked')) {
updating_geoip = '1'; updating_geoip = '1';
} }
$("#ajax-geoip").html(wait_mess); $("#ajax-geoip").html(wait_mess);
let service = $('#geoip_service option:selected').val(); let service = $('#geoip_service option:selected').val();
let jsonData = {
"server_ip": $('#geoipserv option:selected').val(),
"service": service,
"update": updating_geoip
}
$.ajax({ $.ajax({
url: "/app/install/geoip", url: "/app/install/geoip",
data: { data: JSON.stringify(jsonData),
server_ip: $('#geoipserv option:selected').val(), contentType: "application/json; charset=utf-8",
service: service,
update: updating_geoip,
token: $('#token').val()
},
type: "POST", type: "POST",
success: function (data) { success: function (data) {
$("#ajax-geoip").html(''); $("#ajax-geoip").html('');
try { if (data.status === 'failed') {
if (data.indexOf('error:') != '-1') { toastr.error(data.error);
toastr.error(data); } else {
}
} catch (e) {
parseAnsibleJsonOutput(data, service + ' GeoIP', '#geoip_service'); parseAnsibleJsonOutput(data, service + ' GeoIP', '#geoip_service');
$("#geoip_service").trigger("selectmenuchange"); $("#geoip_service").trigger("selectmenuchange");
} }
@ -119,10 +121,6 @@ $( function() {
function checkGeoipInstallation() { function checkGeoipInstallation() {
$.ajax({ $.ajax({
url: "/app/install/geoip/" + $('#geoip_service option:selected').val() + "/" + $('#geoipserv option:selected').val(), url: "/app/install/geoip/" + $('#geoip_service option:selected').val() + "/" + $('#geoipserv option:selected').val(),
// data: {
// token: $('#token').val()
// },
// type: "POST",
success: function (data) { success: function (data) {
data = data.replace(/^\s+|\s+$/g, ''); data = data.replace(/^\s+|\s+$/g, '');
if (data.indexOf('No such file or directory') != '-1' || data.indexOf('cannot access') != '-1') { if (data.indexOf('No such file or directory') != '-1' || data.indexOf('cannot access') != '-1') {
@ -137,10 +135,9 @@ function checkGeoipInstallation() {
} }
function installService(service) { function installService(service) {
$("#ajax").html('') $("#ajax").html('')
var syn_flood = 0; let syn_flood = 0;
var docker = 0; let docker = 0;
var select_id = '#' + service + 'addserv'; let select_id = '#' + service + 'addserv';
var nice_names = {'haproxy': 'HAProxy', 'nginx': 'NGINX', 'apache': 'Apache'};
if ($('#' + service + '_syn_flood').is(':checked')) { if ($('#' + service + '_syn_flood').is(':checked')) {
syn_flood = '1'; syn_flood = '1';
} }
@ -148,11 +145,11 @@ function installService(service) {
docker = '1'; docker = '1';
} }
if ($(select_id).val() == '------' || $(select_id).val() === null) { if ($(select_id).val() == '------' || $(select_id).val() === null) {
var select_server = $('#translate').attr('data-select_server'); let select_server = $('#translate').attr('data-select_server');
toastr.warning(select_server); toastr.warning(select_server);
return false return false
} }
var jsonData = {}; let jsonData = {};
jsonData['servers'] = {'0': {}} jsonData['servers'] = {'0': {}}
jsonData['services'] = {}; jsonData['services'] = {};
jsonData['services'][service] = {}; jsonData['services'][service] = {};
@ -174,16 +171,13 @@ function installService(service) {
504: function () { 504: function () {
showErrorStatus(nice_names[service], $(select_id + ' option:selected').text()); showErrorStatus(nice_names[service], $(select_id + ' option:selected').text());
}, },
data: { data: JSON.stringify(jsonData),
jsonData: JSON.stringify(jsonData) contentType: "application/json; charset=utf-8",
},
type: "POST", type: "POST",
success: function (data) { success: function (data) {
try { if (data.status === 'failed') {
if (data.indexOf('error:') != '-1') { toastr.error(data.error);
toastr.error(data); } else {
}
} catch (e) {
parseAnsibleJsonOutput(data, nice_names[service], select_id); parseAnsibleJsonOutput(data, nice_names[service], select_id);
$(select_id).trigger("selectmenuchange"); $(select_id).trigger("selectmenuchange");
} }
@ -193,42 +187,40 @@ function installService(service) {
function installExporter(exporter) { function installExporter(exporter) {
$("#ajaxmon").html(''); $("#ajaxmon").html('');
$("#ajaxmon").html(wait_mess); $("#ajaxmon").html(wait_mess);
var exporter_id = '#' + exporter + '_exp_addserv'; let exporter_id = '#' + exporter + '_exp_addserv';
var ext_prom = 0; let ext_prom = 0;
let nice_exporter_name = nice_names[exporter] + ' exporter';
if ($('#' + exporter + '_ext_prom').is(':checked')) { if ($('#' + exporter + '_ext_prom').is(':checked')) {
ext_prom = '1'; ext_prom = '1';
} }
var nice_names = {'haproxy': 'HAProxy exporter', 'nginx': 'NGINX exporter', 'apache': 'Apache exporter', 'node': 'Node exporter', 'keepalived': 'Keepalived exporter'}; let jsonData = {
"server_ip": $(exporter_id).val(),
"exporter_v": $('#' + exporter + 'expver').val(),
"ext_prom": ext_prom,
}
$("#ajax").html(wait_mess); $("#ajax").html(wait_mess);
$.ajax({ $.ajax({
url: "/app/install/exporter/" + exporter, url: "/app/install/exporter/" + exporter,
500: function () { 500: function () {
showErrorStatus(nice_names[exporter], $(exporter_id + ' option:selected').text()); showErrorStatus(nice_exporter_name, $(exporter_id + ' option:selected').text());
}, },
504: function () { 504: function () {
showErrorStatus(nice_names[exporter], $(exporter_id + ' option:selected').text()); showErrorStatus(nice_exporter_name, $(exporter_id + ' option:selected').text());
},
data: {
server_ip: $(exporter_id).val(),
exporter_v: $('#' + exporter + 'expver').val(),
ext_prom: ext_prom,
token: $('#token').val()
}, },
data: JSON.stringify(jsonData),
contentType: "application/json; charset=utf-8",
type: "POST", type: "POST",
success: function (data) { success: function (data) {
try { if (data.status === 'failed') {
if (data.indexOf('error:') != '-1') { toastr.error(data.error);
toastr.error(data); } else {
} parseAnsibleJsonOutput(data, nice_exporter_name, exporter_id);
} catch (e) {
parseAnsibleJsonOutput(data, nice_names[exporter], exporter_id);
$(exporter_id).trigger("selectmenuchange"); $(exporter_id).trigger("selectmenuchange");
} }
} }
}); });
} }
function showExporterVersion(exporter) { function showExporterVersion(exporter) {
var nice_names = {'haproxy': 'HAProxy', 'nginx': 'NGINX', 'apache': 'Apache', 'node': 'Node', 'keepalived': 'Keepalived'};
$.ajax({ $.ajax({
url: "/app/install/exporter/" + exporter + "/version/" + $('#' + exporter + '_exp_addserv option:selected').val(), url: "/app/install/exporter/" + exporter + "/version/" + $('#' + exporter + '_exp_addserv option:selected').val(),
success: function (data) { success: function (data) {
@ -272,26 +264,25 @@ function showServiceVersion(service) {
}); });
} }
function showErrorStatus(service_name, server) { function showErrorStatus(service_name, server) {
var something_wrong = $('#translate').attr('data-something_wrong'); let something_wrong = $('#translate').attr('data-something_wrong');
toastr.error(something_wrong + ' ' + service_name + ' ' + server); toastr.error(something_wrong + ' ' + service_name + ' ' + server);
} }
function parseAnsibleJsonOutput(output, service_name, select_id) { function parseAnsibleJsonOutput(output, service_name, select_id) {
output = JSON.parse(JSON.stringify(output));
let was_installed = $('#translate').attr('data-was_installed'); let was_installed = $('#translate').attr('data-was_installed');
let server_name = ''; let server_name = '';
for (var k in output['ok']) { for (let k in output['ok']) {
if (select_id) { if (select_id) {
server_name = $(select_id + ' option[value="'+k+'"]').text(); server_name = $(select_id + ' option[value="'+k+'"]').text();
} }
toastr.success(service_name + ' ' + was_installed +' ' + server_name); toastr.success(service_name + ' ' + was_installed +' ' + server_name);
} }
for (var k in output['failures']) { for (let k in output['failures']) {
if (select_id) { if (select_id) {
server_name = $(select_id + ' option[value="'+k+'"]').text(); server_name = $(select_id + ' option[value="'+k+'"]').text();
} }
showErrorStatus(service_name, server_name); showErrorStatus(service_name, server_name);
} }
for (var k in output['dark']) { for (let k in output['dark']) {
if (select_id) { if (select_id) {
server_name = $(select_id + ' option[value="'+k+'"]').text(); server_name = $(select_id + ' option[value="'+k+'"]').text();
} }

View File

@ -334,7 +334,7 @@ function getTable() {
} else { } else {
$("#ajaxtable").html(data); $("#ajaxtable").html(data);
$("input[type=submit], button").button(); $("input[type=submit], button").button();
$.getScript("/inc/script.js"); $.getScript("/app/static/js/script.js");
$.getScript("/app/static/js/overview.js"); $.getScript("/app/static/js/overview.js");
FontAwesomeConfig = {searchPseudoElements: true, observeMutations: false}; FontAwesomeConfig = {searchPseudoElements: true, observeMutations: false};
} }
@ -357,7 +357,7 @@ function getList() {
} else { } else {
$("#ajaxlist").html(data); $("#ajaxlist").html(data);
$("input[type=submit], button").button(); $("input[type=submit], button").button();
$.getScript("/inc/script.js"); $.getScript("/app/static/js/script.js");
$.getScript("/app/static/js/overview.js"); $.getScript("/app/static/js/overview.js");
FontAwesomeConfig = {searchPseudoElements: true, observeMutations: false}; FontAwesomeConfig = {searchPseudoElements: true, observeMutations: false};
} }
@ -433,7 +433,7 @@ function getSessions() {
} else { } else {
$("#ajaxsessions").html(data); $("#ajaxsessions").html(data);
$("input[type=submit], button").button(); $("input[type=submit], button").button();
$.getScript("/inc/script.js"); $.getScript("/app/static/js/script.js");
$.getScript("/app/static/js/overview.js"); $.getScript("/app/static/js/overview.js");
FontAwesomeConfig = {searchPseudoElements: true, observeMutations: false}; FontAwesomeConfig = {searchPseudoElements: true, observeMutations: false};
} }

View File

@ -1,4 +1,4 @@
var url = "/inc/script.js"; var url = "/app/static/js/script.js";
var cur_url = window.location.href.split('/app/').pop(); var cur_url = window.location.href.split('/app/').pop();
cur_url = cur_url.split('/'); cur_url = cur_url.split('/');
var intervalId; var intervalId;

View File

@ -43,7 +43,6 @@ function getHAClusterVIPS(cluster_id) {
clearUdpVip(); clearUdpVip();
$('#new-udp-vip').append('<option value="------" selected>------</option>') $('#new-udp-vip').append('<option value="------" selected>------</option>')
data.forEach(function (obj) { data.forEach(function (obj) {
console.log(obj.vip);
$('#new-udp-vip').append('<option value="' + obj.id + '">' + obj.vip + '</option>') $('#new-udp-vip').append('<option value="' + obj.id + '">' + obj.vip + '</option>')
}); });
$('#new-udp-vip').selectmenu("refresh"); $('#new-udp-vip').selectmenu("refresh");
@ -320,7 +319,8 @@ function saveUdpListener(jsonData, dialog_id, listener_id=0, edited=0, reconfigu
function Reconfigure(listener_id) { function Reconfigure(listener_id) {
return $.ajax({ return $.ajax({
url: "/app/install/udp", url: "/app/install/udp",
data: {listener_id: listener_id}, data: JSON.stringify({listener_id: listener_id}),
contentType: "application/json; charset=utf-8",
async: false, async: false,
type: "POST", type: "POST",
success: function (data) { success: function (data) {

View File

@ -2,12 +2,12 @@ var awesome = "/app/static/js/fontawesome.min.js"
var waf = "/app/static/js/waf.js" var waf = "/app/static/js/waf.js"
var overview = "/app/static/js/overview.js" var overview = "/app/static/js/overview.js"
function showOverviewWaf(serv, hostnamea) { function showOverviewWaf(serv, hostnamea) {
var service = cur_url[1]; let service = cur_url[1];
if (service == 'haproxy') { if (service == 'haproxy') {
$.getScript('/app/static/js/chart.min-4.3.0.js'); $.getScript('/app/static/js/chart.min-4.3.0.js');
showWafMetrics(); showWafMetrics();
} }
var i; let i;
for (i = 0; i < serv.length; i++) { for (i = 0; i < serv.length; i++) {
showOverviewWafCallBack(serv[i], hostnamea[i]) showOverviewWafCallBack(serv[i], hostnamea[i])
} }
@ -15,7 +15,7 @@ function showOverviewWaf(serv, hostnamea) {
$.getScript(waf); $.getScript(waf);
} }
function showOverviewWafCallBack(serv, hostnamea) { function showOverviewWafCallBack(serv, hostnamea) {
var service = cur_url[1]; let service = cur_url[1];
$.ajax({ $.ajax({
url: "/app/waf/overview/" + service + "/" + serv, url: "/app/waf/overview/" + service + "/" + serv,
beforeSend: function () { beforeSend: function () {
@ -32,7 +32,7 @@ function showOverviewWafCallBack(serv, hostnamea) {
}); });
} }
function metrics_waf(name) { function metrics_waf(name) {
var enable = 0; let enable = 0;
if ($('#' + name).is(':checked')) { if ($('#' + name).is(':checked')) {
enable = '1'; enable = '1';
} }
@ -50,16 +50,15 @@ function metrics_waf(name) {
function installWaf(ip1) { function installWaf(ip1) {
$("#ajax").html(''); $("#ajax").html('');
$("#ajax").html(wait_mess); $("#ajax").html(wait_mess);
var service = cur_url[1]; let service = cur_url[1];
$.ajax({ $.ajax({
url: "/app/install/waf/" + service + "/" + ip1, url: "/app/install/waf/" + service + "/" + ip1,
type: "POST", type: "POST",
contentType: "application/json; charset=utf-8",
success: function (data) { success: function (data) {
try { if (data.status === 'failed') {
if (data.indexOf('error:') != '-1') { toastr.error(data.error);
toastr.error(data); } else {
}
} catch (e) {
toastr.clear(); toastr.clear();
parseAnsibleJsonOutput(data, `${service} WAF`, false); parseAnsibleJsonOutput(data, `${service} WAF`, false);
showOverviewWaf(ip, hostnamea); showOverviewWaf(ip, hostnamea);
@ -69,9 +68,9 @@ function installWaf(ip1) {
}); });
} }
function changeWafMode(id) { function changeWafMode(id) {
var waf_mode = $('#' + id + ' option:selected').val(); let waf_mode = $('#' + id + ' option:selected').val();
var server_hostname = id.split('_')[0]; let server_hostname = id.split('_')[0];
var service = cur_url[1]; let service = cur_url[1];
$.ajax({ $.ajax({
url: "/app/waf/" + service + "/mode/" + server_hostname + "/" + waf_mode, url: "/app/waf/" + service + "/mode/" + server_hostname + "/" + waf_mode,
success: function (data) { success: function (data) {
@ -85,22 +84,18 @@ function changeWafMode(id) {
} }
$( function() { $( function() {
$( "#waf_rules input" ).change(function() { $( "#waf_rules input" ).change(function() {
var id = $(this).attr('id').split('-'); let id = $(this).attr('id').split('-');
waf_rules_en(id[1]) waf_rules_en(id[1])
}); });
}); });
function waf_rules_en(id) { function waf_rules_en(id) {
var enable = 0; let enable = 0;
if ($('#rule_id-' + id).is(':checked')) { if ($('#rule_id-' + id).is(':checked')) {
enable = '1'; enable = '1';
} }
var serv = cur_url[2]; let serv = cur_url[2];
$.ajax({ $.ajax({
url: "/app/waf/" + serv + "/rule/" + id + "/" + enable, url: "/app/waf/" + serv + "/rule/" + id + "/" + enable,
// data: {
// token: $('#token').val()
// },
// type: "POST",
success: function (data) { success: function (data) {
if (data.indexOf('sed:') != '-1' || data.indexOf('error: ') != '-1') { if (data.indexOf('sed:') != '-1' || data.indexOf('error: ') != '-1') {
toastr.error(data); toastr.error(data);
@ -132,17 +127,19 @@ function addNewConfig() {
}, },
buttons: { buttons: {
"Create": function () { "Create": function () {
var valid = true; let valid = true;
allFields = $( [] ).add( $('#new_rule_name') ).add( $('#new_rule_description') ) let new_rule_name_id = $('#new_rule_name');
let new_rule_description_id = $('#new_rule_description');
allFields = $([]).add(new_rule_name_id).add(new_rule_description_id)
allFields.removeClass("ui-state-error"); allFields.removeClass("ui-state-error");
valid = valid && checkLength( $('#new_rule_name'), "New rule name", 1 ); valid = valid && checkLength(new_rule_name_id, "New rule name", 1);
valid = valid && checkLength( $('#new_rule_description'), "New rule description", 1 ); valid = valid && checkLength(new_rule_description_id, "New rule description", 1);
if (valid) { if (valid) {
let new_rule_name = $('#new_rule_name').val(); let new_rule_name = new_rule_name_id.val();
let new_rule_description = $('#new_rule_description').val(); let new_rule_description = new_rule_description_id.val();
let new_rule_file = new_rule_name.replaceAll(' ', '_'); let new_rule_file = new_rule_name.replaceAll(' ', '_');
var service = cur_url[1]; let service = cur_url[1];
var serv = cur_url[2]; let serv = cur_url[2];
service = escapeHtml(service); service = escapeHtml(service);
new_rule_name = escapeHtml(new_rule_name); new_rule_name = escapeHtml(new_rule_name);
new_rule_description = escapeHtml(new_rule_description); new_rule_description = escapeHtml(new_rule_description);
@ -161,8 +158,8 @@ function addNewConfig() {
if (data.indexOf('error:') != '-1') { if (data.indexOf('error:') != '-1') {
toastr.error(data); toastr.error(data);
} else { } else {
var getId = new RegExp('[0-9]+'); let getId = new RegExp('[0-9]+');
var id = data.match(getId) + ''; let id = data.match(getId) + '';
window.location.replace('waf.py?service=' + service + '&waf_rule_id=' + id + '&serv=' + serv); window.location.replace('waf.py?service=' + service + '&waf_rule_id=' + id + '&serv=' + serv);
} }
} }

View File

@ -1,5 +1,5 @@
<link href="{{ url_for('static', filename='css/table-6.3.9.css') }}" rel="stylesheet" type="text/css"> <link href="{{ url_for('static', filename='css/table-6.3.9.css') }}" rel="stylesheet" type="text/css">
<script type="text/javascript" charset="utf8" src="/inc/dataTables.min.js"></script> <script type="text/javascript" charset="utf8" src="/app/static/js/dataTables.min.js"></script>
{% if action == "checker" %} {% if action == "checker" %}
{% set column_for_sort = 3 %} {% set column_for_sort = 3 %}
{% else %} {% else %}

View File

@ -1,7 +1,7 @@
{% from 'include/input_macros.html' import input, checkbox, copy_to_clipboard %} {% from 'include/input_macros.html' import input, checkbox, copy_to_clipboard %}
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$('#{{list_id}}').on( 'page.dt', function () { $.getScript("/inc/fontawesome.min.js"); } ) $('#{{list_id}}').on( 'page.dt', function () { $.getScript("/app/static/js/fontawesome.min.js"); } )
.DataTable( { .DataTable( {
"order": [[ 0, "desc" ]], "order": [[ 0, "desc" ]],
"pageLength": 25, "pageLength": 25,
@ -76,7 +76,7 @@
$( function() { $( function() {
$('#list_add_ip').click(function () { $('#list_add_ip').click(function () {
addListIp.dialog('open'); addListIp.dialog('open');
$.getScript("/inc/runtumeapi.js"); $.getScript("/app/static/js/runtumeapi.js");
}); });
var addListIp = $("#list_add_ip_form").dialog({ var addListIp = $("#list_add_ip_form").dialog({
autoOpen: false, autoOpen: false,

View File

@ -2,7 +2,7 @@
<tr class="newbackup" id="s3-backup-table-{{b.id}}"> <tr class="newbackup" id="s3-backup-table-{{b.id}}">
<td class="padding10 first-collumn"> <td class="padding10 first-collumn">
<span id="backup-s3-server-{{b.id}}" style="display: none">{{ b.server }}</span> <span id="backup-s3-server-{{b.id}}" style="display: none">{{ b.server }}</span>
{{s.1}} {{b.server}}
</td> </td>
<td> <td>
<span id="s3-server-{{b.id}}">{{b.s3_server}}</span> <span id="s3-server-{{b.id}}">{{b.s3_server}}</span>
@ -20,18 +20,11 @@
<span id="s3-backup-description-{{b.id}}"></span> <span id="s3-backup-description-{{b.id}}"></span>
{% endif %} {% endif %}
</td> </td>
<!-- <td>--> <td>
<!-- <a class="add" onclick="cloneS3Backup({{b.id}})" id="clone-s3-backup{{b.id}}" title="Clone S3 {{b.server}}" style="cursor: pointer;"></a>--> <a class="add" onclick="cloneS3Backup({{b.id}})" id="clone-s3-backup{{b.id}}" title="Clone S3 {{b.server}}" style="cursor: pointer;"></a>
<!-- </td>--> </td>
<td> <td>
<a class="delete" onclick="confirmDeleteS3Backup({{b.id}})" title="Delete S3 backup {{b.server}}" style="cursor: pointer;"></a> <a class="delete" onclick="confirmDeleteS3Backup({{b.id}})" title="Delete S3 backup {{b.server}}" style="cursor: pointer;"></a>
</td> </td>
</tr> </tr>
<script>
$( function() {
$("#s3-backup-time-{{ b.id}}" ).selectmenu({
width: 100
});
});
</script>
{% endfor %} {% endfor %}

View File

@ -2,7 +2,7 @@
{% from 'include/input_macros.html' import copy_to_clipboard %} {% from 'include/input_macros.html' import copy_to_clipboard %}
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$('#sessions_table').on( 'page.dt', function () { $.getScript("/inc/fontawesome.min.js"); } ) $('#sessions_table').on( 'page.dt', function () { $.getScript("/app/static/js/fontawesome.min.js"); } )
.DataTable( { .DataTable( {
"order": [[ 5, "desc" ]], "order": [[ 5, "desc" ]],
"pageLength": 25, "pageLength": 25,

View File

@ -24,7 +24,7 @@
$("form input[type='checkbox']").attr("checked",false).change(); $("form input[type='checkbox']").attr("checked",false).change();
} }
}); });
$.getScript('/inc/script.js'); $.getScript('/app/static/js/script.js');
function show_diff(id) { function show_diff(id) {
if ($('#show_diff_'+id).css('display') == 'none') { if ($('#show_diff_'+id).css('display') == 'none') {
$('#show_diff_'+id).show(); $('#show_diff_'+id).show();

View File

@ -5,7 +5,7 @@
{% set headers = headers.split(' ') %} {% set headers = headers.split(' ') %}
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$('#{{tables_head.0.strip()}}').on( 'page.dt', function () { $.getScript("/inc/fontawesome.min.js"); } ) $('#{{tables_head.0.strip()}}').on( 'page.dt', function () { $.getScript("/app/static/js/fontawesome.min.js"); } )
.DataTable( { .DataTable( {
"pageLength": 25, "pageLength": 25,
"columnDefs": [ "columnDefs": [

View File

@ -6,7 +6,7 @@
{% set headers = headers.split(' ') %} {% set headers = headers.split(' ') %}
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$('#{{t.0.0.strip()}}').on( 'page.dt', function () { $.getScript("/inc/fontawesome.min.js"); } ) $('#{{t.0.0.strip()}}').on( 'page.dt', function () { $.getScript("/app/static/js/fontawesome.min.js"); } )
.DataTable( { .DataTable( {
"pageLength": 10, "pageLength": 10,
"columnDefs": [ "columnDefs": [

View File

@ -2,28 +2,28 @@
{% block title %}{{lang.menu_links.config.h2}} {{service_desc.service}}{% endblock %} {% block title %}{{lang.menu_links.config.h2}} {{service_desc.service}}{% endblock %}
{% block h2 %}{{lang.menu_links.config.h2}} {{service_desc.service}}{% endblock %} {% block h2 %}{{lang.menu_links.config.h2}} {{service_desc.service}}{% endblock %}
{% block content %} {% block content %}
<link rel="stylesheet" href="/inc/codemirror/lib/codemirror.css"> <link rel="stylesheet" href="/app/static/js/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/inc/codemirror/addon/dialog/dialog.css"> <link rel="stylesheet" href="/app/static/js/codemirror/addon/dialog/dialog.css">
<link rel="stylesheet" href="/inc/codemirror/addon/fold/foldgutter.css"> <link rel="stylesheet" href="/app/static/js/codemirror/addon/fold/foldgutter.css">
<script src="/inc/codemirror/lib/codemirror.js"></script> <script src="/app/static/js/codemirror/lib/codemirror.js"></script>
<script src="/inc/codemirror/addon/search/search.js"></script> <script src="/app/static/js/codemirror/addon/search/search.js"></script>
<script src="/inc/codemirror/addon/search/searchcursor.js"></script> <script src="/app/static/js/codemirror/addon/search/searchcursor.js"></script>
<script src="/inc/codemirror/addon/search/jump-to-line.js"></script> <script src="/app/static/js/codemirror/addon/search/jump-to-line.js"></script>
<script src="/inc/codemirror/addon/search/matchesonscrollbar.js"></script> <script src="/app/static/js/codemirror/addon/search/matchesonscrollbar.js"></script>
<script src="/inc/codemirror/addon/search/match-highlighter.js"></script> <script src="/app/static/js/codemirror/addon/search/match-highlighter.js"></script>
<script src="/inc/codemirror/addon/dialog/dialog.js"></script> <script src="/app/static/js/codemirror/addon/dialog/dialog.js"></script>
<script src="/inc/codemirror/addon/edit/matchbrackets.js"></script> <script src="/app/static/js/codemirror/addon/edit/matchbrackets.js"></script>
<script src="/inc/codemirror/addon/edit/closebrackets.js"></script> <script src="/app/static/js/codemirror/addon/edit/closebrackets.js"></script>
<script src="/inc/codemirror/addon/comment/comment.js"></script> <script src="/app/static/js/codemirror/addon/comment/comment.js"></script>
<script src="/inc/codemirror/addon/wrap/hardwrap.js"></script> <script src="/app/static/js/codemirror/addon/wrap/hardwrap.js"></script>
<script src="/inc/codemirror/addon/fold/foldcode.js"></script> <script src="/app/static/js/codemirror/addon/fold/foldcode.js"></script>
<script src="/inc/codemirror/addon/fold/foldgutter.js"></script> <script src="/app/static/js/codemirror/addon/fold/foldgutter.js"></script>
<script src="/inc/codemirror/addon/fold/brace-fold.js"></script> <script src="/app/static/js/codemirror/addon/fold/brace-fold.js"></script>
<script src="/inc/codemirror/addon/fold/comment-fold.js"></script> <script src="/app/static/js/codemirror/addon/fold/comment-fold.js"></script>
<script src="/inc/codemirror/addon/scroll/annotatescrollbar.js"></script> <script src="/app/static/js/codemirror/addon/scroll/annotatescrollbar.js"></script>
<script src="/inc/codemirror/mode/nginx.js"></script> <script src="/app/static/js/codemirror/mode/nginx.js"></script>
<script src="/inc/codemirror/mode/haproxy.js"></script> <script src="/app/static/js/codemirror/mode/haproxy.js"></script>
<script src="/inc/codemirror/keymap/sublime.js"></script> <script src="/app/static/js/codemirror/keymap/sublime.js"></script>
<script src="/app/static/js/configshow.js"></script> <script src="/app/static/js/configshow.js"></script>
{% if is_serv_protected and g.user_params['role'] > 2 %} {% if is_serv_protected and g.user_params['role'] > 2 %}
<meta http-equiv="refresh" content="0; url=/app/service"> <meta http-equiv="refresh" content="0; url=/app/service">

View File

@ -6,7 +6,7 @@
{% include 'include/getstarted.html' %} {% include 'include/getstarted.html' %}
{% else %} {% else %}
<link href="{{ url_for('static', filename='css/table-6.3.9.css') }}" rel="stylesheet" type="text/css"> <link href="{{ url_for('static', filename='css/table-6.3.9.css') }}" rel="stylesheet" type="text/css">
<script type="text/javascript" charset="utf8" src="/inc/dataTables.min.js"></script> <script type="text/javascript" charset="utf8" src="/app/static/js/dataTables.min.js"></script>
<p> <p>
<form action="{{ action }}" method="post" class="left-space"> <form action="{{ action }}" method="post" class="left-space">
<input type="hidden" value="{{service}}" name="service" id="service"> <input type="hidden" value="{{service}}" name="service" id="service">

View File

@ -110,6 +110,14 @@
{{ checkbox('syn_flood') }} {{ checkbox('syn_flood') }}
</td> </td>
</tr> </tr>
<tr>
<td class="help_cursor">
<span title="{{lang.ha_page.use_src_help}}">{{ lang.ha_page.use_src }}</span>
</td>
<td class="help_cursor">
{{ checkbox('use_src', title=lang.ha_page.use_src_help) }}
</td>
</tr>
<tr> <tr>
<td class="padding20 help_cursor"><span title="{{lang.ha_page.try_install}} HAProxy">HAProxy</span></td> <td class="padding20 help_cursor"><span title="{{lang.ha_page.try_install}} HAProxy">HAProxy</span></td>
<td class="help_cursor">{{ checkbox('hap', title=lang.ha_page.try_install+' HAProxy') }}</td> <td class="help_cursor">{{ checkbox('hap', title=lang.ha_page.try_install+' HAProxy') }}</td>
@ -168,6 +176,10 @@
<td class="padding20 help_cursor"><span title="{{lang.ha_page.create_virt_server}}">{{lang.words.add|title()}} VIRT {{lang.words.server}}</span></td> <td class="padding20 help_cursor"><span title="{{lang.ha_page.create_virt_server}}">{{lang.words.add|title()}} VIRT {{lang.words.server}}</span></td>
<td class="help_cursor">{{ checkbox('vrrp-ip-add-virt_server', title=lang.ha_page.create_virt_server, checked='checked') }}</td> <td class="help_cursor">{{ checkbox('vrrp-ip-add-virt_server', title=lang.ha_page.create_virt_server, checked='checked') }}</td>
</tr> </tr>
<tr>
<td class="padding20 help_cursor"><span title="{{lang.ha_page.use_src_help}}">{{ lang.ha_page.use_src }}</span></td>
<td class="help_cursor">{{ checkbox('vrrp-ip-add-use_src', title=lang.ha_page.use_src_help, checked='checked') }}</td>
</tr>
</table> </table>
</div> </div>
<div id="dialog-confirm" style="display: none;"> <div id="dialog-confirm" style="display: none;">

View File

@ -7,13 +7,13 @@
{% include 'include/no_sub.html' %} {% include 'include/no_sub.html' %}
{% else %} {% else %}
<link href="{{ url_for('static', filename='css/table-6.3.9.css') }}" rel="stylesheet" type="text/css"> <link href="{{ url_for('static', filename='css/table-6.3.9.css') }}" rel="stylesheet" type="text/css">
<link href="/inc/dataTables/buttons.dataTables.min.css" rel="stylesheet" type="text/css"> <link href="/app/static/js/dataTables/buttons.dataTables.min.css" rel="stylesheet" type="text/css">
<script type="text/javascript" charset="utf8" src="/inc/dataTables.min.js"></script> <script type="text/javascript" charset="utf8" src="/app/static/js/dataTables.min.js"></script>
<script type="text/javascript" charset="utf8" src="/inc/dataTables/dataTables.buttons.min.js"></script> <script type="text/javascript" charset="utf8" src="/app/static/js/dataTables/dataTables.buttons.min.js"></script>
<script type="text/javascript" charset="utf8" src="/inc/dataTables/jszip.min.js"></script> <script type="text/javascript" charset="utf8" src="/app/static/js/dataTables/jszip.min.js"></script>
<script type="text/javascript" charset="utf8" src="/inc/dataTables/pdfmake.min.js"></script> <script type="text/javascript" charset="utf8" src="/app/static/js/dataTables/pdfmake.min.js"></script>
<script type="text/javascript" charset="utf8" src="/inc/dataTables/vfs_fonts.js"></script> <script type="text/javascript" charset="utf8" src="/app/static/js/dataTables/vfs_fonts.js"></script>
<script type="text/javascript" charset="utf8" src="/inc/dataTables/buttons.html5.min.js"></script> <script type="text/javascript" charset="utf8" src="/app/static/js/dataTables/buttons.html5.min.js"></script>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$('#table_history').on('page.dt') $('#table_history').on('page.dt')

View File

@ -27,22 +27,22 @@
<script src="https://use.fontawesome.com/releases/v5.15.4/js/all.js" data-auto-replace-svg="nest"></script> <script src="https://use.fontawesome.com/releases/v5.15.4/js/all.js" data-auto-replace-svg="nest"></script>
<script>FontAwesomeConfig = { searchPseudoElements: true, observeMutations: false };</script> <script>FontAwesomeConfig = { searchPseudoElements: true, observeMutations: false };</script>
<script defer src="/app/static/js/ion.sound.min.js"></script> <script defer src="/app/static/js/ion.sound.min.js"></script>
<script defer src="/inc/intro/introjs.min.js"></script> <script defer src="/app/static/js/intro/introjs.min.js"></script>
<link href="/inc/intro/introjs.min.css" rel="stylesheet"> <link href="/app/static/js/intro/introjs.min.css" rel="stylesheet">
<link href="/inc/intro/introjs-modern.css" rel="stylesheet"> <link href="/app/static/js/intro/introjs-modern.css" rel="stylesheet">
<link href="{{ url_for('static', filename='css/awesome-6.3.9.css') }}" rel="stylesheet"> <link href="{{ url_for('static', filename='css/awesome-6.3.9.css') }}" rel="stylesheet">
<link href="{{ url_for('static', filename='css/style-6.3.9.css') }}" rel="stylesheet"> <link href="{{ url_for('static', filename='css/style-6.3.9.css') }}" rel="stylesheet">
<link href="{{ url_for('static', filename='css/nprogress.css') }}" rel="stylesheet"> <link href="{{ url_for('static', filename='css/nprogress.css') }}" rel="stylesheet">
<link href="{{ url_for('static', filename='css/jquery-ui.min.css') }}" rel="stylesheet"> <link href="{{ url_for('static', filename='css/jquery-ui.min.css') }}" rel="stylesheet">
<link href="{{ url_for('static', filename='css/jquery-ui.structure.min.css') }}" rel="stylesheet"> <link href="{{ url_for('static', filename='css/jquery-ui.structure.min.css') }}" rel="stylesheet">
<script src="/inc/jquery-3.6.0.min.js"></script> <script src="/app/static/js/jquery-3.6.0.min.js"></script>
<script src="/inc/jquery-ui.min.js"></script> <script src="/app/static/js/jquery-ui.min.js"></script>
<script src="/app/static/js/js.cookie.min.js"></script> <script src="/app/static/js/js.cookie.min.js"></script>
<script src="/app/static/js/reconnecting-websocket.js"></script> <script src="/app/static/js/reconnecting-websocket.js"></script>
<script src="/app/static/js/hotkeys.js"></script> <script src="/app/static/js/hotkeys.js"></script>
<link href="{{ url_for('static', filename='css/select2.css') }}" rel="stylesheet" /> <link href="{{ url_for('static', filename='css/select2.css') }}" rel="stylesheet" />
<script src="/app/static/js/select2.js"></script> <script src="/app/static/js/select2.js"></script>
<script src="/inc/script.js"></script> <script src="/app/static/js/script.js"></script>
<script src="/app/static/js/nprogress.js"></script> <script src="/app/static/js/nprogress.js"></script>
<link href="{{ url_for('static', filename='css/toastr-6.3.9.css') }}" rel="stylesheet"/> <link href="{{ url_for('static', filename='css/toastr-6.3.9.css') }}" rel="stylesheet"/>
<script src="/app/static/js/toastr.js"></script> <script src="/app/static/js/toastr.js"></script>

View File

@ -22,5 +22,5 @@
</h4> </h4>
</center> </center>
<div id="oops_div"> <div id="oops_div">
<img src="/inc/images/oops.png" alt="Oops"> <img src="/app/static/images/images/oops.png" alt="Oops">
</div> </div>

View File

@ -3,7 +3,7 @@
{% block h2 %}{{ lang.p_s_page.p_s_title_history }}{% endblock %} {% block h2 %}{{ lang.p_s_page.p_s_title_history }}{% endblock %}
{% block content %} {% block content %}
<link href="{{ url_for('static', filename='css/table-6.3.9.css') }}" rel="stylesheet" type="text/css"> <link href="{{ url_for('static', filename='css/table-6.3.9.css') }}" rel="stylesheet" type="text/css">
<script type="text/javascript" charset="utf8" src="/inc/dataTables.min.js"></script> <script type="text/javascript" charset="utf8" src="/app/static/js/dataTables.min.js"></script>
<style> <style>
@media (max-width: 1280px) { @media (max-width: 1280px) {
.div-pannel { .div-pannel {

View File

@ -509,6 +509,8 @@
"check_apache_log": "Check <a href='/app/logs/internal' target='_blank' title='Internal logs'>Apache error log</a> for more information.", "check_apache_log": "Check <a href='/app/logs/internal' target='_blank' title='Internal logs'>Apache error log</a> for more information.",
"was_installed": "was installed on", "was_installed": "was installed on",
"start_enter": "Start typing into the network interface to add VIP", "start_enter": "Start typing into the network interface to add VIP",
"use_src": "Use VIP address as source",
"use_src_help": "Use VIP address as source for outgoing connections to backends",
"save_apply": "<b>Save</b> - means saving the HA cluster settings for Roxy-WI, without changing the component settings on the cluster members. <br /> <b>Apply</b> - recreate the HA cluster configuration on the cluster member servers and install additional services.", "save_apply": "<b>Save</b> - means saving the HA cluster settings for Roxy-WI, without changing the component settings on the cluster members. <br /> <b>Apply</b> - recreate the HA cluster configuration on the cluster member servers and install additional services.",
} }
%} %}

View File

@ -509,6 +509,8 @@
"check_apache_log": "Consultez <a href='/app/logs/internal' target='_blank' title='Journaux internes'>le journal des erreurs Apache</a> pour plus dinformations.", "check_apache_log": "Consultez <a href='/app/logs/internal' target='_blank' title='Journaux internes'>le journal des erreurs Apache</a> pour plus dinformations.",
"was_installed": "a été installé sur", "was_installed": "a été installé sur",
"start_enter": "Commencez à taper dans l'interface réseau pour ajouter VIP", "start_enter": "Commencez à taper dans l'interface réseau pour ajouter VIP",
"use_src": "Utiliser l'adresse VIP comme source",
"use_src_help": "Utiliser l'adresse VIP comme source pour les connexions sortantes vers les backends",
"save_apply": "<b>Enregistrer</b> - signifie enregistrer les paramètres du cluster HA pour Roxy-WI, sans modifier les paramètres des composants sur les membres du cluster. <br /> <b>Appliquer </b>: recréez la configuration du cluster HA sur les serveurs membres du cluster et installez des services supplémentaires.", "save_apply": "<b>Enregistrer</b> - signifie enregistrer les paramètres du cluster HA pour Roxy-WI, sans modifier les paramètres des composants sur les membres du cluster. <br /> <b>Appliquer </b>: recréez la configuration du cluster HA sur les serveurs membres du cluster et installez des services supplémentaires.",
} }
%} %}

View File

@ -509,6 +509,8 @@
"check_apache_log": "Verifique <a href='/app/logs/internal' target='_blank' title='Registros internos'>o log de erros do Apache</a> para obter mais informações.", "check_apache_log": "Verifique <a href='/app/logs/internal' target='_blank' title='Registros internos'>o log de erros do Apache</a> para obter mais informações.",
"was_installed": "foi instalado em", "was_installed": "foi instalado em",
"start_enter": "Comece a digitar na interface de rede para adicionar VIP", "start_enter": "Comece a digitar na interface de rede para adicionar VIP",
"use_src": "Use o endereço VIP como fonte",
"use_src_help": "Use o endereço VIP como fonte para conexões de saída para back-ends",
"save_apply": "<b>Salvar</b> - significa salvar as configurações do cluster HA para Roxy-WI, sem alterar as configurações do componente nos membros do cluster. <br /> <b>Aplicar</b> recrie a configuração do cluster HA nos servidores membros do cluster e instale serviços adicionais.", "save_apply": "<b>Salvar</b> - significa salvar as configurações do cluster HA para Roxy-WI, sem alterar as configurações do componente nos membros do cluster. <br /> <b>Aplicar</b> recrie a configuração do cluster HA nos servidores membros do cluster e instale serviços adicionais.",
} }
%} %}

View File

@ -509,6 +509,8 @@
"check_apache_log": "Проверьте <a href='/app/logs/internal' target='_blank' title='Внутренние логи'>журнал ошибок Apache</a> для получения дополнительной информации.", "check_apache_log": "Проверьте <a href='/app/logs/internal' target='_blank' title='Внутренние логи'>журнал ошибок Apache</a> для получения дополнительной информации.",
"was_installed": "был установлен на", "was_installed": "был установлен на",
"start_enter": "Начните вводить в сетевой интерфейс для добавления VIP", "start_enter": "Начните вводить в сетевой интерфейс для добавления VIP",
"use_src": "Использовать VIP-адрес в качестве источника",
"use_src_help": "Использовать VIP-адрес в качестве источника исходящих подключений к бэкэндам",
"save_apply": "<b>Сохранить</b> - подразумевает сохранение настроек HА кластера для Roxy-WI, без изменения настроек компонентов на участниках кластера. <br /> <b>Применить</b> - пересоздать конфигурацию HА кластера на серверах участниках кластера и установит дополнительные сервисы." "save_apply": "<b>Сохранить</b> - подразумевает сохранение настроек HА кластера для Roxy-WI, без изменения настроек компонентов на участниках кластера. <br /> <b>Применить</b> - пересоздать конфигурацию HА кластера на серверах участниках кластера и установит дополнительные сервисы."
} }
%} %}

View File

@ -4,7 +4,7 @@
{% block content %} {% block content %}
{% from 'include/input_macros.html' import input, checkbox, select %} {% from 'include/input_macros.html' import input, checkbox, select %}
<link href="{{ url_for('static', filename='css/table-6.3.9.css') }}" rel="stylesheet" type="text/css"> <link href="{{ url_for('static', filename='css/table-6.3.9.css') }}" rel="stylesheet" type="text/css">
<script type="text/javascript" charset="utf8" src="/inc/dataTables.min.js"></script> <script type="text/javascript" charset="utf8" src="/app/static/js/dataTables.min.js"></script>
<script type="text/javascript" charset="utf8" src="/app/static/js/runtimeapi.js"></script> <script type="text/javascript" charset="utf8" src="/app/static/js/runtimeapi.js"></script>
<div id="tabs"> <div id="tabs">
<ul> <ul>

View File

@ -5,27 +5,27 @@
{% if is_serv_protected and g.user_params['role'] > 2 %} {% if is_serv_protected and g.user_params['role'] > 2 %}
<meta http-equiv="refresh" content="0; url=/app/service/{{service}}"> <meta http-equiv="refresh" content="0; url=/app/service/{{service}}">
{% else %} {% else %}
<link rel="stylesheet" href="/inc/codemirror/lib/codemirror.css"> <link rel="stylesheet" href="/app/static/js/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/inc/codemirror/addon/dialog/dialog.css"> <link rel="stylesheet" href="/app/static/js/codemirror/addon/dialog/dialog.css">
<link rel="stylesheet" href="/inc/codemirror/addon/fold/foldgutter.css"> <link rel="stylesheet" href="/app/static/js/codemirror/addon/fold/foldgutter.css">
<script src="/inc/codemirror/lib/codemirror.js"></script> <script src="/app/static/js/codemirror/lib/codemirror.js"></script>
<script src="/inc/codemirror/addon/search/search.js"></script> <script src="/app/static/js/codemirror/addon/search/search.js"></script>
<script src="/inc/codemirror/addon/search/searchcursor.js"></script> <script src="/app/static/js/codemirror/addon/search/searchcursor.js"></script>
<script src="/inc/codemirror/addon/search/jump-to-line.js"></script> <script src="/app/static/js/codemirror/addon/search/jump-to-line.js"></script>
<script src="/inc/codemirror/addon/search/matchesonscrollbar.js"></script> <script src="/app/static/js/codemirror/addon/search/matchesonscrollbar.js"></script>
<script src="/inc/codemirror/addon/search/match-highlighter.js"></script> <script src="/app/static/js/codemirror/addon/search/match-highlighter.js"></script>
<script src="/inc/codemirror/addon/dialog/dialog.js"></script> <script src="/app/static/js/codemirror/addon/dialog/dialog.js"></script>
<script src="/inc/codemirror/addon/edit/matchbrackets.js"></script> <script src="/app/static/js/codemirror/addon/edit/matchbrackets.js"></script>
<script src="/inc/codemirror/addon/edit/closebrackets.js"></script> <script src="/app/static/js/codemirror/addon/edit/closebrackets.js"></script>
<script src="/inc/codemirror/addon/comment/comment.js"></script> <script src="/app/static/js/codemirror/addon/comment/comment.js"></script>
<script src="/inc/codemirror/addon/wrap/hardwrap.js"></script> <script src="/app/static/js/codemirror/addon/wrap/hardwrap.js"></script>
<script src="/inc/codemirror/addon/fold/foldcode.js"></script> <script src="/app/static/js/codemirror/addon/fold/foldcode.js"></script>
<script src="/inc/codemirror/addon/fold/foldgutter.js"></script> <script src="/app/static/js/codemirror/addon/fold/foldgutter.js"></script>
<script src="/inc/codemirror/addon/fold/brace-fold.js"></script> <script src="/app/static/js/codemirror/addon/fold/brace-fold.js"></script>
<script src="/inc/codemirror/addon/fold/comment-fold.js"></script> <script src="/app/static/js/codemirror/addon/fold/comment-fold.js"></script>
<script src="/inc/codemirror/addon/scroll/annotatescrollbar.js"></script> <script src="/app/static/js/codemirror/addon/scroll/annotatescrollbar.js"></script>
<script src="/inc/codemirror/mode/haproxy.js"></script> <script src="/app/static/js/codemirror/mode/haproxy.js"></script>
<script src="/inc/codemirror/keymap/sublime.js"></script> <script src="/app/static/js/codemirror/keymap/sublime.js"></script>
<script src="/app/static/js/configshow.js"></script> <script src="/app/static/js/configshow.js"></script>
<div class="left-space" style="margin-top: var(--indent);"> <div class="left-space" style="margin-top: var(--indent);">
<select autofocus required name="section" id="section"> <select autofocus required name="section" id="section">

View File

@ -91,7 +91,8 @@
getApacheChartData(server_ip) getApacheChartData(server_ip)
{% endif %} {% endif %}
{%- elif service == 'haproxy' %} {%- elif service == 'haproxy' %}
showBytes(server_ip) showBytes(server_ip);
setInterval(showBytes, 60000, server_ip);
{%- elif service == 'keepalived' %} {%- elif service == 'keepalived' %}
keepalivedBecameMaster(server_ip) keepalivedBecameMaster(server_ip)
{% endif %} {% endif %}

View File

@ -4,7 +4,7 @@
{% block content %} {% block content %}
{% from 'include/input_macros.html' import input, select %} {% from 'include/input_macros.html' import input, select %}
<script src="/app/static/js/smon.js"></script> <script src="/app/static/js/smon.js"></script>
<script src="/inc/jquery.timeago.js" type="text/javascript"></script> <script src="/app/static/js/jquery.timeago.js" type="text/javascript"></script>
<link href="{{ url_for('static', filename='css/servers.css') }}" rel="stylesheet"/> <link href="{{ url_for('static', filename='css/servers.css') }}" rel="stylesheet"/>
<link href="{{ url_for('static', filename='css/smon.css') }}" rel="stylesheet"/> <link href="{{ url_for('static', filename='css/smon.css') }}" rel="stylesheet"/>
<link href="{{ url_for('static', filename='css/ha.css') }}" rel="stylesheet"> <link href="{{ url_for('static', filename='css/ha.css') }}" rel="stylesheet">

Some files were not shown because too many files have changed in this diff Show More