Ability choose haproxy version in the install page
pull/161/head
Pavel Loginov 2019-10-15 00:41:21 +03:00
parent 3a82cfd432
commit 16cc10d862
5 changed files with 21 additions and 9 deletions

View File

@ -314,13 +314,14 @@ def install_haproxy(serv, **kwargs):
stats_user = sql.get_setting('stats_user')
stats_password = sql.get_setting('stats_password')
proxy = sql.get_setting('proxy')
hapver = kwargs.get('hapver')
os.system("cp scripts/%s ." % script)
proxy_serv = proxy if proxy is not None else ""
commands = [ "sudo chmod +x "+tmp_config_path+script+" && " +tmp_config_path+"/"+script +" PROXY=" + proxy_serv+
" SOCK_PORT="+haproxy_sock_port+" STAT_PORT="+stats_port+" STAT_FILE="+server_state_file+
" STATS_USER="+stats_user+" STATS_PASS="+stats_password ]
" STATS_USER="+stats_user+" STATS_PASS="+stats_password+" HAPVER="+hapver]
error = str(upload(serv, tmp_config_path, script))

View File

@ -413,7 +413,7 @@ if form.getvalue('masteradd'):
os.system("rm -f %s" % script)
if form.getvalue('haproxyaddserv'):
funct.install_haproxy(form.getvalue('haproxyaddserv'), syn_flood=form.getvalue('syn_flood'))
funct.install_haproxy(form.getvalue('haproxyaddserv'), syn_flood=form.getvalue('syn_flood'), hapver=form.getvalue('hapver'))
if form.getvalue('installwaf'):
funct.waf_install(form.getvalue('installwaf'))

View File

@ -13,6 +13,7 @@ do
STATS_USER) STATS_USER=${VALUE} ;;
STATS_PASS) STATS_PASS=${VALUE} ;;
STAT_FILE) STAT_FILE=${VALUE} ;;
HAPVER) HAPVER=${VALUE} ;;
*)
esac
done
@ -22,7 +23,11 @@ then
export http_proxy="$PROXY"
export https_proxy="$PROXY"
fi
if [ $? -eq 1 ]
then
sudo yum install wget socat -y > /dev/null
sudo wget https://repo.haproxy-wi.org/haproxy-$HAPVER.el7.x86_64.rpm --no-check-certificate
fi
if [ -f /etc/haproxy/haproxy.cfg ];then
echo -e 'Info: Haproxy already installed. You can edit config<a href="/app/config.py" title="Edit HAProxy config">here</a> <br /><br />'
exit 1
@ -31,15 +36,15 @@ set +x
if hash apt-get 2>/dev/null; then
sudo apt-get install haproxy socat -y
else
sudo wget https://repo.haproxy-wi.org/haproxy-2.0.6-1.el7.x86_64.rpm --no-check-certificate
sudo yum install haproxy-2.0.6-1.el7.x86_64.rpm -y
sudo wget https://repo.haproxy-wi.org/haproxy-$HAPVER.el7.x86_64.rpm --no-check-certificate
sudo yum install haproxy-$HAPVER.el7.x86_64.rpm -y
fi
if [ $? -eq 1 ]
then
sudo yum install wget socat -y > /dev/null
sudo wget https://repo.haproxy-wi.org/haproxy-2.0.6-1.el7.x86_64.rpm --no-check-certificate
sudo yum install haproxy-2.0.6-1.el7.x86_64.rpm -y
sudo wget https://repo.haproxy-wi.org/haproxy-$HAPVER.el7.x86_64.rpm --no-check-certificate
sudo yum install haproxy-$HAPVER.el7.x86_64.rpm -y
fi
if [ $? -eq 1 ]
then

View File

@ -3,14 +3,19 @@
<script src="/inc/users.js"></script>
<table class="overview">
<tr class="overviewHead">
<td class="padding10 first-collumn" style="width: 350px;">Note</td>
<td class="padding10 first-collumn" style="width: 350px;">Version</td>
<td class="padding10 first-collumn">Server</td>
<td style="width: 150px;">SYN flood protect</td>
<td></td>
</tr>
<tr>
<td class="padding10 first-collumn" style="width: 350px;">
<b>Haproxy-WI will try install haproxy-2.0.6, if it does not work then haproxy-1.15</b>
<select id="hapver" name="hapver" required>
<option disabled>Choose HAProxy version</option>
<option value="2.0.4-1">2.0.4-1</option>
<option value="2.0.6-1">2.0.6-1</option>
<option value="2.0.7-1" selected>2.0.7-1</option>
</select>
</td>
<td class="padding10 first-collumn">
<select autofocus required name="{{select_id}}" id="{{select_id}}">

View File

@ -108,6 +108,7 @@ $( function() {
data: {
haproxyaddserv: $('#haproxyaddserv').val(),
syn_flood: syn_flood,
hapver: $('#hapver option:selected' ).val(),
token: $('#token').val()
},
type: "GET",