Skip to content

Commit

Permalink
focal fossa
Browse files Browse the repository at this point in the history
Partial ubuntu 20.04 support for testing.
  • Loading branch information
QROkes committed May 23, 2020
1 parent cab9f3e commit ba2f121
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 47 deletions.
28 changes: 22 additions & 6 deletions lib/bkp
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,14 @@ bkp_s3_profile() {
[[ -z $max_age ]] && max_age="1M"
sudo sed -i -E "/^[#]?GPG_KEY=/c GPG_KEY='disabled'" $HOME/.duply/$profile/conf
sudo sed -i -E "/^[#]?GPG_PW=/c #GPG_PW='_GPG_PASSWORD_'" $HOME/.duply/$profile/conf
sudo sed -i -E "/^[#]?TARGET=/c TARGET='s3+http://${bucket}'" $HOME/.duply/$profile/conf
sudo sed -i -E "/^[#]?SOURCE=/c SOURCE='$source'" $HOME/.duply/$profile/conf
sudo sed -i -E "/^[#]?MAX_AGE=/c MAX_AGE=$max_age" $HOME/.duply/$profile/conf

if [[ -z $s3_european_buckets ]]; then
sudo echo 'DUPL_PARAMS="$DUPL_PARAMS --s3-use-new-style "' >> $HOME/.duply/$profile/conf
if [[ $(check_osname) == "focal" ]]; then
sudo sed -i -E "/^[#]?TARGET=/c TARGET='boto3+s3://${bucket}'" $HOME/.duply/$profile/conf
else
sudo echo 'DUPL_PARAMS="$DUPL_PARAMS --s3-use-new-style --s3-european-buckets "' >> $HOME/.duply/$profile/conf
sudo sed -i -E "/^[#]?TARGET=/c TARGET='s3+http://${bucket}'" $HOME/.duply/$profile/conf
sudo echo 'DUPL_PARAMS="$DUPL_PARAMS --s3-use-new-style "' >> $HOME/.duply/$profile/conf
fi

echo "${gre}Backup profile ${blu}'$profile'${gre} was successfully created!${end}"
Expand Down Expand Up @@ -229,13 +229,28 @@ s3_send() {
bucket_validation $bucket

folder=$(echo $bucket | cut -f 2- -d "/" -s)
[[ -n $folder ]] && keyfol="${folder}/"
[[ -n $folder ]] && folder="/${folder}/"

export keyfol
export folder
export bucket=$(echo $bucket | cut -f 1 -d "/")
export send_to_s3

python - &>/dev/null <<END

if [[ $(check_osname) == "focal" ]]; then
python3 - &>/dev/null <<END
import os,boto3
filepath = os.environ['send_to_s3']
BUCKET = os.environ['bucket']
folder = os.environ['keyfol']
s3_client = boto3.client('s3')
s3_client.upload_file(filepath, BUCKET, folder + filepath.split('/')[-1])
END
else
python - &>/dev/null <<END
import os,boto
filepath = os.environ['send_to_s3']
Expand All @@ -248,6 +263,7 @@ k = bucket.new_key(folder + filepath.split('/')[-1])
k.set_contents_from_filename(filepath)
END
fi

if [[ $? == 0 ]]; then
unset send_to_s3
Expand Down
15 changes: 6 additions & 9 deletions lib/general
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

readonly app_version="1.11.3"
readonly svr_version="1.4"
readonly os_ubuntu_supported=(xenial bionic)
readonly os_ubuntu_supported=(xenial bionic focal)
readonly php_supported=(7.2 7.3 7.4)
readonly datadog_agent_ver="7"

Expand Down Expand Up @@ -212,7 +212,7 @@ pre_install() {
api-events_update i1
sudo apt -y -qq install dialog
sudo apt -y -qq install software-properties-common
[[ $(check_osname) != "bionic" ]] && sudo apt -y -qq install python-software-properties
[[ $(check_osname) == "xenial" ]] && sudo apt -y -qq install python-software-properties
sudo apt -y -qq install pwgen
sudo apt -y -qq install unzip
sudo apt -y -qq install zip
Expand All @@ -232,21 +232,18 @@ app_purge() {
mysql_client_install() {
api-events_update im2
local osname=$(check_osname)
sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'

# Cases with MariaDB v10.4 support - https://downloads.mariadb.org/mariadb/repositories/
case "$osname" in
"xenial")
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo add-apt-repository "deb [arch=amd64,arm64,i386,ppc64el] http://mirrors.syringanetworks.net/mariadb/repo/10.4/ubuntu $osname main"
;;
"bionic")
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
"bionic"|"focal")
sudo add-apt-repository "deb [arch=amd64,arm64,ppc64el] http://mirrors.syringanetworks.net/mariadb/repo/10.4/ubuntu $osname main"
;;
"cosmic"|"disco")
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo add-apt-repository "deb [arch=amd64] http://mirrors.syringanetworks.net/mariadb/repo/10.4/ubuntu $osname main"
;;
esac

pre_install
sudo apt -y install mariadb-client
conf_write mysql-client true
Expand Down
17 changes: 9 additions & 8 deletions lib/install
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,13 @@ LimitNOFILE=$nginxfd" | tee -a /etc/systemd/system/nginx.service.d/nofile_limit.
sudo cat /opt/webinoly/templates/general/sysctl >> /etc/sysctl.conf
sudo sed -i "/fs.file-max =/c \ fs.file-max = ${newfd}" /etc/sysctl.conf
sudo sed -i "/vm.max_map_count =/c \ vm.max_map_count = ${newfd}" /etc/sysctl.conf

# BBR is only valid in kernel > v4.9, bionic is at least 4.15
if [[ $(check_osname) == "bionic" ]]; then
sudo modprobe tcp_bbr
else
if [[ $(check_osname) == "xenial" ]]; then
sudo sed -i '/tcp_congestion_control/s/^/#/' /etc/sysctl.conf
sudo sed -i '/tcp_notsent_lowat/s/^/#/' /etc/sysctl.conf
else
sudo modprobe tcp_bbr
fi

swap_create
Expand Down Expand Up @@ -135,10 +136,10 @@ nginx_install() {
api-events_update in1
pre_install
if [[ ($(conf_read nginx-ppa) == "mainline" || $nginx == "mainline") && $nginx != "stable" ]]; then
echo | sudo add-apt-repository ppa:nginx/mainline
[[ $(check_osname) != "focal" ]] && echo | sudo add-apt-repository ppa:nginx/mainline
conf_write nginx-ppa mainline
else
echo | sudo add-apt-repository ppa:nginx/stable
[[ $(check_osname) != "focal" ]] && echo | sudo add-apt-repository ppa:nginx/stable
conf_write nginx-ppa stable
fi
pre_install
Expand Down Expand Up @@ -393,12 +394,12 @@ nginx_tool() {
[[ $(conf_read php-tool) == "true" && ! -f /var/www/$(conf_read tools-port)/htdocs/php/index.php ]] && php_tool_site

# Install LetsEncrypt
echo | sudo add-apt-repository ppa:certbot/certbot
[[ $(check_osname) != "focal" ]] && echo | sudo add-apt-repository ppa:certbot/certbot
pre_install
sudo apt -y install certbot

# Instalar Duply & Duplicity
sudo apt -y install python-boto duplicity duply
[[ $(check_osname) == "focal" ]] && sudo apt -y install python3-boto3 duplicity duply || sudo apt -y install python-boto duplicity duply

conf_write nginx-tool true
api-events_update in10
Expand Down Expand Up @@ -437,7 +438,7 @@ php_tool() {
[[ $(conf_read nginx) == "true" ]] && php_tool_site

# Redis (Object Cache)
echo | sudo add-apt-repository ppa:chris-lea/redis-server
[[ $(check_osname) != "focal" ]] && 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
Expand Down
31 changes: 17 additions & 14 deletions lib/webin
Original file line number Diff line number Diff line change
Expand Up @@ -717,23 +717,26 @@ create_blackhole_cert() {


webinoly_update() {
checkver=$(wget --timeout=10 -t 1 -qO- https://api.webinoly.com/check?text=true)
currentver=$(conf_read app-version)
if [[ $(conf_read branch) =~ ^(alpha|beta)$ ]] && ! [[ $update =~ ^(alpha|beta)$ ]]; then
echo "${red}[ERROR] Beta/alpha versions can not be updated to stable versions!${end}"
exit 1
fi

if [[ ( -n $checkver && ${checkver//.} -gt ${currentver//.} ) || ( -n $update && $update != true ) ]]; then
if [[ $(conf_read branch) =~ ^(alpha|beta)$ ]] && ! [[ $update =~ ^(alpha|beta)$ ]]; then
echo "${red}[ERROR] Beta/alpha versions can not be updated to stable versions!${end}"
exit 1
fi

echo ""
[[ -n $update && $update != true ]] && branch="-ver=${update}" || branch=""
sudo wget --timeout=15 -t 1 --referer="https://update.webinoly.com/?ver=${app_version}" -qrO weby https://qrok.es/wyupd && sudo bash weby upd $branch
[[ $? == 0 ]] && echo "${gre}Webinoly App has been updated successfully!${end}"
api-events_update wy1s
if [[ -n $update && $update != true ]]; then
branch="-ver=${update}"
else
echo "${gre}You currently have the latest version!${end}"
checkver=$(wget --timeout=10 -t 1 -qO- https://api.webinoly.com/check?text=true)
currentver=$(conf_read app-version)
if [[ -n $checkver && ${checkver//.} -gt ${currentver//.} ]]; then
echo "${gre}You currently have the latest version!${end}"
exit 0
fi
fi

sudo wget --timeout=15 -t 1 --referer="https://update.webinoly.com/?ver=${app_version}" -qrO weby https://qrok.es/wyupd && sudo bash weby upd $branch

[[ $? == 0 ]] && echo "${gre}Webinoly App has been updated successfully!${end}"
api-events_update wy1s
}


Expand Down
10 changes: 1 addition & 9 deletions plugins/stack
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,7 @@ elif [[ -n $purge && -n $mysql ]]; then
# Cases with MariaDB v10.4 support
os_name=$(check_osname)
sudo add-apt-repository --remove "http://mirrors.syringanetworks.net/mariadb/repo/${mysqlver}/ubuntu"
case "$osname" in
"trusty")
sudo apt-key del 0xcbcb082a1bb943db
;;
"xenial"|"bionic"|"cosmic"|"disco")
sudo apt-key del 0xF1656F24C74CD1D8

;;
esac
sudo apt-key del 0xF1656F24C74CD1D8

if [[ $mysql != "keep-data" ]]; then
sudo rm -rf /etc/mysql
Expand Down
14 changes: 13 additions & 1 deletion weby
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Check OS support
distr=`echo $(lsb_release -i | cut -d':' -f 2)`
osver=`echo $(lsb_release -c | cut -d':' -f 2)`
if ! [[ $distr == "Ubuntu" && $osver =~ ^(xenial|bionic)$ ]]; then
if ! [[ $distr == "Ubuntu" && $osver =~ ^(xenial|bionic|focal)$ ]]; then
echo "$(tput setaf 1)"
echo "****************************************************************************"
echo "**** This OS is not supported by Webinoly and could not work properly ****"
Expand Down Expand Up @@ -185,6 +185,18 @@ echo "**************************************************************************
echo "${end}"


if [[ $osver == "focal" ]]; then
conf_write branch beta
echo "${red}"
echo "****************************************************************************"
echo "*******************${bol} Ubuntu 20.04 (Focal Fossa) ${end}${red}********************"
echo "***************** Partial support, only for testing. ******************"
echo "************** Don't use it in production enviroments! ****************"
echo "****************************************************************************"
echo "${end}"
fi


# Remove Installation File
sudo rm weby
app_purge

0 comments on commit ba2f121

Please sign in to comment.