minor improvements
- wget with referer for better statistics. - api-events instead myapi - proxy sites now with includes for better fuile handling and ssl.
This commit is contained in:
parent
e0f7aeaf03
commit
c00f4602d2
|
@ -55,6 +55,6 @@
|
|||
# pm4 - MySQL Purge Finished
|
||||
|
||||
|
||||
api_catch_status() {
|
||||
api-events_catch_status() {
|
||||
echo "${blu}API Status: $1 ${end}"
|
||||
}
|
16
lib/general
16
lib/general
|
@ -117,19 +117,19 @@ pre_install() {
|
|||
sudo apt-get -qq update
|
||||
if [[ $(conf_read pre-packs) != true ]]; then
|
||||
# Check for missing essential packages
|
||||
api_update i1
|
||||
api-events_update i1
|
||||
sudo apt-get -y -qq install software-properties-common
|
||||
sudo apt-get -y -qq install python-software-properties
|
||||
sudo apt-get -y -qq install pwgen
|
||||
sudo apt-get -y -qq install unzip
|
||||
conf_write pre-packs true
|
||||
api_update i2
|
||||
api-events_update i2
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
mysql_client_install() {
|
||||
api_update im2
|
||||
api-events_update im2
|
||||
local osname=$(check_osname)
|
||||
# Cases with MariaDB v10.2 support
|
||||
case "$osname" in
|
||||
|
@ -146,7 +146,7 @@ mysql_client_install() {
|
|||
sudo apt-get -y install mariadb-client
|
||||
conf_write mysql-client true
|
||||
echo "${gre}MySQL Client has been successfully installed!${end}"
|
||||
api_update im3
|
||||
api-events_update im3
|
||||
}
|
||||
|
||||
|
||||
|
@ -167,11 +167,11 @@ tools_port() {
|
|||
}
|
||||
|
||||
|
||||
api_update() {
|
||||
api-events_update() {
|
||||
conf_write status-api $1
|
||||
if [[ -a /opt/webinoly/lib/myapi ]]; then
|
||||
source /opt/webinoly/lib/myapi
|
||||
api_catch_status $1
|
||||
if [[ -a /opt/webinoly/lib/api-events ]]; then
|
||||
source /opt/webinoly/lib/api-events
|
||||
api-events_catch_status $1
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
52
lib/install
52
lib/install
|
@ -15,7 +15,7 @@ app_purge() {
|
|||
|
||||
|
||||
linux_optim() {
|
||||
api_update in4
|
||||
api-events_update in4
|
||||
if [[ $(conf_read linux-optim) == "true" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
@ -84,13 +84,13 @@ net.ipv4.tcp_max_syn_backlog = 3240000
|
|||
sudo kill $(cat /run/nginx.pid)
|
||||
conf_write linux-optim true
|
||||
sudo nginx -t && sudo service nginx start
|
||||
api_update in7
|
||||
api-events_update in7
|
||||
}
|
||||
|
||||
|
||||
linux_purge() {
|
||||
if [[ $(conf_read linux-optim) == "true" ]]; then
|
||||
api_update pn7
|
||||
api-events_update pn7
|
||||
sudo sed -i '/WebinolyStart/,/WebinolyEnd/{/.*/d}' /etc/security/limits.conf
|
||||
sudo sed -i '/WebinolyStart/,/WebinolyEnd/{/.*/d}' /etc/sysctl.conf
|
||||
sudo rm -rf /etc/systemd/system/nginx.service.d
|
||||
|
@ -99,7 +99,7 @@ linux_purge() {
|
|||
sudo sysctl -p
|
||||
sudo systemctl daemon-reload
|
||||
conf_write linux-optim purged
|
||||
api_update pn8
|
||||
api-events_update pn8
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ messagend_install() {
|
|||
|
||||
|
||||
nginx_install() {
|
||||
api_update in1
|
||||
api-events_update in1
|
||||
if [[ ($(conf_read nginx-ppa) == "mainline" || $value == "mainline") && $value != "stable" ]]; then
|
||||
echo | sudo add-apt-repository ppa:nginx/development
|
||||
conf_write nginx-ppa mainline
|
||||
|
@ -142,12 +142,12 @@ nginx_install() {
|
|||
sudo nginx -t && sudo service nginx start
|
||||
conf_write nginx true
|
||||
echo "${gre}Nginx has been installed successfully! ${end}"
|
||||
api_update in2
|
||||
api-events_update in2
|
||||
}
|
||||
|
||||
|
||||
php_install() {
|
||||
api_update ip1
|
||||
api-events_update ip1
|
||||
if [[ -n $(conf_read php-ver) && ($(conf_read php-ver) == "7.2" || $(conf_read php-ver) == "7.1" || $(conf_read php-ver) == "7.0" || $(conf_read php-ver) == "5.6") ]]; then
|
||||
echo "${gre}Default PHP version '$(conf_read php-ver)' detected!${end}"
|
||||
else
|
||||
|
@ -194,12 +194,12 @@ php_install() {
|
|||
conf_write php true
|
||||
conf_write php-v$ver true
|
||||
echo "${gre}PHP has been installed successfully! ${end}"
|
||||
api_update ip2
|
||||
api-events_update ip2
|
||||
}
|
||||
|
||||
|
||||
mysql_install() {
|
||||
api_update im1
|
||||
api-events_update im1
|
||||
[[ $(conf_read mysql-client) != "true" ]] && mysql_client_install
|
||||
|
||||
pre_install
|
||||
|
@ -235,13 +235,13 @@ _EOF_
|
|||
|
||||
conf_write mysql true
|
||||
echo "${gre}MySQL has been installed successfully! ${end}"
|
||||
api_update im4
|
||||
api-events_update im4
|
||||
}
|
||||
|
||||
|
||||
#NGINX OPTIM
|
||||
nginx_optim() {
|
||||
api_update in3
|
||||
api-events_update in3
|
||||
sudo cp -R /opt/webinoly/templates/nginx/common /etc/nginx/common
|
||||
sudo cp -R /opt/webinoly/templates/nginx/conf.d/* /etc/nginx/conf.d/
|
||||
|
||||
|
@ -265,14 +265,14 @@ nginx_optim() {
|
|||
linux_optim
|
||||
server_version
|
||||
conf_write nginx-optim true
|
||||
api_update in8
|
||||
api-events_update in8
|
||||
}
|
||||
|
||||
|
||||
|
||||
# PHP OPTIM
|
||||
php_optim() {
|
||||
api_update ip3
|
||||
api-events_update ip3
|
||||
[[ -n $1 ]] && ver="$1" || ver=$(conf_read php-ver)
|
||||
|
||||
if [[ -n $(conf_read max-mb-uploads) && $(conf_read max-mb-uploads) =~ ^[0-9]+$ ]]; then
|
||||
|
@ -341,7 +341,7 @@ php_optim() {
|
|||
|
||||
conf_write php-optim true
|
||||
sudo service php*-fpm reload
|
||||
api_update ip4
|
||||
api-events_update ip4
|
||||
}
|
||||
|
||||
|
||||
|
@ -355,7 +355,7 @@ nginx_tool_site() {
|
|||
|
||||
|
||||
nginx_tool() {
|
||||
api_update in9
|
||||
api-events_update in9
|
||||
[[ -z $(conf_read tools-port) ]] && tools_port 22222
|
||||
[[ $(conf_read php) == "true" ]] && nginx_tool_site
|
||||
# in case php was installed before nginx
|
||||
|
@ -370,12 +370,12 @@ nginx_tool() {
|
|||
|
||||
conf_write web-tool true
|
||||
conf_write nginx-tool true
|
||||
api_update in10
|
||||
api-events_update in10
|
||||
}
|
||||
|
||||
|
||||
php_tool_site() {
|
||||
api_update ip6
|
||||
api-events_update ip6
|
||||
# Status pages
|
||||
sudo mkdir -p /var/www/$(conf_read tools-port)/htdocs/fpm/status
|
||||
sudo touch /var/www/$(conf_read tools-port)/htdocs/fpm/status/php
|
||||
|
@ -385,12 +385,12 @@ php_tool_site() {
|
|||
sudo mkdir -p /var/www/$(conf_read tools-port)/htdocs/php
|
||||
sudo touch /var/www/$(conf_read tools-port)/htdocs/php/index.php
|
||||
sudo echo '<?php phpinfo(); ?>' >> /var/www/$(conf_read tools-port)/htdocs/php/index.php
|
||||
api_update ip7
|
||||
api-events_update ip7
|
||||
}
|
||||
|
||||
|
||||
php_tool() {
|
||||
api_update ip5
|
||||
api-events_update ip5
|
||||
# in case nginx was installed before php
|
||||
if [[ $(conf_read nginx-tool) == "true" && ! -a /etc/nginx/sites-available/$(conf_read tools-port) ]]; then
|
||||
nginx_tool_site
|
||||
|
@ -415,12 +415,12 @@ php_tool() {
|
|||
sudo service php*-fpm reload
|
||||
conf_write web-tool true
|
||||
conf_write php-tool true
|
||||
api_update ip8
|
||||
api-events_update ip8
|
||||
}
|
||||
|
||||
|
||||
mysql_tool() {
|
||||
api_update im5
|
||||
api-events_update im5
|
||||
#PhpMyAdmin unattended script installation
|
||||
local AUTOGENPASS_PMA=`pwgen -s -1`
|
||||
echo "phpmyadmin phpmyadmin/dbconfig-install boolean true" | debconf-set-selections
|
||||
|
@ -436,20 +436,20 @@ mysql_tool() {
|
|||
|
||||
conf_write mysql-tool true
|
||||
echo "${gre}PhpMyAdmin has been installed successfully! ${end}"
|
||||
api_update im6
|
||||
api-events_update im6
|
||||
}
|
||||
|
||||
|
||||
swap_delete() {
|
||||
local swapkb=$(grep SwapTotal /proc/meminfo | cut -f 2 -d ':' | tr -d ' ' | cut -f 1 -d 'k')
|
||||
if [[ -n $swapkb && $swapkb =~ ^[0-9]+$ && $swapkb -gt 0 && $(conf_read swap-owner) == "webinoly" ]]; then
|
||||
api_update pn9
|
||||
api-events_update pn9
|
||||
sudo swapoff -a -v > /dev/null
|
||||
sudo rm /swapfile
|
||||
sudo sed -i '/\/swapfile/d' /etc/fstab
|
||||
sudo sed -i '/vm.swappiness/d' /etc/sysctl.conf
|
||||
conf_delete swap-owner
|
||||
api_update pn10
|
||||
api-events_update pn10
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -468,7 +468,7 @@ swap_create() {
|
|||
|
||||
# https://help.ubuntu.com/community/SwapFaq
|
||||
if [[ -z $swapkb || $swapkb == "0" ]]; then
|
||||
api_update in5
|
||||
api-events_update in5
|
||||
if [[ -n $(conf_read swap-mem) && $(conf_read swap-mem) =~ ^[0-9]+$ ]]; then
|
||||
local newswap=$(conf_read swap-mem)
|
||||
elif [[ $ram -le 2 ]]; then
|
||||
|
@ -515,7 +515,7 @@ swap_create() {
|
|||
|
||||
echo "${gre} A new SWAP Partion (${newswap}Gb) has been created! ${end}"
|
||||
fi
|
||||
api_update in6
|
||||
api-events_update in6
|
||||
else
|
||||
if [[ $(conf_read swap-owner) != "webinoly" ]]; then
|
||||
conf_write swap-owner system
|
||||
|
|
|
@ -244,7 +244,7 @@ elif [ "$type" == "-parked" ]; then
|
|||
# Reverse proxy
|
||||
elif [[ "$type" == "-proxy" ]]; then
|
||||
createsite
|
||||
sudo sed -i '/include /d' /etc/nginx/sites-available/$domain
|
||||
sudo sed -i '/php.conf;/d' /etc/nginx/sites-available/$domain
|
||||
sudo sed -i '/root /d' /etc/nginx/sites-available/$domain
|
||||
sudo sed -i '/index /d' /etc/nginx/sites-available/$domain
|
||||
sudo sed -i '/error_log /r /opt/webinoly/templates/template-site-proxy' /etc/nginx/sites-available/$domain
|
||||
|
|
|
@ -53,7 +53,7 @@ if [[ $arg == "-noptim" && $opt == "-lemp" ]]; then
|
|||
|
||||
# Delete some stack
|
||||
elif [[ $arg == "-purge" && ( $opt == "-html" || $opt == "-nginx" ) ]]; then
|
||||
api_update pn1
|
||||
api-events_update pn1
|
||||
if [[ $(conf_read nginx) != "true" ]]; then
|
||||
echo "${red}Nginx is not installed, hence can not be deleted! ${end}"
|
||||
clear_force_flag
|
||||
|
@ -86,23 +86,23 @@ elif [[ $arg == "-purge" && ( $opt == "-html" || $opt == "-nginx" ) ]]; then
|
|||
fi
|
||||
if [[ $answer == [Yy] ]]; then
|
||||
[[ $(conf_read mysql-tool) == "true" ]] && stack -pma -purge
|
||||
api_update pn2
|
||||
api-events_update pn2
|
||||
site -delete-all
|
||||
sudo rm -rf /var/www/$(conf_read tools-port)
|
||||
sudo rm -rf /var/www/html
|
||||
api_update pn3
|
||||
api-events_update pn3
|
||||
fi
|
||||
|
||||
sudo service nginx stop
|
||||
sudo apt-get -y purge nginx nginx-common
|
||||
[[ $(conf_read nginx-ppa) == "mainline" ]] && echo | sudo add-apt-repository --remove 'ppa:nginx/development' || echo | sudo add-apt-repository --remove 'ppa:nginx/stable'
|
||||
api_update pn4
|
||||
api_update pn5
|
||||
api-events_update pn4
|
||||
api-events_update pn5
|
||||
sudo apt-get -y purge letsencrypt python-boto duplicity duply
|
||||
sudo apt-get -y autoremove
|
||||
sudo rm $HOME/www
|
||||
sudo rm $HOME/sites-available
|
||||
api_update pn6
|
||||
api-events_update pn6
|
||||
linux_purge
|
||||
|
||||
[[ $(conf_read php-tool) != "true" ]] && conf_write web-tool purged
|
||||
|
@ -120,7 +120,7 @@ elif [[ $arg == "-purge" && ( $opt == "-html" || $opt == "-nginx" ) ]]; then
|
|||
echo ""
|
||||
|
||||
elif [[ $arg == "-purge" && $opt == "-php" ]]; then
|
||||
api_update pp1
|
||||
api-events_update pp1
|
||||
if [[ $(conf_read php) != "true" ]]; then
|
||||
echo "${red}PHP is not installed, hence can not be deleted! ${end}"
|
||||
clear_force_flag
|
||||
|
@ -175,11 +175,11 @@ elif [[ $arg == "-purge" && $opt == "-php" ]]; then
|
|||
echo ""
|
||||
fi
|
||||
echo ""
|
||||
api_update pp2
|
||||
api-events_update pp2
|
||||
|
||||
|
||||
elif [[ $arg == "-purge" && $opt == "-mysql" ]]; then
|
||||
api_update pm1
|
||||
api-events_update pm1
|
||||
if [[ $(conf_read mysql) != "true" ]]; then
|
||||
echo "${red}MySQL is not installed, hence can not be deleted! ${end}"
|
||||
clear_force_flag
|
||||
|
@ -238,10 +238,10 @@ elif [[ $arg == "-purge" && $opt == "-mysql" ]]; then
|
|||
echo ""
|
||||
fi
|
||||
echo ""
|
||||
api_update pm4
|
||||
api-events_update pm4
|
||||
|
||||
elif [[ $arg == "-purge" && $opt == "-pma" ]]; then
|
||||
api_update pm2
|
||||
api-events_update pm2
|
||||
if [[ $(conf_read mysql-tool) != "true" ]]; then
|
||||
echo "${red} PhpMyAdmin is not installed, hence can not be deleted! ${end}"
|
||||
clear_force_flag
|
||||
|
@ -278,7 +278,7 @@ elif [[ $arg == "-purge" && $opt == "-pma" ]]; then
|
|||
echo ""
|
||||
fi
|
||||
echo ""
|
||||
api_update pm3
|
||||
api-events_update pm3
|
||||
|
||||
elif [[ $arg == "-purge" && $opt == "-web-tools" ]]; then
|
||||
if [[ $(conf_read web-tool) != "true" ]]; then
|
||||
|
|
|
@ -17,7 +17,7 @@ fi
|
|||
|
||||
if [[ $opt == "-update" ]]; then
|
||||
echo ""
|
||||
sudo wget --timeout=15 -qrO weby https://qrok.es/wyupd && sudo bash weby 0
|
||||
sudo wget --timeout=15 --referer='https://update.webinoly.com/' -qrO weby https://qrok.es/wyupd && sudo bash weby 0
|
||||
echo "${gre}Webinoly App has been updated successfully!${end}"
|
||||
|
||||
|
||||
|
|
2
weby
2
weby
|
@ -55,7 +55,7 @@ if [[ $2 == "-ver="* ]]; then
|
|||
fi
|
||||
echo $(tput sgr0)
|
||||
else
|
||||
sudo wget --timeout=15 -qrO $HOME/webinoly.tar https://qrok.es/wytar
|
||||
sudo wget --timeout=15 --referer='https://webinoly.com/' -qrO $HOME/webinoly.tar https://qrok.es/wytar
|
||||
fi
|
||||
|
||||
[[ ! -d /opt/webinoly ]] && sudo mkdir /opt/webinoly
|
||||
|
|
Loading…
Reference in a new issue