Almost there, don't use this yet

This commit is contained in:
jeroenlaylo
2018-11-30 17:04:15 +01:00
parent 963ad242e9
commit ed9d8e304d
7 changed files with 296 additions and 421 deletions

View File

@@ -1,10 +0,0 @@
v3.9.0 - November 11, 2018
[+] Rebranded the fork to WordOps
[+] Codebase cleanup
[+] Set PHP 7.2 as the default
[+] Included support for newer OS releases
[+] Reworked the HTTPS configuration
[=] Replaced Postfix with smtp-cli
[-] Dropped mail services
[-] Dropped w3tc support

253
install
View File

@@ -1,57 +1,77 @@
#!/bin/bash
#########################################
### WordOps install and update script ###
#########################################
### CONTENTS
### ---
### 1. VARIABLES AND DECLARATIONS
### 2. PREPARE FOR INSTALLATION
# WordOps install and update script
###
# 1 - Set the CLI output colors
###
# Blue
function wo_lib_echo()
{
echo $(tput setaf 4)$@$(tput sgr0)
}
# White
function wo_lib_echo_info()
{
echo $(tput setaf 7)$@$(tput sgr0)
}
# Red
function wo_lib_echo_fail()
{
echo $(tput setaf 1)$@$(tput sgr0)
}
# Check whether the installation is called with elevated rights
###
# 1 - Check whether the installation is called with elevated rights
###
if [[ $EUID -ne 0 ]]; then
wo_lib_echo_fail "Sudo privilege required..."
wo_lib_echo_fail "Uses: wget -qO wo wordops.se/tup && sudo bash wo"
exit 100
fi
# Capture errors
###
# 1 - Capture errors
###
function wo_lib_error()
{
echo "[ `date` ] $(tput setaf 1)$@$(tput sgr0)"
exit $2
}
# Update the apt sewers with fresh info
wo_lib_echo "Executing apt-get update, please wait..."
###
# 1- Update the apt sewers with fresh info
###
wo_lib_echo "Updating apt-get repository info"
apt-get update &>> /dev/null
# Check whether lsb_release is installed, and if not, install it
###
# 1- Check whether lsb_release is installed, and if not, install it
###
if [ ! -x /usr/bin/lsb_release ]; then
wo_lib_echo "Installing lsb-release, please wait..."
apt-get -y install lsb-release &>> /dev/null
fi
# Define variables for later use
###
# 1 - Define variables for later use
###
wo_branch=$1
readonly wo_version_old="2.2.3"
readonly wo_version_new="3.9.0"
readonly wo_version_new="3.8.5"
readonly wo_log_dir=/var/log/wo/
readonly wo_install_log=/var/log/wo/install.log
readonly wo_linux_distro=$(lsb_release -i | awk '{print $3}')
readonly wo_distro_version=$(lsb_release -sc)
# Checking linux distro
###
# 1 - Checking linux distro
###
if [ "$wo_linux_distro" != "Ubuntu" ] && [ "$wo_linux_distro" != "Debian" ]; then
wo_lib_echo_fail "WordOps (wo) only supports Ubuntu and Debian at the moment."
wo_lib_echo_fail "If you are feeling adventurous, you are free to fork WordOps to support"
@@ -60,45 +80,64 @@ if [ "$wo_linux_distro" != "Ubuntu" ] && [ "$wo_linux_distro" != "Debian" ]; the
exit 100
fi
# WordOps (wo) only supports Ubuntu/Debian versions that are eligible for support
###
# 1 - WordOps (wo) only supports Ubuntu/Debian versions that are eligible for support
###
lsb_release -d | egrep -e "14.04|16.04|18.04|jessie|stretch" &>> /dev/null
if [ "$?" -ne "0" ]; then
wo_lib_echo_fail "WordOps (wo) only supports Ubuntu 14.04/16.04/18.04, Debian 8.x and Debian 9.x"
exit 100
fi
# To prevent errors or unexpected behaviour, create
# the log directory and properly set the ACL.
###
# 1 - To prevent errors or unexpected behaviour, create the log and ACL it
###
if [ ! -d $wo_log_dir ]; then
wo_lib_echo "Creating WordOps log directory, just a second..."
mkdir -p $wo_log_dir || wo_lib_error "Whoops - seems we are unable to create the log directory $wo_log_dir, exit status " $?
# Touch/create two empty log files within the wo_log_dir
touch /var/log/wo/{wordops.log,install.log}
# Set the ACL to only allow access by the root user and block others
chmod -R 700 /var/log/wo || wo_lib_error "Whoops, there was an error setting the permissions on the WordOps log folder, exit status " $?
fi
# Install a few dependencies (python v3, git, tar and python-software-properties),
# plus generate the locale afterwards.
###
# 2 - Setup the dependencies for installation
####
function wo_install_dep()
{
if [ "$wo_linux_distro" == "Ubuntu" ]; then
apt-get -y install build-essential curl gzip python3 python3-apt python3-setuptools python3-dev sqlite3 git tar software-properties-common sendmail || wo_lib_error "There was an error during dependency installation, exit status " 1
apt-get -y install build-essential curl gzip python3 python3-apt python3-setuptools python3-dev sqlite3 git tar software-properties-common postfix pigz || wo_lib_error "There was an error during dependency installation, exit status " 1
elif [ "$wo_linux_distro" == "Debian" ]; then
apt-get -y install build-essential curl gzip dirmngr python3 python3-apt python3-setuptools python3-dev sqlite3 git tar python-software-properties sendmail || wo_lib_error "There was an error during dependency installation, exit status " 1
apt-get -y install build-essential curl gzip dirmngr python3 python3-apt python-setuptools python3-dev sqlite3 git tar software-properties-common postfix pigz || wo_lib_error "There was an error during dependency installation, exit status " 1
fi
# Generate the locale, output to the blackhole rather than STDOUT
locale-gen en &>> /dev/null
}
# Create the WordOps database and intialize it
###
# 3 - Create/migrate the essentials
###
function wo_sync_db()
{
if [ ! -f /var/lib/wo/dbase.db ]; then
###
# Switching from EE -> WO
###
if [ -f /var/lib/ee/ee.db ]; then
# Create the WordOps folder
mkdir -p /var/lib/wo
# Backup the nginx directory
tar -cvf - /etc/nginx /var/lib/ee/ee.db | pigz -9 > /var/lib/wo/ee-nginx.tgz
# Copy the EasyEngine database
cp /var/lib/ee/ee.db /var/lib/wo/dbase.db
###
# Clean WO installation
###
elif [ ! -f /var/lib/wo/dbase.db ]; then
mkdir -p /var/lib/wo
echo "CREATE TABLE sites (
@@ -188,10 +227,9 @@ function wo_sync_db()
# Import the configuration into the WordOps SQLite database
echo "INSERT INTO sites (sitename, site_type, cache_type, site_path, is_enabled, is_ssl, storage_fs, storage_db)
VALUES (\"$site\", \"$wo_site_current\", \"$wo_site_current_cache\", \"$wo_webroot\", \"$wo_site_status\", 0, 'ext4', 'mysql');" | sqlite3 /var/lib/wo/dbase.db
done
else
wo_php_version=$(php -v | head -n1 | cut -d' ' -f2 |cut -c1-3)
wo_php_version="7.2"
wo_lib_echo "Updating WordOps Database"
echo "ALTER TABLE sites ADD COLUMN db_name varchar;" | sqlite3 /var/lib/wo/dbase.db
echo "ALTER TABLE sites ADD COLUMN db_user varchar; " | sqlite3 /var/lib/wo/dbase.db
@@ -200,6 +238,33 @@ function wo_sync_db()
echo "ALTER TABLE sites ADD COLUMN is_hhvm INT DEFAULT '0';" | sqlite3 /var/lib/wo/dbase.db
echo "ALTER TABLE sites ADD COLUMN php_version varchar DEFAULT \"$wo_php_version\";" | sqlite3 /var/lib/wo/dbase.db
fi
###
# ee-acme-sh by VirtuBox, https://virtubox.net/
###
if [ ! -f ~/.acme.sh/acme.sh ]; then
wget -O - https://get.acme.sh | sh
BASHRC_EE_ACME_FIRST_RELEASE=$(grep "ee-acme" $HOME/.bashrc)
BASHRC_EE_ACME_LAST_RELEASE=$(grep "ee-acme.sh" $HOME/.bashrc)
if [ -f $HOME/.ee-acme/ee-acme ] && [ -z "$BASHRC_EE_ACME_LAST_RELEASE" ]; then
rm -rf $HOME/.ee-acme/*
echo 'alias ee-acme="/root/.ee-acme/ee-acme.sh"' >> $HOME/.ee-acme/ee-acme
wget -qO $HOME/.ee-acme/ee-acme.sh https://raw.githubusercontent.com/WordOps/wo-acme-sh/master/script/ee-acme.sh
chmod +x $HOME/.ee-acme/ee-acme.sh
elif [ -x $HOME/.ee-acme/ee-acme.sh ]; then
rm $HOME/.ee-acme/ee-acme.sh
wget -qO $HOME/.ee-acme/ee-acme.sh https://raw.githubusercontent.com/WordOps/wo-acme-sh/master/script/ee-acme.sh
chmod +x $HOME/.ee-acme/ee-acme.sh
elif [ ! -d $HOME/.ee-acme ]; then
mkdir -p $HOME/.ee-acme
wget -qO $HOME/.ee-acme/ee-acme.sh https://raw.githubusercontent.com/WordOps/wo-acme-sh/master/script/ee-acme.sh
chmod +x $HOME/.ee-acme/ee-acme.sh
if [ -z "$BASHRC_EE_ACME_FIRST_RELEASE" ] && [ -z "$BASHRC_EE_ACME_LAST_RELEASE" ]; then
echo 'alias ee-acme="/root/.ee-acme/ee-acme.sh"' >> $HOME/.bashrc
fi
fi
fi
}
# Once again, set the proper ACL on the WordOps configuration directory
@@ -223,7 +288,7 @@ function wo_update_wp_cli()
dpkg --compare-versions ${WP_CLI_VERSION} lt 1.4.1
# Update WP-CLI to the most recent version
if [ "$?" == "0" ]; then
wget -qO ${WP_CLI_PATH} https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
wget -qO ${WP_CLI_PATH} https://raw.githubusercontent.com/WordOps/wpcli-builds/gh-pages/phar/wp-cli.phar
chmod +x ${WP_CLI_PATH}
fi
fi
@@ -232,11 +297,9 @@ function wo_update_wp_cli()
# Now, finally, let's install WordOps
function wo_install()
{
# Remove old versions of EasyEngine/WordOps
rm -rf /tmp/easyengine &>> /dev/null
rm -rf /tmp/wordops &>> /dev/null
# Clone the latest version directly from GitHub
wo_lib_echo "Downloading WordOps straight from GitHub - fresh and brewed with love. Hold your horses..."
if [ "$wo_branch" = "" ]; then
wo_branch=master
@@ -250,87 +313,26 @@ function wo_install()
python3 setup.py install || wo_lib_error "An error was encountered during the installation, exit status " $?
}
# Update the WordOps installation,
# remove old versions
function wo_update()
{
wo_lib_echo "Importing the EasyEngine configuration and magically importing it to WordOps."
wo_lib_echo "No worries, we'll make sure the configuration is duly backupped..."
wo_grant_host=$(grep grant-host /etc/easyengine/ee.conf | awk '{ print $3 }' | head -1 )
wo_db_name=$(grep db-name /etc/easyengine/ee.conf | awk '{ print $3 }')
wo_db_user=$(grep db-name /etc/easyengine/ee.conf | awk '{ print $3 }')
wo_wp_prefix=$(grep prefix /etc/easyengine/ee.conf | awk '{ print $3 }')
wo_wp_user=$(grep 'user ' /etc/easyengine/ee.conf | grep -v db-user |awk '{ print $3 }')
wo_wp_pass=$(grep password /etc/easyengine/ee.conf | awk '{ print $3 }')
wo_wp_email=$(grep email /etc/easyengine/ee.conf | awk '{ print $3 }')
wo_ip_addr=$(grep ip-address /etc/easyengine/ee.conf |awk -F'=' '{ print $2 }')
sed -i "s/ip-address.*/ip-address = ${wo_ip_addr}/" /etc/wo/wo.conf && \
sed -i "s/grant-host.*/grant-host = ${wo_grant_host}/" /etc/ee/wo.conf && \
sed -i "s/db-name.*/db-name = ${db-name}/" /etc/ee/wo.conf && \
sed -i "s/db-user.*/db-user = ${wo_db_user}/" /etc/wo/wo.conf && \
sed -i "s/prefix.*/prefix = ${wo_wp_prefix}/" /etc/wo/wo.conf && \
sed -i "s/^user.*/user = ${wo_wp_user}/" /etc/wo/wo.conf && \
sed -i "s/password.*/password = ${wo_wp_password}/" /etc/wo/wo.conf && \
sed -i "s/email.*/email = ${wo_wp_email}/" /etc/wo/wo.conf || wo_lib_error "An error was encountered during the configuration update, exit status " $?
wo_lib_echo "Removing EasyEngine 2.x"
rm -rf /etc/bash_completion.d/ee /etc/easyengine/ /usr/share/easyengine/ /usr/local/lib/easyengine /usr/local/sbin/easyengine /usr/local/sbin/ee /var/log/easyengine
# Softlink to fix command not found error
ln -s /usr/local/bin/wo /usr/local/sbin/wo || wo_lib_error "Unable to softlink the WordOps binary, exit status " $?
}
function wo_upgrade_php(){
# Change the PHP repository for PHP 7.x support
if [ "$wo_distro_version" == "trusty" ]; then
if [ -f /etc/apt/sources.list.d/ondrej-php5-5_6-trusty.list ]; then
# add-apt-repository -y --remove 'ppa:ondrej/php5-5.6'
if [ "$wo_linux_distro" == "Ubuntu" ]; then
add-apt-repository -y 'ppa:ondrej/php'
wo_lib_echo "Updating the PHP repository for some neat PHP 7 support"
apt-get update &>> /dev/null
apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php7.2-imap php7.2-mcrypt php7.2-readline php7.2-mysql php7.2-cli php7.2-common php7.2-curl php7.2-mbstring php7.2-bcmath php7.2-recode php7.2-mysql php7.2-opcache php-memcached php-imagick memcached php-pear php-xdebug php-msgpack php7.2-zip php7.2-xml php7.2-soap php-memcache || wo_lib_error "Unable to install PHP 5.6 packages, exit status " 1
sed -i "s/pid.*/pid = \/run\/php\/php5.6-fpm.pid/" /etc/php/5.6/fpm/php-fpm.conf && \
sed -i "s/error_log.*/error_log = \/var\/log\/php\/5.6\/fpm.log/" /etc/php/5.6/fpm/php-fpm.conf && \
sed -i "s/log_level.*/log_level = notice/" /etc/php/5.6/fpm/php-fpm.conf && \
sed -i "s/include.*/include = \/etc\/php\/5.6\/fpm\/pool.d\/*.conf/" /etc/php/5.6/fpm/php-fpm.conf && \
sed -i "s/slowlog =.*/slowlog = \/var\/log\/php\/5.6\/slow.log/" /etc/php/5.6/fpm/pool.d/debug.conf || wo_lib_error "An error was encountered during the configuration update, exit status " $?
mkdir -p /var/log/php/7.2/
touch /var/log/php/7.2/slow.log /var/log/php/7.2/fpm.log
service php5-fpm stop &>> /dev/null
service php7.2-fpm restart &>> /dev/null
rm -f /etc/apt/sources.list.d/ondrej-php5-5_6-trusty.list &>> /dev/null
apt-get remove -y php5-fpm php5-curl php5-gd php5-imap php5-mcrypt php5-common php5-readline php5-mysql php5-cli php5-memcache php5-imagick memcached graphviz php-pear
systemctl php7.2-fpm restart &>> /dev/null
# Fix for PHP 7.2 missed packages
elif [ -f /etc/php/mods-available/readline.ini ]; then
mkdir -p /tmp/php-conf/7.2
cp -f /etc/php/7.2/fpm/pool.d/www.conf /tmp/php-conf/7.2 &>> /dev/null
cp -f /etc/php/7.2/fpm/pool.d/debug.conf /tmp/php-conf/7.2 &>> /dev/null
cp -f /etc/php/7.2/fpm/php.ini /tmp/php-conf/7.2 &>> /dev/null
cp -f /etc/php/7.2/fpm/php-fpm.conf /tmp/php-conf/7.2 &>> /dev/null
apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php7.2-imap php7.2-mcrypt php7.2-readline php7.2-mysql php7.2-cli php7.2-common php7.2-curl php7.2-mbstring php7.2-bcmath php7.2-recode php7.2-mysql php7.2-opcache php-memcached php-imagick memcached php-pear php-xdebug php-msgpack php7.2-zip php7.2-xml php-memcache || wo_lib_error "Unable to install PHP 7.2 packages, exit status " 1
dpkg-query -W -f='${Status} ${Version}\n' php7.2-fpm 2>/dev/null | grep installed
if [ "$?" -eq "0" ]; then
apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php7.2-imap php7.2-mcrypt php7.2-readline php7.2-common php7.2-recode php7.2-mysql php7.2-cli php7.2-curl php7.2-mbstring php7.2-bcmath php7.2-mysql php7.2-opcache php7.2-zip php7.2-xml php-memcached php-imagick php-memcache memcached php-pear php-xdebug php-msgpack php7.2-soap || wo_lib_error "Unable to install PHP 7.2 packages, exit status " 1
mv -f /tmp/php-conf/7.2/www.conf /etc/php/7.2/fpm/pool.d/www.conf &>> /dev/null
mv -f /tmp/php-conf/7.2/debug.conf /etc/php/7.2/fpm/pool.d/debug.conf &>> /dev/null
mv -f /tmp/php-conf/7.2/php.ini /etc/php/7.2/fpm/php.ini &>> /dev/null
mv -f /tmp/php-conf/7.2/php-fpm.conf /etc/php/7.2/fpm/php-fpm.conf &>> /dev/null
service php7.2-fpm restart &>> /dev/null
fi
mv -f /tmp/php-conf/7.2/www.conf /etc/php/7.2/fpm/pool.d/www.conf &>> /dev/null
mv -f /tmp/php-conf/7.2/debug.conf /etc/php/7.2/fpm/pool.d/debug.conf &>> /dev/null
mv -f /tmp/php-conf/7.2/php.ini /etc/php/7.2/fpm/php.ini &>> /dev/null
mv -f /tmp/php-conf/7.2/php-fpm.conf /etc/php/7.2/fpm/php-fpm.conf &>> /dev/null
service php7.2-fpm restart &>> /dev/null
rm -rf /tmp/php-conf
fi
elif [ "$wo_linux_distro" == "Debian" ]; then
apt-get install apt-transport-https lsb-release ca-certificates locales locales-all -y
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list
apt-get update &>> /dev/null
apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php7.2-imap php7.2-mcrypt php7.2-readline php7.2-mysql php7.2-cli php7.2-common php7.2-curl php7.2-mbstring php7.2-bcmath php7.2-recode php7.2-mysql php7.2-opcache php-memcached php-imagick memcached php-pear php-xdebug php-msgpack php7.2-zip php7.2-xml php7.2-soap php-memcache || wo_lib_error "Unable to install PHP 5.6 packages, exit status " 1
systemctl php7.2-fpm restart &>> /dev/null
fi
}
@@ -386,10 +388,6 @@ if [ -f /etc/ImageMagick/policy.xml ]
if [ -f /etc/nginx/nginx.conf ]; then
wo_lib_echo "Updating Nginx configuration, please wait..."
# From version 3.1.10 we are using Suse builder for repository
if [ "$wo_distro_version" == "precise" ]; then
wo_lib_echo_fail ".my.cnf cannot be located in your current user or root folder..."
elif [ "$wo_distro_version" == "trusty" ]; then
grep -Hr 'http://download.opensuse.org/repositories/home:/rtCamp:/EasyEngine/xUbuntu_14.04/ /' /etc/apt/sources.list.d/ &>> /dev/null
@@ -401,7 +399,7 @@ if [ -f /etc/ImageMagick/policy.xml ]
gpg --keyserver "hkp://pgp.mit.edu" --recv-keys '3050AC3CD2AE6F03'
gpg -a --export --armor '3050AC3CD2AE6F03' | apt-key add -
if [ -f /etc/nginx/conf.d/ee-nginx.conf ]; then
mv /etc/nginx/conf.d/ee-nginx.conf /etc/nginx/conf.d/ee-nginx.conf.old &>> /dev/null
mv /etc/nginx/conf.d/ee-nginx.conf /etc/nginx/conf.d/wo-nginx.conf.old &>> /dev/null
fi
mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.old &>> /dev/null
apt-get update
@@ -421,35 +419,9 @@ if [ -f /etc/ImageMagick/policy.xml ]
service nginx restart &>> /dev/null
fi
elif [ "$wo_distro_version" == "wheezy" ]; then
grep -Hr 'http://download.opensuse.org/repositories/home:/rtCamp:/EasyEngine/Debian_7.0/ /' /etc/apt/sources.list.d/ &>> /dev/null
if [[ $? -ne 0 ]]; then
echo -e "deb http://download.opensuse.org/repositories/home:/rtCamp:/EasyEngine/Debian_7.0/ /" >> /etc/apt/sources.list.d/wo-repo.list
gpg --keyserver "hkp://pgp.mit.edu" --recv-keys '3050AC3CD2AE6F03'
gpg -a --export --armor '3050AC3CD2AE6F03' | apt-key add -
if [ -f /etc/nginx/conf.d/wo-nginx.conf ]; then
mv /etc/nginx/conf.d/wo-nginx.conf /etc/nginx/conf.d/wo-nginx.conf.old &>> /dev/null
fi
mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.old &>> /dev/null
mv /etc/nginx/fastcgi_params /etc/nginx/fastcgi_params.old &>> /dev/null
apt-get update
service nginx stop &>> /dev/null
DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confmiss" -o Dpkg::Options::="--force-confold" -y install nginx-custom
service nginx restart &>> /dev/null
fi
dpkg --get-selections | grep -v deinstall | grep nginx-common
if [ $? -eq 0 ]; then
apt-get update
service nginx stop &>> /dev/null
DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confmiss" -o Dpkg::Options::="--force-confold" -y install nginx-ee nginx-custom
service nginx restart &>> /dev/null
fi
elif [ "$wo_distro_version" == "jessie" ]; then
elif [ "$wo_linux_distro" == "Debian" ]; then
grep -Hr 'http://download.opensuse.org/repositories/home:/rtCamp:/EasyEngine/Debian_8.0/ /' /etc/apt/sources.list.d/ &>> /dev/null
#grep -Hr "deb http://packages.dotdeb.org jessie all" /etc/apt/sources.list.d/wo-repo.list &>> /dev/null
if [[ $? -ne 0 ]]; then
#sed -i "/deb http:\/\/packages.dotdeb.org jessie all/d" /etc/apt/sources.list.d/wo-repo.list &>> /dev/null
echo -e "deb http://download.opensuse.org/repositories/home:/rtCamp:/EasyEngine/Debian_8.0/ /" >> /etc/apt/sources.list.d/wo-repo.list
gpg --keyserver "hkp://pgp.mit.edu" --recv-keys '3050AC3CD2AE6F03'
gpg -a --export --armor '3050AC3CD2AE6F03' | apt-key add -
@@ -459,9 +431,9 @@ if [ -f /etc/ImageMagick/policy.xml ]
mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.old &>> /dev/null
mv /etc/nginx/fastcgi_params /etc/nginx/fastcgi_params.old &>> /dev/null
apt-get update
service nginx stop &>> /dev/null
systemctl stop nginx &>> /dev/null
apt-get -o Dpkg::Options::="--force-confmiss" -o Dpkg::Options::="--force-confold" -y install nginx-custom
service nginx restart &>> /dev/null
systemctl restart nginx &>> /dev/null
fi
dpkg --get-selections | grep -v deinstall | grep nginx-common
if [ $? -eq 0 ]; then
@@ -470,9 +442,9 @@ if [ -f /etc/ImageMagick/policy.xml ]
if [ $? -eq 0 ]; then
apt-get remove -y nginx-mainline
fi
service nginx stop &>> /dev/null
systemctl stop nginx &>> /dev/null
DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confmiss" -o Dpkg::Options::="--force-confold" -y --allow-unauthenticated install nginx-ee nginx-custom
service nginx restart &>> /dev/null
systemctl restart nginx &>> /dev/null
fi
fi
fi
@@ -551,7 +523,7 @@ if [ -f /etc/ImageMagick/policy.xml ]
#Fix Redis-server security issue
#http://redis.io/topics/security
if [ -f /etc/redis/redis.conf ]; then
grep -0 -v "#" /etc/redis/redis.conf | grep 'bind' &>> /dev/null
grep -0 -v "#" /etc/redis/redis.confse | grep 'bind' &>> /dev/null
if [ $? -ne 0 ]; then
sed -i '$ a bind 127.0.0.1' /etc/redis/redis.conf &>> /dev/null
service redis-server restart &>> /dev/null
@@ -600,9 +572,6 @@ if [ -f /etc/ImageMagick/policy.xml ]
crontab -l | sed '/--min_expiry_limit/d' | crontab -
/bin/bash -c "crontab -l 2> /dev/null | { cat; echo -e \"\n0 0 * * 0 wo site update --le=renew --all 2> /dev/null # Renew all letsencrypt SSL cert. Set by EasyEngine\"; } | crontab -"
fi
}
# Do git intialisation

View File

@@ -310,20 +310,20 @@ class WODebugController(CementBaseController):
nc.savef('/etc/nginx/conf.d/upstream.conf')
# Enable xdebug
WOFileUtils.searchreplace(self, "/etc/php/7.0/mods-available/"
WOFileUtils.searchreplace(self, "/etc/php/7.2/mods-available/"
"xdebug.ini",
";zend_extension",
"zend_extension")
# Fix slow log is not enabled default in PHP5.6
config = configparser.ConfigParser()
config.read('/etc/php/7.0/fpm/pool.d/debug.conf')
config['debug']['slowlog'] = '/var/log/php/7.0/slow.log'
config.read('/etc/php/7.2/fpm/pool.d/debug.conf')
config['debug']['slowlog'] = '/var/log/php/7.2/slow.log'
config['debug']['request_slowlog_timeout'] = '10s'
with open('/etc/php/7.0/fpm/pool.d/debug.conf',
with open('/etc/php/7.2/fpm/pool.d/debug.conf',
encoding='utf-8', mode='w') as confifile:
Log.debug(self, "Writting debug.conf configuration into "
"/etc/php/7.0/fpm/pool.d/debug.conf")
"/etc/php/7.2/fpm/pool.d/debug.conf")
config.write(confifile)
self.trigger_php = True
@@ -331,7 +331,7 @@ class WODebugController(CementBaseController):
else:
Log.info(self, "PHP debug is already enabled")
self.msg = self.msg + ['/var/log/php/7.0/slow.log']
self.msg = self.msg + ['/var/log/php/7.2/slow.log']
# PHP global debug stop
elif (self.app.pargs.php7 == 'off' and not self.app.pargs.site_name):
@@ -349,7 +349,7 @@ class WODebugController(CementBaseController):
nc.savef('/etc/nginx/conf.d/upstream.conf')
# Disable xdebug
WOFileUtils.searchreplace(self, "/etc/php/7.0/mods-available/"
WOFileUtils.searchreplace(self, "/etc/php/7.2/mods-available/"
"xdebug.ini",
"zend_extension",
";zend_extension")
@@ -365,38 +365,38 @@ class WODebugController(CementBaseController):
# PHP5-FPM start global debug
if (self.app.pargs.fpm7 == 'on' and not self.app.pargs.site_name):
if not WOShellExec.cmd_exec(self, "grep \"log_level = debug\" "
"/etc/php/7.0/fpm/php-fpm.conf"):
"/etc/php/7.2/fpm/php-fpm.conf"):
Log.info(self, "Setting up PHP7.0-FPM log_level = debug")
config = configparser.ConfigParser()
config.read('/etc/php/7.0/fpm/php-fpm.conf')
config.read('/etc/php/7.2/fpm/php-fpm.conf')
config.remove_option('global', 'include')
config['global']['log_level'] = 'debug'
config['global']['include'] = '/etc/php/7.0/fpm/pool.d/*.conf'
with open('/etc/php/7.0/fpm/php-fpm.conf',
config['global']['include'] = '/etc/php/7.2/fpm/pool.d/*.conf'
with open('/etc/php/7.2/fpm/php-fpm.conf',
encoding='utf-8', mode='w') as configfile:
Log.debug(self, "Writting php7.0-FPM configuration into "
"/etc/php/7.0/fpm/php-fpm.conf")
"/etc/php/7.2/fpm/php-fpm.conf")
config.write(configfile)
self.trigger_php = True
else:
Log.info(self, "PHP7.0-FPM log_level = debug already setup")
self.msg = self.msg + ['/var/log/php/7.0/fpm.log']
self.msg = self.msg + ['/var/log/php/7.2/fpm.log']
# PHP5-FPM stop global debug
elif (self.app.pargs.fpm7 == 'off' and not self.app.pargs.site_name):
if WOShellExec.cmd_exec(self, "grep \"log_level = debug\" "
"/etc/php/7.0/fpm/php-fpm.conf"):
"/etc/php/7.2/fpm/php-fpm.conf"):
Log.info(self, "Disabling PHP7.0-FPM log_level = debug")
config = configparser.ConfigParser()
config.read('/etc/php/7.0/fpm/php-fpm.conf')
config.read('/etc/php/7.2/fpm/php-fpm.conf')
config.remove_option('global', 'include')
config['global']['log_level'] = 'notice'
config['global']['include'] = '/etc/php/7.0/fpm/pool.d/*.conf'
with open('/etc/php/7.0/fpm/php-fpm.conf',
config['global']['include'] = '/etc/php/7.2/fpm/pool.d/*.conf'
with open('/etc/php/7.2/fpm/php-fpm.conf',
encoding='utf-8', mode='w') as configfile:
Log.debug(self, "writting php7.0 configuration into "
"/etc/php/7.0/fpm/php-fpm.conf")
"/etc/php/7.2/fpm/php-fpm.conf")
config.write(configfile)
self.trigger_php = True
else:

View File

@@ -30,7 +30,7 @@ class WOInfoController(CementBaseController):
dict(help='Get PHP configuration information',
action='store_true')),
(['--php7'],
dict(help='Get PHP 7.0 configuration information',
dict(help='Get PHP 7.2 configuration information',
action='store_true')),
(['--nginx'],
dict(help='Get Nginx configuration information',
@@ -143,14 +143,14 @@ class WOInfoController(CementBaseController):
version = os.popen("php7.0 -v 2>/dev/null | head -n1 | cut -d' ' -f2 |"
" cut -d'+' -f1 | tr -d '\n'").read
config = configparser.ConfigParser()
config.read('/etc/php/7.0/fpm/php.ini')
config.read('/etc/php/7.2/fpm/php.ini')
expose_php = config['PHP']['expose_php']
memory_limit = config['PHP']['memory_limit']
post_max_size = config['PHP']['post_max_size']
upload_max_filesize = config['PHP']['upload_max_filesize']
max_execution_time = config['PHP']['max_execution_time']
config.read('/etc/php/7.0/fpm/pool.d/www.conf')
config.read('/etc/php/7.2/fpm/pool.d/www.conf')
www_listen = config['www']['listen']
www_ping_path = config['www']['ping.path']
www_pm_status_path = config['www']['pm.status_path']
@@ -168,7 +168,7 @@ class WOInfoController(CementBaseController):
except Exception as e:
www_xdebug = 'off'
config.read('/etc/php/7.0/fpm/pool.d/debug.conf')
config.read('/etc/php/7.2/fpm/pool.d/debug.conf')
debug_listen = config['debug']['listen']
debug_ping_path = config['debug']['ping.path']
debug_pm_status_path = config['debug']['pm.status_path']

View File

@@ -1017,38 +1017,38 @@ class WOStackController(CementBaseController):
#PHP7.0 configuration for debian
if (WOVariables.wo_platform_codename == 'jessie' ) and set(WOVariables.wo_php7_0).issubset(set(apt_packages)):
# Create log directories
if not os.path.exists('/var/log/php/7.0/'):
Log.debug(self, 'Creating directory /var/log/php/7.0/')
os.makedirs('/var/log/php/7.0/')
if not os.path.exists('/var/log/php/7.2/'):
Log.debug(self, 'Creating directory /var/log/php/7.2/')
os.makedirs('/var/log/php/7.2/')
# Parse etc/php/7.0/fpm/php.ini
# Parse etc/php/7.2/fpm/php.ini
config = configparser.ConfigParser()
Log.debug(self, "configuring php file /etc/php/7.0/fpm/php.ini")
config.read('/etc/php/7.0/fpm/php.ini')
Log.debug(self, "configuring php file /etc/php/7.2/fpm/php.ini")
config.read('/etc/php/7.2/fpm/php.ini')
config['PHP']['expose_php'] = 'Off'
config['PHP']['post_max_size'] = '100M'
config['PHP']['upload_max_filesize'] = '100M'
config['PHP']['max_execution_time'] = '300'
config['PHP']['date.timezone'] = WOVariables.wo_timezone
with open('/etc/php/7.0/fpm/php.ini',
with open('/etc/php/7.2/fpm/php.ini',
encoding='utf-8', mode='w') as configfile:
Log.debug(self, "Writting php configuration into "
"/etc/php/7.0/fpm/php.ini")
"/etc/php/7.2/fpm/php.ini")
config.write(configfile)
# Parse /etc/php/7.0/fpm/php-fpm.conf
# Parse /etc/php/7.2/fpm/php-fpm.conf
data = dict(pid="/run/php/php7.0-fpm.pid", error_log="/var/log/php7.0-fpm.log",
include="/etc/php/7.0/fpm/pool.d/*.conf")
include="/etc/php/7.2/fpm/pool.d/*.conf")
Log.debug(self, "writting php 7.0 configuration into "
"/etc/php/7.0/fpm/php-fpm.conf")
wo_php_fpm = open('/etc/php/7.0/fpm/php-fpm.conf',
"/etc/php/7.2/fpm/php-fpm.conf")
wo_php_fpm = open('/etc/php/7.2/fpm/php-fpm.conf',
encoding='utf-8', mode='w')
self.app.render((data), 'php-fpm.mustache', out=wo_php_fpm)
wo_php_fpm.close()
# Parse /etc/php/7.0/fpm/pool.d/www.conf
# Parse /etc/php/7.2/fpm/pool.d/www.conf
config = configparser.ConfigParser()
config.read_file(codecs.open('/etc/php/7.0/fpm/pool.d/www.conf',
config.read_file(codecs.open('/etc/php/7.2/fpm/pool.d/www.conf',
"r", "utf8"))
config['www']['ping.path'] = '/ping'
config['www']['pm.status_path'] = '/status'
@@ -1060,30 +1060,30 @@ class WOStackController(CementBaseController):
config['www']['request_terminate_timeout'] = '300'
config['www']['pm'] = 'ondemand'
config['www']['listen'] = '127.0.0.1:9070'
with codecs.open('/etc/php/7.0/fpm/pool.d/www.conf',
with codecs.open('/etc/php/7.2/fpm/pool.d/www.conf',
encoding='utf-8', mode='w') as configfile:
Log.debug(self, "writting PHP5 configuration into "
"/etc/php/7.0/fpm/pool.d/www.conf")
"/etc/php/7.2/fpm/pool.d/www.conf")
config.write(configfile)
# Generate /etc/php/7.0/fpm/pool.d/debug.conf
WOFileUtils.copyfile(self, "/etc/php/7.0/fpm/pool.d/www.conf",
"/etc/php/7.0/fpm/pool.d/debug.conf")
WOFileUtils.searchreplace(self, "/etc/php/7.0/fpm/pool.d/"
# Generate /etc/php/7.2/fpm/pool.d/debug.conf
WOFileUtils.copyfile(self, "/etc/php/7.2/fpm/pool.d/www.conf",
"/etc/php/7.2/fpm/pool.d/debug.conf")
WOFileUtils.searchreplace(self, "/etc/php/7.2/fpm/pool.d/"
"debug.conf", "[www]", "[debug]")
config = configparser.ConfigParser()
config.read('/etc/php/7.0/fpm/pool.d/debug.conf')
config.read('/etc/php/7.2/fpm/pool.d/debug.conf')
config['debug']['listen'] = '127.0.0.1:9170'
config['debug']['rlimit_core'] = 'unlimited'
config['debug']['slowlog'] = '/var/log/php/7.0/slow.log'
config['debug']['slowlog'] = '/var/log/php/7.2/slow.log'
config['debug']['request_slowlog_timeout'] = '10s'
with open('/etc/php/7.0/fpm/pool.d/debug.conf',
with open('/etc/php/7.2/fpm/pool.d/debug.conf',
encoding='utf-8', mode='w') as confifile:
Log.debug(self, "writting PHP5 configuration into "
"/etc/php/7.0/fpm/pool.d/debug.conf")
"/etc/php/7.2/fpm/pool.d/debug.conf")
config.write(confifile)
with open("/etc/php/7.0/fpm/pool.d/debug.conf",
with open("/etc/php/7.2/fpm/pool.d/debug.conf",
encoding='utf-8', mode='a') as myfile:
myfile.write("php_admin_value[xdebug.profiler_output_dir] "
"= /tmp/ \nphp_admin_value[xdebug.profiler_"
@@ -1093,8 +1093,8 @@ class WOStackController(CementBaseController):
"profiler_enable] = off\n")
# Disable xdebug
if not WOShellExec.cmd_exec(self, "grep -q \';zend_extension\' /etc/php/7.0/mods-available/xdebug.ini"):
WOFileUtils.searchreplace(self, "/etc/php/7.0/mods-available/"
if not WOShellExec.cmd_exec(self, "grep -q \';zend_extension\' /etc/php/7.2/mods-available/xdebug.ini"):
WOFileUtils.searchreplace(self, "/etc/php/7.2/mods-available/"
"xdebug.ini",
"zend_extension",
";zend_extension")
@@ -1139,38 +1139,38 @@ class WOStackController(CementBaseController):
#preconfiguration for php7.0
if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and set(WOVariables.wo_php7_0).issubset(set(apt_packages)):
# Create log directories
if not os.path.exists('/var/log/php/7.0/'):
Log.debug(self, 'Creating directory /var/log/php/7.0/')
os.makedirs('/var/log/php/7.0/')
if not os.path.exists('/var/log/php/7.2/'):
Log.debug(self, 'Creating directory /var/log/php/7.2/')
os.makedirs('/var/log/php/7.2/')
# Parse etc/php/7.0/fpm/php.ini
# Parse etc/php/7.2/fpm/php.ini
config = configparser.ConfigParser()
Log.debug(self, "configuring php file /etc/php/7.0/fpm/php.ini")
config.read('/etc/php/7.0/fpm/php.ini')
Log.debug(self, "configuring php file /etc/php/7.2/fpm/php.ini")
config.read('/etc/php/7.2/fpm/php.ini')
config['PHP']['expose_php'] = 'Off'
config['PHP']['post_max_size'] = '100M'
config['PHP']['upload_max_filesize'] = '100M'
config['PHP']['max_execution_time'] = '300'
config['PHP']['date.timezone'] = WOVariables.wo_timezone
with open('/etc/php/7.0/fpm/php.ini',
with open('/etc/php/7.2/fpm/php.ini',
encoding='utf-8', mode='w') as configfile:
Log.debug(self, "Writting php configuration into "
"/etc/php/7.0/fpm/php.ini")
"/etc/php/7.2/fpm/php.ini")
config.write(configfile)
# Parse /etc/php/7.0/fpm/php-fpm.conf
data = dict(pid="/run/php/php7.0-fpm.pid", error_log="/var/log/php/7.0/fpm.log",
include="/etc/php/7.0/fpm/pool.d/*.conf")
# Parse /etc/php/7.2/fpm/php-fpm.conf
data = dict(pid="/run/php/php7.0-fpm.pid", error_log="/var/log/php/7.2/fpm.log",
include="/etc/php/7.2/fpm/pool.d/*.conf")
Log.debug(self, "writting php 7.0 configuration into "
"/etc/php/7.0/fpm/php-fpm.conf")
wo_php_fpm = open('/etc/php/7.0/fpm/php-fpm.conf',
"/etc/php/7.2/fpm/php-fpm.conf")
wo_php_fpm = open('/etc/php/7.2/fpm/php-fpm.conf',
encoding='utf-8', mode='w')
self.app.render((data), 'php-fpm.mustache', out=wo_php_fpm)
wo_php_fpm.close()
# Parse /etc/php/7.0/fpm/pool.d/www.conf
# Parse /etc/php/7.2/fpm/pool.d/www.conf
config = configparser.ConfigParser()
config.read_file(codecs.open('/etc/php/7.0/fpm/pool.d/www.conf',
config.read_file(codecs.open('/etc/php/7.2/fpm/pool.d/www.conf',
"r", "utf8"))
config['www']['ping.path'] = '/ping'
config['www']['pm.status_path'] = '/status'
@@ -1182,30 +1182,30 @@ class WOStackController(CementBaseController):
config['www']['request_terminate_timeout'] = '300'
config['www']['pm'] = 'ondemand'
config['www']['listen'] = '127.0.0.1:9070'
with codecs.open('/etc/php/7.0/fpm/pool.d/www.conf',
with codecs.open('/etc/php/7.2/fpm/pool.d/www.conf',
encoding='utf-8', mode='w') as configfile:
Log.debug(self, "writting PHP5 configuration into "
"/etc/php/7.0/fpm/pool.d/www.conf")
"/etc/php/7.2/fpm/pool.d/www.conf")
config.write(configfile)
# Generate /etc/php/7.0/fpm/pool.d/debug.conf
WOFileUtils.copyfile(self, "/etc/php/7.0/fpm/pool.d/www.conf",
"/etc/php/7.0/fpm/pool.d/debug.conf")
WOFileUtils.searchreplace(self, "/etc/php/7.0/fpm/pool.d/"
# Generate /etc/php/7.2/fpm/pool.d/debug.conf
WOFileUtils.copyfile(self, "/etc/php/7.2/fpm/pool.d/www.conf",
"/etc/php/7.2/fpm/pool.d/debug.conf")
WOFileUtils.searchreplace(self, "/etc/php/7.2/fpm/pool.d/"
"debug.conf", "[www]", "[debug]")
config = configparser.ConfigParser()
config.read('/etc/php/7.0/fpm/pool.d/debug.conf')
config.read('/etc/php/7.2/fpm/pool.d/debug.conf')
config['debug']['listen'] = '127.0.0.1:9170'
config['debug']['rlimit_core'] = 'unlimited'
config['debug']['slowlog'] = '/var/log/php/7.0/slow.log'
config['debug']['slowlog'] = '/var/log/php/7.2/slow.log'
config['debug']['request_slowlog_timeout'] = '10s'
with open('/etc/php/7.0/fpm/pool.d/debug.conf',
with open('/etc/php/7.2/fpm/pool.d/debug.conf',
encoding='utf-8', mode='w') as confifile:
Log.debug(self, "writting PHP5 configuration into "
"/etc/php/7.0/fpm/pool.d/debug.conf")
"/etc/php/7.2/fpm/pool.d/debug.conf")
config.write(confifile)
with open("/etc/php/7.0/fpm/pool.d/debug.conf",
with open("/etc/php/7.2/fpm/pool.d/debug.conf",
encoding='utf-8', mode='a') as myfile:
myfile.write("php_admin_value[xdebug.profiler_output_dir] "
"= /tmp/ \nphp_admin_value[xdebug.profiler_"
@@ -1215,8 +1215,8 @@ class WOStackController(CementBaseController):
"profiler_enable] = off\n")
# Disable xdebug
if not WOShellExec.cmd_exec(self, "grep -q \';zend_extension\' /etc/php/7.0/mods-available/xdebug.ini"):
WOFileUtils.searchreplace(self, "/etc/php/7.0/mods-available/"
if not WOShellExec.cmd_exec(self, "grep -q \';zend_extension\' /etc/php/7.2/mods-available/xdebug.ini"):
WOFileUtils.searchreplace(self, "/etc/php/7.2/mods-available/"
"xdebug.ini",
"zend_extension",
";zend_extension")

View File

@@ -40,9 +40,6 @@ class WOStackUpgradeController(CementBaseController):
dict(help='Upgrade WPCLI', action='store_true')),
(['--redis'],
dict(help='Upgrade Redis', action='store_true')),
(['--php56'],
dict(help="Upgrade to PHP5.6 from PHP5.5",
action='store_true')),
(['--no-prompt'],
dict(help="Upgrade Packages without any prompt",
action='store_true')),
@@ -72,38 +69,21 @@ class WOStackUpgradeController(CementBaseController):
if WOVariables.wo_platform_distro == "ubuntu":
WORepo.remove(self, ppa="ppa:ondrej/php5")
WORepo.add(self, ppa=WOVariables.wo_php_repo)
else:
WOAptGet.remove(self, ["php5-xdebug"])
WOFileUtils.searchreplace(self, WOVariables.wo_repo_file_path,
"php55", "php56")
Log.info(self, "Updating apt-cache, please wait...")
WOAptGet.update(self)
Log.info(self, "Installing packages, please wait ...")
if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'):
WOAptGet.install(self, WOVariables.wo_php5_6 + WOVariables.wo_php_extra)
WOAptGet.install(self, WOVariables.wo_php + WOVariables.wo_php_extra)
else:
WOAptGet.install(self, WOVariables.wo_php)
if WOVariables.wo_platform_distro == "debian":
WOShellExec.cmd_exec(self, "pecl install xdebug")
with open("/etc/php5/mods-available/xdebug.ini",
encoding='utf-8', mode='a') as myfile:
myfile.write(";zend_extension=/usr/lib/php5/20131226/"
"xdebug.so\n")
WOFileUtils.create_symlink(self, ["/etc/php5/mods-available/"
"xdebug.ini", "/etc/php5/fpm/conf.d"
"/20-xedbug.ini"])
Log.info(self, "Successfully upgraded from PHP 5.5 to PHP 5.6")
@expose(hide=True)
def default(self):
# All package update
if ((not self.app.pargs.php56)):
apt_packages = []
packages = []
@@ -133,22 +113,10 @@ class WOStackUpgradeController(CementBaseController):
Log.info(self, "Nginx Stable is not already installed")
if self.app.pargs.php:
if (WOVariables.wo_platform_distro == 'debian' or WOVariables.wo_platform_codename == 'precise'):
if WOAptGet.is_installed(self, 'php5-fpm'):
apt_packages = apt_packages + WOVariables.wo_php
if WOAptGet.is_installed(self, 'php7.2-fpm'):
apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra
else:
Log.info(self, "PHP is not installed")
if WOAptGet.is_installed(self, 'php7.0-fpm'):
apt_packages = apt_packages + WOVariables.wo_php7_0
else:
if WOAptGet.is_installed(self, 'php5.6-fpm'):
apt_packages = apt_packages + WOVariables.wo_php5_6 + WOVariables.wo_php_extra
else:
Log.info(self, "PHP 5.6 is not installed")
if WOAptGet.is_installed(self, 'php7.0-fpm'):
apt_packages = apt_packages + WOVariables.wo_php7_0 + WOVariables.wo_php_extra
else:
Log.info(self, "PHP 7.0 is not installed")
Log.info(self, "PHP 7.2 is not installed")
if self.app.pargs.hhvm:
if WOAptGet.is_installed(self, 'hhvm'):
@@ -199,14 +167,8 @@ class WOStackUpgradeController(CementBaseController):
# Post Actions after package updates
if (set(WOVariables.wo_nginx).issubset(set(apt_packages))):
WOService.restart_service(self, 'nginx')
if (WOVariables.wo_platform_distro == 'debian' or WOVariables.wo_platform_codename == 'precise'):
if set(WOVariables.wo_php).issubset(set(apt_packages)):
WOService.restart_service(self, 'php5-fpm')
else:
if set(WOVariables.wo_php5_6).issubset(set(apt_packages)):
WOService.restart_service(self, 'php5.6-fpm')
if set(WOVariables.wo_php7_0).issubset(set(apt_packages)):
WOService.restart_service(self, 'php7.0-fpm')
WOService.restart_service(self, 'php7.2-fpm')
if set(WOVariables.wo_hhvm).issubset(set(apt_packages)):
WOService.restart_service(self, 'hhvm')
if set(WOVariables.wo_mysql).issubset(set(apt_packages)):
@@ -225,9 +187,5 @@ class WOStackUpgradeController(CementBaseController):
WOFileUtils.chmod(self, "/usr/bin/wp", 0o775)
Log.info(self, "Successfully updated packages")
# PHP 5.6 to 5.6
elif (self.app.pargs.php56):
self.upgrade_php56()
else:
self.app.args.print_help()

View File

@@ -12,7 +12,7 @@ class WOVariables():
"""Intialization of core variables"""
# WordOps version
wo_version = "3.9.0"
wo_version = "3.8.5"
# WordOps packages versions
wo_wp_cli = "2.0.1"
wo_adminer = "4.6.3"
@@ -81,9 +81,6 @@ class WOVariables():
# WordOps stack installation variables
# Nginx repo and packages
if wo_platform_codename == 'precise':
wo_nginx_repo = ("deb http://download.opensuse.org/repositories/home:"
"/rtCamp:/EasyEngine/xUbuntu_12.04/ /")
elif wo_platform_codename == 'trusty':
wo_nginx_repo = ("deb http://download.opensuse.org/repositories/home:"
"/rtCamp:/EasyEngine/xUbuntu_14.04/ /")
@@ -93,69 +90,36 @@ class WOVariables():
elif wo_platform_codename == 'bionic':
wo_nginx_repo = ("deb http://download.opensuse.org/repositories/home:"
"/rtCamp:/EasyEngine/xUbuntu_18.04/ /")
elif wo_platform_codename == 'whwozy':
wo_nginx_repo = ("deb http://download.opensuse.org/repositories/home:"
"/rtCamp:/EasyEngine/Debian_7.0/ /")
elif wo_platform_codename == 'jessie':
wo_nginx_repo = ("deb http://download.opensuse.org/repositories/home:"
"/rtCamp:/EasyEngine/Debian_8.0/ /")
elif wo_platform_codename == 'stretch':
wo_nginx_repo = ("deb http://download.opensuse.org/repositories/home:"
"/rtCamp:/EasyEngine/Debian_8.0/ /")
wo_nginx = ["nginx-custom", "nginx-ee"]
wo_nginx_key = '3050AC3CD2AE6F03'
# PHP repo and packages
if wo_platform_distro == 'ubuntu':
if wo_platform_codename == 'precise':
wo_php_repo = "ppa:ondrej/php5-5.6"
wo_php = ["php5-fpm", "php5-curl", "php5-gd", "php5-imap",
"php5-mcrypt", "php5-common", "php5-readline",
"php5-mysql", "php5-cli", "php5-memcache", "php5-imagick",
"memcached", "graphviz", "php-pear"]
elif (wo_platform_codename == 'trusty' or wo_platform_codename == 'xenial' or wo_platform_codename == 'bionic'):
if (wo_platform_codename == 'trusty' or wo_platform_codename == 'xenial' or wo_platform_codename == 'bionic'):
wo_php_repo = "ppa:ondrej/php"
# PHP5.6 for those who like to live on the dangerous side
wo_php5_6 = ["php5.6-fpm", "php5.6-curl", "php5.6-gd", "php5.6-imap",
"php5.6-mcrypt", "php5.6-readline", "php5.6-common", "php5.6-recode",
"php5.6-mysql", "php5.6-cli", "php5.6-curl", "php5.6-mbstring",
"php5.6-bcmath", "php5.6-mysql", "php5.6-opcache", "php5.6-zip", "php5.6-xml", "php5.6-soap"]
# PHP7.0 going EOL soon
wo_php7_0 = ["php7.0-fpm", "php7.0-curl", "php7.0-gd", "php7.0-imap",
"php7.0-mcrypt", "php7.0-readline", "php7.0-common", "php7.0-recode",
"php7.0-cli", "php7.0-mbstring",
"php7.0-bcmath", "php7.0-mysql", "php7.0-opcache", "php7.0-zip", "php7.0-xml", "php7.0-soap"]
wo_php7_2 = ["php7.2-fpm", "php7.2-curl", "php7.2-gd", "php7.2-imap",
wo_php = ["php7.2-fpm", "php7.2-curl", "php7.2-gd", "php7.2-imap",
"php7.2-readline", "php7.2-common", "php7.2-recode",
"php7.2-cli", "php7.2-mbstring",
"php7.2-bcmath", "php7.2-mysql", "php7.2-opcache", "php7.2-zip", "php7.2-xml", "php7.2-soap"]
wo_php_extra = ["php-memcached", "php-imagick", "php-memcache", "memcached",
"graphviz", "php-pear", "php-xdebug", "php-msgpack", "php-redis"]
elif wo_platform_distro == 'debian':
if wo_platform_codename == 'wheezy':
wo_php_repo = ("deb http://packages.dotdeb.org {codename}-php56 all"
.format(codename=wo_platform_codename))
else :
wo_php_repo = ("deb http://packages.dotdeb.org {codename} all".format(codename=wo_platform_codename))
wo_php = ["php5-fpm", "php5-curl", "php5-gd", "php5-imap",
"php5-mcrypt", "php5-common", "php5-readline",
"php5-mysqlnd", "php5-cli", "php5-memcache", "php5-imagick",
"memcached", "graphviz", "php-pear"]
wo_php7_0 = ["php7.0-fpm", "php7.0-curl", "php7.0-gd", "php7.0-imap",
"php7.0-mcrypt", "php7.0-common", "php7.0-readline", "php7.0-redis",
"php7.0-mysql", "php7.0-cli", "php7.0-memcache", "php7.0-imagick",
"php7.0-mbstring", "php7.0-recode", "php7.0-bcmath", "php7.0-opcache", "php7.0-zip", "php7.0-xml",
"php7.0-soap", "php7.0-msgpack",
"memcached", "graphviz", "php-pear", "php7.0-xdebug"]
wo_php = ["php7.2-fpm", "php7.2-curl", "php7.2-gd", "php7.2-imap",
"php7.2-mcrypt", "php7.2-common", "php7.2-readline", "php7.2-redis",
"php7.2-mysql", "php7.2-cli", "php7.2-memcache", "php7.2-imagick",
"php7.2-mbstring", "php7.2-recode", "php7.2-bcmath", "php7.2-opcache", "php7.2-zip", "php7.2-xml",
"php7.2-soap", "php7.2-msgpack",
"memcached", "graphviz", "php-pear", "php7.2-xdebug"]
wo_php_extra = []
if wo_platform_codename == 'wheezy':
wo_php = wo_php + ["php5-dev"]
if wo_platform_codename == 'precise' or wo_platform_codename == 'jessie':
wo_php = wo_php + ["php5-xdebug"]
# MySQL repo and packages
if wo_platform_distro == 'ubuntu':
wo_mysql_repo = ("deb [arch=amd64,i386,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/"
@@ -170,11 +134,7 @@ class WOVariables():
# HHVM repo details
if wo_platform_distro == 'ubuntu':
if wo_platform_codename == "precise":
wo_boost_repo = ("ppa:mapnik/boost")
wo_hhvm_repo = ("deb http://dl.hhvm.com/ubuntu {codename} main"
.format(codename=wo_platform_codename))
elif wo_platform_codename == "trusty" or wo_platform_codename == "xenial" or wo_platform_codename == "bionic":
if wo_platform_codename == "trusty" or wo_platform_codename == "xenial" or wo_platform_codename == "bionic":
wo_hhvm_repo = ("deb http://dl.hhvm.com/ubuntu {codename} main"
.format(codename=wo_platform_codename))
else:
@@ -192,9 +152,7 @@ class WOVariables():
.format(codename=wo_platform_codename))
if (wo_platform_codename == 'trusty' or wo_platform_codename == 'xenial' or wo_platform_codename == 'bionic'):
wo_redis = ['redis-server', 'php-redis']
else:
wo_redis = ['redis-server', 'php5-redis']
wo_redis = ['redis-server', 'php7.2-redis']
# Repo path
wo_repo_file = "wo-repo.list"