fixes and improvements

Fixed:
404 error when cache disabled
swap not working on reboot in some cloud providers
Redis not starting on reboot in some cloud providers
Defaul-site command now check if default conf file exist

Improvements:
Now we use our API for better stats.
This commit is contained in:
Cristhian Martínez Ochoa 2018-12-28 20:09:29 -06:00
parent 0e572f6bc8
commit 6a184a75d2
5 changed files with 27 additions and 8 deletions

View file

@ -3,7 +3,7 @@ source /opt/webinoly/lib/general
app_version() {
local app_ver="1.7.0"
local app_ver="1.7.1"
echo $app_ver
}
svr_version() {
@ -448,6 +448,7 @@ php_tool() {
echo | sudo add-apt-repository ppa:chris-lea/redis-server
pre_install
sudo apt -y install redis-server php-redis
sudo systemctl enable redis-server
# Memcached (Object Cache)
sudo apt -y install php-memcached php-memcache memcached
@ -548,7 +549,7 @@ swap_create() {
sudo mkswap /swapfile
sudo swapon /swapfile
sudo sed -i "/LABEL.*/a \/swapfile none swap sw 0 0" /etc/fstab
sudo echo "/swapfile none swap sw 0 0" >> /etc/fstab
# Swap created by Webinoly - so we should remove it in uninstall
conf_write swap-owner webinoly

View file

@ -527,7 +527,7 @@ system_info() {
remove_domain_default_site() {
# In case we have a domain as default before.
if ! [[ $(conf_read default-site) =~ ^(default|blackhole)$ || -z $(conf_read default-site) ]]; then
[[ -L /etc/nginx/sites-enabled/default ]] || sudo ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
[[ ! -L /etc/nginx/sites-enabled/default && -a /etc/nginx/sites-available/default ]] && sudo ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
sudo sed -i "s/listen 80 default_server;/listen 80;/" /etc/nginx/sites-available/$(conf_read default-site)
sudo sed -i "s/listen \[::\]:80 default_server;/listen [::]:80;/" /etc/nginx/sites-available/$(conf_read default-site)
sudo sed -i "s/listen 443 ssl http2 default_server;/listen 443 ssl http2;/" /etc/nginx/sites-available/$(conf_read default-site)

View file

@ -504,8 +504,8 @@ elif [[ $opt == "-default-site" ]]; then
if [[ $value == "default" ]]; then
if [[ -a /opt/webinoly/templates/source/default ]]; then
remove_domain_default_site
sudo cat /opt/webinoly/templates/source/default >| /etc/nginx/sites-available/default
remove_domain_default_site
conf_write default-site default
echo "${gre}Default Nginx was successfully assigned as default site!${end}"
else
@ -513,8 +513,8 @@ elif [[ $opt == "-default-site" ]]; then
exit 1
fi
elif [[ $value == "blackhole" ]]; then
remove_domain_default_site
sudo cat /opt/webinoly/templates/general/nginx-blackhole >| /etc/nginx/sites-available/default
remove_domain_default_site
create_blackhole_cert
conf_write default-site blackhole
echo "${gre}Blackhole Nginx site was successfully assigned as default site!${end}"
@ -539,6 +539,7 @@ elif [[ $opt == "-default-site" ]]; then
conf_write default-site $value
echo "${gre}Site ${blu}- ${value} -${gre} was successfully assigned as default site!${end}"
else
[[ -a /etc/nginx/sites-available/$value ]] && echo "${red}Site found but is disabled.${end}"
echo "${red}[ERROR] Please, enter a valid option (default, blackhole or domain.com). ${end}"
exit 1
fi

View file

@ -1,7 +1,7 @@
# PHP NGINX CONFIGURATION
# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE Webinoly
location / {
try_files $uri $uri/ /index.php?$args $uri =404;
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;

21
weby
View file

@ -66,8 +66,6 @@ if [[ $2 == "-ver="* ]]; then
sudo wget --timeout=15 -t 1 -qrO $HOME/webinoly.tar https://qrok.es/webinoly?version=$ver
webyversion="$ver"
[[ $ver == "beta" ]] && echo "[WARNING] You are installing a BETA version of Webinoly and it's not recommended for production enviroments."
# Just for stadistics
[[ $statskip == "true" ]] || sudo wget --timeout=15 -t 1 --spider --referer="https://webinoly.com/?version=${ver}${update}" -q https://qrok.es/wyver
else
echo "[ERROR] Version not found or not available! ($code) $(tput sgr0)"
exit 1
@ -100,6 +98,7 @@ fi
# Check for Server Conf Updates and Save Tools Port after library is available.
if [[ -a /opt/webinoly/webinoly.conf ]]; then
echo "${gre}Webinoly Configuration file was found, so we will use it!${end}"
oldapp=$(conf_read app-version)
# svr_version function was created at the same time as the first update of server-version. Not check before!
if declare -F svr_version > /dev/null 2>&1; then
newver=$(svr_version)
@ -113,11 +112,29 @@ else
newinst="true"
fi
# Write app version
declare -F app_version > /dev/null 2>&1 && webyversion=$(app_version)
[[ -z $webyversion ]] && webyversion="undetermined"
conf_write app-version $webyversion
# Ping to Webinoly Stats
opt=$setup
if [[ $2 == "-ver="* && $webyversion == $ver && $statskip != "true" ]]; then
type="Custom"
elif [[ -n $update && -n $oldapp ]]; then
type="Updates"
opt=$oldapp
elif [[ -z $update && -n $oldapp ]]; then
type="Reinstall"
opt=$oldapp
elif [[ $newinst == "true" ]]; then
type="New"
else
type="Error"
fi
[[ $statskip == "true" ]] || wget https://api.webinoly.com/stats/?install=Public:${webyversion}:${type}:${opt} --referer="Webinoly-Internal-Verified-Stats" --spider --timeout=15 -t 1 -q
# Stack installation
[[ $setup -gt 0 && $setup -le 3 ]] && stack -nginx