From 1f89f18828685f32e8e98dca908dd1fd7725dce1 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Mon, 25 Feb 2019 07:47:36 +0100 Subject: [PATCH 01/56] update nginx php query parameter handling * replace /index.php?$args with /index.php$is_args$args according to WP 5.0 rest api faq --- wo/cli/templates/22222.mustache | 2 +- wo/cli/templates/locations-php7.mustache | 2 +- wo/cli/templates/locations.mustache | 2 +- wo/cli/templates/php-hhvm.mustache | 2 +- wo/cli/templates/php.mustache | 2 +- wo/cli/templates/php7.mustache | 2 +- wo/cli/templates/redis-hhvm.mustache | 2 +- wo/cli/templates/redis-php7.mustache | 2 +- wo/cli/templates/redis.mustache | 2 +- wo/cli/templates/wpfc-hhvm.mustache | 2 +- wo/cli/templates/wpfc-php7.mustache | 2 +- wo/cli/templates/wpfc.mustache | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/wo/cli/templates/22222.mustache b/wo/cli/templates/22222.mustache index ecd934b..346c164 100644 --- a/wo/cli/templates/22222.mustache +++ b/wo/cli/templates/22222.mustache @@ -23,7 +23,7 @@ server { include common/acl.conf; location / { - try_files $uri $uri/ /index.php?$args; + try_files $uri $uri/ /index.php$is_args$args; } # Display menu at location /fpm/status/ diff --git a/wo/cli/templates/locations-php7.mustache b/wo/cli/templates/locations-php7.mustache index ec75110..58c0011 100644 --- a/wo/cli/templates/locations-php7.mustache +++ b/wo/cli/templates/locations-php7.mustache @@ -9,7 +9,7 @@ location = /favicon.ico { location = /robots.txt { # Some WordPress plugin gererate robots.txt file # Refer #340 issue - try_files $uri $uri/ /index.php?$args @robots; + try_files $uri $uri/ /index.php$is_args$args @robots; access_log off; log_not_found off; } diff --git a/wo/cli/templates/locations.mustache b/wo/cli/templates/locations.mustache index 38e20dd..36155bf 100644 --- a/wo/cli/templates/locations.mustache +++ b/wo/cli/templates/locations.mustache @@ -9,7 +9,7 @@ location = /favicon.ico { location = /robots.txt { # Some WordPress plugin gererate robots.txt file # Refer #340 issue - try_files $uri $uri/ /index.php?$args @robots; + try_files $uri $uri/ /index.php$is_args$args @robots; access_log off; log_not_found off; } diff --git a/wo/cli/templates/php-hhvm.mustache b/wo/cli/templates/php-hhvm.mustache index 3c7a7bb..ac76401 100644 --- a/wo/cli/templates/php-hhvm.mustache +++ b/wo/cli/templates/php-hhvm.mustache @@ -1,7 +1,7 @@ # PHP NGINX CONFIGURATION # DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE location / { - try_files $uri $uri/ /index.php?$args; + try_files $uri $uri/ /index.php$is_args$args; } location ~ \.php$ { try_files $uri =404; diff --git a/wo/cli/templates/php.mustache b/wo/cli/templates/php.mustache index de0f096..65f75fe 100644 --- a/wo/cli/templates/php.mustache +++ b/wo/cli/templates/php.mustache @@ -1,7 +1,7 @@ # PHP NGINX CONFIGURATION # DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE location / { - try_files $uri $uri/ /index.php?$args; + try_files $uri $uri/ /index.php$is_args$args; } location ~ \.php$ { try_files $uri =404; diff --git a/wo/cli/templates/php7.mustache b/wo/cli/templates/php7.mustache index d9f9d9a..871d3c5 100644 --- a/wo/cli/templates/php7.mustache +++ b/wo/cli/templates/php7.mustache @@ -1,7 +1,7 @@ # PHP NGINX CONFIGURATION # DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE location / { - try_files $uri $uri/ /index.php?$args; + try_files $uri $uri/ /index.php$is_args$args; } location ~ \.php$ { try_files $uri =404; diff --git a/wo/cli/templates/redis-hhvm.mustache b/wo/cli/templates/redis-hhvm.mustache index 8ebeaf8..764ef09 100644 --- a/wo/cli/templates/redis-hhvm.mustache +++ b/wo/cli/templates/redis-hhvm.mustache @@ -18,7 +18,7 @@ if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no } # Use cached or actual file if they exists, Otherwise pass request to WordPress location / { - try_files $uri $uri/ /index.php?$args; + try_files $uri $uri/ /index.php$is_args$args; } location /redis-fetch { diff --git a/wo/cli/templates/redis-php7.mustache b/wo/cli/templates/redis-php7.mustache index 9134b84..93d5943 100644 --- a/wo/cli/templates/redis-php7.mustache +++ b/wo/cli/templates/redis-php7.mustache @@ -18,7 +18,7 @@ if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no } # Use cached or actual file if they exists, Otherwise pass request to WordPress location / { - try_files $uri $uri/ /index.php?$args; + try_files $uri $uri/ /index.php$is_args$args; } location /redis-fetch { diff --git a/wo/cli/templates/redis.mustache b/wo/cli/templates/redis.mustache index 8335ea8..e29e02f 100644 --- a/wo/cli/templates/redis.mustache +++ b/wo/cli/templates/redis.mustache @@ -18,7 +18,7 @@ if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no } # Use cached or actual file if they exists, Otherwise pass request to WordPress location / { - try_files $uri $uri/ /index.php?$args; + try_files $uri $uri/ /index.php$is_args$args; } location /redis-fetch { diff --git a/wo/cli/templates/wpfc-hhvm.mustache b/wo/cli/templates/wpfc-hhvm.mustache index 424e95b..6326d5d 100644 --- a/wo/cli/templates/wpfc-hhvm.mustache +++ b/wo/cli/templates/wpfc-hhvm.mustache @@ -18,7 +18,7 @@ if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no } # Use cached or actual file if they exists, Otherwise pass request to WordPress location / { - try_files $uri $uri/ /index.php?$args; + try_files $uri $uri/ /index.php$is_args$args; } location ~ ^/wp-content/cache/minify/(.+\.(css|js))$ { try_files $uri /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1; diff --git a/wo/cli/templates/wpfc-php7.mustache b/wo/cli/templates/wpfc-php7.mustache index 108a3e8..b62d088 100644 --- a/wo/cli/templates/wpfc-php7.mustache +++ b/wo/cli/templates/wpfc-php7.mustache @@ -18,7 +18,7 @@ if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no } # Use cached or actual file if they exists, Otherwise pass request to WordPress location / { - try_files $uri $uri/ /index.php?$args; + try_files $uri $uri/ /index.php$is_args$args; } location ~ ^/wp-content/cache/minify/(.+\.(css|js))$ { try_files $uri /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1; diff --git a/wo/cli/templates/wpfc.mustache b/wo/cli/templates/wpfc.mustache index 6406b71..ec03b0c 100644 --- a/wo/cli/templates/wpfc.mustache +++ b/wo/cli/templates/wpfc.mustache @@ -18,7 +18,7 @@ if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no } # Use cached or actual file if they exists, Otherwise pass request to WordPress location / { - try_files $uri $uri/ /index.php?$args; + try_files $uri $uri/ /index.php$is_args$args; } location ~ ^/wp-content/cache/minify/(.+\.(css|js))$ { try_files $uri /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1; From e526f88c75fa8a8b9fcdcc91790c353301fb17e9 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Mon, 25 Feb 2019 12:27:23 +0100 Subject: [PATCH 02/56] Improve install * Add script description with release and last update * improve code quality by using shellscript standards --- install | 84 +++++++++++++++++++++++++++++++-------------------------- 1 file changed, 46 insertions(+), 38 deletions(-) diff --git a/install b/install index c44bb2c..4027d1d 100644 --- a/install +++ b/install @@ -1,13 +1,20 @@ #!/bin/bash -######################################### -### WordOps install and update script ### -######################################### -### CONTENTS -### --- -### 1. VARIABLES AND DECLARATIONS -### 2. PREPARE FOR INSTALLATION -### 3. INSTALLATION -### 4. +# ------------------------------------------------------------------------- +# WordOps install and update script +# ------------------------------------------------------------------------- +# Website: https://wordops.org +# GitHub: https://github.com/WordOps/WordOps +# Copyright (c) 2019 - WordOps +# This script is licensed under M.I.T +# ------------------------------------------------------------------------- +# Version 3.9.1 - 2019-02-25 +# ------------------------------------------------------------------------- +# CONTENTS +# --- +# 1. VARIABLES AND DECLARATIONS +# 2. PREPARE FOR INSTALLATION +# 3. INSTALLATION +# 4. ### # 1 - Set the CLI output colors @@ -42,7 +49,7 @@ fi ### function wo_lib_error() { - echo "[ `date` ] $(tput setaf 1)$@$(tput sgr0)" + echo "[ $(date) ] $(tput setaf 1)$@$(tput sgr0)" exit $2 } @@ -153,7 +160,7 @@ function wo_install_dep() apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php7.2-imap php-sodium 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_lib_error "Not all PHP packages could be installed." 1 systemctl php7.2-fpm restart &>> /dev/null fi - + ### # Webp mapping ### @@ -211,7 +218,7 @@ function wo_sync_db() php_version VARCHAR );" | sqlite3 /var/lib/wo/dbase.db - if [ -f /var/lib/wo/dbase-ee.db]; then + if [ -f /var/lib/wo/dbase-ee.db ]; then # Copy the main EasyEngine database over since we are migrating cp /var/lib/wo/dbase-ee.db /var/lib/wo/dbase.db fi @@ -297,12 +304,14 @@ function wo_sync_db() wo_lib_echo "Replace the PHP ports for PHP 7.2" # Copy the previous upstream.conf cp /etc/nginx/conf.d/upstream.conf /etc/nginx/conf.d/upstream.bak + { # Replace the ports for PHP 7.2 - sed -i 's/9000/9072/g' /etc/nginx/conf.d/upstream.conf &>> /dev/null - sed -i 's/9070/9072/g' /etc/nginx/conf.d/upstream.conf &>> /dev/null + sed -i 's/9000/9072/g' /etc/nginx/conf.d/upstream.conf + sed -i 's/9070/9072/g' /etc/nginx/conf.d/upstream.conf # Replace the ports for debug PHP 7.2 - sed -i 's/9001/9172/g' /etc/nginx/conf.d/upstream.conf &>> /dev/null - sed -i 's/9170/9172/g' /etc/nginx/conf.d/upstream.conf &>> /dev/null + sed -i 's/9001/9172/g' /etc/nginx/conf.d/upstream.conf + sed -i 's/9170/9172/g' /etc/nginx/conf.d/upstream.conf + } > /dev/null 2>&1 fi echo "UPDATE sites SET php_version = REPLACE(php_version, '5.6', '7.2');" | sqlite3 /var/lib/wo/dbase.db @@ -346,16 +355,16 @@ function secure_wo_db() function wo_update_wp_cli() { wo_lib_echo "Updating WP-CLI version to resolve compatibility issue." - PHP_PATH=$(which php) - WP_CLI_PATH=$(which wp) - if [ "${WP_CLI_PATH}" != "" ]; then + PHP_PATH=$(command -v php) + WP_CLI_PATH=$(command -v wp) + if [ -z "$WP_CLI_PATH" ]; then # Obtain the current WP-CLI version - WP_CLI_VERSION=$(${PHP_PATH} ${WP_CLI_PATH} --allow-root cli version | awk '{ print $2 }') - dpkg --compare-versions ${WP_CLI_VERSION} lt 1.4.1 + WP_CLI_VERSION=$($PHP_PATH $WP_CLI_PATH --allow-root cli version | awk '{ print $2 }') + 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/WordOps/wpcli-builds/gh-pages/phar/wp-cli.phar - chmod +x ${WP_CLI_PATH} + 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 } @@ -371,10 +380,10 @@ function wo_install() wo_branch=master fi - git clone -b $wo_branch https://github.com/WordOps/WordOps.git /tmp/wordops --quiet > /dev/null \ + git clone -b "$wo_branch" https://github.com/WordOps/WordOps.git /tmp/wordops --quiet > /dev/null \ || wo_lib_error "An error was encountered during the download, exit status" $? - cd /tmp/wordops + cd /tmp/wordops || exit 1 wo_lib_echo "The moment you've all been waiting for, time to install WordOps!" python3 setup.py install || wo_lib_error "An error was encountered during the installation, exit status " $? } @@ -384,7 +393,7 @@ function wo_update_latest() if [ -f /etc/nginx/fastcgi_params ] then - cat /etc/nginx/fastcgi_params| grep -q 'HTTP_PROXY' + grep -q 'HTTP_PROXY' /etc/nginx/fastcgi_params if [[ $? -ne 0 ]]; then echo "fastcgi_param HTTP_PROXY \"\";" >> /etc/nginx/fastcgi_params echo "fastcgi_param HTTP_PROXY \"\";" >> /etc/nginx/fastcgi.conf @@ -641,32 +650,31 @@ function wo_update_latest() function wo_git_init() { # Nginx under git version control - if [ -d /etc/nginx ];then - cd /etc/nginx + [ -d /etc/nginx ] && { + cd /etc/nginx || exit 1 if [ ! -d /etc/nginx/.git ]; then git init &>> /dev/null fi git add -A . git commit -am "Updated Nginx" > /dev/null - fi + } # WordOps under git version control - cd /etc/wo - if [ ! -d /etc/wo/.git ]; then + cd /etc/wo || exit 1 + [ ! -d /etc/wo/.git ] && { git init > /dev/null - fi + } git add -A . git commit -am "Installed/Updated to WordOps" &>> /dev/null #PHP under git version control - if [ -d /etc/php ];then - cd /etc/php + [ -d /etc/php ] && { + cd /etc/php || exit 1 if [ ! -d /etc/php/.git ]; then - git init &>> /dev/null + git init fi git add -A . - git commit -am "Updated PHP" > /dev/null - fi - + git commit -am "Updated PHP" + }> /dev/null } if [ ! -f /usr/local/bin/wo ]; then From 9d6f6c2bb47f01fdb716be92eef89d33812acd9d Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Sat, 2 Mar 2019 20:12:06 +0100 Subject: [PATCH 03/56] Fix wo update & cleanup info * update README.md * cleanup changelog.md * fix wo update command url * remove php-sodium (php7.0 & php7.1 only) * remove php-memcache --- CHANGELOG.md | 45 ++++++++++++++----- README.md | 96 +++++++++++++++++++++++++++------------- install | 57 +++++++++++++----------- wo/cli/plugins/update.py | 2 +- 4 files changed, 133 insertions(+), 67 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3653b8..152af56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,36 @@ -### v3.9.0 - November 30, 2018 +# Changelog -**Initial release** +All notable changes to this project will be documented in this file. -[+] Rebranded the fork to WordOps -[+] Codebase cleanup -[+] Set PHP 7.2 as the default -[+] Included support for newer OS releases -[+] Reworked the HTTPS configuration -[+] Added more automated testing with Redis -[=] Replaced Postfix with smtp-cli -[-] Dropped mail services -[-] Dropped w3tc support \ No newline at end of file +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), + +### v3.X.X - [Unreleased] + +#### Changed + +- Updating nginx fastcgi_cache template +- Updating Nginx configuration for WordPress 5.0 +- remove --experimental args + +#### Added + +- Add webp image support with nginx mapping +- Add PHP 7.3 support + +#### Fixed + +- Nginx variable $webp_suffix on fresh install + +### v3.9.2 - November 30, 2018 + +#### Changed + +- Rebranded the fork to WordOps +- Codebase cleanup +- Set PHP 7.2 as the default +- Included support for newer OS releases +- Reworked the HTTPS configuration +- Added more automated testing with Redis +- Replaced Postfix with smtp-cli +- Dropped mail services +- Dropped w3tc support \ No newline at end of file diff --git a/README.md b/README.md index 5f72825..8e916b0 100644 --- a/README.md +++ b/README.md @@ -1,46 +1,68 @@ -# [WordOps](https://wordops.org/) +

+ WordOps +
+

-[![Travis Build Status](https://travis-ci.org/WordOps/WordOps.svg?branch=master)](https://travis-ci.org/WordOps/WordOps) +

An essential toolset that eases WordPress site and server administration

-WordOps (wo) is the essential toolset that eases WordPress site and server administration. +

+build +MIT +Commits -**WordOps currently supports:** +

-- Ubuntu 14.04, 16.04 & 18.04 -- Debian 7, 8 & 9 -**Port requirements:** -| Name | Port Number | Inbound | Outbound | -|:-----:|:-----------:|:-------:|:---------:| -|SSH |22 | ✓ |✓ | -|HTTP |80 | ✓ |✓ | -|HTTPS/SSL |443 | ✓ |✓ | -|WO Admin |22222 | ✓ | | -|GPG Key Server |11371 | |✓ | +

+ Key Features • + Requirements • + Getting Started • + Usage • + Cheatsheet • + Credits • + License +

-## Quick start +--- + +## Key Features + +- Easy Migration from EasyEngine v3 +- Automated WordPress, Nginx, PHP, MySQL & Redis installation +- Optimized Nginx configuration with multiple cache backends support +- Let's Encrypt SSL certificates + +## Requirements + +### Operating System + +- Ubuntu : 16.04 LTS (Xenial) - 18.04 LTS (Bionic) +- Debian : 8 (Jessie) - 9 (Stretch) + +### Ports requirements + +- SSH (22 or custom) +- HTTP & HTTPS (80 & 443) +- WO Admin (22222) +- GPG key Server (11371 outbound) + +## Getting Started ```bash wget -qO wo wordops.se/tup && sudo bash wo # Install WordOps sudo wo site create example.com --wp # Install required packages & setup WordPress on example.com ``` -## Must read! + +## Must read WordOps made some fundamental changes: -* We've deprecated the mail stack. Less is more. As an alternative, take a look at [iRedMail](https://www.iredmail.org/) or [Caesonia](https://github.com/vedetta-com/caesonia). And an alternative for Roundcube is [Rainloop](https://www.rainloop.net/). -* Support for w3tc is dropped as a security precaution. -* We are currently migrating the PHP 5.x series to PHP 7.1 and PHP 7.2. We'll offer an easy to use migration script once we are confident enough to unleash this daemon. For now, new sites get installed with PHP 7.2 as the default. +- We've deprecated the mail stack. Less is more. As an alternative, take a look at [iRedMail](https://www.iredmail.org/) or [Caesonia](https://github.com/vedetta-com/caesonia). And an alternative for Roundcube is [Rainloop](https://www.rainloop.net/). +- Support for w3tc is dropped as a security precaution. +- We are currently migrating the PHP 5.x series to PHP 7.2 and PHP 7.3. We'll offer an easy to use migration script once we are confident enough to unleash this daemon. For now, new sites get installed with PHP 7.2 as the default. -## Update WordOps - -#### With one simple command -``` -wo update -``` - -## More site creation commands +## Usage ### Standard WordPress sites @@ -70,6 +92,7 @@ wo site create example.com --wpsubdomain --wpredis # install wpmu-subdomain + n ``` ### Non-WordPress sites + ```bash wo site create example.com --html # create example.com for static/html sites wo site create example.com --php # create example.com with php support @@ -77,19 +100,32 @@ wo site create example.com --mysql # create example.com with php & mysql supp ``` ### HHVM enabled sites + ```bash wo site create example.com --wp --hhvm # create example.com WordPress site with HHVM support wo site create example.com --php --hhvm # create example.com php site with HHVM support ``` -## Cheatsheet - site creation +## Cheatsheet | | single site | multisite w/ subdir | multisite w/ subdom | |--------------------|---------------|-----------------------|--------------------------| | **NO Cache** | --wp | --wpsubdir | --wpsubdomain | | **WP Super Cache** | --wpsc | --wpsubdir --wpsc | --wpsubdomain --wpsc | -| **Nginx cache** | --wpfc | --wpsubdir --wpfc | --wpsubdomain --wpfc | +| **Nginx fastcgi_cache** | --wpfc | --wpsubdir --wpfc | --wpsubdomain --wpfc | | **Redis cache** | --wpredis | --wpsubdir --wpredis | --wpsubdomain --wpredis | + +## Update WordOps + +```bash +wo update +``` + +## Credits + +- [EasyEngine](https://github.com/easyengine/easyengine) + ## License -[MIT](http://opensource.org/licenses/MIT) \ No newline at end of file + +- [MIT](http://opensource.org/licenses/MIT) © [WordOps](https://wordops.org) \ No newline at end of file diff --git a/install b/install index 4027d1d..710fb7a 100644 --- a/install +++ b/install @@ -62,7 +62,7 @@ apt-get update &>> /dev/null ### # 1- Check whether lsb_release is installed, and if not, install it ### -if [ ! -x /usr/bin/lsb_release ]; then +if [ -z "$(command -v lsb_release)" ]; then wo_lib_echo "Installing lsb-release, please wait..." apt-get -y install lsb-release &>> /dev/null fi @@ -118,9 +118,9 @@ fi 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 pigz || 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 pigz gnupg2 || 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 software-properties-common pigz || 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 python3-setuptools python3-dev sqlite3 git tar software-properties-common pigz gnupg2 || wo_lib_error "There was an error during dependency installation, exit status " 1 fi locale-gen en &>> /dev/null @@ -145,7 +145,7 @@ function wo_install_dep() add-apt-repository -y 'ppa:ondrej/php' wo_lib_echo "Updating the PHP repository for some neat PHP 7.2 support" apt-get update &>> /dev/null - apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php7.2-imap php-sodium 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_lib_error "Not all PHP packages could be installed. " 1 + apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php-memcached php7.2-imap php7.2-common php7.2-readline php-redis php7.2-mysql php7.2-cli php-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 graphviz php-pear php7.2-xdebug || wo_lib_error "Not all PHP packages could be installed. " 1 mkdir -p /var/log/php/7.2/ touch /var/log/php/7.2/slow.log /var/log/php/7.2/fpm.log systemctl php7.2-fpm restart &>> /dev/null @@ -157,7 +157,7 @@ function wo_install_dep() 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 php-sodium 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_lib_error "Not all PHP packages could be installed." 1 + apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php-memcached php7.2-imap php7.2-common php7.2-readlne php-redis php7.2-mysql php7.2-cli php-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 graphviz php-pear php7.2-xdebug || wo_lib_error "Not all PHP packages could be installed." 1 systemctl php7.2-fpm restart &>> /dev/null fi @@ -168,6 +168,12 @@ function wo_install_dep() mkdir -p /etc/nginx/conf.d echo -e 'map $http_accept $webp_suffix {\n default "";\n "~*webp" ".webp";\n}\n' > /etc/nginx/conf.d/webp.conf } + + # Let's Encrypt .well-known folder setup + if [ ! -d /var/www/html/.well-known/acme-challenge ]; then + mkdir -p /var/www/html/.well-known/acme-challenge + chown -R www-data:www-data /var/www/html/.well-known + fi } ### @@ -305,17 +311,17 @@ function wo_sync_db() # Copy the previous upstream.conf cp /etc/nginx/conf.d/upstream.conf /etc/nginx/conf.d/upstream.bak { - # Replace the ports for PHP 7.2 - sed -i 's/9000/9072/g' /etc/nginx/conf.d/upstream.conf - sed -i 's/9070/9072/g' /etc/nginx/conf.d/upstream.conf - # Replace the ports for debug PHP 7.2 - sed -i 's/9001/9172/g' /etc/nginx/conf.d/upstream.conf - sed -i 's/9170/9172/g' /etc/nginx/conf.d/upstream.conf + # Replace the ports for PHP 7.2 + sed -i 's/9000/9072/g' /etc/nginx/conf.d/upstream.conf + sed -i 's/9070/9072/g' /etc/nginx/conf.d/upstream.conf + # Replace the ports for debug PHP 7.2 + sed -i 's/9001/9172/g' /etc/nginx/conf.d/upstream.conf + sed -i 's/9170/9172/g' /etc/nginx/conf.d/upstream.conf } > /dev/null 2>&1 fi echo "UPDATE sites SET php_version = REPLACE(php_version, '5.6', '7.2');" | sqlite3 /var/lib/wo/dbase.db - echo "UPDATE sites SET php_version = REPLACE(php_version, '7.0', '7.2');" | sqlite3 /var/lib/wo/dbase.db + echo "UPDATE sites SET php_version = REPLACE(php_version, '7.0', '7.3');" | sqlite3 /var/lib/wo/dbase.db ### # ee-acme-sh by VirtuBox, https://virtubox.net/ @@ -355,18 +361,19 @@ function secure_wo_db() function wo_update_wp_cli() { wo_lib_echo "Updating WP-CLI version to resolve compatibility issue." - PHP_PATH=$(command -v php) WP_CLI_PATH=$(command -v wp) - if [ -z "$WP_CLI_PATH" ]; then - # Obtain the current WP-CLI version - WP_CLI_VERSION=$($PHP_PATH $WP_CLI_PATH --allow-root cli version | awk '{ print $2 }') - dpkg --compare-versions "$WP_CLI_VERSION" lt 1.4.1 + if [ -n "$WP_CLI_PATH" ]; then # Update WP-CLI to the most recent version - if [ "$?" == "0" ]; then - wget -qO "$WP_CLI_PATH" https://raw.githubusercontent.com/WordOps/wpcli-builds/gh-pages/phar/wp-cli.phar - chmod +x "$WP_CLI_PATH" - fi + wget -qO "$WP_CLI_PATH" https://raw.githubusercontent.com/WordOps/wpcli-builds/gh-pages/phar/wp-cli.phar + chmod +x "$WP_CLI_PATH" + else + wget -qO /usr/local/bin/wp https://raw.githubusercontent.com/WordOps/wpcli-builds/gh-pages/phar/wp-cli.phar + chmod +x /usr/local/bin/wp fi + + [ -d /etc/bash_completion ] && { + wget -qO /etc/bash_completion.d/wp-completion.bash https://raw.githubusercontent.com/wp-cli/wp-cli/master/utils/wp-completion.bash + } } # Now, finally, let's install WordOps @@ -376,9 +383,9 @@ function wo_install() rm -rf /tmp/wordops &>> /dev/null wo_lib_echo "Downloading WordOps straight from GitHub - fresh and brewed with love. Hold your horses..." - if [ "$wo_branch" = "" ]; then + [ -z "$wo_branch" ] && { wo_branch=master - fi + } git clone -b "$wo_branch" https://github.com/WordOps/WordOps.git /tmp/wordops --quiet > /dev/null \ || wo_lib_error "An error was encountered during the download, exit status" $? @@ -621,7 +628,7 @@ function wo_update_latest() add-apt-repository -y 'ppa:ondrej/php' wo_lib_echo "Updating the PHP repository for some neat PHP 7.2 support" apt-get update &>> /dev/null - apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php7.2-imap php-sodium 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_lib_error "Not all PHP packages could be installed. " 1 + apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php7.2-imap php-memcached php7.2-common php7.2-readline php-redis php7.2-mysql php7.2-cli php-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 graphviz php-pear php7.2-xdebug || wo_lib_error "Not all PHP packages could be installed. " 1 mkdir -p /var/log/php/7.2/ touch /var/log/php/7.2/slow.log /var/log/php/7.2/fpm.log systemctl php7.2-fpm restart &>> /dev/null @@ -633,7 +640,7 @@ function wo_update_latest() 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 php-sodium 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_lib_error "Not all PHP packages could be installed." 1 + apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php7.2-imap php-memcached php7.2-common php7.2-readline php-redis php7.2-mysql php7.2-cli php-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 graphviz php-pear php7.2-xdebug || wo_lib_error "Not all PHP packages could be installed." 1 systemctl php7.2-fpm restart &>> /dev/null fi diff --git a/wo/cli/plugins/update.py b/wo/cli/plugins/update.py index 171e748..80d42e3 100644 --- a/wo/cli/plugins/update.py +++ b/wo/cli/plugins/update.py @@ -23,7 +23,7 @@ class WOUpdateController(CementBaseController): @expose(hide=True) def default(self): filename = "woupdate" + time.strftime("%Y%m%d-%H%M%S") - WODownload.download(self, [["https://wrdps.nl/woup", + WODownload.download(self, [["https://raw.githubusercontent.com/WordOps/WordOps/master/install", "/tmp/{0}".format(filename), "update script"]]) try: From d11b7e27efbb3054ebcd113409f61a5bfdeb8a25 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Sat, 2 Mar 2019 20:38:31 +0100 Subject: [PATCH 04/56] fix stack issues * fix php7.2 stack detection * add php7.3 as php7.0 replacement --- wo/cli/controllers/base.py | 2 +- wo/cli/plugins/debug.py | 140 +++---- wo/cli/plugins/info.py | 49 +-- wo/cli/plugins/site.py | 242 +++--------- wo/cli/plugins/site_functions.py | 60 +-- wo/cli/plugins/stack.py | 465 ++++++++++++------------ wo/cli/plugins/stack_services.py | 163 +++++---- wo/cli/templates/php.mustache | 2 +- wo/cli/templates/php7.mustache | 2 +- wo/cli/templates/redis-php7.mustache | 2 +- wo/cli/templates/redis.mustache | 2 +- wo/cli/templates/upstream.mustache | 14 +- wo/cli/templates/wpcommon-php7.mustache | 2 +- wo/cli/templates/wpfc-php7.mustache | 2 +- wo/cli/templates/wpfc.mustache | 2 +- wo/cli/templates/wpsc-php7.mustache | 2 +- wo/cli/templates/wpsc.mustache | 2 +- wo/core/services.py | 7 +- wo/core/variables.py | 61 ++-- 19 files changed, 557 insertions(+), 664 deletions(-) diff --git a/wo/cli/controllers/base.py b/wo/cli/controllers/base.py index ad49a25..9a2dbc0 100644 --- a/wo/cli/controllers/base.py +++ b/wo/cli/controllers/base.py @@ -6,7 +6,7 @@ VERSION = WOVariables.wo_version BANNER = """ WordOps v%s -Copyright (c) 2018 WordOps. +Copyright (c) 2019 WordOps. """ % VERSION diff --git a/wo/cli/plugins/debug.py b/wo/cli/plugins/debug.py index 218bb08..6cfe596 100644 --- a/wo/cli/plugins/debug.py +++ b/wo/cli/plugins/debug.py @@ -49,7 +49,7 @@ class WODebugController(CementBaseController): dict(help='start/stop debugging fastcgi configuration', action='store' or 'store_const', choices=('on', 'off'), const='on', nargs='?')), - (['--php72'], + (['--php73'], dict(help='start/stop debugging server PHP 7.2 configuration', action='store' or 'store_const', choices=('on', 'off'), const='on', nargs='?')), @@ -80,7 +80,7 @@ class WODebugController(CementBaseController): action='store', dest='interval')), (['site_name'], dict(help='Website Name', nargs='?', default=None)) - ] + ] usage = "wo debug [] [options] " @expose(hide=True) @@ -100,7 +100,7 @@ class WODebugController(CementBaseController): for ip_addr in debug_address: if not ("debug_connection "+ip_addr in open('/etc/nginx/' - 'nginx.conf', encoding='utf-8').read()): + 'nginx.conf', encoding='utf-8').read()): Log.info(self, "Setting up Nginx debug connection" " for "+ip_addr) WOShellExec.cmd_exec(self, "sed -i \"/events {{/a\\ \\ \\ " @@ -187,26 +187,28 @@ class WODebugController(CementBaseController): # Change upstream.conf nc = NginxConfig() nc.loadf('/etc/nginx/conf.d/upstream.conf') - nc.set([('upstream','php',), 'server'], '127.0.0.1:9001') + nc.set([('upstream', 'php',), 'server'], '127.0.0.1:9001') if os.path.isfile("/etc/nginx/common/wpfc-hhvm.conf"): - nc.set([('upstream','hhvm',), 'server'], '127.0.0.1:9001') + nc.set([('upstream', 'hhvm',), 'server'], '127.0.0.1:9001') nc.savef('/etc/nginx/conf.d/upstream.conf') # Enable xdebug - WOFileUtils.searchreplace(self, "/etc/{0}/mods-available/".format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5") + - "xdebug.ini", - ";zend_extension", - "zend_extension") + WOFileUtils.searchreplace(self, "/etc/{0}/mods-available/".format("php/7.2" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5") + + "xdebug.ini", + ";zend_extension", + "zend_extension") # Fix slow log is not enabled default in PHP5.6 config = configparser.ConfigParser() - config.read('/etc/{0}/fpm/pool.d/debug.conf'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) - config['debug']['slowlog'] = '/var/log/{0}/slow.log'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5") + config.read('/etc/{0}/fpm/pool.d/debug.conf'.format("php/7.2" if (WOVariables.wo_platform_codename == + 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) + config['debug']['slowlog'] = '/var/log/{0}/slow.log'.format("php/7.2" if ( + WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5") config['debug']['request_slowlog_timeout'] = '10s' - with open('/etc/{0}/fpm/pool.d/debug.conf'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5"), + with open('/etc/{0}/fpm/pool.d/debug.conf'.format("php/7.2" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5"), encoding='utf-8', mode='w') as confifile: Log.debug(self, "Writting debug.conf configuration into " - "/etc/{0}/fpm/pool.d/debug.conf".format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) + "/etc/{0}/fpm/pool.d/debug.conf".format("php/7.2" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) config.write(confifile) self.trigger_php = True @@ -214,7 +216,8 @@ class WODebugController(CementBaseController): else: Log.info(self, "PHP debug is already enabled") - self.msg = self.msg + ['/var/log/{0}/slow.log'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")] + self.msg = self.msg + ['/var/log/{0}/slow.log'.format("php/7.2" if ( + WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")] # PHP global debug stop elif (self.app.pargs.php == 'off' and not self.app.pargs.site_name): @@ -226,13 +229,13 @@ class WODebugController(CementBaseController): # Change upstream.conf nc = NginxConfig() nc.loadf('/etc/nginx/conf.d/upstream.conf') - nc.set([('upstream','php',), 'server'], '127.0.0.1:9000') + nc.set([('upstream', 'php',), 'server'], '127.0.0.1:9000') if os.path.isfile("/etc/nginx/common/wpfc-hhvm.conf"): - nc.set([('upstream','hhvm',), 'server'], '127.0.0.1:8000') + nc.set([('upstream', 'hhvm',), 'server'], '127.0.0.1:8000') nc.savef('/etc/nginx/conf.d/upstream.conf') # Disable xdebug - WOFileUtils.searchreplace(self, "/etc/{0}/mods-available/".format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5") + + WOFileUtils.searchreplace(self, "/etc/{0}/mods-available/".format("php/7.2" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5") + "xdebug.ini", "zend_extension", ";zend_extension") @@ -248,38 +251,43 @@ class WODebugController(CementBaseController): # PHP5-FPM start global debug if (self.app.pargs.fpm == 'on' and not self.app.pargs.site_name): if not WOShellExec.cmd_exec(self, "grep \"log_level = debug\" " - "/etc/{0}/fpm/php-fpm.conf".format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")): + "/etc/{0}/fpm/php-fpm.conf".format("php/7.2" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")): Log.info(self, "Setting up PHP5-FPM log_level = debug") config = configparser.ConfigParser() - config.read('/etc/{0}/fpm/php-fpm.conf'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) + config.read('/etc/{0}/fpm/php-fpm.conf'.format("php/7.2" if (WOVariables.wo_platform_codename == + 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) config.remove_option('global', 'include') config['global']['log_level'] = 'debug' - config['global']['include'] = '/etc/{0}/fpm/pool.d/*.conf'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5") - with open('/etc/{0}/fpm/php-fpm.conf'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5"), + config['global']['include'] = '/etc/{0}/fpm/pool.d/*.conf'.format("php/7.2" if ( + WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5") + with open('/etc/{0}/fpm/php-fpm.conf'.format("php/7.2" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5"), encoding='utf-8', mode='w') as configfile: Log.debug(self, "Writting php5-FPM configuration into " - "/etc/{0}/fpm/php-fpm.conf".format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) + "/etc/{0}/fpm/php-fpm.conf".format("php/7.2" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) config.write(configfile) self.trigger_php = True else: Log.info(self, "PHP5-FPM log_level = debug already setup") - self.msg = self.msg + ['/var/log/{0}/fpm.log'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")] + self.msg = self.msg + ['/var/log/{0}/fpm.log'.format("php/7.2" if ( + WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")] # PHP5-FPM stop global debug elif (self.app.pargs.fpm == 'off' and not self.app.pargs.site_name): if WOShellExec.cmd_exec(self, "grep \"log_level = debug\" " - "/etc/{0}/fpm/php-fpm.conf".format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")): + "/etc/{0}/fpm/php-fpm.conf".format("php/7.2" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")): Log.info(self, "Disabling PHP5-FPM log_level = debug") config = configparser.ConfigParser() - config.read('/etc/{0}/fpm/php-fpm.conf'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) + config.read('/etc/{0}/fpm/php-fpm.conf'.format("php/7.2" if (WOVariables.wo_platform_codename == + 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) config.remove_option('global', 'include') config['global']['log_level'] = 'notice' - config['global']['include'] = '/etc/{0}/fpm/pool.d/*.conf'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5") - with open('/etc/{0}/fpm/php-fpm.conf'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5"), + config['global']['include'] = '/etc/{0}/fpm/pool.d/*.conf'.format("php/7.2" if ( + WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5") + with open('/etc/{0}/fpm/php-fpm.conf'.format("php/7.2" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5"), encoding='utf-8', mode='w') as configfile: Log.debug(self, "writting php5 configuration into " - "/etc/{0}/fpm/php-fpm.conf".format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) + "/etc/{0}/fpm/php-fpm.conf".format("php/7.2" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) config.write(configfile) self.trigger_php = True @@ -287,13 +295,13 @@ class WODebugController(CementBaseController): Log.info(self, "PHP5-FPM log_level = debug already disabled") @expose(hide=True) - def debug_php72(self): + def debug_php73(self): """Start/Stop PHP debug""" # PHP global debug start - if (self.app.pargs.php72 == 'on' and not self.app.pargs.site_name): + if (self.app.pargs.php73 == 'on' and not self.app.pargs.site_name): if (WOVariables.wo_platform_codename == 'wheezy' or WOVariables.wo_platform_codename == 'precise'): - Log.error(self,"PHP 7.2 not supported.") + Log.error(self, "PHP 7.2 not supported.") if not (WOShellExec.cmd_exec(self, "sed -n \"/upstream php7" "{/,/}/p \" /etc/nginx/" "conf.d/upstream.conf " @@ -304,16 +312,16 @@ class WODebugController(CementBaseController): # Change upstream.conf nc = NginxConfig() nc.loadf('/etc/nginx/conf.d/upstream.conf') - nc.set([('upstream','php72',), 'server'], '127.0.0.1:9172') + nc.set([('upstream', 'php73',), 'server'], '127.0.0.1:9172') if os.path.isfile("/etc/nginx/common/wpfc-hhvm.conf"): - nc.set([('upstream','hhvm',), 'server'], '127.0.0.1:9172') + nc.set([('upstream', 'hhvm',), 'server'], '127.0.0.1:9172') nc.savef('/etc/nginx/conf.d/upstream.conf') # Enable xdebug WOFileUtils.searchreplace(self, "/etc/php/7.2/mods-available/" - "xdebug.ini", - ";zend_extension", - "zend_extension") + "xdebug.ini", + ";zend_extension", + "zend_extension") # Fix slow log is not enabled default in PHP5.6 config = configparser.ConfigParser() @@ -334,8 +342,8 @@ class WODebugController(CementBaseController): 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): - if WOShellExec.cmd_exec(self, " sed -n \"/upstream php72 {/,/}/p\" " + elif (self.app.pargs.php73 == 'off' and not self.app.pargs.site_name): + if WOShellExec.cmd_exec(self, " sed -n \"/upstream php73 {/,/}/p\" " "/etc/nginx/conf.d/upstream.conf " "| grep 9172"): Log.info(self, "Disabling PHP 7.2 debug") @@ -343,9 +351,9 @@ class WODebugController(CementBaseController): # Change upstream.conf nc = NginxConfig() nc.loadf('/etc/nginx/conf.d/upstream.conf') - nc.set([('upstream','php72',), 'server'], '127.0.0.1:9072') + nc.set([('upstream', 'php73',), 'server'], '127.0.0.1:9072') if os.path.isfile("/etc/nginx/common/wpfc-hhvm.conf"): - nc.set([('upstream','hhvm',), 'server'], '127.0.0.1:8000') + nc.set([('upstream', 'hhvm',), 'server'], '127.0.0.1:8000') nc.savef('/etc/nginx/conf.d/upstream.conf') # Disable xdebug @@ -565,7 +573,7 @@ class WODebugController(CementBaseController): if ('{0}{1}/logs/error.log'.format(WOVariables.wo_webroot, self.app.pargs.site_name) - not in self.msg): + not in self.msg): self.msg = self.msg + ['{0}{1}/logs/error.log' .format(WOVariables.wo_webroot, self.app.pargs.site_name)] @@ -595,9 +603,9 @@ class WODebugController(CementBaseController): if self.app.pargs.php: self.app.pargs.php = 'off' self.debug_php() - if self.app.pargs.php7: - self.app.pargs.php7 = 'off' - self.debug_php7() + if self.app.pargs.php73: + self.app.pargs.php73 = 'off' + self.debug_php73() if self.app.pargs.fpm: self.app.pargs.fpm = 'off' self.debug_fpm() @@ -626,12 +634,12 @@ class WODebugController(CementBaseController): # Reload PHP if self.trigger_php: if WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic': - if WOAptGet.is_installed(self,'php5.6-fpm'): - WOService.reload_service(self, 'php5.6-fpm') - if WOAptGet.is_installed(self,'php7.2-fpm'): + if WOAptGet.is_installed(self, 'php7.2-fpm'): + WOService.reload_service(self, 'php7.2-fpm') + if WOAptGet.is_installed(self, 'php7.2-fpm'): WOService.reload_service(self, 'php7.2-fpm') else: - WOService.reload_service(self, 'php5-fpm') + WOService.reload_service(self, 'php7.2-fpm') self.app.close(0) @expose(hide=True) @@ -644,12 +652,12 @@ class WODebugController(CementBaseController): self.trigger_php = False if ((not self.app.pargs.nginx) and (not self.app.pargs.php) and (not self.app.pargs.php7) - and (not self.app.pargs.fpm) and (not self.app.pargs.fpm7) and (not self.app.pargs.mysql) - and (not self.app.pargs.wp) and (not self.app.pargs.rewrite) - and (not self.app.pargs.all) - and (not self.app.pargs.site_name) - and (not self.app.pargs.import_slow_log) - and (not self.app.pargs.interval)): + and (not self.app.pargs.fpm) and (not self.app.pargs.fpm7) and (not self.app.pargs.mysql) + and (not self.app.pargs.wp) and (not self.app.pargs.rewrite) + and (not self.app.pargs.all) + and (not self.app.pargs.site_name) + and (not self.app.pargs.import_slow_log) + and (not self.app.pargs.interval)): if self.app.pargs.stop or self.app.pargs.start: print("--start/stop option is deprecated since ee v3.0.5") self.app.args.print_help() @@ -716,8 +724,8 @@ class WODebugController(CementBaseController): self.app.pargs.nginx = 'on' self.app.pargs.php = 'on' self.app.pargs.fpm = 'on' - if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and WOAptGet.is_installed(self,'php7.2-fpm'): - self.app.pargs.php7 = 'on' + if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and WOAptGet.is_installed(self, 'php7.2-fpm'): + self.app.pargs.php73 = 'on' self.app.pargs.fpm7 = 'on' self.app.pargs.mysql = 'on' self.app.pargs.rewrite = 'on' @@ -728,16 +736,16 @@ class WODebugController(CementBaseController): self.app.pargs.nginx = 'off' self.app.pargs.php = 'off' self.app.pargs.fpm = 'off' - if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and WOAptGet.is_installed(self,'php7.2-fpm'): - self.app.pargs.php7 = 'off' + if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and WOAptGet.is_installed(self, 'php7.2-fpm'): + self.app.pargs.php73 = 'off' self.app.pargs.fpm7 = 'off' self.app.pargs.mysql = 'off' self.app.pargs.rewrite = 'off' - if ((not self.app.pargs.nginx) and (not self.app.pargs.php) and (not self.app.pargs.php7) - and (not self.app.pargs.fpm) and (not self.app.pargs.fpm7) and (not self.app.pargs.mysql) - and (not self.app.pargs.wp) and (not self.app.pargs.rewrite) - and self.app.pargs.site_name): + if ((not self.app.pargs.nginx) and (not self.app.pargs.php) and (not self.app.pargs.php73) + and (not self.app.pargs.fpm) and (not self.app.pargs.fpm7) and (not self.app.pargs.mysql) + and (not self.app.pargs.wp) and (not self.app.pargs.rewrite) + and self.app.pargs.site_name): self.app.args.print_help() # self.app.pargs.nginx = 'on' # self.app.pargs.wp = 'on' @@ -749,8 +757,8 @@ class WODebugController(CementBaseController): self.debug_php() if self.app.pargs.fpm: self.debug_fpm() - if self.app.pargs.php7: - self.debug_php7() + if self.app.pargs.php73: + self.debug_php73() if self.app.pargs.fpm7: self.debug_fpm7() if self.app.pargs.mysql: @@ -774,9 +782,9 @@ class WODebugController(CementBaseController): # Reload PHP if self.trigger_php: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - if WOAptGet.is_installed(self,'php5.6-fpm'): + if WOAptGet.is_installed(self, 'php5.6-fpm'): WOService.restart_service(self, 'php5.6-fpm') - if WOAptGet.is_installed(self,'php7.2-fpm'): + if WOAptGet.is_installed(self, 'php7.2-fpm'): WOService.restart_service(self, 'php7.2-fpm') else: WOService.restart_service(self, 'php5-fpm') diff --git a/wo/cli/plugins/info.py b/wo/cli/plugins/info.py index f70f444..127f847 100644 --- a/wo/cli/plugins/info.py +++ b/wo/cli/plugins/info.py @@ -27,15 +27,15 @@ class WOInfoController(CementBaseController): dict(help='Get MySQL configuration information', action='store_true')), (['--php'], - dict(help='Get PHP configuration information', - action='store_true')), - (['--php72'], dict(help='Get PHP 7.2 configuration information', action='store_true')), + (['--php73'], + dict(help='Get PHP 7.3 configuration information', + action='store_true')), (['--nginx'], dict(help='Get Nginx configuration information', action='store_true')), - ] + ] usage = "wo info [options]" @expose(hide=True) @@ -66,17 +66,19 @@ class WOInfoController(CementBaseController): @expose(hide=True) def info_php(self): """Display PHP information""" - version = os.popen("{0} -v 2>/dev/null | head -n1 | cut -d' ' -f2 |".format("php5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php") + + version = os.popen("{0} -v 2>/dev/null | head -n1 | cut -d' ' -f2 |".format("php7.2" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php") + " cut -d'+' -f1 | tr -d '\n'").read config = configparser.ConfigParser() - config.read('/etc/{0}/fpm/php.ini'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) + config.read('/etc/{0}/fpm/php.ini'.format("php/7.2" if (WOVariables.wo_platform_codename == + 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) 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/{0}/fpm/pool.d/www.conf'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) + config.read('/etc/{0}/fpm/pool.d/www.conf'.format("php/7.2" if (WOVariables.wo_platform_codename == + 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) www_listen = config['www']['listen'] www_ping_path = config['www']['ping.path'] www_pm_status_path = config['www']['pm.status_path'] @@ -94,7 +96,8 @@ class WOInfoController(CementBaseController): except Exception as e: www_xdebug = 'off' - config.read('/etc/{0}/fpm/pool.d/debug.conf'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) + config.read('/etc/{0}/fpm/pool.d/debug.conf'.format("php/7.2" if (WOVariables.wo_platform_codename == + 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) debug_listen = config['debug']['listen'] debug_ping_path = config['debug']['ping.path'] debug_pm_status_path = config['debug']['pm.status_path'] @@ -138,19 +141,19 @@ class WOInfoController(CementBaseController): self.app.render((data), 'info_php.mustache') @expose(hide=True) - def info_php72(self): + def info_php73(self): """Display PHP information""" - version = os.popen("php7.2 -v 2>/dev/null | head -n1 | cut -d' ' -f2 |" + version = os.popen("php7.3 -v 2>/dev/null | head -n1 | cut -d' ' -f2 |" " cut -d'+' -f1 | tr -d '\n'").read config = configparser.ConfigParser() - config.read('/etc/php/7.2/fpm/php.ini') + config.read('/etc/php/7.3/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.2/fpm/pool.d/www.conf') + config.read('/etc/php/7.3/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 +171,7 @@ class WOInfoController(CementBaseController): except Exception as e: www_xdebug = 'off' - config.read('/etc/php/7.2/fpm/pool.d/debug.conf') + config.read('/etc/php/7.3/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'] @@ -243,12 +246,12 @@ class WOInfoController(CementBaseController): def default(self): """default function for info""" if (not self.app.pargs.nginx and not self.app.pargs.php - and not self.app.pargs.mysql and not self.app.pargs.php72): + and not self.app.pargs.mysql and not self.app.pargs.php73): self.app.pargs.nginx = True self.app.pargs.php = True self.app.pargs.mysql = True if WOAptGet.is_installed(self, 'php7.2-fpm'): - self.app.pargs.php = True + self.app.pargs.php = True if self.app.pargs.nginx: if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self, 'nginx-common'): @@ -258,21 +261,21 @@ class WOInfoController(CementBaseController): if self.app.pargs.php: if (WOVariables.wo_platform_distro == 'debian' or WOVariables.wo_platform_codename == 'precise'): - if WOAptGet.is_installed(self, 'php5-fpm'): + if WOAptGet.is_installed(self, 'php7.2-fpm'): self.info_php() else: - Log.error(self, "PHP5 is not installed") + Log.error(self, "PHP 7.2 is not installed") else: - if WOAptGet.is_installed(self, 'php5.6-fpm'): + if WOAptGet.is_installed(self, 'php7.2-fpm'): self.info_php() else: - Log.error(self, "PHP5.6 is not installed") + Log.error(self, "PHP 7.2 is not installed") - if self.app.pargs.php72: - if WOAptGet.is_installed(self, 'php7.2-fpm'): - self.info_php72() + if self.app.pargs.php73: + if WOAptGet.is_installed(self, 'php7.3-fpm'): + self.info_php73() else: - Log.error(self, "PHP 7.2 is not installed") + Log.error(self, "PHP 7.3 is not installed") if self.app.pargs.mysql: if WOShellExec.cmd_exec(self, "mysqladmin ping"): diff --git a/wo/cli/plugins/site.py b/wo/cli/plugins/site.py index 1a7752e..1a70bfc 100644 --- a/wo/cli/plugins/site.py +++ b/wo/cli/plugins/site.py @@ -309,8 +309,8 @@ class WOSiteCreateController(CementBaseController): dict(help="create html site", action='store_true')), (['--php'], dict(help="create php site", action='store_true')), - (['--php72'], - dict(help="create php 7.2 site", action='store_true')), + (['--php73'], + dict(help="create php 7.3 site", action='store_true')), (['--mysql'], dict(help="create mysql site", action='store_true')), (['--wp'], @@ -344,9 +344,6 @@ class WOSiteCreateController(CementBaseController): dest='wppass')), (['--proxy'], dict(help="create proxy for site", nargs='+')), - (['--experimental'], - dict(help="Enable Experimenal packages without prompt", - action='store_true')), ] @expose(hide=True) @@ -410,16 +407,16 @@ class WOSiteCreateController(CementBaseController): data['port'] = port wo_site_webroot = "" - if self.app.pargs.php72: + if self.app.pargs.php73: data = dict(site_name=wo_domain, www_domain=wo_www_domain, - static=False, basic=False, php72=True, wp=False, + static=False, basic=False, php73=True, wp=False, wpfc=False, wpsc=False, multisite=False, wpsubdir=False, webroot=wo_site_webroot) data['basic'] = True if stype in ['html', 'php' ]: data = dict(site_name=wo_domain, www_domain=wo_www_domain, - static=True, basic=False, php72=False, wp=False, + static=True, basic=False, php73=False, wp=False, wpfc=False, wpsc=False, multisite=False, wpsubdir=False, webroot=wo_site_webroot) @@ -430,7 +427,7 @@ class WOSiteCreateController(CementBaseController): elif stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']: data = dict(site_name=wo_domain, www_domain=wo_www_domain, - static=False, basic=True, wp=False, wpfc=False, + static=False, basic=True, wp=False, wpfc=False, wpsc=False, wpredis=False, multisite=False, wpsubdir=False, webroot=wo_site_webroot, wo_db_name='', wo_db_user='', wo_db_pass='', @@ -453,49 +450,14 @@ class WOSiteCreateController(CementBaseController): if stype == "html" and self.app.pargs.hhvm: Log.error(self, "Can not create HTML site with HHVM") - if data and self.app.pargs.php72: - if (not self.app.pargs.experimental): - Log.info(self, "Do you wish to install PHP 7.2 now for {0}?".format(wo_domain)) - - # Check prompt - check_prompt = input("Type \"y\" to continue [n]:") - if check_prompt != "Y" and check_prompt != "y": - Log.info(self, "Not using PHP 7.2 for site.") - data['php72'] = False - data['basic'] = True - php72 = 0 - self.app.pargs.php72 = False - else: - data['php72'] = True - php72 = 1 - else: - data['php72'] = True - php72 = 1 - elif data: - data['php72'] = False - php72 = 0 + if data and self.app.pargs.php73: + data['php73'] = True + php73 = 1 if (not self.app.pargs.wpfc) and (not self.app.pargs.wpsc) and (not self.app.pargs.wpredis) and (not self.app.pargs.hhvm): data['basic'] = True if data and self.app.pargs.hhvm: - if (not self.app.pargs.experimental): - Log.info(self, "HHVM is experimental feature and it may not " - "work with all plugins of your site.\nYou can " - "disable it by passing --hhvm=off later.\nDo you wish" - " to enable HHVM now for {0}?".format(wo_domain)) - - # Check prompt - check_prompt = input("Type \"y\" to continue [n]:") - if check_prompt != "Y" and check_prompt != "y": - Log.info(self, "Not using HHVM for site.") - data['hhvm'] = False - hhvm = 0 - self.app.pargs.hhvm = False - else: - data['hhvm'] = True - hhvm = 1 - else: data['hhvm'] = True hhvm = 1 @@ -503,20 +465,7 @@ class WOSiteCreateController(CementBaseController): data['hhvm'] = False hhvm = 0 - if (cache == 'wpredis' and (not self.app.pargs.experimental)): - Log.info(self, "Redis is experimental feature and it may not " - "work with all CSS/JS/Cache of your site.\nYou can " - "disable it by changing cache later.\nDo you wish" - " to enable Redis now for {0}?".format(wo_domain)) - - # Check prompt - check_prompt = input("Type \"y\" to continue [n]:") - if check_prompt != "Y" and check_prompt != "y": - Log.error(self, "Not using Redis for site") - cache = 'basic' - data['wpredis'] = False - data['basic'] = True - self.app.pargs.wpredis = False + if cache == 'wpredis': # Check rerequired packages are installed or not wo_auth = site_package_check(self, stype) @@ -563,8 +512,8 @@ class WOSiteCreateController(CementBaseController): " http://{0}".format(wo_domain)) return - if data['php72']: - php_version = "7.2" + if data['php73']: + php_version = "7.3" else: php_version = "7.2" @@ -705,23 +654,6 @@ class WOSiteCreateController(CementBaseController): "`tail /var/log/wo/wordops.log` and please try again") if self.app.pargs.letsencrypt : - if (not self.app.pargs.experimental): - if stype in ['wpsubdomain']: - Log.warn(self, "Wildcard domains are not supported in Lets Encrypt.\nWP SUBDOMAIN site will get SSL for primary site only.") - - Log.info(self, "Letsencrypt is currently in beta phase." - " \nDo you wish" - " to enable SSl now for {0}?".format(wo_domain)) - - # Check prompt - check_prompt = input("Type \"y\" to continue [n]:") - if check_prompt != "Y" and check_prompt != "y": - data['letsencrypt'] = False - letsencrypt = False - else: - data['letsencrypt'] = True - letsencrypt = True - else: data['letsencrypt'] = True letsencrypt = True @@ -775,8 +707,8 @@ class WOSiteUpdateController(CementBaseController): dict(help="update to html site", action='store_true')), (['--php'], dict(help="update to php site", action='store_true')), - (['--php72'], - dict(help="update to php7 site", + (['--php73'], + dict(help="update to PHP 7.3 site", action='store' or 'store_const', choices=('on', 'off'), const='on', nargs='?')), (['--mysql'], @@ -804,9 +736,6 @@ class WOSiteUpdateController(CementBaseController): choices=('on', 'off', 'renew'), const='on', nargs='?')), (['--proxy'], dict(help="update to proxy site", nargs='+')), - (['--experimental'], - dict(help="Enable Experimenal packages without prompt", - action='store_true')), (['--all'], dict(help="update all sites", action='store_true')), ] @@ -822,9 +751,9 @@ class WOSiteUpdateController(CementBaseController): if pargs.html: Log.error(self, "No site can be updated to html") - if not (pargs.php or pargs.php72 or + if not (pargs.php or pargs.php73 or pargs.mysql or pargs.wp or pargs.wpsubdir or - pargs.wpsubdomain or pargs.wpfc or pargs.wpsc or + pargs.wpsubdomain or pargs.wpfc or pargs.wpsc or pargs.hhvm or pargs.wpredis or pargs.letsencrypt): Log.error(self, "Please provide options to update sites.") @@ -850,7 +779,7 @@ class WOSiteUpdateController(CementBaseController): def doupdatesite(self, pargs): hhvm = None letsencrypt = False - php72 = None + php73 = None data = dict() @@ -900,13 +829,13 @@ class WOSiteUpdateController(CementBaseController): check_php_version = check_site.php_version if check_php_version == "7.2": - old_php72 = True + old_php73 = True else: - old_php72 = False + old_php73 = False if (pargs.password and not (pargs.html or - pargs.php or pargs.php72 or pargs.mysql or - pargs.wp or pargs.wpfc or pargs.wpsc or + pargs.php or pargs.php73 or pargs.mysql or + pargs.wp or pargs.wpfc or pargs.wpsc or pargs.wpsubdir or pargs.wpsubdomain)): try: updatewpuserpassword(self, wo_domain, wo_site_webroot) @@ -925,16 +854,16 @@ class WOSiteUpdateController(CementBaseController): Log.info(self, Log.FAIL + "Can not update HTML site to HHVM") return 1 - if ((stype == 'php' and oldsitetype not in ['html', 'proxy', 'php72']) or - # (stype == 'php72' and oldsitetype not in ['html', 'mysql', 'php', 'php72', 'wp', 'wpsubdir', 'wpsubdomain', ]) or + if ((stype == 'php' and oldsitetype not in ['html', 'proxy', 'php73']) or + # (stype == 'php73' and oldsitetype not in ['html', 'mysql', 'php', 'php73', 'wp', 'wpsubdir', 'wpsubdomain', ]) or (stype == 'mysql' and oldsitetype not in ['html', 'php', - 'proxy','php72']) or + 'proxy','php73']) or (stype == 'wp' and oldsitetype not in ['html', 'php', 'mysql', - 'proxy', 'wp', 'php72']) or + 'proxy', 'wp', 'php73']) or (stype == 'wpsubdir' and oldsitetype in ['wpsubdomain']) or (stype == 'wpsubdomain' and oldsitetype in ['wpsubdir']) or (stype == oldsitetype and cache == oldcachetype) and - not pargs.php72): + not pargs.php73): Log.info(self, Log.FAIL + "can not update {0} {1} to {2} {3}". format(oldsitetype, oldcachetype, stype, cache)) return 1 @@ -952,7 +881,7 @@ class WOSiteUpdateController(CementBaseController): if stype == 'php': data = dict(site_name=wo_domain, www_domain=wo_www_domain, - static=False, basic=True, wp=False, wpfc=False, + static=False, basic=True, wp=False, wpfc=False, wpsc=False, wpredis=False, multisite=False, wpsubdir=False, webroot=wo_site_webroot, currsitetype=oldsitetype, currcachetype=oldcachetype) @@ -960,7 +889,7 @@ class WOSiteUpdateController(CementBaseController): elif stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']: data = dict(site_name=wo_domain, www_domain=wo_www_domain, - static=False, basic=True, wp=False, wpfc=False, + static=False, basic=True, wp=False, wpfc=False, wpsc=False, wpredis=False, multisite=False, wpsubdir=False, webroot=wo_site_webroot, wo_db_name='', wo_db_user='', wo_db_pass='', @@ -976,7 +905,7 @@ class WOSiteUpdateController(CementBaseController): if stype == 'wpsubdir': data['wpsubdir'] = True - if pargs.hhvm or pargs.php72: + if pargs.hhvm or pargs.php73: if not data: data = dict(site_name=wo_domain, www_domain=wo_www_domain, currsitetype=oldsitetype, @@ -1038,24 +967,24 @@ class WOSiteUpdateController(CementBaseController): data['hhvm'] = False hhvm = False - if pargs.php72 == 'on' : - data['php72'] = True - php72 = True - check_php_version= '7.2' - elif pargs.php72 == 'off': - data['php72'] = False - php72 = False - check_php_version = '5.6' + if pargs.php73 == 'on' : + data['php73'] = True + php73 = True + check_php_version= '7.3' + elif pargs.php73 == 'off': + data['php73'] = False + php73 = False + check_php_version = '7.2' - if pargs.php72: - if php72 is old_php72: - if php72 is False: - Log.info(self, "PHP 7.2 is already disabled for given " + if pargs.php73: + if php73 is old_php73: + if php73 is False: + Log.info(self, "PHP 7.3 is already disabled for given " "site") - elif php72 is True: - Log.info(self, "PHP 7.2 is already enabled for given " + elif php73 is True: + Log.info(self, "PHP 7.3 is already enabled for given " "site") - pargs.php72 = False + pargs.php73 = False #--letsencrypt=renew code goes here if pargs.letsencrypt == "renew" and not pargs.all: @@ -1154,92 +1083,31 @@ class WOSiteUpdateController(CementBaseController): data['hhvm'] = False hhvm = False - if data and (not pargs.php72): - if old_php72 is True: - data['php72'] = True - php72 = True + if data and (not pargs.php73): + if old_php73 is True: + data['php73'] = True + php73 = True else: - data['php72'] = False - php72 = False + data['php73'] = False + php73 = False - if pargs.hhvm=="on" or pargs.letsencrypt=="on" or pargs.php72=="on": - if pargs.php72 == "on": - if (not pargs.experimental): - Log.info(self, "Do you wish to enable PHP 7.2 now for {0}?".format(wo_domain)) - - check_prompt = input("Type \"y\" to continue [n]:") - if check_prompt != "Y" and check_prompt != "y": - Log.info(self, "Not using PHP 7.2 for site") - data['php72'] = False - php72 = False - else: - data['php72'] = True - php72 = True - else: - data['php72'] = True - php72 = True + if pargs.hhvm=="on" or pargs.letsencrypt=="on" or pargs.php73=="on": + if pargs.php73 == "on": + data['php73'] = True + php73 = True if pargs.hhvm == "on": - if (not pargs.experimental): - Log.info(self, "HHVM is experimental feature and it may not" - " work with all plugins of your site.\nYou can " - "disable it by passing --hhvm=off later.\nDo you wish" - " to enable HHVM now for {0}?".format(wo_domain)) - - # Check prompt - check_prompt = input("Type \"y\" to continue [n]:") - if check_prompt != "Y" and check_prompt != "y": - Log.info(self, "Not using HHVM for site") - data['hhvm'] = False - hhvm = False - else: - data['hhvm'] = True - hhvm = True - else: data['hhvm'] = True hhvm = True if pargs.letsencrypt == "on": - - if (not pargs.experimental): - - if oldsitetype in ['wpsubdomain']: - Log.warn(self, "Wildcard domains are not supported in Lets Encrypt.\nWP SUBDOMAIN site will get SSL for primary site only.") - - Log.info(self, "Letsencrypt is currently in beta phase." - " \nDo you wish" - " to enable SSl now for {0}?".format(wo_domain)) - - check_prompt = input("Type \"y\" to continue [n]:") - if check_prompt != "Y" and check_prompt != "y": - Log.info(self, "Not using letsencrypt for site") - data['letsencrypt'] = False - letsencrypt = False - else: - data['letsencrypt'] = True - letsencrypt = True - else: data['letsencrypt'] = True letsencrypt = True if pargs.wpredis and data['currcachetype'] != 'wpredis': - if (not pargs.experimental): - Log.info(self, "Redis is experimental feature and it may not" - " work with all plugins of your site.\nYou can " - "disable it by changing cache type later.\nDo you wish" - " to enable Redis now for {0}?".format(wo_domain)) - - # Check prompt - check_prompt = input("Type \"y\" to continue [n]: ") - if check_prompt != "Y" and check_prompt != "y": - Log.error(self, "Not using Redis for site") - data['wpredis'] = False - data['basic'] = True - cache = 'basic' - - if ((hhvm is old_hhvm) and (php72 is old_php72) and + if ((hhvm is old_hhvm) and (php73 is old_php73) and (stype == oldsitetype and cache == oldcachetype)): return 1 diff --git a/wo/cli/plugins/site_functions.py b/wo/cli/plugins/site_functions.py index 79b301c..7d128be 100644 --- a/wo/cli/plugins/site_functions.py +++ b/wo/cli/plugins/site_functions.py @@ -72,7 +72,7 @@ def setupdomain(self, data): wo_site_nginx_conf = open('/etc/nginx/sites-available/{0}' .format(wo_domain_name), encoding='utf-8', mode='w') - if not data['php72']: + if not data['php73']: self.app.render((data), 'virtualconf.mustache', out=wo_site_nginx_conf) else: @@ -623,7 +623,7 @@ def sitebackup(self, data): .format(data['site_name']), backup_path) if data['currsitetype'] in ['html', 'php', 'proxy', 'mysql']: - if data['php72'] is True and not data['wp']: + if data['php73'] is True and not data['wp']: Log.info(self, "Backing up Webroot \t\t", end='') WOFileUtils.copyfiles(self, wo_site_webroot + '/htdocs', backup_path + '/htdocs') Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]") @@ -663,7 +663,7 @@ def sitebackup(self, data): Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]") # move wp-config.php/wo-config.php to backup if data['currsitetype'] in ['mysql', 'proxy']: - if data['php72'] is True and not data['wp']: + if data['php73'] is True and not data['wp']: WOFileUtils.copyfile(self, configfiles[0], backup_path) else: WOFileUtils.mvfile(self, configfiles[0], backup_path) @@ -677,7 +677,7 @@ def site_package_check(self, stype): stack = WOStackController() stack.app = self.app if stype in ['html', 'proxy', 'php', 'mysql', 'wp', 'wpsubdir', - 'wpsubdomain', 'php72']: + 'wpsubdomain', 'php73']: Log.debug(self, "Setting apt_packages variable for Nginx") # Check if server has nginx-custom package @@ -708,22 +708,22 @@ def site_package_check(self, stype): wo_nginx.write('fastcgi_param \tSCRIPT_FILENAME ' '\t$request_filename;\n') - if self.app.pargs.php and self.app.pargs.php72: + if self.app.pargs.php and self.app.pargs.php73: Log.error(self,"Error: two different PHP versions cannot be combined within the same WordOps site") - if not self.app.pargs.php72 and stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: + if not self.app.pargs.php73 and stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: Log.debug(self, "Setting apt_packages variable for PHP") - apt_packages = apt_packages + WOVariables.wo_php72 + WOVariables.wo_php_extra + apt_packages = apt_packages + WOVariables.wo_php73 + WOVariables.wo_php_extra - if self.app.pargs.php72 and stype in [ 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: + if self.app.pargs.php73 and stype in [ 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - Log.debug(self, "Setting apt_packages variable for PHP 7.2") - if not WOAptGet.is_installed(self, 'php7.2-fpm'): - apt_packages = apt_packages + WOVariables.wo_php72 + WOVariables.wo_php_extra + Log.debug(self, "Setting apt_packages variable for PHP 7.3") + if not WOAptGet.is_installed(self, 'php7.3-fpm'): + apt_packages = apt_packages + WOVariables.wo_php73 + WOVariables.wo_php_extra else: - Log.debug(self, "Setting apt_packages variable for PHP 7.2") - if not WOAptGet.is_installed(self, 'php7.2-fpm'): - apt_packages = apt_packages + WOVariables.wo_php72 + Log.debug(self, "Setting apt_packages variable for PHP 7.3") + if not WOAptGet.is_installed(self, 'php7.3-fpm'): + apt_packages = apt_packages + WOVariables.wo_php73 if stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']: Log.debug(self, "Setting apt_packages variable for MySQL") @@ -736,7 +736,7 @@ def site_package_check(self, stype): if stype in ['wp', 'wpsubdir', 'wpsubdomain']: Log.debug(self, "Setting packages variable for WP-CLI") - if not WOShellExec.cmd_exec(self, "which wp"): + if not WOShellExec.cmd_exec(self, "command -v wp"): packages = packages + [["https://github.com/wp-cli/wp-cli/" "releases/download/v{0}/" "wp-cli-{0}.phar" @@ -830,13 +830,13 @@ def site_package_check(self, stype): hhvm_file.write("upstream hhvm {\nserver 127.0.0.1:8000;\n" "server 127.0.0.1:9000 backup;\n}\n") - if self.app.pargs.php72: + if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'wheezy' or WOVariables.wo_platform_codename == 'precise'): Log.error(self,"PHP 7.0 is not supported in your Platform") - Log.debug(self, "Setting apt_packages variable for PHP 7.0") - if not WOAptGet.is_installed(self, 'php7.2-fpm'): - apt_packages = apt_packages + WOVariables.wo_php72 + WOVariables.wo_php_extra + Log.debug(self, "Setting apt_packages variable for PHP 7.3") + if not WOAptGet.is_installed(self, 'php7.3-fpm'): + apt_packages = apt_packages + WOVariables.wo_php73 + WOVariables.wo_php_extra if os.path.isdir("/etc/nginx/common") and (not os.path.isfile("/etc/nginx/common/php7.conf")): @@ -894,9 +894,9 @@ def site_package_check(self, stype): if os.path.isfile("/etc/nginx/conf.d/upstream.conf"): if not WOFileUtils.grep(self, "/etc/nginx/conf.d/upstream.conf", - "php72"): + "php73"): with open("/etc/nginx/conf.d/upstream.conf", "a") as php_file: - php_file.write("upstream php72 {\nserver 127.0.0.1:9072;\n}\n" + php_file.write("upstream php73 {\nserver 127.0.0.1:9072;\n}\n" "upstream debug72 {\nserver 127.0.0.1:9172;\n}\n") return(stack.install(apt_packages=apt_packages, packages=packages, @@ -1032,7 +1032,7 @@ def detSitePar(opts): cachelist = list() for key, val in opts.items(): if val and key in ['html', 'php', 'mysql', 'wp', - 'wpsubdir', 'wpsubdomain','php72']: + 'wpsubdir', 'wpsubdomain','php73']: typelist.append(key) elif val and key in ['wpfc', 'wpsc', 'wpredis']: cachelist.append(key) @@ -1046,7 +1046,7 @@ def detSitePar(opts): cachetype = 'basic' else: cachetype = cachelist[0] - elif False not in [x in ('php72','mysql','html') for x in typelist]: + elif False not in [x in ('php73','mysql','html') for x in typelist]: sitetype = 'mysql' if not cachelist: cachetype = 'basic' @@ -1058,7 +1058,7 @@ def detSitePar(opts): cachetype = 'basic' else: cachetype = cachelist[0] - elif False not in [x in ('php72','mysql') for x in typelist]: + elif False not in [x in ('php73','mysql') for x in typelist]: sitetype = 'mysql' if not cachelist: cachetype = 'basic' @@ -1076,8 +1076,8 @@ def detSitePar(opts): cachetype = 'basic' else: cachetype = cachelist[0] - elif False not in [x in ('php72','html') for x in typelist]: - sitetype = 'php72' + elif False not in [x in ('php73','html') for x in typelist]: + sitetype = 'php73' if not cachelist: cachetype = 'basic' else: @@ -1094,19 +1094,19 @@ def detSitePar(opts): cachetype = 'basic' else: cachetype = cachelist[0] - elif False not in [x in ('wp','php72') for x in typelist]: + elif False not in [x in ('wp','php73') for x in typelist]: sitetype = 'wp' if not cachelist: cachetype = 'basic' else: cachetype = cachelist[0] - elif False not in [x in ('wpsubdir','php72') for x in typelist]: + elif False not in [x in ('wpsubdir','php73') for x in typelist]: sitetype = 'wpsubdir' if not cachelist: cachetype = 'basic' else: cachetype = cachelist[0] - elif False not in [x in ('wpsubdomain','php72') for x in typelist]: + elif False not in [x in ('wpsubdomain','php73') for x in typelist]: sitetype = 'wpsubdomain' if not cachelist: cachetype = 'basic' @@ -1118,7 +1118,7 @@ def detSitePar(opts): if not typelist and not cachelist: sitetype = None cachetype = None - elif (not typelist or "php72" in typelist) and cachelist: + elif (not typelist or "php73" in typelist) and cachelist: sitetype = 'wp' cachetype = cachelist[0] elif typelist and (not cachelist): diff --git a/wo/cli/plugins/stack.py b/wo/cli/plugins/stack.py index c7334d4..63cf56c 100644 --- a/wo/cli/plugins/stack.py +++ b/wo/cli/plugins/stack.py @@ -53,12 +53,12 @@ class WOStackController(CementBaseController): dict(help='Install admin tools stack', action='store_true')), (['--nginx'], dict(help='Install Nginx stack', action='store_true')), -# (['--nginxmainline'], -# dict(help='Install Nginx mainline stack', action='store_true')), + # (['--nginxmainline'], + # dict(help='Install Nginx mainline stack', action='store_true')), (['--php'], - dict(help='Install PHP stack', action='store_true')), - (['--php72'], dict(help='Install PHP 7.2 stack', action='store_true')), + (['--php73'], + dict(help='Install PHP 7.3 stack', action='store_true')), (['--mysql'], dict(help='Install MySQL stack', action='store_true')), (['--hhvm'], @@ -75,7 +75,7 @@ class WOStackController(CementBaseController): dict(help='Install Redis', action='store_true')), (['--phpredisadmin'], dict(help='Install phpRedisAdmin', action='store_true')), - ] + ] usage = "ee stack (command) [options]" @expose(hide=True) @@ -96,11 +96,11 @@ class WOStackController(CementBaseController): mysql_pref_file.write(mysql_pref) WORepo.add(self, repo_url=WOVariables.wo_mysql_repo) Log.debug(self, 'Adding key for {0}' - .format(WOVariables.wo_mysql_repo)) + .format(WOVariables.wo_mysql_repo)) WORepo.add_key(self, '0xcbcb082a1bb943db', - keyserver="keyserver.ubuntu.com") + keyserver="keyserver.ubuntu.com") WORepo.add_key(self, '0xF1656F24C74CD1D8', - keyserver="keyserver.ubuntu.com") + keyserver="keyserver.ubuntu.com") chars = ''.join(random.sample(string.ascii_letters, 8)) Log.debug(self, "Pre-seeding MySQL") Log.debug(self, "echo \"mariadb-server-10.1 " @@ -154,7 +154,7 @@ class WOStackController(CementBaseController): WORepo.add_key(self, WOVariables.wo_nginx_key) if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - if set(WOVariables.wo_php72).issubset(set(apt_packages)): + if set(WOVariables.wo_php73).issubset(set(apt_packages)): Log.info(self, "Adding repository for PHP, please wait...") Log.debug(self, 'Adding ppa for PHP') WORepo.add(self, ppa=WOVariables.wo_php_repo) @@ -173,7 +173,7 @@ class WOStackController(CementBaseController): WORepo.add(self, ppa=WOVariables.wo_php_repo) if WOVariables.wo_platform_codename == 'jessie': - if set(WOVariables.wo_php72).issubset(set(apt_packages)): + if set(WOVariables.wo_php73).issubset(set(apt_packages)): Log.debug(self, 'Adding repo_url of php 7.0 for debian') WORepo.add(self, repo_url=WOVariables.wo_php_repo) Log.debug(self, 'Adding Dotdeb/php GPG key') @@ -243,8 +243,8 @@ class WOStackController(CementBaseController): self.app.render((data), 'fastcgi.mustache', out=wo_nginx) wo_nginx.close() - data = dict(php="9000", debug="9001", hhvm="8000",php72="9072",debug7="9172", - hhvmconf=False, php7conf= True if WOAptGet.is_installed(self,'php7.2-fpm') else False ) + data = dict(php="9000", debug="9001", hhvm="8000", php73="9072", debug7="9172", + hhvmconf=False, php7conf=True if WOAptGet.is_installed(self, 'php7.2-fpm') else False) Log.debug(self, 'Writting the nginx configuration to ' 'file /etc/nginx/conf.d/upstream.conf') wo_nginx = open('/etc/nginx/conf.d/upstream.conf', @@ -315,56 +315,56 @@ class WOStackController(CementBaseController): out=wo_nginx) wo_nginx.close() - #php7 conf + # php7 conf if (WOVariables.wo_platform_codename == 'stretch' or WOVariables.wo_platform_codename == 'jessie' or WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and (not - os.path.isfile("/etc/nginx/common/php7.conf")): + os.path.isfile("/etc/nginx/common/php7.conf")): #data = dict() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/locations-php7.conf') + 'file /etc/nginx/common/locations-php7.conf') wo_nginx = open('/etc/nginx/common/locations-php7.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'locations-php7.mustache', - out=wo_nginx) + out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/php7.conf') + 'file /etc/nginx/common/php7.conf') wo_nginx = open('/etc/nginx/common/php7.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'php7.mustache', - out=wo_nginx) + out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpcommon-php7.conf') + 'file /etc/nginx/common/wpcommon-php7.conf') wo_nginx = open('/etc/nginx/common/wpcommon-php7.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'wpcommon-php7.mustache', - out=wo_nginx) + out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpfc-php7.conf') + 'file /etc/nginx/common/wpfc-php7.conf') wo_nginx = open('/etc/nginx/common/wpfc-php7.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'wpfc-php7.mustache', - out=wo_nginx) + out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpsc-php7.conf') + 'file /etc/nginx/common/wpsc-php7.conf') wo_nginx = open('/etc/nginx/common/wpsc-php7.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'wpsc-php7.mustache', - out=wo_nginx) + out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' 'file /etc/nginx/common/redis-php7.conf') wo_nginx = open('/etc/nginx/common/redis-php7.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'redis-php7.mustache', - out=wo_nginx) + out=wo_nginx) wo_nginx.close() # Nginx-Plus does not have nginx package structure like this @@ -393,8 +393,8 @@ class WOStackController(CementBaseController): wo_nginx.close() passwd = ''.join([random.choice - (string.ascii_letters + string.digits) - for n in range(6)]) + (string.ascii_letters + string.digits) + for n in range(6)]) try: WOShellExec.cmd_exec(self, "printf \"WordOps:" "$(openssl passwd -crypt " @@ -433,14 +433,14 @@ class WOStackController(CementBaseController): '22222.access.log', '{0}22222/' 'logs/access.log' - .format(WOVariables.wo_webroot)] + .format(WOVariables.wo_webroot)] ) WOFileUtils.create_symlink(self, ['/var/log/nginx/' '22222.error.log', '{0}22222/' 'logs/error.log' - .format(WOVariables.wo_webroot)] + .format(WOVariables.wo_webroot)] ) try: @@ -474,7 +474,8 @@ class WOStackController(CementBaseController): .format(WOVariables.wo_webroot)) except CommandExecutionError as e: - Log.error(self, "Failed to generate HTTPS certificate for 22222") + Log.error( + self, "Failed to generate HTTPS certificate for 22222") # Nginx Configation into GIT WOGit.add(self, @@ -482,12 +483,12 @@ class WOStackController(CementBaseController): WOService.reload_service(self, 'nginx') if set(["nginx-plus"]).issubset(set(apt_packages)) or set(["nginx"]).issubset(set(apt_packages)): WOShellExec.cmd_exec(self, "sed -i -e 's/^user/#user/'" - " -e '/^#user/a user" - "\ www-data\;'" - " /etc/nginx/nginx.conf") + " -e '/^#user/a user" + "\ www-data\;'" + " /etc/nginx/nginx.conf") if not WOShellExec.cmd_exec(self, "cat /etc/nginx/" - "nginx.conf | grep -q " - "'/etc/nginx/sites-enabled'"): + "nginx.conf | grep -q " + "'/etc/nginx/sites-enabled'"): WOShellExec.cmd_exec(self, "sed -i '/\/etc\/" "nginx\/conf\.d\/\*" "\.conf/a \ include" @@ -505,17 +506,17 @@ class WOStackController(CementBaseController): wo_nginx.close() print("HTTP Auth User Name: WordOps" - + "\nHTTP Auth Password : {0}".format(passwd)) + + "\nHTTP Auth Password : {0}".format(passwd)) WOService.reload_service(self, 'nginx') else: self.msg = (self.msg + ["HTTP Auth User Name: WordOps"] - + ["HTTP Auth Password : {0}".format(passwd)]) + + ["HTTP Auth Password : {0}".format(passwd)]) else: WOService.restart_service(self, 'nginx') - if WOAptGet.is_installed(self,'redis-server'): + if WOAptGet.is_installed(self, 'redis-server'): if os.path.isfile("/etc/nginx/nginx.conf") and (not - os.path.isfile("/etc/nginx/common/redis.conf")): + os.path.isfile("/etc/nginx/common/redis.conf")): data = dict() Log.debug(self, 'Writting the nginx configuration to ' @@ -527,7 +528,7 @@ class WOStackController(CementBaseController): wo_nginx.close() if os.path.isfile("/etc/nginx/nginx.conf") and (not - os.path.isfile("/etc/nginx/common/redis-hhvm.conf")): + os.path.isfile("/etc/nginx/common/redis-hhvm.conf")): data = dict() Log.debug(self, 'Writting the nginx configuration to ' @@ -540,14 +541,14 @@ class WOStackController(CementBaseController): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): if os.path.isfile("/etc/nginx/nginx.conf") and (not - os.path.isfile("/etc/nginx/common/redis-php7.conf")): + os.path.isfile("/etc/nginx/common/redis-php7.conf")): data = dict() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/redis-php7.conf') + 'file /etc/nginx/common/redis-php7.conf') wo_nginx = open('/etc/nginx/common/redis-php7.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'redis-php7.mustache', - out=wo_nginx) + out=wo_nginx) wo_nginx.close() if os.path.isfile("/etc/nginx/conf.d/upstream.conf"): @@ -561,16 +562,16 @@ class WOStackController(CementBaseController): " keepalive 10;\n}\n") if os.path.isfile("/etc/nginx/nginx.conf") and (not - os.path.isfile("/etc/nginx/conf.d/redis.conf")): + os.path.isfile("/etc/nginx/conf.d/redis.conf")): with open("/etc/nginx/conf.d/redis.conf", "a") as redis_file: redis_file.write("# Log format Settings\n" "log_format rt_cache_redis '$remote_addr $upstream_response_time $srcache_fetch_status [$time_local] '\n" "'$http_host \"$request\" $status $body_bytes_sent '\n" "'\"$http_referer\" \"$http_user_agent\"';\n") - #setup nginx common folder for php7 - if self.app.pargs.php72: + # setup nginx common folder for php7 + if self.app.pargs.php73: if os.path.isdir("/etc/nginx/common") and (not - os.path.isfile("/etc/nginx/common/php7.conf")): + os.path.isfile("/etc/nginx/common/php7.conf")): data = dict() Log.debug(self, 'Writting the nginx configuration to ' 'file /etc/nginx/common/locations-php7.conf') @@ -581,15 +582,15 @@ class WOStackController(CementBaseController): wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/php7.conf') + 'file /etc/nginx/common/php7.conf') wo_nginx = open('/etc/nginx/common/php7.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'php7.mustache', - out=wo_nginx) + out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpcommon-php7.conf') + 'file /etc/nginx/common/wpcommon-php7.conf') wo_nginx = open('/etc/nginx/common/wpcommon-php7.conf', encoding='utf-8', mode='w') self.app.render((data), 'wpcommon-php7.mustache', @@ -597,37 +598,37 @@ class WOStackController(CementBaseController): wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpfc-php7.conf') + 'file /etc/nginx/common/wpfc-php7.conf') wo_nginx = open('/etc/nginx/common/wpfc-php7.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'wpfc-php7.mustache', - out=wo_nginx) + out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpsc-php7.conf') + 'file /etc/nginx/common/wpsc-php7.conf') wo_nginx = open('/etc/nginx/common/wpsc-php7.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'wpsc-php7.mustache', - out=wo_nginx) + out=wo_nginx) wo_nginx.close() if os.path.isdir("/etc/nginx/common") and (not os.path.isfile("/etc/nginx/common/redis-php7.conf")): data = dict() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/redis-php7.conf') + 'file /etc/nginx/common/redis-php7.conf') wo_nginx = open('/etc/nginx/common/redis-php7.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'redis-php7.mustache', - out=wo_nginx) + out=wo_nginx) wo_nginx.close() if os.path.isfile("/etc/nginx/conf.d/upstream.conf"): if not WOFileUtils.grep(self, "/etc/nginx/conf.d/upstream.conf", - "php72"): + "php73"): with open("/etc/nginx/conf.d/upstream.conf", "a") as php_file: - php_file.write("upstream php72 {\nserver 127.0.0.1:9072;\n}\n" - "upstream debug72 {\nserver 127.0.0.1:9172;\n}\n") + php_file.write("upstream php73 {\nserver 127.0.0.1:9072;\n}\n" + "upstream debug72 {\nserver 127.0.0.1:9172;\n}\n") if set(WOVariables.wo_hhvm).issubset(set(apt_packages)): @@ -637,7 +638,7 @@ class WOStackController(CementBaseController): "9000", "8000") if (WOVariables.wo_platform_codename != 'xenial' or WOVariables.wo_platform_codename != 'bionic'): WOFileUtils.searchreplace(self, "/etc/nginx/hhvm.conf", - "9000", "8000") + "9000", "8000") with open("/etc/hhvm/php.ini", "a") as hhvm_file: hhvm_file.write("hhvm.log.header = true\n" @@ -675,7 +676,7 @@ class WOStackController(CementBaseController): WOService.restart_service(self, 'hhvm') if os.path.isfile("/etc/nginx/nginx.conf") and (not - os.path.isfile("/etc/nginx/common/php-hhvm.conf")): + os.path.isfile("/etc/nginx/common/php-hhvm.conf")): data = dict() Log.debug(self, 'Writting the nginx configuration to ' @@ -708,7 +709,7 @@ class WOStackController(CementBaseController): if set(WOVariables.wo_redis).issubset(set(apt_packages)): if os.path.isfile("/etc/nginx/nginx.conf") and (not - os.path.isfile("/etc/nginx/common/redis.conf")): + os.path.isfile("/etc/nginx/common/redis.conf")): data = dict() Log.debug(self, 'Writting the nginx configuration to ' @@ -720,7 +721,7 @@ class WOStackController(CementBaseController): wo_nginx.close() if os.path.isfile("/etc/nginx/nginx.conf") and (not - os.path.isfile("/etc/nginx/common/redis-hhvm.conf")): + os.path.isfile("/etc/nginx/common/redis-hhvm.conf")): data = dict() Log.debug(self, 'Writting the nginx configuration to ' @@ -742,7 +743,7 @@ class WOStackController(CementBaseController): " keepalive 10;\n}\n") if os.path.isfile("/etc/nginx/nginx.conf") and (not - os.path.isfile("/etc/nginx/conf.d/redis.conf")): + os.path.isfile("/etc/nginx/conf.d/redis.conf")): with open("/etc/nginx/conf.d/redis.conf", "a") as redis_file: redis_file.write("# Log format Settings\n" "log_format rt_cache_redis '$remote_addr $upstream_response_time $srcache_fetch_status [$time_local] '\n" @@ -772,11 +773,11 @@ class WOStackController(CementBaseController): # Parse /etc/php/7.2/fpm/php-fpm.conf data = dict(pid="/run/php/php7.2-fpm.pid", error_log="/var/log/php/7.2/fpm.log", - include="/etc/php/7.2/fpm/pool.d/*.conf") + include="/etc/php/7.2/fpm/pool.d/*.conf") Log.debug(self, "writting php5 configuration into " - "/etc/php/7.2/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') + encoding='utf-8', mode='w') self.app.render((data), 'php-fpm.mustache', out=wo_php_fpm) wo_php_fpm.close() @@ -793,7 +794,10 @@ class WOStackController(CementBaseController): config['www']['pm.max_spare_servers'] = '5' config['www']['request_terminate_timeout'] = '100' config['www']['pm'] = 'ondemand' - config['www']['listen'] = '127.0.0.1:9072' + config['www']['chdir'] = '/' + config['www']['prefix'] = '/var/run/php' + config['www']['listen'] = 'php73-fpm.sock' + config['www']['listen.backlog'] = '32768' with codecs.open('/etc/php/7.2/fpm/pool.d/www.conf', encoding='utf-8', mode='w') as configfile: Log.debug(self, "Writing PHP 7.2 configuration into " @@ -829,9 +833,9 @@ class WOStackController(CementBaseController): # Disable xdebug 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") + "xdebug.ini", + "zend_extension", + ";zend_extension") # PHP and Debug pull configuration if not os.path.exists('{0}22222/htdocs/fpm/status/' @@ -870,41 +874,41 @@ class WOStackController(CementBaseController): WOGit.add(self, ["/etc/php"], msg="Adding PHP into Git") WOService.restart_service(self, 'php7.2-fpm') - #PHP7.0 configuration for debian - if (WOVariables.wo_platform_codename == 'jessie' ) and set(WOVariables.wo_php72).issubset(set(apt_packages)): + # PHP7.3 configuration for debian + if (WOVariables.wo_platform_codename == 'jessie') and set(WOVariables.wo_php73).issubset(set(apt_packages)): # Create log directories - 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/') + if not os.path.exists('/var/log/php/7.3/'): + Log.debug(self, 'Creating directory /var/log/php/7.3/') + os.makedirs('/var/log/php/7.3/') - # Parse etc/php/7.2/fpm/php.ini + # Parse etc/php/7.3/fpm/php.ini config = configparser.ConfigParser() - Log.debug(self, "configuring php file /etc/php/7.2/fpm/php.ini") - config.read('/etc/php/7.2/fpm/php.ini') + Log.debug(self, "configuring php file /etc/php/7.3/fpm/php.ini") + config.read('/etc/php/7.3/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.2/fpm/php.ini', + with open('/etc/php/7.3/fpm/php.ini', encoding='utf-8', mode='w') as configfile: Log.debug(self, "Writting php configuration into " - "/etc/php/7.2/fpm/php.ini") + "/etc/php/7.3/fpm/php.ini") config.write(configfile) - # Parse /etc/php/7.2/fpm/php-fpm.conf - data = dict(pid="/run/php/php7.2-fpm.pid", error_log="/var/log/php7.2-fpm.log", - include="/etc/php/7.2/fpm/pool.d/*.conf") + # Parse /etc/php/7.3/fpm/php-fpm.conf + data = dict(pid="/run/php/php7.3-fpm.pid", error_log="/var/log/php7.3-fpm.log", + include="/etc/php/7.3/fpm/pool.d/*.conf") Log.debug(self, "writting php 7.0 configuration into " - "/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') + "/etc/php/7.3/fpm/php-fpm.conf") + wo_php_fpm = open('/etc/php/7.3/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.2/fpm/pool.d/www.conf + # Parse /etc/php/7.3/fpm/pool.d/www.conf config = configparser.ConfigParser() - config.read_file(codecs.open('/etc/php/7.2/fpm/pool.d/www.conf', + config.read_file(codecs.open('/etc/php/7.3/fpm/pool.d/www.conf', "r", "utf8")) config['www']['ping.path'] = '/ping' config['www']['pm.status_path'] = '/status' @@ -915,31 +919,34 @@ class WOStackController(CementBaseController): config['www']['pm.max_spare_servers'] = '30' config['www']['request_terminate_timeout'] = '300' config['www']['pm'] = 'ondemand' - config['www']['listen'] = '127.0.0.1:9072' - with codecs.open('/etc/php/7.2/fpm/pool.d/www.conf', + config['www']['chdir'] = '/' + config['www']['prefix'] = '/var/run/php' + config['www']['listen'] = 'php73-fpm.sock' + config['www']['listen.backlog'] = '32768' + with codecs.open('/etc/php/7.3/fpm/pool.d/www.conf', encoding='utf-8', mode='w') as configfile: Log.debug(self, "writting PHP5 configuration into " - "/etc/php/7.2/fpm/pool.d/www.conf") + "/etc/php/7.3/fpm/pool.d/www.conf") config.write(configfile) - # 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/" + # Generate /etc/php/7.3/fpm/pool.d/debug.conf + WOFileUtils.copyfile(self, "/etc/php/7.3/fpm/pool.d/www.conf", + "/etc/php/7.3/fpm/pool.d/debug.conf") + WOFileUtils.searchreplace(self, "/etc/php/7.3/fpm/pool.d/" "debug.conf", "[www]", "[debug]") config = configparser.ConfigParser() - config.read('/etc/php/7.2/fpm/pool.d/debug.conf') - config['debug']['listen'] = '127.0.0.1:9172' + config.read('/etc/php/7.3/fpm/pool.d/debug.conf') + config['debug']['listen'] = '127.0.0.1:9182' config['debug']['rlimit_core'] = 'unlimited' - config['debug']['slowlog'] = '/var/log/php/7.2/slow.log' + config['debug']['slowlog'] = '/var/log/php/7.3/slow.log' config['debug']['request_slowlog_timeout'] = '10s' - with open('/etc/php/7.2/fpm/pool.d/debug.conf', + with open('/etc/php/7.3/fpm/pool.d/debug.conf', encoding='utf-8', mode='w') as confifile: Log.debug(self, "writting PHP5 configuration into " - "/etc/php/7.2/fpm/pool.d/debug.conf") + "/etc/php/7.3/fpm/pool.d/debug.conf") config.write(confifile) - with open("/etc/php/7.2/fpm/pool.d/debug.conf", + with open("/etc/php/7.3/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_" @@ -949,11 +956,11 @@ class WOStackController(CementBaseController): "profiler_enable] = off\n") # Disable xdebug - 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") + if not WOShellExec.cmd_exec(self, "grep -q \';zend_extension\' /etc/php/7.3/mods-available/xdebug.ini"): + WOFileUtils.searchreplace(self, "/etc/php/7.3/mods-available/" + "xdebug.ini", + "zend_extension", + ";zend_extension") # PHP and Debug pull configuration if not os.path.exists('{0}22222/htdocs/fpm/status/' @@ -990,10 +997,10 @@ class WOStackController(CementBaseController): WOVariables.wo_php_user, recursive=True) WOGit.add(self, ["/etc/php"], msg="Adding PHP into Git") - WOService.restart_service(self, 'php7.2-fpm') + WOService.restart_service(self, 'php7.3-fpm') - #preconfiguration for php7.2 - if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and set(WOVariables.wo_php72).issubset(set(apt_packages)): + # preconfiguration for php7.2 + if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and set(WOVariables.wo_php).issubset(set(apt_packages)): # Create log directories if not os.path.exists('/var/log/php/7.2/'): Log.debug(self, 'Creating directory /var/log/php/7.2/') @@ -1016,11 +1023,11 @@ class WOStackController(CementBaseController): # Parse /etc/php/7.2/fpm/php-fpm.conf data = dict(pid="/run/php/php7.2-fpm.pid", error_log="/var/log/php/7.2/fpm.log", - include="/etc/php/7.2/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.2/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') + encoding='utf-8', mode='w') self.app.render((data), 'php-fpm.mustache', out=wo_php_fpm) wo_php_fpm.close() @@ -1073,9 +1080,9 @@ class WOStackController(CementBaseController): # Disable xdebug 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") + "xdebug.ini", + "zend_extension", + ";zend_extension") # PHP and Debug pull configuration if not os.path.exists('{0}22222/htdocs/fpm/status/' @@ -1114,8 +1121,6 @@ class WOStackController(CementBaseController): WOGit.add(self, ["/etc/php"], msg="Adding PHP into Git") WOService.restart_service(self, 'php7.2-fpm') - - if set(WOVariables.wo_mysql).issubset(set(apt_packages)): if not os.path.isfile("/etc/mysql/my.cnf"): config = ("[mysqld]\nwait_timeout = 30\n" @@ -1169,12 +1174,12 @@ class WOStackController(CementBaseController): '{0}22222/htdocs/db/pma/config.inc.php file ' .format(WOVariables.wo_webroot)) blowfish_key = ''.join([random.choice - (string.ascii_letters + string.digits) - for n in range(10)]) + (string.ascii_letters + string.digits) + for n in range(10)]) WOFileUtils.searchreplace(self, '{0}22222/htdocs/db/pma/config.inc.php' .format(WOVariables.wo_webroot), - "$cfg[\'blowfish_secret\'] = \'\';","$cfg[\'blowfish_secret\'] = \'{0}\';" + "$cfg[\'blowfish_secret\'] = \'\';", "$cfg[\'blowfish_secret\'] = \'{0}\';" .format(blowfish_key)) Log.debug(self, 'Setting HOST Server For Mysql to ' '{0}22222/htdocs/db/pma/config.inc.php file ' @@ -1182,7 +1187,7 @@ class WOStackController(CementBaseController): WOFileUtils.searchreplace(self, '{0}22222/htdocs/db/pma/config.inc.php' .format(WOVariables.wo_webroot), - "$cfg[\'Servers\'][$i][\'host\'] = \'localhost\';","$cfg[\'Servers\'][$i][\'host\'] = \'{0}\';" + "$cfg[\'Servers\'][$i][\'host\'] = \'localhost\';", "$cfg[\'Servers\'][$i][\'host\'] = \'{0}\';" .format(WOVariables.wo_mysql_host)) Log.debug(self, 'Setting Privileges of webroot permission to ' '{0}22222/htdocs/db/pma file ' @@ -1273,7 +1278,7 @@ class WOStackController(CementBaseController): WOMysql.execute(self, 'grant select on *.* to \'anemometer\'' '@\'{0}\' IDENTIFIED' ' BY \'{1}\''.format(self.app.config.get('mysql', - 'grant-host'),chars)) + 'grant-host'), chars)) Log.debug(self, "grant all on slow-query-log.*" " to anemometer@root_user IDENTIFIED BY password ") WOMysql.execute(self, 'grant all on slow_query_log.* to' @@ -1338,12 +1343,12 @@ class WOStackController(CementBaseController): try: # Default action for stack installation if ((not self.app.pargs.web) and (not self.app.pargs.admin) and - (not self.app.pargs.nginx) and (not self.app.pargs.php) and - (not self.app.pargs.mysql) and (not self.app.pargs.wpcli) and - (not self.app.pargs.phpmyadmin) and (not self.app.pargs.hhvm) and - (not self.app.pargs.adminer) and (not self.app.pargs.utils) and - (not self.app.pargs.redis) and (not self.app.pargs.phpredisadmin) and - (not self.app.pargs.php72)): + (not self.app.pargs.nginx) and (not self.app.pargs.php) and + (not self.app.pargs.mysql) and (not self.app.pargs.wpcli) and + (not self.app.pargs.phpmyadmin) and (not self.app.pargs.hhvm) and + (not self.app.pargs.adminer) and (not self.app.pargs.utils) and + (not self.app.pargs.redis) and (not self.app.pargs.phpredisadmin) and + (not self.app.pargs.php73)): self.app.pargs.web = True self.app.pargs.admin = True @@ -1385,7 +1390,7 @@ class WOStackController(CementBaseController): self.post_pref(apt, packages) elif WOAptGet.is_installed(self, 'nginx'): Log.info(self, "WordOps detected an already installed nginx package." - "It may or may not have required modules.\n") + "It may or may not have required modules.\n") apt = ["nginx"] + WOVariables.wo_nginx self.post_pref(apt, packages) else: @@ -1393,43 +1398,45 @@ class WOStackController(CementBaseController): if self.app.pargs.php: Log.debug(self, "Setting apt_packages variable for PHP") - if not (WOAptGet.is_installed(self, 'php5-fpm') or WOAptGet.is_installed(self, 'php5.6-fpm')): + if not (WOAptGet.is_installed(self, 'php5-fpm') or WOAptGet.is_installed(self, 'php7.2-fpm')): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - apt_packages = apt_packages + WOVariables.wo_php72 + WOVariables.wo_php_extra + apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra else: apt_packages = apt_packages + WOVariables.wo_php else: Log.debug(self, "PHP already installed") Log.info(self, "PHP already installed") - #PHP 7.0 for Debian (jessie+) - if self.app.pargs.php72 and WOVariables.wo_platform_distro == 'debian': + # PHP 7.3 for Debian (jessie+) + if self.app.pargs.php73 and WOVariables.wo_platform_distro == 'debian': if (WOVariables.wo_platform_codename == 'jessie'): - Log.debug(self, "Setting apt_packages variable for PHP 7.2") - if not WOAptGet.is_installed(self, 'php7.2-fpm') : - apt_packages = apt_packages + WOVariables.wo_php72 + Log.debug(self, "Setting apt_packages variable for PHP 7.3") + if not WOAptGet.is_installed(self, 'php7.3-fpm'): + apt_packages = apt_packages + WOVariables.wo_php73 if not WOAptGet.is_installed(self, 'php5-fpm'): apt_packages = apt_packages + WOVariables.wo_php else: - Log.debug(self, "PHP 7.2 already installed") - Log.info(self, "PHP 7.2 already installed") + Log.debug(self, "PHP 7.3 already installed") + Log.info(self, "PHP 7.3 already installed") else: - Log.debug(self, "PHP 7.2 Not Available for your Distribution") - Log.info(self, "PHP 7.2 Not Available for your Distribution") + Log.debug( + self, "PHP 7.3 Not Available for your Distribution") + Log.info(self, "PHP 7.3 Not Available for your Distribution") - #PHP 7.0 for Ubuntu - if self.app.pargs.php72 and not WOVariables.wo_platform_distro == 'debian': + # PHP 7.3 for Ubuntu + if self.app.pargs.php73 and not WOVariables.wo_platform_distro == 'debian': if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - Log.debug(self, "Setting apt_packages variable for PHP 7.2") - if not WOAptGet.is_installed(self, 'php7.2-fpm') : - apt_packages = apt_packages + WOVariables.wo_php72 + WOVariables.wo_php_extra + Log.debug(self, "Setting apt_packages variable for PHP 7.3") + if not WOAptGet.is_installed(self, 'php7.3-fpm'): + apt_packages = apt_packages + WOVariables.wo_php73 + WOVariables.wo_php_extra else: - Log.debug(self, "PHP 7.2 already installed") - Log.info(self, "PHP 7.2 already installed") + Log.debug(self, "PHP 7.3 already installed") + Log.info(self, "PHP 7.3 already installed") else: - Log.debug(self, "Unfortunately PHP 7.2 is not available for your Ubuntu or Debian version.") - Log.info(self, "Unfortunately PHP 7.2 is not available for your Ubuntu or Debian version.") - + Log.debug( + self, "Unfortunately PHP 7.3 is not available for your Ubuntu or Debian version.") + Log.info( + self, "Unfortunately PHP 7.3 is not available for your Ubuntu or Debian version.") if self.app.pargs.hhvm: Log.debug(self, "Setting apt packages variable for HHVM") @@ -1458,7 +1465,7 @@ class WOStackController(CementBaseController): if self.app.pargs.wpcli: Log.debug(self, "Setting packages variable for WP-CLI") - if not WOShellExec.cmd_exec(self, "which wp"): + if not WOShellExec.cmd_exec(self, "command -v wp"): packages = packages + [["https://github.com/wp-cli/wp-cli/" "releases/download/v{0}/" "wp-cli-{0}.phar" @@ -1478,7 +1485,7 @@ class WOStackController(CementBaseController): Log.debug(self, "Setting packages varible for phpRedisAdmin") packages = packages + [["https://github.com/ErikDubbelboer/" "phpRedisAdmin/archive/master.tar.gz", - "/tmp/pra.tar.gz","phpRedisAdmin"], + "/tmp/pra.tar.gz", "phpRedisAdmin"], ["https://github.com/nrk/predis/" "archive/v1.0.1.tar.gz", "/tmp/predis.tar.gz", "Predis"]] @@ -1492,7 +1499,7 @@ class WOStackController(CementBaseController): "htdocs/db/adminer/index.php" .format(WOVariables.wo_webroot), "Adminer"]] - + if self.app.pargs.utils: Log.debug(self, "Setting packages variable for utils") packages = packages + [["https://storage.googleapis.com/google-code-archive-downloads/" @@ -1563,19 +1570,21 @@ class WOStackController(CementBaseController): if os.path.isfile("/etc/redis/redis.conf"): if WOVariables.wo_ram < 512: Log.debug(self, "Setting maxmemory variable to {0} in redis.conf" - .format(int(WOVariables.wo_ram*1024*1024*0.1))) + .format(int(WOVariables.wo_ram*1024*1024*0.1))) WOShellExec.cmd_exec(self, "sed -i 's/# maxmemory /maxmemory {0}/' /etc/redis/redis.conf" .format(int(WOVariables.wo_ram*1024*1024*0.1))) - Log.debug(self, "Setting maxmemory-policy variable to allkeys-lru in redis.conf") + Log.debug( + self, "Setting maxmemory-policy variable to allkeys-lru in redis.conf") WOShellExec.cmd_exec(self, "sed -i 's/# maxmemory-policy.*/maxmemory-policy allkeys-lru/' " "/etc/redis/redis.conf") WOService.restart_service(self, 'redis-server') else: Log.debug(self, "Setting maxmemory variable to {0} in redis.conf" - .format(int(WOVariables.wo_ram*1024*1024*0.2))) + .format(int(WOVariables.wo_ram*1024*1024*0.2))) WOShellExec.cmd_exec(self, "sed -i 's/# maxmemory /maxmemory {0}/' /etc/redis/redis.conf" .format(int(WOVariables.wo_ram*1024*1024*0.2))) - Log.debug(self, "Setting maxmemory-policy variable to allkeys-lru in redis.conf") + Log.debug( + self, "Setting maxmemory-policy variable to allkeys-lru in redis.conf") WOShellExec.cmd_exec(self, "sed -i 's/# maxmemory-policy.*/maxmemory-policy allkeys-lru/' " "/etc/redis/redis.conf") WOService.restart_service(self, 'redis-server') @@ -1594,12 +1603,12 @@ class WOStackController(CementBaseController): packages = [] if ((not self.app.pargs.web) and (not self.app.pargs.admin) and - (not self.app.pargs.nginx) and (not self.app.pargs.php) and - (not self.app.pargs.php72) and (not self.app.pargs.mysql) and - (not self.app.pargs.wpcli) and (not self.app.pargs.phpmyadmin) and - (not self.app.pargs.hhvm) and (not self.app.pargs.adminer) and - (not self.app.pargs.utils) and (not self.app.pargs.all) and - (not self.app.pargs.redis) and (not self.app.pargs.phpredisadmin)): + (not self.app.pargs.nginx) and (not self.app.pargs.php) and + (not self.app.pargs.php73) and (not self.app.pargs.mysql) and + (not self.app.pargs.wpcli) and (not self.app.pargs.phpmyadmin) and + (not self.app.pargs.hhvm) and (not self.app.pargs.adminer) and + (not self.app.pargs.utils) and (not self.app.pargs.all) and + (not self.app.pargs.redis) and (not self.app.pargs.phpredisadmin)): self.app.pargs.web = True self.app.pargs.admin = True @@ -1607,7 +1616,7 @@ class WOStackController(CementBaseController): self.app.pargs.web = True self.app.pargs.admin = True if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - self.app.pargs.php72 = True + self.app.pargs.php73 = True if self.app.pargs.web: self.app.pargs.nginx = True @@ -1625,35 +1634,35 @@ class WOStackController(CementBaseController): Log.debug(self, "Removing apt_packages variable of Nginx") apt_packages = apt_packages + WOVariables.wo_nginx else: - Log.error(self,"Cannot Remove! Nginx Stable version not found.") + Log.error(self, "Cannot Remove! Nginx Stable version not found.") if self.app.pargs.php: Log.debug(self, "Removing apt_packages variable of PHP") if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - apt_packages = apt_packages + WOVariables.wo_php72 + apt_packages = apt_packages + WOVariables.wo_php if not WOAptGet.is_installed(self, 'php7.2-fpm'): apt_packages = apt_packages + WOVariables.wo_php_extra else: apt_packages = apt_packages + WOVariables.wo_php - #PHP7.0 for debian(jessie+) - if self.app.pargs.php72: + # PHP7.3 for debian(jessie+) + if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'jessie'): - Log.debug(self, "Removing apt_packages variable of PHP 7.0") - apt_packages = apt_packages + WOVariables.wo_php72 - if not WOAptGet.is_installed(self, 'php5-fpm'): + Log.debug(self, "Removing apt_packages variable of PHP 7.3") + apt_packages = apt_packages + WOVariables.wo_php73 + if not WOAptGet.is_installed(self, 'php7.3-fpm'): apt_packages = apt_packages + WOVariables.wo_php_extra else: - Log.info(self,"PHP 7.0 not supported.") + Log.info(self, "PHP 7.3 not supported.") - if self.app.pargs.php72: + if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - Log.debug(self, "Removing apt_packages variable of PHP 7.0") - apt_packages = apt_packages + WOVariables.wo_php72 - if not WOAptGet.is_installed(self, 'php5.6-fpm'): + Log.debug(self, "Removing apt_packages variable of PHP 7.3") + apt_packages = apt_packages + WOVariables.wo_php73 + if not WOAptGet.is_installed(self, 'php7.3-fpm'): apt_packages = apt_packages + WOVariables.wo_php_extra else: - Log.info(self,"PHP 7.0 not supported.") + Log.info(self, "PHP 7.3 not supported.") if self.app.pargs.hhvm: if WOAptGet.is_installed(self, 'hhvm'): @@ -1712,7 +1721,7 @@ class WOStackController(CementBaseController): if wo_prompt == 'YES' or wo_prompt == 'yes': - if (set(["nginx-custom"]).issubset(set(apt_packages))) : + if (set(["nginx-custom"]).issubset(set(apt_packages))): WOService.stop_service(self, 'nginx') if len(packages): @@ -1725,16 +1734,16 @@ class WOStackController(CementBaseController): WOAptGet.remove(self, apt_packages) WOAptGet.auto_remove(self) - Log.info(self, "Successfully removed packages") - #Added for Ondrej Repo missing package Fix - if self.app.pargs.php72: - if WOAptGet.is_installed(self, 'php5.6-fpm'): - Log.info(self, "PHP5.6-fpm found on system.") - Log.info(self, "Verifying and installing missing packages,") - WOShellExec.cmd_exec(self, "apt-get install -y php-memcached php-igbinary") - + # Added for Ondrej Repo missing package Fix + if self.app.pargs.php: + if WOAptGet.is_installed(self, 'php7.2-fpm'): + Log.info(self, "PHP7.2-fpm found on system.") + Log.info( + self, "Verifying and installing missing packages,") + WOShellExec.cmd_exec( + self, "apt-get install -y php-memcached php-igbinary") @expose(help="Purge packages") def purge(self): @@ -1744,12 +1753,12 @@ class WOStackController(CementBaseController): # Default action for stack purge if ((not self.app.pargs.web) and (not self.app.pargs.admin) and - (not self.app.pargs.nginx) and (not self.app.pargs.php) and - (not self.app.pargs.php7) and (not self.app.pargs.mysql) and - (not self.app.pargs.wpcli) and (not self.app.pargs.phpmyadmin) and - (not self.app.pargs.hhvm) and (not self.app.pargs.adminer) and - (not self.app.pargs.utils) and (not self.app.pargs.all) and - (not self.app.pargs.redis) and (not self.app.pargs.phpredisadmin)): + (not self.app.pargs.nginx) and (not self.app.pargs.php) and + (not self.app.pargs.php73) and (not self.app.pargs.mysql) and + (not self.app.pargs.wpcli) and (not self.app.pargs.phpmyadmin) and + (not self.app.pargs.hhvm) and (not self.app.pargs.adminer) and + (not self.app.pargs.utils) and (not self.app.pargs.all) and + (not self.app.pargs.redis) and (not self.app.pargs.phpredisadmin)): self.app.pargs.web = True self.app.pargs.admin = True @@ -1757,7 +1766,7 @@ class WOStackController(CementBaseController): self.app.pargs.web = True self.app.pargs.admin = True if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - self.app.pargs.php7 = True + self.app.pargs.php73 = True if self.app.pargs.web: self.app.pargs.nginx = True @@ -1775,32 +1784,32 @@ class WOStackController(CementBaseController): Log.debug(self, "Purge apt_packages variable of Nginx") apt_packages = apt_packages + WOVariables.wo_nginx else: - Log.error(self,"Cannot Purge! Nginx Stable version not found.") + Log.error(self, "Cannot Purge! Nginx Stable version not found.") if self.app.pargs.php: Log.debug(self, "Purge apt_packages variable PHP") if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): apt_packages = apt_packages + WOVariables.wo_php_extra else: - apt_packages = apt_packages + WOVariables.wo_php72 + apt_packages = apt_packages + WOVariables.wo_php73 - #For debian --php7 - if self.app.pargs.php72: + # For debian --php73 + if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'jessie'): - Log.debug(self, "Removing apt_packages variable of PHP 7.0") - apt_packages = apt_packages + WOVariables.wo_php72 - if not WOAptGet.is_installed(self, 'php5-fpm'): + Log.debug(self, "Removing apt_packages variable of PHP 7.3") + apt_packages = apt_packages + WOVariables.wo_php73 + if not WOAptGet.is_installed(self, 'php7.2-fpm'): apt_packages = apt_packages + WOVariables.wo_php_extra else: - Log.info(self,"PHP 7.2 not supported.") + Log.info(self, "PHP 7.3 not supported.") - if self.app.pargs.php72: + if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - Log.debug(self, "Removing apt_packages variable of PHP 7.0") - apt_packages = apt_packages + WOVariables.wo_php72 - if not WOAptGet.is_installed(self, 'php5.6-fpm'): + Log.debug(self, "Removing apt_packages variable of PHP 7.3") + apt_packages = apt_packages + WOVariables.wo_php73 + if not WOAptGet.is_installed(self, 'php7.3-fpm'): apt_packages = apt_packages + WOVariables.wo_php_extra else: - Log.info(self,"PHP 7.2 not supported.") + Log.info(self, "PHP 7.3 not supported.") if self.app.pargs.hhvm: if WOAptGet.is_installed(self, 'hhvm'): Log.debug(self, "Purge apt_packages varible of HHVM") @@ -1855,7 +1864,7 @@ class WOStackController(CementBaseController): if wo_prompt == 'YES' or wo_prompt == 'yes': - if (set(["nginx-custom"]).issubset(set(apt_packages))) : + if (set(["nginx-custom"]).issubset(set(apt_packages))): WOService.stop_service(self, 'nginx') if len(apt_packages): @@ -1867,16 +1876,16 @@ class WOStackController(CementBaseController): WOFileUtils.remove(self, packages) WOAptGet.auto_remove(self) - Log.info(self, "Successfully purged packages") - #Added for php Ondrej repo missing package fix - if self.app.pargs.php72: - if WOAptGet.is_installed(self, 'php5.6-fpm'): - Log.info(self, "PHP5.6-fpm found on system.") - Log.info(self, "Verifying and installing missing packages,") - WOShellExec.cmd_exec(self, "apt-get install -y php-memcached php-igbinary") - + # Added for php Ondrej repo missing package fix + if self.app.pargs.php73: + if WOAptGet.is_installed(self, 'php7.3-fpm'): + Log.info(self, "PHP7.3-fpm found on system.") + Log.info( + self, "Verifying and installing missing packages,") + WOShellExec.cmd_exec( + self, "apt-get install -y php-memcached php-igbinary") def load(app): @@ -1887,4 +1896,4 @@ def load(app): handler.register(WOStackUpgradeController) # register a hook (function) to run after arguments are parsed. - hook.register('post_argument_parsing', wo_stack_hook) \ No newline at end of file + hook.register('post_argument_parsing', wo_stack_hook) diff --git a/wo/cli/plugins/stack_services.py b/wo/cli/plugins/stack_services.py index 10183d6..a2cf3c5 100644 --- a/wo/cli/plugins/stack_services.py +++ b/wo/cli/plugins/stack_services.py @@ -15,13 +15,13 @@ class WOStackStatusController(CementBaseController): arguments = [ (['--memcache'], dict(help='start/stop/restart memcache', action='store_true')), - ] + ] @expose(help="Start stack services") def start(self): """Start services""" services = [] - if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php7 + if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php73 or self.app.pargs.mysql or self.app.pargs.hhvm or self.app.pargs.memcache or self.app.pargs.redis): self.app.pargs.nginx = True @@ -29,43 +29,43 @@ class WOStackStatusController(CementBaseController): self.app.pargs.mysql = True if self.app.pargs.nginx: - if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self,'nginx-mainline'): + if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self, 'nginx-mainline'): services = services + ['nginx'] else: Log.info(self, "Nginx is not 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'): - services = services + ['php5-fpm'] + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: - Log.info(self, "PHP5-FPM is not installed") + Log.info(self, "PHP7.2-FPM is not installed") else: - if WOAptGet.is_installed(self, 'php5.6-fpm'): - services = services + ['php5.6-fpm'] + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: - Log.info(self, "PHP5.6-FPM is not installed") + Log.info(self, "PHP7.2-FPM is not installed") if WOAptGet.is_installed(self, 'php7.2-fpm'): services = services + ['php7.2-fpm'] else: Log.info(self, "PHP7.2-FPM is not installed") - if self.app.pargs.php7: + if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] else: - Log.info(self, "PHP7.2-FPM is not installed") + Log.info(self, "PHP7.3-FPM is not installed") else: - Log.info(self, "Your platform does not support PHP 7") + Log.info(self, "Your platform does not support PHP 7.3") if self.app.pargs.mysql: if ((WOVariables.wo_mysql_host is "localhost") or - (WOVariables.wo_mysql_host is "127.0.0.1")): + (WOVariables.wo_mysql_host is "127.0.0.1")): if (WOAptGet.is_installed(self, 'mysql-server') or - WOAptGet.is_installed(self, 'percona-server-server-5.6') or - WOAptGet.is_installed(self, 'mariadb-server')): + WOAptGet.is_installed(self, 'percona-server-server-5.6') or + WOAptGet.is_installed(self, 'mariadb-server')): services = services + ['mysql'] else: Log.info(self, "MySQL is not installed") @@ -98,7 +98,7 @@ class WOStackStatusController(CementBaseController): def stop(self): """Stop services""" services = [] - if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php7 + if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php73 or self.app.pargs.mysql or self.app.pargs.hhvm or self.app.pargs.memcache or self.app.pargs.redis): self.app.pargs.nginx = True @@ -106,43 +106,43 @@ class WOStackStatusController(CementBaseController): self.app.pargs.mysql = True if self.app.pargs.nginx: - if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self,'nginx-mainline'): + if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self, 'nginx-mainline'): services = services + ['nginx'] else: Log.info(self, "Nginx is not 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'): - services = services + ['php5-fpm'] + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: Log.info(self, "PHP5-FPM is not installed") else: - if WOAptGet.is_installed(self, 'php5.6-fpm'): - services = services + ['php5.6-fpm'] + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: - Log.info(self, "PHP5.6-FPM is not installed") + Log.info(self, "PHP7.2-FPM is not installed") if WOAptGet.is_installed(self, 'php7.2-fpm'): services = services + ['php7.2-fpm'] else: Log.info(self, "PHP7.2-FPM is not installed") - if self.app.pargs.php7: + if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] else: - Log.info(self, "PHP7.2-FPM is not installed") + Log.info(self, "PHP7.3-FPM is not installed") else: - Log.info(self, "Your platform does not support PHP 7") + Log.info(self, "Your platform does not support PHP 7.3") if self.app.pargs.mysql: if ((WOVariables.wo_mysql_host is "localhost") or - (WOVariables.wo_mysql_host is "127.0.0.1")): + (WOVariables.wo_mysql_host is "127.0.0.1")): if (WOAptGet.is_installed(self, 'mysql-server') or - WOAptGet.is_installed(self, 'percona-server-server-5.6') or - WOAptGet.is_installed(self, 'mariadb-server')): + WOAptGet.is_installed(self, 'percona-server-server-5.6') or + WOAptGet.is_installed(self, 'mariadb-server')): services = services + ['mysql'] else: Log.info(self, "MySQL is not installed") @@ -175,7 +175,7 @@ class WOStackStatusController(CementBaseController): def restart(self): """Restart services""" services = [] - if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php7 + if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php73 or self.app.pargs.mysql or self.app.pargs.hhvm or self.app.pargs.memcache or self.app.pargs.redis): self.app.pargs.nginx = True @@ -183,44 +183,43 @@ class WOStackStatusController(CementBaseController): self.app.pargs.mysql = True if self.app.pargs.nginx: - if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self,'nginx-mainline'): + if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self, 'nginx-mainline'): services = services + ['nginx'] else: Log.info(self, "Nginx is not 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'): - services = services + ['php5-fpm'] + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: - Log.info(self, "PHP5-FPM is not installed") + Log.info(self, "PHP7.2-FPM is not installed") else: - if WOAptGet.is_installed(self, 'php5.6-fpm'): - services = services + ['php5.6-fpm'] + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: - Log.info(self, "PHP5.6-FPM is not installed") + Log.info(self, "PHP7.2-FPM is not installed") if WOAptGet.is_installed(self, 'php7.2-fpm'): services = services + ['php7.2-fpm'] else: Log.info(self, "PHP7.2-FPM is not installed") - if self.app.pargs.php7: + if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] else: - Log.info(self, "PHP7.2-FPM is not installed") + Log.info(self, "PHP7.3-FPM is not installed") else: - Log.info(self, "Your platform does not support PHP 7") - + Log.info(self, "Your platform does not support PHP 7.3") if self.app.pargs.mysql: if ((WOVariables.wo_mysql_host is "localhost") or - (WOVariables.wo_mysql_host is "127.0.0.1")): + (WOVariables.wo_mysql_host is "127.0.0.1")): if (WOAptGet.is_installed(self, 'mysql-server') or - WOAptGet.is_installed(self, 'percona-server-server-5.6') or - WOAptGet.is_installed(self, 'mariadb-server')): + WOAptGet.is_installed(self, 'percona-server-server-5.6') or + WOAptGet.is_installed(self, 'mariadb-server')): services = services + ['mysql'] else: Log.info(self, "MySQL is not installed") @@ -253,7 +252,7 @@ class WOStackStatusController(CementBaseController): def status(self): """Status of services""" services = [] - if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php7 + if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php73 or self.app.pargs.mysql or self.app.pargs.hhvm or self.app.pargs.memcache or self.app.pargs.redis): self.app.pargs.nginx = True @@ -262,43 +261,43 @@ class WOStackStatusController(CementBaseController): self.app.pargs.hhvm = True if self.app.pargs.nginx: - if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self,'nginx-mainline'): + if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self, 'nginx-mainline'): services = services + ['nginx'] else: Log.info(self, "Nginx is not 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'): - services = services + ['php5-fpm'] + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: - Log.info(self, "PHP5-FPM is not installed") + Log.info(self, "PHP7.2-FPM is not installed") else: - if WOAptGet.is_installed(self, 'php5.6-fpm'): - services = services + ['php5.6-fpm'] + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: - Log.info(self, "PHP5.6-FPM is not installed") + Log.info(self, "PHP7.2-FPM is not installed") if WOAptGet.is_installed(self, 'php7.2-fpm'): services = services + ['php7.2-fpm'] else: Log.info(self, "PHP7.2-FPM is not installed") - if self.app.pargs.php7: + if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] else: - Log.info(self, "PHP7.2-FPM is not installed") + Log.info(self, "PHP7.3-FPM is not installed") else: - Log.info(self, "Your platform does not support PHP 7") + Log.info(self, "Your platform does not support PHP 7.3") if self.app.pargs.mysql: if ((WOVariables.wo_mysql_host is "localhost") or - (WOVariables.wo_mysql_host is "127.0.0.1")): + (WOVariables.wo_mysql_host is "127.0.0.1")): if (WOAptGet.is_installed(self, 'mysql-server') or - WOAptGet.is_installed(self, 'percona-server-server-5.6') or - WOAptGet.is_installed(self, 'mariadb-server')): + WOAptGet.is_installed(self, 'percona-server-server-5.6') or + WOAptGet.is_installed(self, 'mariadb-server')): services = services + ['mysql'] else: Log.info(self, "MySQL is not installed") @@ -331,51 +330,51 @@ class WOStackStatusController(CementBaseController): def reload(self): """Reload service""" services = [] - if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php7 - or self.app.pargs.mysql or self.app.pargs.hhvm or self.app.pargs.memcache + if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php73 + or self.app.pargs.mysql or self.app.pargs.hhvm or self.app.pargs.memcache or self.app.pargs.redis): self.app.pargs.nginx = True self.app.pargs.php = True self.app.pargs.mysql = True if self.app.pargs.nginx: - if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self,'nginx-mainline'): + if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self, 'nginx-mainline'): services = services + ['nginx'] else: Log.info(self, "Nginx is not 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'): - services = services + ['php5-fpm'] + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: - Log.info(self, "PHP5-FPM is not installed") + Log.info(self, "PHP7.2-FPM is not installed") else: - if WOAptGet.is_installed(self, 'php5.6-fpm'): - services = services + ['php5.6-fpm'] + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: - Log.info(self, "PHP5.6-FPM is not installed") + Log.info(self, "php7.2-fpm is not installed") if WOAptGet.is_installed(self, 'php7.2-fpm'): services = services + ['php7.2-fpm'] else: Log.info(self, "PHP7.2-FPM is not installed") - if self.app.pargs.php7: + if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] else: - Log.info(self, "PHP7.2-FPM is not installed") + Log.info(self, "PHP7.3-FPM is not installed") else: Log.info(self, "Your platform does not support PHP 7") if self.app.pargs.mysql: if ((WOVariables.wo_mysql_host is "localhost") or - (WOVariables.wo_mysql_host is "127.0.0.1")): + (WOVariables.wo_mysql_host is "127.0.0.1")): if (WOAptGet.is_installed(self, 'mysql-server') or - WOAptGet.is_installed(self, 'percona-server-server-5.6') or - WOAptGet.is_installed(self, 'mariadb-server')): + WOAptGet.is_installed(self, 'percona-server-server-5.6') or + WOAptGet.is_installed(self, 'mariadb-server')): services = services + ['mysql'] else: Log.info(self, "MySQL is not installed") @@ -391,7 +390,7 @@ class WOStackStatusController(CementBaseController): services = services + ['memcached'] else: Log.info(self, "Memcache is not installed") - + if self.app.pargs.redis: if WOAptGet.is_installed(self, 'redis-server'): services = services + ['redis-server'] diff --git a/wo/cli/templates/php.mustache b/wo/cli/templates/php.mustache index 65f75fe..7288f48 100644 --- a/wo/cli/templates/php.mustache +++ b/wo/cli/templates/php.mustache @@ -6,5 +6,5 @@ location / { location ~ \.php$ { try_files $uri =404; include fastcgi_params; - fastcgi_pass php; + fastcgi_pass php72; } diff --git a/wo/cli/templates/php7.mustache b/wo/cli/templates/php7.mustache index 871d3c5..d0ab167 100644 --- a/wo/cli/templates/php7.mustache +++ b/wo/cli/templates/php7.mustache @@ -6,5 +6,5 @@ location / { location ~ \.php$ { try_files $uri =404; include fastcgi_params; - fastcgi_pass php7; + fastcgi_pass php73; } diff --git a/wo/cli/templates/redis-php7.mustache b/wo/cli/templates/redis-php7.mustache index 93d5943..42779bb 100644 --- a/wo/cli/templates/redis-php7.mustache +++ b/wo/cli/templates/redis-php7.mustache @@ -52,5 +52,5 @@ location ~ \.php$ { more_set_headers 'X-SRCache-Store-Status $srcache_store_status'; include fastcgi_params; - fastcgi_pass php7; + fastcgi_pass php73; } diff --git a/wo/cli/templates/redis.mustache b/wo/cli/templates/redis.mustache index e29e02f..273a1c3 100644 --- a/wo/cli/templates/redis.mustache +++ b/wo/cli/templates/redis.mustache @@ -53,5 +53,5 @@ location ~ \.php$ { more_set_headers 'X-SRCache-Store-Status $srcache_store_status'; include fastcgi_params; - fastcgi_pass php; + fastcgi_pass php72; } diff --git a/wo/cli/templates/upstream.mustache b/wo/cli/templates/upstream.mustache index 3db3ead..9e8f1e4 100644 --- a/wo/cli/templates/upstream.mustache +++ b/wo/cli/templates/upstream.mustache @@ -1,18 +1,24 @@ # Common upstream settings upstream php { -server 127.0.0.1:9072; +server 127.0.0.1:9000; } upstream debug { # Debug Pool -server 127.0.0.1:9172; +server 127.0.0.1:9100; +} +upstream php72 { +server unix:/var/run/php/php72-fpm.sock; +} +upstream php73 { +server unix:/var/run/php/php73-fpm.sock; } {{#php7conf}} upstream php7 { -server 127.0.0.1:9072; +server 127.0.0.1:9070; } upstream debug7 { # Debug Pool -server 127.0.0.1:9172; +server 127.0.0.1:9170; } {{/php7conf}} diff --git a/wo/cli/templates/wpcommon-php7.mustache b/wo/cli/templates/wpcommon-php7.mustache index 1b4b0fc..e99977b 100644 --- a/wo/cli/templates/wpcommon-php7.mustache +++ b/wo/cli/templates/wpcommon-php7.mustache @@ -4,7 +4,7 @@ location = /wp-login.php { limit_req zone=one burst=1 nodelay; include fastcgi_params; - fastcgi_pass php7; + fastcgi_pass php73; } # Disable wp-config.txt location = /wp-config.txt { diff --git a/wo/cli/templates/wpfc-php7.mustache b/wo/cli/templates/wpfc-php7.mustache index b62d088..55c999d 100644 --- a/wo/cli/templates/wpfc-php7.mustache +++ b/wo/cli/templates/wpfc-php7.mustache @@ -26,7 +26,7 @@ location ~ ^/wp-content/cache/minify/(.+\.(css|js))$ { location ~ \.php$ { try_files $uri =404; include fastcgi_params; - fastcgi_pass php7; + fastcgi_pass php73; fastcgi_cache_bypass $skip_cache; fastcgi_no_cache $skip_cache; fastcgi_cache WORDPRESS; diff --git a/wo/cli/templates/wpfc.mustache b/wo/cli/templates/wpfc.mustache index ec03b0c..666c177 100644 --- a/wo/cli/templates/wpfc.mustache +++ b/wo/cli/templates/wpfc.mustache @@ -26,7 +26,7 @@ location ~ ^/wp-content/cache/minify/(.+\.(css|js))$ { location ~ \.php$ { try_files $uri =404; include fastcgi_params; - fastcgi_pass php; + fastcgi_pass php72; fastcgi_cache_bypass $skip_cache; fastcgi_no_cache $skip_cache; fastcgi_cache WORDPRESS; diff --git a/wo/cli/templates/wpsc-php7.mustache b/wo/cli/templates/wpsc-php7.mustache index 7cca3f8..80f96cc 100644 --- a/wo/cli/templates/wpsc-php7.mustache +++ b/wo/cli/templates/wpsc-php7.mustache @@ -25,7 +25,7 @@ location / { location ~ \.php$ { try_files $uri =404; include fastcgi_params; - fastcgi_pass php7; + fastcgi_pass php73; # Following line is needed by WP Super Cache plugin fastcgi_param SERVER_NAME $http_host; } diff --git a/wo/cli/templates/wpsc.mustache b/wo/cli/templates/wpsc.mustache index e5b1648..acbbfe8 100644 --- a/wo/cli/templates/wpsc.mustache +++ b/wo/cli/templates/wpsc.mustache @@ -25,7 +25,7 @@ location / { location ~ \.php$ { try_files $uri =404; include fastcgi_params; - fastcgi_pass php; + fastcgi_pass php72; # Following line is needed by WP Super Cache plugin fastcgi_param SERVER_NAME $http_host; } diff --git a/wo/core/services.py b/wo/core/services.py index ad5d8b8..c028880 100644 --- a/wo/core/services.py +++ b/wo/core/services.py @@ -100,8 +100,8 @@ class WOService(): Log.info(self, "Reload : {0:10}".format(service_name), end='') retcode = subprocess.getstatusoutput(service_cmd) if retcode[0] == 0: - Log.info(self, "[" + Log.ENDC + "OK" + Log.OKBLUE + "]") - return True + Log.info(self, "[" + Log.ENDC + "OK" + Log.OKBLUE + "]") + return True else: Log.debug(self, "{0}".format(retcode[1])) Log.info(self, "[" + Log.FAIL + "Failed" + Log.OKBLUE+"]") @@ -113,11 +113,10 @@ class WOService(): def get_service_status(self, service_name): - try: is_exist = subprocess.getstatusoutput('which {0}' .format(service_name)) - if is_exist[0] == 0 or service_name in ['php7.0-fpm', 'php5.6-fpm']: + if is_exist[0] == 0 or service_name in ['php7.2-fpm', 'php7.3-fpm']: retcode = subprocess.getstatusoutput('service {0} status' .format(service_name)) if retcode[0] == 0: diff --git a/wo/core/variables.py b/wo/core/variables.py index 4139c21..43c63b1 100644 --- a/wo/core/variables.py +++ b/wo/core/variables.py @@ -11,14 +11,14 @@ import datetime class WOVariables(): """Intialization of core variables""" - # WordOps version + # WordOps version wo_version = "3.9.2" # WordOps packages versions wo_wp_cli = "2.0.1" wo_adminer = "4.6.3" # Get WPCLI path - wo_wpcli_path = os.popen('which wp | tr "\n" " "').read() + wo_wpcli_path = os.popen('command -v wp | tr "\n" " "').read() if wo_wpcli_path == '': wo_wpcli_path = '/usr/bin/wp ' @@ -68,9 +68,9 @@ class WOVariables(): wo_mysql_host = "" config = configparser.RawConfigParser() if os.path.exists('/etc/mysql/conf.d/my.cnf'): - cnfpath = "/etc/mysql/conf.d/my.cnf" + cnfpath = "/etc/mysql/conf.d/my.cnf" else: - cnfpath = os.path.expanduser("~")+"/.my.cnf" + cnfpath = os.path.expanduser("~")+"/.my.cnf" if [cnfpath] == config.read(cnfpath): try: wo_mysql_host = config.get('client', 'host') @@ -89,7 +89,7 @@ class WOVariables(): "/rtCamp:/EasyEngine/xUbuntu_16.04/ /") elif wo_platform_codename == 'bionic': wo_nginx_repo = ("deb http://download.opensuse.org/repositories/home:" - "/rtCamp:/EasyEngine/xUbuntu_18.04/ /") + "/rtCamp:/EasyEngine/xUbuntu_18.04/ /") elif wo_platform_codename == 'jessie': wo_nginx_repo = ("deb http://download.opensuse.org/repositories/home:" "/rtCamp:/EasyEngine/Debian_8.0/ /") @@ -104,40 +104,41 @@ class WOVariables(): if wo_platform_distro == 'ubuntu': if (wo_platform_codename == 'trusty' or wo_platform_codename == 'xenial' or wo_platform_codename == 'bionic'): wo_php_repo = "ppa:ondrej/php" - wo_php = ["php7.2-fpm", "php-sodium", "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_php72 = ["php7.2-fpm", "php-sodium", "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", + 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_php73 = ["php7.3-fpm", "php7.3-curl", "php7.3-gd", "php7.3-imap", + "php7.3-readline", "php7.3-common", "php7.3-recode", + "php7.3-cli", "php7.3-mbstring", + "php7.3-bcmath", "php7.3-mysql", "php7.3-opcache", "php7.3-zip", "php7.3-xml", "php7.3-soap"] + wo_php_extra = ["php-memcached", "php-imagick", "graphviz", "php-pear", "php-xdebug", "php-msgpack", "php-redis"] elif wo_platform_distro == 'debian': - wo_php_repo = ("deb https://packages.sury.org/php/ {codename} main".format(codename=wo_platform_codename)) + wo_php_repo = ( + "deb https://packages.sury.org/php/ {codename} main".format(codename=wo_platform_codename)) wo_php = ["php7.2-fpm", "php7.2-curl", "php7.2-gd", "php7.2-imap", - "php-sodium", "php7.2-common", "php7.2-readline", "php7.2-redis", - "php7.2-mysql", "php7.2-cli", "php7.2-memcache", "php7.2-imagick", + "php7.2-common", "php7.2-readline", "php-redis", + "php7.2-mysql", "php7.2-cli", "php-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_php72 = ["php7.2-fpm", "php7.2-curl", "php7.2-gd", "php7.2-imap", - "php-sodium", "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"] + "php7.2-soap", "php7.2-msgpack", + "graphviz", "php-pear", "php-xdebug"] + wo_php73 = ["php7.3-fpm", "php7.3-curl", "php7.3-gd", "php7.3-imap", + "php7.3-common", "php7.3-readline", "php-redis", + "php7.3-mysql", "php7.3-cli", "php-imagick", + "php7.3-mbstring", "php7.3-recode", "php7.3-bcmath", "php7.3-opcache", "php7.3-zip", "php7.3-xml", + "php7.3-soap", "php7.3-msgpack", + "graphviz", "php-pear", "php-xdebug"] wo_php_extra = [] # MySQL repo and packages if wo_platform_distro == 'ubuntu': wo_mysql_repo = ("deb [arch=amd64,i386,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/" - "10.1/ubuntu {codename} main" + "10.3/ubuntu {codename} main" .format(codename=wo_platform_codename)) elif wo_platform_distro == 'debian': wo_mysql_repo = ("deb [arch=amd64,i386,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/" - "10.1/debian {codename} main" + "10.3/debian {codename} main" .format(codename=wo_platform_codename)) wo_mysql = ["mariadb-server", "percona-toolkit"] @@ -146,7 +147,7 @@ class WOVariables(): if wo_platform_distro == 'ubuntu': 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)) + .format(codename=wo_platform_codename)) else: wo_hhvm_repo = ("deb http://dl.hhvm.com/debian {codename} main" .format(codename=wo_platform_codename)) @@ -159,10 +160,10 @@ class WOVariables(): else: wo_redis_repo = ("deb https://packages.sury.org/php/ {codename} all" - .format(codename=wo_platform_codename)) + .format(codename=wo_platform_codename)) if (wo_platform_codename == 'trusty' or wo_platform_codename == 'xenial' or wo_platform_codename == 'bionic' or wo_platform_distro == 'debian'): - wo_redis = ['redis-server', 'php7.2-redis'] + wo_redis = ['redis-server', 'php-redis'] # Repo path wo_repo_file = "wo-repo.list" From 6de52b411e8d44a172325d2ccfa1666673b0782b Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Sun, 3 Mar 2019 00:08:51 +0100 Subject: [PATCH 05/56] restore previous version --- wo/cli/plugins/site.py | 146 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 139 insertions(+), 7 deletions(-) diff --git a/wo/cli/plugins/site.py b/wo/cli/plugins/site.py index 1a70bfc..30e3559 100644 --- a/wo/cli/plugins/site.py +++ b/wo/cli/plugins/site.py @@ -344,6 +344,9 @@ class WOSiteCreateController(CementBaseController): dest='wppass')), (['--proxy'], dict(help="create proxy for site", nargs='+')), + (['--experimental'], + dict(help="Enable Experimenal packages without prompt", + action='store_true')), ] @expose(hide=True) @@ -451,13 +454,48 @@ class WOSiteCreateController(CementBaseController): Log.error(self, "Can not create HTML site with HHVM") if data and self.app.pargs.php73: + if (not self.app.pargs.experimental): + Log.info(self, "Do you wish to install PHP 7.2 now for {0}?".format(wo_domain)) + + # Check prompt + check_prompt = input("Type \"y\" to continue [n]:") + if check_prompt != "Y" and check_prompt != "y": + Log.info(self, "Not using PHP 7.2 for site.") + data['php73'] = False + data['basic'] = True + php73 = 0 + self.app.pargs.php73 = False + else: data['php73'] = True php73 = 1 + else: + data['php73'] = True + php73 = 1 + elif data: + data['php73'] = False + php73 = 0 if (not self.app.pargs.wpfc) and (not self.app.pargs.wpsc) and (not self.app.pargs.wpredis) and (not self.app.pargs.hhvm): data['basic'] = True if data and self.app.pargs.hhvm: + if (not self.app.pargs.experimental): + Log.info(self, "HHVM is experimental feature and it may not " + "work with all plugins of your site.\nYou can " + "disable it by passing --hhvm=off later.\nDo you wish" + " to enable HHVM now for {0}?".format(wo_domain)) + + # Check prompt + check_prompt = input("Type \"y\" to continue [n]:") + if check_prompt != "Y" and check_prompt != "y": + Log.info(self, "Not using HHVM for site.") + data['hhvm'] = False + hhvm = 0 + self.app.pargs.hhvm = False + else: + data['hhvm'] = True + hhvm = 1 + else: data['hhvm'] = True hhvm = 1 @@ -465,7 +503,20 @@ class WOSiteCreateController(CementBaseController): data['hhvm'] = False hhvm = 0 - if cache == 'wpredis': + if (cache == 'wpredis' and (not self.app.pargs.experimental)): + Log.info(self, "Redis is experimental feature and it may not " + "work with all CSS/JS/Cache of your site.\nYou can " + "disable it by changing cache later.\nDo you wish" + " to enable Redis now for {0}?".format(wo_domain)) + + # Check prompt + check_prompt = input("Type \"y\" to continue [n]:") + if check_prompt != "Y" and check_prompt != "y": + Log.error(self, "Not using Redis for site") + cache = 'basic' + data['wpredis'] = False + data['basic'] = True + self.app.pargs.wpredis = False # Check rerequired packages are installed or not wo_auth = site_package_check(self, stype) @@ -513,7 +564,7 @@ class WOSiteCreateController(CementBaseController): return if data['php73']: - php_version = "7.3" + php_version = "7.2" else: php_version = "7.2" @@ -654,6 +705,23 @@ class WOSiteCreateController(CementBaseController): "`tail /var/log/wo/wordops.log` and please try again") if self.app.pargs.letsencrypt : + if (not self.app.pargs.experimental): + if stype in ['wpsubdomain']: + Log.warn(self, "Wildcard domains are not supported in Lets Encrypt.\nWP SUBDOMAIN site will get SSL for primary site only.") + + Log.info(self, "Letsencrypt is currently in beta phase." + " \nDo you wish" + " to enable SSl now for {0}?".format(wo_domain)) + + # Check prompt + check_prompt = input("Type \"y\" to continue [n]:") + if check_prompt != "Y" and check_prompt != "y": + data['letsencrypt'] = False + letsencrypt = False + else: + data['letsencrypt'] = True + letsencrypt = True + else: data['letsencrypt'] = True letsencrypt = True @@ -708,7 +776,7 @@ class WOSiteUpdateController(CementBaseController): (['--php'], dict(help="update to php site", action='store_true')), (['--php73'], - dict(help="update to PHP 7.3 site", + dict(help="update to php7 site", action='store' or 'store_const', choices=('on', 'off'), const='on', nargs='?')), (['--mysql'], @@ -736,6 +804,9 @@ class WOSiteUpdateController(CementBaseController): choices=('on', 'off', 'renew'), const='on', nargs='?')), (['--proxy'], dict(help="update to proxy site", nargs='+')), + (['--experimental'], + dict(help="Enable Experimenal packages without prompt", + action='store_true')), (['--all'], dict(help="update all sites", action='store_true')), ] @@ -970,19 +1041,19 @@ class WOSiteUpdateController(CementBaseController): if pargs.php73 == 'on' : data['php73'] = True php73 = True - check_php_version= '7.3' + check_php_version= '7.2' elif pargs.php73 == 'off': data['php73'] = False php73 = False - check_php_version = '7.2' + check_php_version = '5.6' if pargs.php73: if php73 is old_php73: if php73 is False: - Log.info(self, "PHP 7.3 is already disabled for given " + Log.info(self, "PHP 7.2 is already disabled for given " "site") elif php73 is True: - Log.info(self, "PHP 7.3 is already enabled for given " + Log.info(self, "PHP 7.2 is already enabled for given " "site") pargs.php73 = False @@ -1093,20 +1164,81 @@ class WOSiteUpdateController(CementBaseController): if pargs.hhvm=="on" or pargs.letsencrypt=="on" or pargs.php73=="on": if pargs.php73 == "on": + if (not pargs.experimental): + Log.info(self, "Do you wish to enable PHP 7.2 now for {0}?".format(wo_domain)) + + check_prompt = input("Type \"y\" to continue [n]:") + if check_prompt != "Y" and check_prompt != "y": + Log.info(self, "Not using PHP 7.2 for site") + data['php73'] = False + php73 = False + else: data['php73'] = True php73 = True + else: + data['php73'] = True + php73 = True if pargs.hhvm == "on": + if (not pargs.experimental): + Log.info(self, "HHVM is experimental feature and it may not" + " work with all plugins of your site.\nYou can " + "disable it by passing --hhvm=off later.\nDo you wish" + " to enable HHVM now for {0}?".format(wo_domain)) + + # Check prompt + check_prompt = input("Type \"y\" to continue [n]:") + if check_prompt != "Y" and check_prompt != "y": + Log.info(self, "Not using HHVM for site") + data['hhvm'] = False + hhvm = False + else: + data['hhvm'] = True + hhvm = True + else: data['hhvm'] = True hhvm = True if pargs.letsencrypt == "on": + + if (not pargs.experimental): + + if oldsitetype in ['wpsubdomain']: + Log.warn(self, "Wildcard domains are not supported in Lets Encrypt.\nWP SUBDOMAIN site will get SSL for primary site only.") + + Log.info(self, "Letsencrypt is currently in beta phase." + " \nDo you wish" + " to enable SSl now for {0}?".format(wo_domain)) + + check_prompt = input("Type \"y\" to continue [n]:") + if check_prompt != "Y" and check_prompt != "y": + Log.info(self, "Not using letsencrypt for site") + data['letsencrypt'] = False + letsencrypt = False + else: + data['letsencrypt'] = True + letsencrypt = True + else: data['letsencrypt'] = True letsencrypt = True if pargs.wpredis and data['currcachetype'] != 'wpredis': + if (not pargs.experimental): + Log.info(self, "Redis is experimental feature and it may not" + " work with all plugins of your site.\nYou can " + "disable it by changing cache type later.\nDo you wish" + " to enable Redis now for {0}?".format(wo_domain)) + + # Check prompt + check_prompt = input("Type \"y\" to continue [n]: ") + if check_prompt != "Y" and check_prompt != "y": + Log.error(self, "Not using Redis for site") + data['wpredis'] = False + data['basic'] = True + cache = 'basic' + if ((hhvm is old_hhvm) and (php73 is old_php73) and (stype == oldsitetype and cache == oldcachetype)): return 1 From 65cdb1553ed040640bdd1c6bb774dee1c7926352 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Sun, 3 Mar 2019 00:16:20 +0100 Subject: [PATCH 06/56] fix indentation --- wo/cli/plugins/site.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/wo/cli/plugins/site.py b/wo/cli/plugins/site.py index 30e3559..e9cb632 100644 --- a/wo/cli/plugins/site.py +++ b/wo/cli/plugins/site.py @@ -310,7 +310,7 @@ class WOSiteCreateController(CementBaseController): (['--php'], dict(help="create php site", action='store_true')), (['--php73'], - dict(help="create php 7.3 site", action='store_true')), + dict(help="create php 7.2 site", action='store_true')), (['--mysql'], dict(help="create mysql site", action='store_true')), (['--wp'], @@ -454,7 +454,7 @@ class WOSiteCreateController(CementBaseController): Log.error(self, "Can not create HTML site with HHVM") if data and self.app.pargs.php73: - if (not self.app.pargs.experimental): + if (self.app.pargs.experimental): Log.info(self, "Do you wish to install PHP 7.2 now for {0}?".format(wo_domain)) # Check prompt @@ -503,7 +503,7 @@ class WOSiteCreateController(CementBaseController): data['hhvm'] = False hhvm = 0 - if (cache == 'wpredis' and (not self.app.pargs.experimental)): + if (cache == 'wpredis' and (self.app.pargs.experimental)): Log.info(self, "Redis is experimental feature and it may not " "work with all CSS/JS/Cache of your site.\nYou can " "disable it by changing cache later.\nDo you wish" @@ -705,9 +705,9 @@ class WOSiteCreateController(CementBaseController): "`tail /var/log/wo/wordops.log` and please try again") if self.app.pargs.letsencrypt : - if (not self.app.pargs.experimental): + if (self.app.pargs.experimental): if stype in ['wpsubdomain']: - Log.warn(self, "Wildcard domains are not supported in Lets Encrypt.\nWP SUBDOMAIN site will get SSL for primary site only.") + Log.warn(self, "Wildcard domains are not supported in Lets Encrypt.\nWP SUBDOMAIN site will get SSL for primary site only.") Log.info(self, "Letsencrypt is currently in beta phase." " \nDo you wish" @@ -776,7 +776,7 @@ class WOSiteUpdateController(CementBaseController): (['--php'], dict(help="update to php site", action='store_true')), (['--php73'], - dict(help="update to php7 site", + dict(help="update to php73 site", action='store' or 'store_const', choices=('on', 'off'), const='on', nargs='?')), (['--mysql'], @@ -1041,19 +1041,19 @@ class WOSiteUpdateController(CementBaseController): if pargs.php73 == 'on' : data['php73'] = True php73 = True - check_php_version= '7.2' + check_php_version= '7.3' elif pargs.php73 == 'off': data['php73'] = False php73 = False - check_php_version = '5.6' + check_php_version = '7.2' if pargs.php73: if php73 is old_php73: if php73 is False: - Log.info(self, "PHP 7.2 is already disabled for given " + Log.info(self, "PHP 7.3 is already disabled for given " "site") elif php73 is True: - Log.info(self, "PHP 7.2 is already enabled for given " + Log.info(self, "PHP 7.3 is already enabled for given " "site") pargs.php73 = False @@ -1165,11 +1165,11 @@ class WOSiteUpdateController(CementBaseController): if pargs.hhvm=="on" or pargs.letsencrypt=="on" or pargs.php73=="on": if pargs.php73 == "on": if (not pargs.experimental): - Log.info(self, "Do you wish to enable PHP 7.2 now for {0}?".format(wo_domain)) + Log.info(self, "Do you wish to enable PHP 7.3 now for {0}?".format(wo_domain)) check_prompt = input("Type \"y\" to continue [n]:") if check_prompt != "Y" and check_prompt != "y": - Log.info(self, "Not using PHP 7.2 for site") + Log.info(self, "Not using PHP 7.3 for site") data['php73'] = False php73 = False else: @@ -1225,7 +1225,7 @@ class WOSiteUpdateController(CementBaseController): if pargs.wpredis and data['currcachetype'] != 'wpredis': - if (not pargs.experimental): + if (pargs.experimental): Log.info(self, "Redis is experimental feature and it may not" " work with all plugins of your site.\nYou can " "disable it by changing cache type later.\nDo you wish" From a20e610aff4b96315f3f6eeeb344d97c5d6e0c27 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Sun, 3 Mar 2019 14:54:12 +0100 Subject: [PATCH 07/56] testing php73 stack * add new travis test * remove temporarily few travis test to speed up the build * --experimental args isn't required anymore --- .travis.yml | 43 +++++++++++++----------------- wo/cli/plugins/site.py | 4 +-- wo/cli/plugins/site_functions.py | 18 ++++++------- wo/cli/plugins/stack.py | 16 +++++------ wo/cli/templates/wpcommon.mustache | 2 +- 5 files changed, 38 insertions(+), 45 deletions(-) diff --git a/.travis.yml b/.travis.yml index 62880fc..29431b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ before_script: - sudo rm -rf /etc/mysql/ - sudo bash -c 'echo example.com > /etc/hostname' - sudo apt-get -qq purge mysql* graphviz* - - sudo apt-get -qq autoremove + - sudo apt-get -qq autoremove --purge - sudo apt-get update script: @@ -20,7 +20,7 @@ script: - unset LANG - sudo bash -c 'echo -e "[user]\n\tname = abc\n\temail = root@localhost.com" > /home/travis/.gitconfig' - sudo echo "Travis Banch = $TRAVIS_BRANCH" - - sudo apt-get install -y --force-yes git python3-setuptools python3-dev python3-apt + - sudo apt-get install -y --force-yes git python3-setuptools python3-dev python3-apt ccze - sudo bash install $TRAVIS_BRANCH - sudo wo --help - sudo wo stack install || sudo tail -n50 /var/log/wo/wordops.log @@ -30,31 +30,24 @@ script: - sudo wo site create html.net --html || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site create php.com --php || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site create mysql.com --mysql || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create site1.com --wp || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create mysql.com --mysql --php73 || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wp1.com --wp || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wp1.com --wp --php73 ```|| sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create site2.net --wp --wpsc || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create site4.com --wpfc || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create site4.net --wp --wpfc || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create site4.org --wpfc --wp || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create site5.com --wpsubdir || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wpsc1.net --wp --wpsc || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wpfc1.com --wpfc || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wpfc2.net --wp --wpfc || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wpfc3.org --wpfc --wp || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wpsubdir1.com --wpsubdir || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create site6.com --wpsubdir --wpsc || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create site8.com --wpsubdir --wpfc || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create site8.net --wpfc --wpsubdir || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create site9.com --wpsubdomain || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wpsubdirwpsc1.com --wpsubdir --wpsc || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wpsubdirwpsc2.com --wpsubdir --wpfc || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wpsubdirwpfc3.net --wpfc --wpsubdir || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wpsubdomain1.com --wpsubdomain || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create site10.org --wpsubdomain --wpsc || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create site12.org --wpsubdomain --wpfc || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create site12.in --wpfc --wpsubdomain || sudo tail -n50 /var/log/wo/wordops.log - - - yes | sudo wo site create site.hhvm.pagespeed2.com --wpsc --hhvm || sudo tail -n50 /var/log/wo/wordops.log - - yes | sudo wo site create site.hhvm.pagespeed4.com --wpfc --hhvm || sudo tail -n50 /var/log/wo/wordops.log - - yes | sudo wo site create site.hhvm.pagespeed5.com --wpsubdir --hhvm || sudo tail -n50 /var/log/wo/wordops.log - - yes | sudo wo site create site.hhvm.pagespeed6.com --wpsubdir --wpsc --hhvm || sudo tail -n50 /var/log/wo/wordops.log - - yes | sudo wo site create site.hhvm.pagespeed8.com --wpsubdir --wpfc --hhvm || sudo tail -n50 /var/log/wo/wordops.log - - yes | sudo wo site create site.hhvm.pagespeed9.com --wpsubdomain --hhvm || sudo tail -n50 /var/log/wo/wordops.log - - yes | sudo wo site create site.hhvm.pagespeed10.org --wpsubdomain --wpsc --hhvm || sudo tail -n50 /var/log/wo/wordops.log - - yes | sudo wo site create site.hhvm.pagespeed12.in --wpfc --wpsubdomain --hhvm || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wpsubdomainwpsc.org --wpsubdomain --wpsc || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wpsubdomainwpfc.org --wpsubdomain --wpfc || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wpsubdomainwpfc2.in --wpfc --wpsubdomain || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site create site1.localtest.me --php --mysql || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site create site2.localtest.me --mysql --html || sudo tail -n50 /var/log/wo/wordops.log @@ -101,4 +94,4 @@ script: - sudo ls /var/www/ - sudo wp --allow-root --info - - sudo bash -c 'cat /var/log/wo/wordops.log' + - sudo bash -c 'cat /var/log/wo/wordops.log | ccze -A' diff --git a/wo/cli/plugins/site.py b/wo/cli/plugins/site.py index e9cb632..c5b010c 100644 --- a/wo/cli/plugins/site.py +++ b/wo/cli/plugins/site.py @@ -455,7 +455,7 @@ class WOSiteCreateController(CementBaseController): if data and self.app.pargs.php73: if (self.app.pargs.experimental): - Log.info(self, "Do you wish to install PHP 7.2 now for {0}?".format(wo_domain)) + Log.info(self, "Do you wish to install PHP 7.3 now for {0}?".format(wo_domain)) # Check prompt check_prompt = input("Type \"y\" to continue [n]:") @@ -899,7 +899,7 @@ class WOSiteUpdateController(CementBaseController): check_ssl = check_site.is_ssl check_php_version = check_site.php_version - if check_php_version == "7.2": + if check_php_version == "7.3": old_php73 = True else: old_php73 = False diff --git a/wo/cli/plugins/site_functions.py b/wo/cli/plugins/site_functions.py index 7d128be..4137fb9 100644 --- a/wo/cli/plugins/site_functions.py +++ b/wo/cli/plugins/site_functions.py @@ -711,18 +711,18 @@ def site_package_check(self, stype): if self.app.pargs.php and self.app.pargs.php73: Log.error(self,"Error: two different PHP versions cannot be combined within the same WordOps site") - if not self.app.pargs.php73 and stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: - Log.debug(self, "Setting apt_packages variable for PHP") - apt_packages = apt_packages + WOVariables.wo_php73 + WOVariables.wo_php_extra + if not self.app.pargs.php and stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: + Log.debug(self, "Setting apt_packages variable for PHP 7.2") + apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra - if self.app.pargs.php73 and stype in [ 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: + if self.app.pargs.php and stype in [ 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - Log.debug(self, "Setting apt_packages variable for PHP 7.3") + Log.debug(self, "Setting apt_packages variable for PHP 7.2") if not WOAptGet.is_installed(self, 'php7.3-fpm'): - apt_packages = apt_packages + WOVariables.wo_php73 + WOVariables.wo_php_extra + apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra else: - Log.debug(self, "Setting apt_packages variable for PHP 7.3") - if not WOAptGet.is_installed(self, 'php7.3-fpm'): + Log.debug(self, "Setting apt_packages variable for PHP 7.2") + if not WOAptGet.is_installed(self, 'php7.2-fpm'): apt_packages = apt_packages + WOVariables.wo_php73 if stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']: @@ -832,7 +832,7 @@ def site_package_check(self, stype): if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'wheezy' or WOVariables.wo_platform_codename == 'precise'): - Log.error(self,"PHP 7.0 is not supported in your Platform") + Log.error(self,"PHP 7.3 is not supported in your Platform") Log.debug(self, "Setting apt_packages variable for PHP 7.3") if not WOAptGet.is_installed(self, 'php7.3-fpm'): diff --git a/wo/cli/plugins/stack.py b/wo/cli/plugins/stack.py index 63cf56c..2b6c167 100644 --- a/wo/cli/plugins/stack.py +++ b/wo/cli/plugins/stack.py @@ -155,12 +155,12 @@ class WOStackController(CementBaseController): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): if set(WOVariables.wo_php73).issubset(set(apt_packages)): - Log.info(self, "Adding repository for PHP, please wait...") + Log.info(self, "Adding repository for PHP 7.3, please wait...") Log.debug(self, 'Adding ppa for PHP') WORepo.add(self, ppa=WOVariables.wo_php_repo) else: if set(WOVariables.wo_php).issubset(set(apt_packages)): - Log.info(self, "Adding repository for PHP, please wait...") + Log.info(self, "Adding repository for PHP 7.2, please wait...") # Add repository for php if WOVariables.wo_platform_distro == 'debian': if WOVariables.wo_platform_codename != 'jessie': @@ -174,7 +174,7 @@ class WOStackController(CementBaseController): if WOVariables.wo_platform_codename == 'jessie': if set(WOVariables.wo_php73).issubset(set(apt_packages)): - Log.debug(self, 'Adding repo_url of php 7.0 for debian') + Log.debug(self, 'Adding repo_url of php 7.3 for debian') WORepo.add(self, repo_url=WOVariables.wo_php_repo) Log.debug(self, 'Adding Dotdeb/php GPG key') WORepo.add_key(self, '89DF5277') @@ -1397,15 +1397,15 @@ class WOStackController(CementBaseController): Log.debug(self, "Nginx Stable already installed") if self.app.pargs.php: - Log.debug(self, "Setting apt_packages variable for PHP") + Log.debug(self, "Setting apt_packages variable for PHP 7.2") if not (WOAptGet.is_installed(self, 'php5-fpm') or WOAptGet.is_installed(self, 'php7.2-fpm')): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra else: apt_packages = apt_packages + WOVariables.wo_php else: - Log.debug(self, "PHP already installed") - Log.info(self, "PHP already installed") + Log.debug(self, "PHP 7.2 already installed") + Log.info(self, "PHP 7.2 already installed") # PHP 7.3 for Debian (jessie+) if self.app.pargs.php73 and WOVariables.wo_platform_distro == 'debian': @@ -1434,9 +1434,9 @@ class WOStackController(CementBaseController): Log.info(self, "PHP 7.3 already installed") else: Log.debug( - self, "Unfortunately PHP 7.3 is not available for your Ubuntu or Debian version.") + self, "Unfortunately PHP 7.3 is not available for your Ubuntu or Debian version.") Log.info( - self, "Unfortunately PHP 7.3 is not available for your Ubuntu or Debian version.") + self, "Unfortunately PHP 7.3 is not available for your Ubuntu or Debian version.") if self.app.pargs.hhvm: Log.debug(self, "Setting apt packages variable for HHVM") diff --git a/wo/cli/templates/wpcommon.mustache b/wo/cli/templates/wpcommon.mustache index 1444c22..dd4e641 100644 --- a/wo/cli/templates/wpcommon.mustache +++ b/wo/cli/templates/wpcommon.mustache @@ -25,7 +25,7 @@ location /wp-content/uploads { try_files $uri$webp_suffix $uri =404; } location ~ \.php$ { -#Prevent Direct Access Of PHP Files From Web Browsers + #Prevent Direct Access Of PHP Files From Web Browsers deny all; } } From 876a9a6bd7d2c9e344d237727256cc82d0aa5b37 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Sun, 3 Mar 2019 15:00:38 +0100 Subject: [PATCH 08/56] fix typo in travis config --- .travis.yml | 4 ++-- install | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 29431b6..c2c50b1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,9 +30,9 @@ script: - sudo wo site create html.net --html || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site create php.com --php || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site create mysql.com --mysql || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create mysql.com --mysql --php73 || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create mysqlphp73.com --mysql --php73 || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site create wp1.com --wp || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create wp1.com --wp --php73 ```|| sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wpphp73.com --wp --php73 || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site create wpsc1.net --wp --wpsc || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site create wpfc1.com --wpfc || sudo tail -n50 /var/log/wo/wordops.log diff --git a/install b/install index 710fb7a..4ee14e5 100644 --- a/install +++ b/install @@ -7,7 +7,7 @@ # Copyright (c) 2019 - WordOps # This script is licensed under M.I.T # ------------------------------------------------------------------------- -# Version 3.9.1 - 2019-02-25 +# Version 3.9.5 - 2019-03-03 # ------------------------------------------------------------------------- # CONTENTS # --- From 6f93f355c500e66605cbc012612595611c28223c Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Sun, 3 Mar 2019 15:25:52 +0100 Subject: [PATCH 09/56] update to mariadb 10.3 --- wo/cli/plugins/stack.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wo/cli/plugins/stack.py b/wo/cli/plugins/stack.py index 2b6c167..9f5ec60 100644 --- a/wo/cli/plugins/stack.py +++ b/wo/cli/plugins/stack.py @@ -103,12 +103,12 @@ class WOStackController(CementBaseController): keyserver="keyserver.ubuntu.com") chars = ''.join(random.sample(string.ascii_letters, 8)) Log.debug(self, "Pre-seeding MySQL") - Log.debug(self, "echo \"mariadb-server-10.1 " + Log.debug(self, "echo \"mariadb-server-10.3 " "mysql-server/root_password " "password \" | " "debconf-set-selections") try: - WOShellExec.cmd_exec(self, "echo \"mariadb-server-10.1 " + WOShellExec.cmd_exec(self, "echo \"mariadb-server-10.3 " "mysql-server/root_password " "password {chars}\" | " "debconf-set-selections" @@ -117,12 +117,12 @@ class WOStackController(CementBaseController): except CommandExecutionError as e: Log.error("Failed to initialize MySQL package") - Log.debug(self, "echo \"mariadb-server-10.1 " + Log.debug(self, "echo \"mariadb-server-10.3 " "mysql-server/root_password_again " "password \" | " "debconf-set-selections") try: - WOShellExec.cmd_exec(self, "echo \"mariadb-server-10.1 " + WOShellExec.cmd_exec(self, "echo \"mariadb-server-10.3 " "mysql-server/root_password_again " "password {chars}\" | " "debconf-set-selections" From 7c919c8e196850f73a3cbab794f9912f95b538d4 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Sun, 3 Mar 2019 16:10:21 +0100 Subject: [PATCH 10/56] move wp-cli executable --- install | 1 + wo/core/variables.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/install b/install index 4ee14e5..4826e66 100644 --- a/install +++ b/install @@ -369,6 +369,7 @@ function wo_update_wp_cli() else wget -qO /usr/local/bin/wp https://raw.githubusercontent.com/WordOps/wpcli-builds/gh-pages/phar/wp-cli.phar chmod +x /usr/local/bin/wp + ln -s /usr/local/bin/wp /usr/bin/ fi [ -d /etc/bash_completion ] && { diff --git a/wo/core/variables.py b/wo/core/variables.py index 43c63b1..24e4192 100644 --- a/wo/core/variables.py +++ b/wo/core/variables.py @@ -20,7 +20,7 @@ class WOVariables(): # Get WPCLI path wo_wpcli_path = os.popen('command -v wp | tr "\n" " "').read() if wo_wpcli_path == '': - wo_wpcli_path = '/usr/bin/wp ' + wo_wpcli_path = '/usr/local/bin/wp ' # Current date and time of System wo_date = datetime.datetime.now().strftime('%d%b%Y%H%M%S') From d78c0a46d47a4841210ac7f30aaf659b7d0170f3 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Mon, 4 Mar 2019 06:44:21 +0100 Subject: [PATCH 11/56] reworked php7.3 stack * replace previous stack php7 variables * properly set stack php = php7.2 and php73 = php7.3 * rename upstream php72 and php73 to avoid issues when migrating from EEv3 * use unix socket in nginx upstream instead of TCP/IP --- install | 10 +- setup.py | 2 +- wo/cli/plugins/debug.py | 100 ++++++++--------- wo/cli/plugins/info.py | 2 +- wo/cli/plugins/site.py | 14 +-- wo/cli/plugins/site_functions.py | 16 +-- wo/cli/plugins/stack.py | 137 ++++++++++++----------- wo/cli/plugins/stack_services.py | 34 +++--- wo/cli/plugins/stack_upgrade.py | 8 +- wo/cli/templates/22222.mustache | 2 +- wo/cli/templates/locations-php7.mustache | 2 +- wo/cli/templates/locations.mustache | 2 +- wo/cli/templates/nginx-core.mustache | 9 +- wo/cli/templates/upstream.mustache | 2 +- wo/cli/templates/wpcommon.mustache | 2 +- wo/cli/templates/wpfc-php7.mustache | 21 +--- wo/cli/templates/wpfc.mustache | 21 +--- wo/core/variables.py | 12 +- 18 files changed, 182 insertions(+), 214 deletions(-) diff --git a/install b/install index 4826e66..feb3d93 100644 --- a/install +++ b/install @@ -73,7 +73,7 @@ fi wo_branch=$1 migration=0 readonly wo_version_old="2.2.3" -readonly wo_version_new="3.9.2.3" +readonly wo_version_new="3.9.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}') @@ -145,7 +145,7 @@ function wo_install_dep() add-apt-repository -y 'ppa:ondrej/php' wo_lib_echo "Updating the PHP repository for some neat PHP 7.2 support" apt-get update &>> /dev/null - apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php-memcached php7.2-imap php7.2-common php7.2-readline php-redis php7.2-mysql php7.2-cli php-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 graphviz php-pear php7.2-xdebug || wo_lib_error "Not all PHP packages could be installed. " 1 + apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php-memcached php7.2-imap php7.2-common php7.2-readline php-redis php7.2-mysql php7.2-cli php-imagick php7.2-mbstring php7.2-recode php7.2-bcmath php7.2-opcache php7.2-zip php7.2-xml php7.2-soap php-msgpack graphviz php-xdebug || wo_lib_error "Not all PHP packages could be installed. " 1 mkdir -p /var/log/php/7.2/ touch /var/log/php/7.2/slow.log /var/log/php/7.2/fpm.log systemctl php7.2-fpm restart &>> /dev/null @@ -157,7 +157,7 @@ function wo_install_dep() 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 php-memcached php7.2-imap php7.2-common php7.2-readlne php-redis php7.2-mysql php7.2-cli php-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 graphviz php-pear php7.2-xdebug || wo_lib_error "Not all PHP packages could be installed." 1 + apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php-memcached php7.2-imap php7.2-common php7.2-readlne php-redis php7.2-mysql php7.2-cli php-imagick php7.2-mbstring php7.2-recode php7.2-bcmath php7.2-opcache php7.2-zip php7.2-xml php7.2-soap php-msgpack graphviz php-xdebug || wo_lib_error "Not all PHP packages could be installed." 1 systemctl php7.2-fpm restart &>> /dev/null fi @@ -629,7 +629,7 @@ function wo_update_latest() add-apt-repository -y 'ppa:ondrej/php' wo_lib_echo "Updating the PHP repository for some neat PHP 7.2 support" apt-get update &>> /dev/null - apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php7.2-imap php-memcached php7.2-common php7.2-readline php-redis php7.2-mysql php7.2-cli php-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 graphviz php-pear php7.2-xdebug || wo_lib_error "Not all PHP packages could be installed. " 1 + apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php7.2-imap php-memcached php7.2-common php7.2-readline php-redis php7.2-mysql php7.2-cli php-imagick php7.2-mbstring php7.2-recode php7.2-bcmath php7.2-opcache php7.2-zip php7.2-xml php7.2-soap php-msgpack graphviz php-xdebug || wo_lib_error "Not all PHP packages could be installed. " 1 mkdir -p /var/log/php/7.2/ touch /var/log/php/7.2/slow.log /var/log/php/7.2/fpm.log systemctl php7.2-fpm restart &>> /dev/null @@ -641,7 +641,7 @@ function wo_update_latest() 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 php-memcached php7.2-common php7.2-readline php-redis php7.2-mysql php7.2-cli php-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 graphviz php-pear php7.2-xdebug || wo_lib_error "Not all PHP packages could be installed." 1 + apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php7.2-imap php-memcached php7.2-common php7.2-readline php-redis php7.2-mysql php7.2-cli php-imagick php7.2-mbstring php7.2-recode php7.2-bcmath php7.2-opcache php7.2-zip php7.2-xml php7.2-soap php-msgpack graphviz php-xdebug || wo_lib_error "Not all PHP packages could be installed." 1 systemctl php7.2-fpm restart &>> /dev/null fi diff --git a/setup.py b/setup.py index 801c874..b4a9db7 100644 --- a/setup.py +++ b/setup.py @@ -58,7 +58,7 @@ if not os.path.isfile('/root/.gitconfig'): shutil.copy2(os.path.expanduser("~")+'/.gitconfig', '/root/.gitconfig') setup(name='wo', - version='3.9.1', + version='3.9.5', description=long_description, long_description=long_description, classifiers=[], diff --git a/wo/cli/plugins/debug.py b/wo/cli/plugins/debug.py index 6cfe596..5bab61e 100644 --- a/wo/cli/plugins/debug.py +++ b/wo/cli/plugins/debug.py @@ -42,7 +42,7 @@ class WODebugController(CementBaseController): action='store' or 'store_const', choices=('on', 'off'), const='on', nargs='?')), (['--php'], - dict(help='start/stop debugging server PHP configuration', + dict(help='start/stop debugging server PHP 7.2 configuration', action='store' or 'store_const', choices=('on', 'off'), const='on', nargs='?')), (['--fpm'], @@ -50,11 +50,11 @@ class WODebugController(CementBaseController): action='store' or 'store_const', choices=('on', 'off'), const='on', nargs='?')), (['--php73'], - dict(help='start/stop debugging server PHP 7.2 configuration', + dict(help='start/stop debugging server PHP 7.3 configuration', action='store' or 'store_const', choices=('on', 'off'), const='on', nargs='?')), - (['--fpm7'], - dict(help='start/stop debugging fastcgi 7.2 configuration', + (['--fpm73'], + dict(help='start/stop debugging fastcgi 7.3 configuration', action='store' or 'store_const', choices=('on', 'off'), const='on', nargs='?')), (['--mysql'], @@ -301,37 +301,37 @@ class WODebugController(CementBaseController): if (self.app.pargs.php73 == 'on' and not self.app.pargs.site_name): if (WOVariables.wo_platform_codename == 'wheezy' or WOVariables.wo_platform_codename == 'precise'): - Log.error(self, "PHP 7.2 not supported.") - if not (WOShellExec.cmd_exec(self, "sed -n \"/upstream php7" + Log.error(self, "PHP 7.3 not supported.") + if not (WOShellExec.cmd_exec(self, "sed -n \"/upstream php73" "{/,/}/p \" /etc/nginx/" "conf.d/upstream.conf " - "| grep 9172")): + "| grep 9173")): - Log.info(self, "Enabling PHP 7.2 debug") + Log.info(self, "Enabling PHP 7.3 debug") # Change upstream.conf nc = NginxConfig() nc.loadf('/etc/nginx/conf.d/upstream.conf') - nc.set([('upstream', 'php73',), 'server'], '127.0.0.1:9172') + nc.set([('upstream', 'php73',), 'server'], '127.0.0.1:9173') if os.path.isfile("/etc/nginx/common/wpfc-hhvm.conf"): - nc.set([('upstream', 'hhvm',), 'server'], '127.0.0.1:9172') + nc.set([('upstream', 'hhvm',), 'server'], '127.0.0.1:9173') nc.savef('/etc/nginx/conf.d/upstream.conf') # Enable xdebug - WOFileUtils.searchreplace(self, "/etc/php/7.2/mods-available/" + WOFileUtils.searchreplace(self, "/etc/php/7.3/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.2/fpm/pool.d/debug.conf') - config['debug']['slowlog'] = '/var/log/php/7.2/slow.log' + config.read('/etc/php/7.3/fpm/pool.d/debug.conf') + config['debug']['slowlog'] = '/var/log/php/7.3/slow.log' config['debug']['request_slowlog_timeout'] = '10s' - with open('/etc/php/7.2/fpm/pool.d/debug.conf', + with open('/etc/php/7.3/fpm/pool.d/debug.conf', encoding='utf-8', mode='w') as confifile: Log.debug(self, "Writting debug.conf configuration into " - "/etc/php/7.2/fpm/pool.d/debug.conf") + "/etc/php/7.3/fpm/pool.d/debug.conf") config.write(confifile) self.trigger_php = True @@ -339,11 +339,11 @@ class WODebugController(CementBaseController): else: Log.info(self, "PHP debug is already enabled") - self.msg = self.msg + ['/var/log/php/7.2/slow.log'] + self.msg = self.msg + ['/var/log/php/7.3/slow.log'] # PHP global debug stop elif (self.app.pargs.php73 == 'off' and not self.app.pargs.site_name): - if WOShellExec.cmd_exec(self, " sed -n \"/upstream php73 {/,/}/p\" " + if WOShellExec.cmd_exec(self, " sed -n \"/upstream php72 {/,/}/p\" " "/etc/nginx/conf.d/upstream.conf " "| grep 9172"): Log.info(self, "Disabling PHP 7.2 debug") @@ -351,7 +351,7 @@ class WODebugController(CementBaseController): # Change upstream.conf nc = NginxConfig() nc.loadf('/etc/nginx/conf.d/upstream.conf') - nc.set([('upstream', 'php73',), 'server'], '127.0.0.1:9072') + nc.set([('upstream', 'php72',), 'server'], 'unix:/var/run/php/php72-fpm.sock') if os.path.isfile("/etc/nginx/common/wpfc-hhvm.conf"): nc.set([('upstream', 'hhvm',), 'server'], '127.0.0.1:8000') nc.savef('/etc/nginx/conf.d/upstream.conf') @@ -368,47 +368,47 @@ class WODebugController(CementBaseController): Log.info(self, "PHP 7.2 debug is already disabled") @expose(hide=True) - def debug_fpm7(self): + def debug_fpm73(self): """Start/Stop PHP5-FPM debug""" # PHP5-FPM start global debug - if (self.app.pargs.fpm7 == 'on' and not self.app.pargs.site_name): + if (self.app.pargs.fpm73 == 'on' and not self.app.pargs.site_name): if not WOShellExec.cmd_exec(self, "grep \"log_level = debug\" " - "/etc/php/7.2/fpm/php-fpm.conf"): - Log.info(self, "Setting up PHP7.2-FPM log_level = debug") + "/etc/php/7.3/fpm/php-fpm.conf"): + Log.info(self, "Setting up PHP7.3-FPM log_level = debug") config = configparser.ConfigParser() - config.read('/etc/php/7.2/fpm/php-fpm.conf') + config.read('/etc/php/7.3/fpm/php-fpm.conf') config.remove_option('global', 'include') config['global']['log_level'] = 'debug' - config['global']['include'] = '/etc/php/7.2/fpm/pool.d/*.conf' - with open('/etc/php/7.2/fpm/php-fpm.conf', + config['global']['include'] = '/etc/php/7.3/fpm/pool.d/*.conf' + with open('/etc/php/7.3/fpm/php-fpm.conf', encoding='utf-8', mode='w') as configfile: Log.debug(self, "Writing the PHP configuration into " - "/etc/php/7.2/fpm/php-fpm.conf") + "/etc/php/7.3/fpm/php-fpm.conf") config.write(configfile) self.trigger_php = True else: - Log.info(self, "PHP7.2-FPM log_level = debug already setup") + Log.info(self, "PHP7.3-FPM log_level = debug already setup") - self.msg = self.msg + ['/var/log/php/7.2/fpm.log'] + self.msg = self.msg + ['/var/log/php/7.3/fpm.log'] # PHP5-FPM stop global debug - elif (self.app.pargs.fpm7 == 'off' and not self.app.pargs.site_name): + elif (self.app.pargs.fpm73 == 'off' and not self.app.pargs.site_name): if WOShellExec.cmd_exec(self, "grep \"log_level = debug\" " - "/etc/php/7.2/fpm/php-fpm.conf"): - Log.info(self, "Disabling PHP7.2-FPM log_level = debug") + "/etc/php/7.3/fpm/php-fpm.conf"): + Log.info(self, "Disabling PHP7.3-FPM log_level = debug") config = configparser.ConfigParser() - config.read('/etc/php/7.2/fpm/php-fpm.conf') + config.read('/etc/php/7.3/fpm/php-fpm.conf') config.remove_option('global', 'include') config['global']['log_level'] = 'notice' - config['global']['include'] = '/etc/php/7.2/fpm/pool.d/*.conf' - with open('/etc/php/7.2/fpm/php-fpm.conf', + config['global']['include'] = '/etc/php/7.3/fpm/pool.d/*.conf' + with open('/etc/php/7.3/fpm/php-fpm.conf', encoding='utf-8', mode='w') as configfile: - Log.debug(self, "Writing the php7.2 configuration into " - "/etc/php/7.2/fpm/php-fpm.conf") + Log.debug(self, "Writing the php7.3 configuration into " + "/etc/php/7.3/fpm/php-fpm.conf") config.write(configfile) self.trigger_php = True else: - Log.info(self, "PHP7.2-FPM log_level = debug already disabled") + Log.info(self, "PHP7.3-FPM log_level = debug already disabled") @expose(hide=True) def debug_mysql(self): @@ -609,9 +609,9 @@ class WODebugController(CementBaseController): if self.app.pargs.fpm: self.app.pargs.fpm = 'off' self.debug_fpm() - if self.app.pargs.fpm7: - self.app.pargs.fpm7 = 'off' - self.debug_fpm7() + if self.app.pargs.fpm73: + self.app.pargs.fpm73 = 'off' + self.debug_fpm73() if self.app.pargs.mysql: # MySQL debug will not work for remote MySQL if WOVariables.wo_mysql_host is "localhost": @@ -636,8 +636,8 @@ class WODebugController(CementBaseController): if WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic': if WOAptGet.is_installed(self, 'php7.2-fpm'): WOService.reload_service(self, 'php7.2-fpm') - if WOAptGet.is_installed(self, 'php7.2-fpm'): - WOService.reload_service(self, 'php7.2-fpm') + if WOAptGet.is_installed(self, 'php7.3-fpm'): + WOService.reload_service(self, 'php7.3-fpm') else: WOService.reload_service(self, 'php7.2-fpm') self.app.close(0) @@ -651,8 +651,8 @@ class WODebugController(CementBaseController): self.trigger_nginx = False self.trigger_php = False - if ((not self.app.pargs.nginx) and (not self.app.pargs.php) and (not self.app.pargs.php7) - and (not self.app.pargs.fpm) and (not self.app.pargs.fpm7) and (not self.app.pargs.mysql) + if ((not self.app.pargs.nginx) and (not self.app.pargs.php) and (not self.app.pargs.php73) + and (not self.app.pargs.fpm) and (not self.app.pargs.fpm73) and (not self.app.pargs.mysql) and (not self.app.pargs.wp) and (not self.app.pargs.rewrite) and (not self.app.pargs.all) and (not self.app.pargs.site_name) @@ -726,7 +726,7 @@ class WODebugController(CementBaseController): self.app.pargs.fpm = 'on' if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and WOAptGet.is_installed(self, 'php7.2-fpm'): self.app.pargs.php73 = 'on' - self.app.pargs.fpm7 = 'on' + self.app.pargs.fpm73 = 'on' self.app.pargs.mysql = 'on' self.app.pargs.rewrite = 'on' @@ -738,12 +738,12 @@ class WODebugController(CementBaseController): self.app.pargs.fpm = 'off' if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and WOAptGet.is_installed(self, 'php7.2-fpm'): self.app.pargs.php73 = 'off' - self.app.pargs.fpm7 = 'off' + self.app.pargs.fpm73 = 'off' self.app.pargs.mysql = 'off' self.app.pargs.rewrite = 'off' if ((not self.app.pargs.nginx) and (not self.app.pargs.php) and (not self.app.pargs.php73) - and (not self.app.pargs.fpm) and (not self.app.pargs.fpm7) and (not self.app.pargs.mysql) + and (not self.app.pargs.fpm) and (not self.app.pargs.fpm73) and (not self.app.pargs.mysql) and (not self.app.pargs.wp) and (not self.app.pargs.rewrite) and self.app.pargs.site_name): self.app.args.print_help() @@ -782,12 +782,12 @@ class WODebugController(CementBaseController): # Reload PHP if self.trigger_php: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - if WOAptGet.is_installed(self, 'php5.6-fpm'): - WOService.restart_service(self, 'php5.6-fpm') if WOAptGet.is_installed(self, 'php7.2-fpm'): WOService.restart_service(self, 'php7.2-fpm') + if WOAptGet.is_installed(self, 'php7.3-fpm'): + WOService.restart_service(self, 'php7.3-fpm') else: - WOService.restart_service(self, 'php5-fpm') + WOService.restart_service(self, 'php7.2-fpm') if WOVariables.wo_platform_codename == 'jessie': WOService.restart_service(self, 'php7.2-fpm') diff --git a/wo/cli/plugins/info.py b/wo/cli/plugins/info.py index 127f847..1576b04 100644 --- a/wo/cli/plugins/info.py +++ b/wo/cli/plugins/info.py @@ -250,7 +250,7 @@ class WOInfoController(CementBaseController): self.app.pargs.nginx = True self.app.pargs.php = True self.app.pargs.mysql = True - if WOAptGet.is_installed(self, 'php7.2-fpm'): + if WOAptGet.is_installed(self, 'php7.3-fpm'): self.app.pargs.php = True if self.app.pargs.nginx: diff --git a/wo/cli/plugins/site.py b/wo/cli/plugins/site.py index c5b010c..a69883d 100644 --- a/wo/cli/plugins/site.py +++ b/wo/cli/plugins/site.py @@ -308,9 +308,9 @@ class WOSiteCreateController(CementBaseController): (['--html'], dict(help="create html site", action='store_true')), (['--php'], - dict(help="create php site", action='store_true')), - (['--php73'], dict(help="create php 7.2 site", action='store_true')), + (['--php73'], + dict(help="create php 7.3 site", action='store_true')), (['--mysql'], dict(help="create mysql site", action='store_true')), (['--wp'], @@ -461,10 +461,10 @@ class WOSiteCreateController(CementBaseController): check_prompt = input("Type \"y\" to continue [n]:") if check_prompt != "Y" and check_prompt != "y": Log.info(self, "Not using PHP 7.2 for site.") - data['php73'] = False + data['php73'] = True data['basic'] = True - php73 = 0 - self.app.pargs.php73 = False + php73 = 1 + self.app.pargs.php73 = True else: data['php73'] = True php73 = 1 @@ -564,7 +564,7 @@ class WOSiteCreateController(CementBaseController): return if data['php73']: - php_version = "7.2" + php_version = "7.3" else: php_version = "7.2" @@ -1225,7 +1225,7 @@ class WOSiteUpdateController(CementBaseController): if pargs.wpredis and data['currcachetype'] != 'wpredis': - if (pargs.experimental): + if (not pargs.experimental): Log.info(self, "Redis is experimental feature and it may not" " work with all plugins of your site.\nYou can " "disable it by changing cache type later.\nDo you wish" diff --git a/wo/cli/plugins/site_functions.py b/wo/cli/plugins/site_functions.py index 4137fb9..f724e69 100644 --- a/wo/cli/plugins/site_functions.py +++ b/wo/cli/plugins/site_functions.py @@ -711,18 +711,18 @@ def site_package_check(self, stype): if self.app.pargs.php and self.app.pargs.php73: Log.error(self,"Error: two different PHP versions cannot be combined within the same WordOps site") - if not self.app.pargs.php and stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: + if not self.app.pargs.php73 and stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: Log.debug(self, "Setting apt_packages variable for PHP 7.2") apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra - if self.app.pargs.php and stype in [ 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: + if self.app.pargs.php73 and stype in [ 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - Log.debug(self, "Setting apt_packages variable for PHP 7.2") + Log.debug(self, "Setting apt_packages variable for PHP 7.3") if not WOAptGet.is_installed(self, 'php7.3-fpm'): - apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra + apt_packages = apt_packages + WOVariables.wo_php73 + WOVariables.wo_php_extra else: - Log.debug(self, "Setting apt_packages variable for PHP 7.2") - if not WOAptGet.is_installed(self, 'php7.2-fpm'): + Log.debug(self, "Setting apt_packages variable for PHP 7.3") + if not WOAptGet.is_installed(self, 'php7.3-fpm'): apt_packages = apt_packages + WOVariables.wo_php73 if stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']: @@ -896,8 +896,8 @@ def site_package_check(self, stype): if not WOFileUtils.grep(self, "/etc/nginx/conf.d/upstream.conf", "php73"): with open("/etc/nginx/conf.d/upstream.conf", "a") as php_file: - php_file.write("upstream php73 {\nserver 127.0.0.1:9072;\n}\n" - "upstream debug72 {\nserver 127.0.0.1:9172;\n}\n") + php_file.write("upstream php73 {\nserver unix:/var/run/php/php73-fpm.sock;\n}\n" + "upstream debug73 {\nserver 127.0.0.1:9173;\n}\n") return(stack.install(apt_packages=apt_packages, packages=packages, disp_msg=False)) diff --git a/wo/cli/plugins/stack.py b/wo/cli/plugins/stack.py index 9f5ec60..adc094f 100644 --- a/wo/cli/plugins/stack.py +++ b/wo/cli/plugins/stack.py @@ -76,7 +76,7 @@ class WOStackController(CementBaseController): (['--phpredisadmin'], dict(help='Install phpRedisAdmin', action='store_true')), ] - usage = "ee stack (command) [options]" + usage = "wo stack (command) [options]" @expose(hide=True) def default(self): @@ -154,13 +154,14 @@ class WOStackController(CementBaseController): WORepo.add_key(self, WOVariables.wo_nginx_key) if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - if set(WOVariables.wo_php73).issubset(set(apt_packages)): - Log.info(self, "Adding repository for PHP 7.3, please wait...") + if set(WOVariables.wo_php73).issubset(set(apt_packages)) \ + or set(WOVariables.wo_php).issubset(set(apt_packages)): + Log.info(self, "Adding repository for PHP, please wait...") Log.debug(self, 'Adding ppa for PHP') WORepo.add(self, ppa=WOVariables.wo_php_repo) else: if set(WOVariables.wo_php).issubset(set(apt_packages)): - Log.info(self, "Adding repository for PHP 7.2, please wait...") + Log.info(self, "Adding repository for PHP, please wait...") # Add repository for php if WOVariables.wo_platform_distro == 'debian': if WOVariables.wo_platform_codename != 'jessie': @@ -244,7 +245,7 @@ class WOStackController(CementBaseController): wo_nginx.close() data = dict(php="9000", debug="9001", hhvm="8000", php73="9072", debug7="9172", - hhvmconf=False, php7conf=True if WOAptGet.is_installed(self, 'php7.2-fpm') else False) + hhvmconf=False, php7conf=True if WOAptGet.is_installed(self, 'php7.3-fpm') else False) Log.debug(self, 'Writting the nginx configuration to ' 'file /etc/nginx/conf.d/upstream.conf') wo_nginx = open('/etc/nginx/conf.d/upstream.conf', @@ -627,8 +628,8 @@ class WOStackController(CementBaseController): if not WOFileUtils.grep(self, "/etc/nginx/conf.d/upstream.conf", "php73"): with open("/etc/nginx/conf.d/upstream.conf", "a") as php_file: - php_file.write("upstream php73 {\nserver 127.0.0.1:9072;\n}\n" - "upstream debug72 {\nserver 127.0.0.1:9172;\n}\n") + php_file.write("upstream php73 {\nserver unix:/var/run/php/php73-fpm.sock;\n}\n" + "upstream debug73 {\nserver 127.0.0.1:9172;\n}\n") if set(WOVariables.wo_hhvm).issubset(set(apt_packages)): @@ -774,7 +775,7 @@ class WOStackController(CementBaseController): # Parse /etc/php/7.2/fpm/php-fpm.conf data = dict(pid="/run/php/php7.2-fpm.pid", error_log="/var/log/php/7.2/fpm.log", include="/etc/php/7.2/fpm/pool.d/*.conf") - Log.debug(self, "writting php5 configuration into " + Log.debug(self, "writting php7.2 configuration into " "/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') @@ -796,7 +797,7 @@ class WOStackController(CementBaseController): config['www']['pm'] = 'ondemand' config['www']['chdir'] = '/' config['www']['prefix'] = '/var/run/php' - config['www']['listen'] = 'php73-fpm.sock' + config['www']['listen'] = 'php72-fpm.sock' config['www']['listen.backlog'] = '32768' with codecs.open('/etc/php/7.2/fpm/pool.d/www.conf', encoding='utf-8', mode='w') as configfile: @@ -899,7 +900,7 @@ class WOStackController(CementBaseController): # Parse /etc/php/7.3/fpm/php-fpm.conf data = dict(pid="/run/php/php7.3-fpm.pid", error_log="/var/log/php7.3-fpm.log", include="/etc/php/7.3/fpm/pool.d/*.conf") - Log.debug(self, "writting php 7.0 configuration into " + Log.debug(self, "writting php 7.3 configuration into " "/etc/php/7.3/fpm/php-fpm.conf") wo_php_fpm = open('/etc/php/7.3/fpm/php-fpm.conf', encoding='utf-8', mode='w') @@ -925,7 +926,7 @@ class WOStackController(CementBaseController): config['www']['listen.backlog'] = '32768' with codecs.open('/etc/php/7.3/fpm/pool.d/www.conf', encoding='utf-8', mode='w') as configfile: - Log.debug(self, "writting PHP5 configuration into " + Log.debug(self, "writting PHP 7.3 configuration into " "/etc/php/7.3/fpm/pool.d/www.conf") config.write(configfile) @@ -936,13 +937,13 @@ class WOStackController(CementBaseController): "debug.conf", "[www]", "[debug]") config = configparser.ConfigParser() config.read('/etc/php/7.3/fpm/pool.d/debug.conf') - config['debug']['listen'] = '127.0.0.1:9182' + config['debug']['listen'] = '127.0.0.1:9173' config['debug']['rlimit_core'] = 'unlimited' config['debug']['slowlog'] = '/var/log/php/7.3/slow.log' config['debug']['request_slowlog_timeout'] = '10s' with open('/etc/php/7.3/fpm/pool.d/debug.conf', encoding='utf-8', mode='w') as confifile: - Log.debug(self, "writting PHP5 configuration into " + Log.debug(self, "writting PHP 7.3 configuration into " "/etc/php/7.3/fpm/pool.d/debug.conf") config.write(confifile) @@ -999,41 +1000,41 @@ class WOStackController(CementBaseController): WOGit.add(self, ["/etc/php"], msg="Adding PHP into Git") WOService.restart_service(self, 'php7.3-fpm') - # preconfiguration for php7.2 + # preconfiguration for php7.3 if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and set(WOVariables.wo_php).issubset(set(apt_packages)): # Create log directories - 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/') + if not os.path.exists('/var/log/php/7.3/'): + Log.debug(self, 'Creating directory /var/log/php/7.3/') + os.makedirs('/var/log/php/7.3/') # Parse etc/php/7.2/fpm/php.ini config = configparser.ConfigParser() - Log.debug(self, "configuring php file /etc/php/7.2/fpm/php.ini") - config.read('/etc/php/7.2/fpm/php.ini') + Log.debug(self, "configuring php file /etc/php/7.3/fpm/php.ini") + config.read('/etc/php/7.3/fpm/php.ini') config['PHP']['expose_php'] = 'Off' config['PHP']['post_max_size'] = '64M' config['PHP']['upload_max_filesize'] = '64M' config['PHP']['max_execution_time'] = '30' config['PHP']['date.timezone'] = WOVariables.wo_timezone - with open('/etc/php/7.2/fpm/php.ini', + with open('/etc/php/7.3/fpm/php.ini', encoding='utf-8', mode='w') as configfile: Log.debug(self, "Writting php configuration into " - "/etc/php/7.2/fpm/php.ini") + "/etc/php/7.3/fpm/php.ini") config.write(configfile) # Parse /etc/php/7.2/fpm/php-fpm.conf - data = dict(pid="/run/php/php7.2-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.2/fpm/php-fpm.conf") - wo_php_fpm = open('/etc/php/7.2/fpm/php-fpm.conf', + data = dict(pid="/run/php/php7.3-fpm.pid", error_log="/var/log/php/7.3/fpm.log", + include="/etc/php/7.3/fpm/pool.d/*.conf") + Log.debug(self, "writting php 7.3 configuration into " + "/etc/php/7.3/fpm/php-fpm.conf") + wo_php_fpm = open('/etc/php/7.3/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.2/fpm/pool.d/www.conf + # Parse /etc/php/7.3/fpm/pool.d/www.conf config = configparser.ConfigParser() - config.read_file(codecs.open('/etc/php/7.2/fpm/pool.d/www.conf', + config.read_file(codecs.open('/etc/php/7.3/fpm/pool.d/www.conf', "r", "utf8")) config['www']['ping.path'] = '/ping' config['www']['pm.status_path'] = '/status' @@ -1044,31 +1045,34 @@ class WOStackController(CementBaseController): config['www']['pm.max_spare_servers'] = '5' config['www']['request_terminate_timeout'] = '100' config['www']['pm'] = 'ondemand' - config['www']['listen'] = '127.0.0.1:9072' - with codecs.open('/etc/php/7.2/fpm/pool.d/www.conf', + config['www']['chdir'] = '/' + config['www']['prefix'] = '/var/run/php' + config['www']['listen'] = 'php73-fpm.sock' + config['www']['listen.backlog'] = '32768' + with codecs.open('/etc/php/7.3/fpm/pool.d/www.conf', encoding='utf-8', mode='w') as configfile: - Log.debug(self, "writting PHP5 configuration into " - "/etc/php/7.2/fpm/pool.d/www.conf") + Log.debug(self, "writting PHP 7.3 configuration into " + "/etc/php/7.3/fpm/pool.d/www.conf") config.write(configfile) - # 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/" + # Generate /etc/php/7.3/fpm/pool.d/debug.conf + WOFileUtils.copyfile(self, "/etc/php/7.3/fpm/pool.d/www.conf", + "/etc/php/7.3/fpm/pool.d/debug.conf") + WOFileUtils.searchreplace(self, "/etc/php/7.3/fpm/pool.d/" "debug.conf", "[www]", "[debug]") config = configparser.ConfigParser() - config.read('/etc/php/7.2/fpm/pool.d/debug.conf') - config['debug']['listen'] = '127.0.0.1:9172' + config.read('/etc/php/7.3/fpm/pool.d/debug.conf') + config['debug']['listen'] = '127.0.0.1:9173' config['debug']['rlimit_core'] = 'unlimited' - config['debug']['slowlog'] = '/var/log/php/7.2/slow.log' + config['debug']['slowlog'] = '/var/log/php/7.3/slow.log' config['debug']['request_slowlog_timeout'] = '10s' - with open('/etc/php/7.2/fpm/pool.d/debug.conf', + with open('/etc/php/7.3/fpm/pool.d/debug.conf', encoding='utf-8', mode='w') as confifile: - Log.debug(self, "writting PHP5 configuration into " - "/etc/php/7.2/fpm/pool.d/debug.conf") + Log.debug(self, "writting PHP 7.3 configuration into " + "/etc/php/7.3/fpm/pool.d/debug.conf") config.write(confifile) - with open("/etc/php/7.2/fpm/pool.d/debug.conf", + with open("/etc/php/7.3/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_" @@ -1078,8 +1082,8 @@ class WOStackController(CementBaseController): "profiler_enable] = off\n") # Disable xdebug - 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/" + if not WOShellExec.cmd_exec(self, "grep -q \';zend_extension\' /etc/php/7.3/mods-available/xdebug.ini"): + WOFileUtils.searchreplace(self, "/etc/php/7.3/mods-available/" "xdebug.ini", "zend_extension", ";zend_extension") @@ -1119,7 +1123,7 @@ class WOStackController(CementBaseController): WOVariables.wo_php_user, recursive=True) WOGit.add(self, ["/etc/php"], msg="Adding PHP into Git") - WOService.restart_service(self, 'php7.2-fpm') + WOService.restart_service(self, 'php7.3-fpm') if set(WOVariables.wo_mysql).issubset(set(apt_packages)): if not os.path.isfile("/etc/mysql/my.cnf"): @@ -1147,9 +1151,9 @@ class WOStackController(CementBaseController): WOService.reload_service(self, 'mysql') if len(packages): - if any('/usr/bin/wp' == x[1] for x in packages): - Log.debug(self, "Setting Privileges to /usr/bin/wp file ") - WOFileUtils.chmod(self, "/usr/bin/wp", 0o775) + if any('/usr/local/bin/wp' == x[1] for x in packages): + Log.debug(self, "Setting Privileges to /usr/local/bin/wp file ") + WOFileUtils.chmod(self, "/usr/local/bin/wp", 0o775) if any('/tmp/pma.tar.gz' == x[1] for x in packages): @@ -1175,7 +1179,7 @@ class WOStackController(CementBaseController): .format(WOVariables.wo_webroot)) blowfish_key = ''.join([random.choice (string.ascii_letters + string.digits) - for n in range(10)]) + for n in range(25)]) WOFileUtils.searchreplace(self, '{0}22222/htdocs/db/pma/config.inc.php' .format(WOVariables.wo_webroot), @@ -1398,7 +1402,7 @@ class WOStackController(CementBaseController): if self.app.pargs.php: Log.debug(self, "Setting apt_packages variable for PHP 7.2") - if not (WOAptGet.is_installed(self, 'php5-fpm') or WOAptGet.is_installed(self, 'php7.2-fpm')): + if not (WOAptGet.is_installed(self, 'php7.2-fpm') or WOAptGet.is_installed(self, 'php7.2-fpm')): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra else: @@ -1413,7 +1417,7 @@ class WOStackController(CementBaseController): Log.debug(self, "Setting apt_packages variable for PHP 7.3") if not WOAptGet.is_installed(self, 'php7.3-fpm'): apt_packages = apt_packages + WOVariables.wo_php73 - if not WOAptGet.is_installed(self, 'php5-fpm'): + if not WOAptGet.is_installed(self, 'php7.2-fpm'): apt_packages = apt_packages + WOVariables.wo_php else: Log.debug(self, "PHP 7.3 already installed") @@ -1429,6 +1433,8 @@ class WOStackController(CementBaseController): Log.debug(self, "Setting apt_packages variable for PHP 7.3") if not WOAptGet.is_installed(self, 'php7.3-fpm'): apt_packages = apt_packages + WOVariables.wo_php73 + WOVariables.wo_php_extra + if not WOAptGet.is_installed(self, 'php7.2-fpm'): + apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra else: Log.debug(self, "PHP 7.3 already installed") Log.info(self, "PHP 7.3 already installed") @@ -1640,7 +1646,7 @@ class WOStackController(CementBaseController): Log.debug(self, "Removing apt_packages variable of PHP") if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): apt_packages = apt_packages + WOVariables.wo_php - if not WOAptGet.is_installed(self, 'php7.2-fpm'): + if not WOAptGet.is_installed(self, 'php7.3-fpm'): apt_packages = apt_packages + WOVariables.wo_php_extra else: apt_packages = apt_packages + WOVariables.wo_php @@ -1650,7 +1656,7 @@ class WOStackController(CementBaseController): if (WOVariables.wo_platform_codename == 'jessie'): Log.debug(self, "Removing apt_packages variable of PHP 7.3") apt_packages = apt_packages + WOVariables.wo_php73 - if not WOAptGet.is_installed(self, 'php7.3-fpm'): + if not WOAptGet.is_installed(self, 'php7.2-fpm'): apt_packages = apt_packages + WOVariables.wo_php_extra else: Log.info(self, "PHP 7.3 not supported.") @@ -1659,7 +1665,7 @@ class WOStackController(CementBaseController): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): Log.debug(self, "Removing apt_packages variable of PHP 7.3") apt_packages = apt_packages + WOVariables.wo_php73 - if not WOAptGet.is_installed(self, 'php7.3-fpm'): + if not WOAptGet.is_installed(self, 'php7.2-fpm'): apt_packages = apt_packages + WOVariables.wo_php_extra else: Log.info(self, "PHP 7.3 not supported.") @@ -1788,9 +1794,11 @@ class WOStackController(CementBaseController): if self.app.pargs.php: Log.debug(self, "Purge apt_packages variable PHP") if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - apt_packages = apt_packages + WOVariables.wo_php_extra + apt_packages = apt_packages + WOVariables.wo_php + if not WOAptGet.is_installed(self, 'php7.3-fpm'): + apt_packages = apt_packages + WOVariables.wo_php_extra else: - apt_packages = apt_packages + WOVariables.wo_php73 + apt_packages = apt_packages + WOVariables.wo_php # For debian --php73 if self.app.pargs.php73: @@ -1806,7 +1814,7 @@ class WOStackController(CementBaseController): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): Log.debug(self, "Removing apt_packages variable of PHP 7.3") apt_packages = apt_packages + WOVariables.wo_php73 - if not WOAptGet.is_installed(self, 'php7.3-fpm'): + if not WOAptGet.is_installed(self, 'php7.2-fpm'): apt_packages = apt_packages + WOVariables.wo_php_extra else: Log.info(self, "PHP 7.3 not supported.") @@ -1814,14 +1822,7 @@ class WOStackController(CementBaseController): if WOAptGet.is_installed(self, 'hhvm'): Log.debug(self, "Purge apt_packages varible of HHVM") apt_packages = apt_packages + WOVariables.wo_hhvm - if self.app.pargs.redis: - Log.debug(self, "Purge apt_packages variable of Redis") - apt_packages = apt_packages + WOVariables.wo_redis - if self.app.pargs.mysql: - Log.debug(self, "Purge apt_packages variable MySQL") - apt_packages = apt_packages + WOVariables.wo_mysql - packages = packages + ['/usr/bin/mysqltuner'] - if self.app.pargs.wpcli: + Log.debug(self, "Purge package variable WPCLI") if os.path.isfile('/usr/bin/wp'): packages = packages + ['/usr/bin/wp'] @@ -1880,8 +1881,8 @@ class WOStackController(CementBaseController): # Added for php Ondrej repo missing package fix if self.app.pargs.php73: - if WOAptGet.is_installed(self, 'php7.3-fpm'): - Log.info(self, "PHP7.3-fpm found on system.") + if WOAptGet.is_installed(self, 'php7.2-fpm'): + Log.info(self, "PHP7.2-fpm found on system.") Log.info( self, "Verifying and installing missing packages,") WOShellExec.cmd_exec( diff --git a/wo/cli/plugins/stack_services.py b/wo/cli/plugins/stack_services.py index a2cf3c5..bf9fbe6 100644 --- a/wo/cli/plugins/stack_services.py +++ b/wo/cli/plugins/stack_services.py @@ -46,10 +46,10 @@ class WOStackStatusController(CementBaseController): else: Log.info(self, "PHP7.2-FPM is not installed") - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] else: - Log.info(self, "PHP7.2-FPM is not installed") + Log.info(self, "PHP7.3-FPM is not installed") if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): @@ -116,17 +116,17 @@ class WOStackStatusController(CementBaseController): if WOAptGet.is_installed(self, 'php7.2-fpm'): services = services + ['php7.2-fpm'] else: - Log.info(self, "PHP5-FPM is not installed") + Log.info(self, "PHP7.2-FPM is not installed") else: if WOAptGet.is_installed(self, 'php7.2-fpm'): services = services + ['php7.2-fpm'] else: Log.info(self, "PHP7.2-FPM is not installed") - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] else: - Log.info(self, "PHP7.2-FPM is not installed") + Log.info(self, "PHP7.3-FPM is not installed") if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): @@ -200,10 +200,10 @@ class WOStackStatusController(CementBaseController): else: Log.info(self, "PHP7.2-FPM is not installed") - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] else: - Log.info(self, "PHP7.2-FPM is not installed") + Log.info(self, "PHP7.3-FPM is not installed") if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): @@ -278,10 +278,10 @@ class WOStackStatusController(CementBaseController): else: Log.info(self, "PHP7.2-FPM is not installed") - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] else: - Log.info(self, "PHP7.2-FPM is not installed") + Log.info(self, "PHP7.3-FPM is not installed") if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): @@ -355,10 +355,10 @@ class WOStackStatusController(CementBaseController): else: Log.info(self, "php7.2-fpm is not installed") - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] else: - Log.info(self, "PHP7.2-FPM is not installed") + Log.info(self, "PHP7.3-FPM is not installed") if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): @@ -367,7 +367,7 @@ class WOStackStatusController(CementBaseController): else: Log.info(self, "PHP7.3-FPM is not installed") else: - Log.info(self, "Your platform does not support PHP 7") + Log.info(self, "Your platform does not support PHP 7.3") if self.app.pargs.mysql: if ((WOVariables.wo_mysql_host is "localhost") or diff --git a/wo/cli/plugins/stack_upgrade.py b/wo/cli/plugins/stack_upgrade.py index d97bac8..f4b4b6e 100644 --- a/wo/cli/plugins/stack_upgrade.py +++ b/wo/cli/plugins/stack_upgrade.py @@ -89,8 +89,8 @@ class WOStackUpgradeController(CementBaseController): if ((not self.app.pargs.web) and (not self.app.pargs.nginx) and (not self.app.pargs.php) and (not self.app.pargs.mysql) and - (not self.app.pargs.hhvm) and (not self.app.pargs.all) and - (not self.app.pargs.wpcli) and (not self.app.pargs.redis) and + (not self.app.pargs.hhvm) and (not self.app.pargs.all) and + (not self.app.pargs.wpcli) and (not self.app.pargs.redis) and (not self.app.pargs.nginxmainline)): self.app.pargs.web = True @@ -178,13 +178,13 @@ class WOStackUpgradeController(CementBaseController): if len(packages): if self.app.pargs.wpcli: - WOFileUtils.remove(self,['/usr/bin/wp']) + WOFileUtils.remove(self,['/usr/local/bin/wp']) Log.debug(self, "Downloading following: {0}".format(packages)) WODownload.download(self, packages) if self.app.pargs.wpcli: - WOFileUtils.chmod(self, "/usr/bin/wp", 0o775) + WOFileUtils.chmod(self, "/usr/local/bin/wp", 0o775) Log.info(self, "Successfully updated packages") else: diff --git a/wo/cli/templates/22222.mustache b/wo/cli/templates/22222.mustache index 346c164..ab7da89 100644 --- a/wo/cli/templates/22222.mustache +++ b/wo/cli/templates/22222.mustache @@ -39,6 +39,6 @@ server { location ~ \.php$ { try_files $uri =404; include fastcgi_params; - fastcgi_pass php; + fastcgi_pass php72; } } diff --git a/wo/cli/templates/locations-php7.mustache b/wo/cli/templates/locations-php7.mustache index 58c0011..04bd05d 100644 --- a/wo/cli/templates/locations-php7.mustache +++ b/wo/cli/templates/locations-php7.mustache @@ -59,7 +59,7 @@ location = /nginx_status { } location ~ ^/(status|ping)$ { include fastcgi_params; - fastcgi_pass php7; + fastcgi_pass php73; include common/acl.conf; } # WordOps (wo) utilities diff --git a/wo/cli/templates/locations.mustache b/wo/cli/templates/locations.mustache index 36155bf..7d8c6bb 100644 --- a/wo/cli/templates/locations.mustache +++ b/wo/cli/templates/locations.mustache @@ -59,7 +59,7 @@ location = /nginx_status { } location ~ ^/(status|ping)$ { include fastcgi_params; - fastcgi_pass php; + fastcgi_pass php72; include common/acl.conf; } # WordOps (wo) utilities diff --git a/wo/cli/templates/nginx-core.mustache b/wo/cli/templates/nginx-core.mustache index cef16cc..401c8d4 100644 --- a/wo/cli/templates/nginx-core.mustache +++ b/wo/cli/templates/nginx-core.mustache @@ -18,13 +18,14 @@ fastcgi_read_timeout 300; client_max_body_size 100m; # SSL Settings -ssl_protocols TLSv1.1 TLSv1.2; -ssl_session_cache shared:SSL:10m; -ssl_session_timeout 10m; +ssl_protocols TLSv1.2; +ssl_session_cache shared:SSL:50m; +ssl_session_timeout 1d; +ssl_session_tickets off; {{#Ubuntu}} ssl_prefer_server_ciphers on; {{/Ubuntu}} -ssl_ciphers "ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-CHACHA20-POLY1305:EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH"; +ssl_ciphers "EECDH+CHACHA20:EECDH+AESGCM:EECDH+AES"; # Log format Settings log_format rt_cache '$remote_addr $upstream_response_time $upstream_cache_status [$time_local] ' diff --git a/wo/cli/templates/upstream.mustache b/wo/cli/templates/upstream.mustache index 9e8f1e4..00a1ba0 100644 --- a/wo/cli/templates/upstream.mustache +++ b/wo/cli/templates/upstream.mustache @@ -4,7 +4,7 @@ server 127.0.0.1:9000; } upstream debug { # Debug Pool -server 127.0.0.1:9100; +server 127.0.0.1:9001; } upstream php72 { server unix:/var/run/php/php72-fpm.sock; diff --git a/wo/cli/templates/wpcommon.mustache b/wo/cli/templates/wpcommon.mustache index dd4e641..89f0e92 100644 --- a/wo/cli/templates/wpcommon.mustache +++ b/wo/cli/templates/wpcommon.mustache @@ -4,7 +4,7 @@ location = /wp-login.php { limit_req zone=one burst=1 nodelay; include fastcgi_params; - fastcgi_pass php; + fastcgi_pass php72; } # Disable wp-config.txt location = /wp-config.txt { diff --git a/wo/cli/templates/wpfc-php7.mustache b/wo/cli/templates/wpfc-php7.mustache index 55c999d..438aab2 100644 --- a/wo/cli/templates/wpfc-php7.mustache +++ b/wo/cli/templates/wpfc-php7.mustache @@ -1,28 +1,11 @@ # WPFC NGINX CONFIGURATION # DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE -set $skip_cache 0; -# POST requests and URL with a query string should always go to php -if ($request_method = POST) { - set $skip_cache 1; -} -if ($query_string != "") { - set $skip_cache 1; -} -# Don't cache URL containing the following segments -if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*\.php|index.php|/feed/|.*sitemap.*\.xml)") { - set $skip_cache 1; -} -# Don't use the cache for logged in users or recent commenter or customer with items in cart -if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in|[a-z0-9]+_items_in_cart") { - set $skip_cache 1; -} +# $skip_cache variable set in /etc/nginx/conf.d/map-wp-fastcgi-cache.conf + # Use cached or actual file if they exists, Otherwise pass request to WordPress location / { try_files $uri $uri/ /index.php$is_args$args; } -location ~ ^/wp-content/cache/minify/(.+\.(css|js))$ { - try_files $uri /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1; -} location ~ \.php$ { try_files $uri =404; include fastcgi_params; diff --git a/wo/cli/templates/wpfc.mustache b/wo/cli/templates/wpfc.mustache index 666c177..6ad47d0 100644 --- a/wo/cli/templates/wpfc.mustache +++ b/wo/cli/templates/wpfc.mustache @@ -1,28 +1,11 @@ # WPFC NGINX CONFIGURATION # DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE -set $skip_cache 0; -# POST requests and URL with a query string should always go to php -if ($request_method = POST) { - set $skip_cache 1; -} -if ($query_string != "") { - set $skip_cache 1; -} -# Don't cache URL containing the following segments -if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*\.php|index.php|/feed/|.*sitemap.*\.xml)") { - set $skip_cache 1; -} -# Don't use the cache for logged in users or recent commenter or customer with items in cart -if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in|[a-z0-9]+_items_in_cart") { - set $skip_cache 1; -} +# $skip_cache variable set in /etc/nginx/conf.d/map-wp-fastcgi-cache.conf + # Use cached or actual file if they exists, Otherwise pass request to WordPress location / { try_files $uri $uri/ /index.php$is_args$args; } -location ~ ^/wp-content/cache/minify/(.+\.(css|js))$ { - try_files $uri /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1; -} location ~ \.php$ { try_files $uri =404; include fastcgi_params; diff --git a/wo/core/variables.py b/wo/core/variables.py index 24e4192..e08bcc7 100644 --- a/wo/core/variables.py +++ b/wo/core/variables.py @@ -12,10 +12,10 @@ class WOVariables(): """Intialization of core variables""" # WordOps version - wo_version = "3.9.2" + wo_version = "3.9.5" # WordOps packages versions - wo_wp_cli = "2.0.1" - wo_adminer = "4.6.3" + wo_wp_cli = "2.1.0" + wo_adminer = "4.7.1" # Get WPCLI path wo_wpcli_path = os.popen('command -v wp | tr "\n" " "').read() @@ -113,7 +113,7 @@ class WOVariables(): "php7.3-cli", "php7.3-mbstring", "php7.3-bcmath", "php7.3-mysql", "php7.3-opcache", "php7.3-zip", "php7.3-xml", "php7.3-soap"] wo_php_extra = ["php-memcached", "php-imagick", - "graphviz", "php-pear", "php-xdebug", "php-msgpack", "php-redis"] + "graphviz", "php-xdebug", "php-msgpack", "php-redis"] elif wo_platform_distro == 'debian': wo_php_repo = ( "deb https://packages.sury.org/php/ {codename} main".format(codename=wo_platform_codename)) @@ -121,13 +121,13 @@ class WOVariables(): "php7.2-common", "php7.2-readline", "php-redis", "php7.2-mysql", "php7.2-cli", "php-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", + "php7.2-soap", "php-msgpack", "graphviz", "php-pear", "php-xdebug"] wo_php73 = ["php7.3-fpm", "php7.3-curl", "php7.3-gd", "php7.3-imap", "php7.3-common", "php7.3-readline", "php-redis", "php7.3-mysql", "php7.3-cli", "php-imagick", "php7.3-mbstring", "php7.3-recode", "php7.3-bcmath", "php7.3-opcache", "php7.3-zip", "php7.3-xml", - "php7.3-soap", "php7.3-msgpack", + "php7.3-soap", "php-msgpack", "graphviz", "php-pear", "php-xdebug"] wo_php_extra = [] From 188b91df74c5c6ebb1cb606363ca8394a55d5086 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Mon, 4 Mar 2019 07:03:14 +0100 Subject: [PATCH 12/56] fix identation --- wo/cli/plugins/stack.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wo/cli/plugins/stack.py b/wo/cli/plugins/stack.py index adc094f..773d07e 100644 --- a/wo/cli/plugins/stack.py +++ b/wo/cli/plugins/stack.py @@ -1433,7 +1433,7 @@ class WOStackController(CementBaseController): Log.debug(self, "Setting apt_packages variable for PHP 7.3") if not WOAptGet.is_installed(self, 'php7.3-fpm'): apt_packages = apt_packages + WOVariables.wo_php73 + WOVariables.wo_php_extra - if not WOAptGet.is_installed(self, 'php7.2-fpm'): + if not WOAptGet.is_installed(self, 'php7.2-fpm'): apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra else: Log.debug(self, "PHP 7.3 already installed") From 34401eefe6c6bc58c5e73ff4cf9d8681f82ddb53 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Mon, 4 Mar 2019 07:12:57 +0100 Subject: [PATCH 13/56] fix indentation and wp-cli path --- install | 2 +- setup.py | 2 +- wo/cli/plugins/site_functions.py | 77 ++++++++++++++++---------------- wo/cli/plugins/stack.py | 14 +++--- wo/cli/plugins/stack_upgrade.py | 8 ++-- 5 files changed, 51 insertions(+), 52 deletions(-) diff --git a/install b/install index feb3d93..2ba9a78 100644 --- a/install +++ b/install @@ -588,7 +588,7 @@ function wo_update_latest() # Fix for 3.3.2 renamed nginx.conf - nginx -V 2>&1 &>>/dev/null + nginx -V &>>/dev/null 2>&1 if [[ $? -eq 0 ]]; then nginx -t 2>&1 | grep 'open() "/etc/nginx/nginx.conf" failed' &>>/dev/null if [[ $? -eq 0 ]]; then diff --git a/setup.py b/setup.py index b4a9db7..dfc2cdb 100644 --- a/setup.py +++ b/setup.py @@ -55,7 +55,7 @@ except Exception as e: os.system("git config --global user.email {0}".format(wo_email)) if not os.path.isfile('/root/.gitconfig'): - shutil.copy2(os.path.expanduser("~")+'/.gitconfig', '/root/.gitconfig') + shutil.copy2(os.path.expanduser("~")+'/.gitconfig', '/root/.gitconfig') setup(name='wo', version='3.9.5', diff --git a/wo/cli/plugins/site_functions.py b/wo/cli/plugins/site_functions.py index f724e69..43c376c 100644 --- a/wo/cli/plugins/site_functions.py +++ b/wo/cli/plugins/site_functions.py @@ -54,9 +54,9 @@ def check_domain_exists(self, domain): def setupdomain(self, data): - #for debug purpose - # for key, value in data.items() : - # print (key, value) + # for debug purpose + # for key, value in data.items() : + # print (key, value) wo_domain_name = data['site_name'] wo_site_webroot = data['webroot'] if 'webroot' in data.keys() else '' @@ -100,7 +100,6 @@ def setupdomain(self, data): raise SiteError("created nginx configuration failed for site." " check with `nginx -t`") - # create symbolic link for WOFileUtils.create_symlink(self, ['/etc/nginx/sites-available/{0}' .format(wo_domain_name), @@ -323,9 +322,9 @@ def setupwordpress(self, data): .format(wo_domain_name) if data['wpredis'] else ''), log=False - ): + ): pass - else : + else: raise SiteError("generate wp-config failed for wp single site") except CommandExecutionError as e: raise SiteError("generate wp-config failed for wp single site") @@ -346,46 +345,45 @@ def setupwordpress(self, data): "\n\ndefine(\'WP_DEBUG\', false);")) try: if WOShellExec.cmd_exec(self, "bash -c \"php {0} --allow-root" - .format(WOVariables.wo_wpcli_path) - + " core config " - + "--dbname=\'{0}\' --dbprefix=\'{1}\' " - "--dbhost=\'{2}\' " - .format(data['wo_db_name'], wo_wp_prefix, - data['wo_db_host']) - + "--dbuser=\'{0}\' --dbpass=\'{1}\' " - "--extra-php< Date: Mon, 4 Mar 2019 11:39:04 +0100 Subject: [PATCH 14/56] add fastcgi-cache mapping --- wo/cli/plugins/stack.py | 8 ++++++ wo/cli/templates/fastcgi-cache.mustache | 38 +++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 wo/cli/templates/fastcgi-cache.mustache diff --git a/wo/cli/plugins/stack.py b/wo/cli/plugins/stack.py index 16b0dea..7ea9250 100644 --- a/wo/cli/plugins/stack.py +++ b/wo/cli/plugins/stack.py @@ -253,6 +253,14 @@ class WOStackController(CementBaseController): self.app.render((data), 'upstream.mustache', out=wo_nginx) wo_nginx.close() + Log.debug(self, 'Writting the nginx configuration to ' + 'file /etc/nginx/conf.d/map-wp-fastcgi-cache.conf') + wo_nginx = open('/etc/nginx/conf.d/map-wp-fastcgi-cache.conf', + encoding='utf-8', mode='w') + self.app.render((data), 'fastcgi-cache.mustache', + out=wo_nginx) + wo_nginx.close() + # Setup Nginx common directory if not os.path.exists('/etc/nginx/common'): Log.debug(self, 'Creating directory' diff --git a/wo/cli/templates/fastcgi-cache.mustache b/wo/cli/templates/fastcgi-cache.mustache new file mode 100644 index 0000000..7dc99c2 --- /dev/null +++ b/wo/cli/templates/fastcgi-cache.mustache @@ -0,0 +1,38 @@ +# NGINX CONFIGURATION FOR FASTCGI_CACHE EXCEPTION +# DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE +map $http_x_requested_with $http_request_no_cache { + default 0; + XMLHttpRequest 1; +} +map $http_cookie $cookie_no_cache { + default 0; + "~*wordpress_[a-f0-9]+" 1; + "~*wp-postpass" 1; + "~*wordpress_logged_in" 1; + "~*wordpress_no_cache" 1; + "~*comment_author" 1; + "~*woocommerce_items_in_cart" 1; + "~*woocommerce_cart_hash" 1; + "~*wptouch_switch_toogle" 1; + "~*comment_author_email_" 1; +} +map $request_uri $uri_no_cache { + default 0; + "~*/wp-admin/" 1; + "~*/wp-[a-zA-Z0-9-]+.php" 1; + "~*/feed/" 1; + "~*/index.php" 1; + "~*/[a-z0-9_-]+-sitemap([0-9]+)?.xml" 1; + "~*/sitemap(_index)?.xml" 1; + "~*/wp-comments-popup.php" 1; + "~*/wp-links-opml.php" 1; + "~*/xmlrpc.php" 1; +} +map $is_args $query_no_cache { + default 1; + "" 0; +} +map $http_request_no_cache$cookie_no_cache$uri_no_cache$query_no_cache $skip_cache { + default 1; + 0000 0; +} From 89535f0aee13a206c81270269fd22e7b7b6581b4 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Mon, 4 Mar 2019 12:18:20 +0100 Subject: [PATCH 15/56] improve install script & site.py * remove php7.2 installation * cleanup code * improve code quality according to shellcheck warnings --- install | 65 +++----- wo/cli/plugins/clean.py | 2 + wo/cli/plugins/debug.py | 4 +- wo/cli/plugins/site.py | 347 +++++++++++++++++++++------------------- wo/cli/plugins/sync.py | 2 +- 5 files changed, 214 insertions(+), 206 deletions(-) diff --git a/install b/install index 2ba9a78..33def6d 100644 --- a/install +++ b/install @@ -22,17 +22,17 @@ function wo_lib_echo() { - echo $(tput setaf 4)$@$(tput sgr0) + echo "$(tput setaf 4)$*$(tput sgr0)" } function wo_lib_echo_info() { - echo $(tput setaf 7)$@$(tput sgr0) + echo "$(tput setaf 7)$*$(tput sgr0)" } function wo_lib_echo_fail() { - echo $(tput setaf 1)$@$(tput sgr0) + echo "$(tput setaf 1)$*$(tput sgr0)" } ### @@ -49,8 +49,8 @@ fi ### function wo_lib_error() { - echo "[ $(date) ] $(tput setaf 1)$@$(tput sgr0)" - exit $2 + echo "[ $(date) ] $(tput setaf 1)$*$(tput sgr0)" + exit "$2" } ### @@ -93,8 +93,9 @@ fi ### # 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 +if ! { + lsb_release -d | grep -E "14.04|16.04|18.04|jessie|stretch" &>> /dev/null + }; 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 @@ -105,7 +106,7 @@ fi 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 " $? + mkdir -p "$wo_log_dir" || wo_lib_error "Whoops - seems we are unable to create the log directory $wo_log_dir, exit status " $? touch /var/log/wo/{wordops.log,install.log} @@ -141,26 +142,6 @@ function wo_install_dep() fi fi - 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.2 support" - apt-get update &>> /dev/null - apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php-memcached php7.2-imap php7.2-common php7.2-readline php-redis php7.2-mysql php7.2-cli php-imagick php7.2-mbstring php7.2-recode php7.2-bcmath php7.2-opcache php7.2-zip php7.2-xml php7.2-soap php-msgpack graphviz php-xdebug || wo_lib_error "Not all PHP packages could be installed. " 1 - mkdir -p /var/log/php/7.2/ - touch /var/log/php/7.2/slow.log /var/log/php/7.2/fpm.log - systemctl php7.2-fpm restart &>> /dev/null - - 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 php-memcached php7.2-imap php7.2-common php7.2-readlne php-redis php7.2-mysql php7.2-cli php-imagick php7.2-mbstring php7.2-recode php7.2-bcmath php7.2-opcache php7.2-zip php7.2-xml php7.2-soap php-msgpack graphviz php-xdebug || wo_lib_error "Not all PHP packages could be installed." 1 - systemctl php7.2-fpm restart &>> /dev/null - fi - ### # Webp mapping ### @@ -232,7 +213,7 @@ function wo_sync_db() # Check site is enable/live or disable for site in $(ls /etc/nginx/sites-available/ | grep -v default); do - if [ -f /etc/nginx/sites-enabled/$site ]; then + if [ -f "/etc/nginx/sites-enabled/$site" ]; then wo_site_status='1' else wo_site_status='0' @@ -466,11 +447,11 @@ function wo_update_latest() DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confmiss" -o Dpkg::Options::="--force-confold" -y install nginx-custom nginx-ee service nginx restart &>> /dev/null fi - dpkg --get-selections | grep -v deinstall | grep nginx-common - if [ $? -eq 0 ]; then + CHECK_NGINX_COMMON=$(dpkg --get-selections | grep -v deinstall | grep nginx-common) + if [ -n "$CHECK_NGINX_COMMON" ]; then apt-get update - dpkg --get-selections | grep -v deinstall | grep nginx-mainline - if [ $? -eq 0 ]; then + CHECK_NGINX_MAILINE=$(dpkg --get-selections | grep -v deinstall | grep nginx-mainline) + if [ -n "$CHECK_NGINX_MAILINE" ]; then apt-get remove -y nginx-mainline fi service nginx stop &>> /dev/null @@ -494,11 +475,11 @@ function wo_update_latest() apt-get -o Dpkg::Options::="--force-confmiss" -o Dpkg::Options::="--force-confold" -y install nginx-custom systemctl restart nginx &>> /dev/null fi - dpkg --get-selections | grep -v deinstall | grep nginx-common - if [ $? -eq 0 ]; then + CHECK_NGINX_COMMON=$(dpkg --get-selections | grep -v deinstall | grep nginx-common) + if [ -n "$CHECK_NGINX_COMMON" ]; then apt-get update - dpkg --get-selections | grep -v deinstall | grep nginx-mainline - if [ $? -eq 0 ]; then + CHECK_NGINX_MAILINE=$(dpkg --get-selections | grep -v deinstall | grep nginx-mainline) + if [ -n "$CHECK_NGINX_MAILINE" ]; then apt-get remove -y nginx-mainline fi systemctl stop nginx &>> /dev/null @@ -516,8 +497,8 @@ function wo_update_latest() fi # Fix HHVM autostart on reboot - dpkg --get-selections | grep -v deinstall | grep hhvm &>> /dev/null - if [ $? -eq 0 ]; then + CHECK_HHVM_INSTALL=$(dpkg --get-selections | grep -v deinstall | grep hhvm &>> /dev/null) + if [ -n "$CHECK_HHVM_INSTALL" ]; then update-rc.d hhvm defaults &>> /dev/null fi @@ -645,7 +626,7 @@ function wo_update_latest() systemctl php7.2-fpm restart &>> /dev/null fi - #Fix for SSL cert --all + # Fix for SSL cert --all crontab -l | grep -q '\-\-min_expiry_limit' if [[ $? -eq 0 ]]; then crontab -l > /var/spool/cron/cron-backup.txt #backup cron before editing @@ -674,7 +655,7 @@ function wo_git_init() git add -A . git commit -am "Installed/Updated to WordOps" &>> /dev/null - #PHP under git version control + # PHP under git version control [ -d /etc/php ] && { cd /etc/php || exit 1 if [ ! -d /etc/php/.git ]; then @@ -700,7 +681,7 @@ else read -p "Update WordOps to $wo_version_new (y/n): " wo_ans if [ "$wo_ans" = "y" ] || [ "$wo_ans" = "Y" ]; then wo_install_dep | tee -ai $wo_install_log - wo_sync_db 2&>>1 $EE_INSTALL_LOG + wo_sync_db >> $EE_INSTALL_LOG 2>&1 secure_wo_db | tee -ai $EE_INSTALL_LOG wo_upgrade_php | tee -ai $wo_install_log wo_install | tee -ai $wo_install_log diff --git a/wo/cli/plugins/clean.py b/wo/cli/plugins/clean.py index 38ddf61..8780e8e 100644 --- a/wo/cli/plugins/clean.py +++ b/wo/cli/plugins/clean.py @@ -53,6 +53,7 @@ class WOCleanController(CementBaseController): self.clean_opcache() if self.app.pargs.redis: self.clean_redis() + @expose(hide=True) def clean_redis(self): """This function clears Redis cache""" @@ -97,6 +98,7 @@ class WOCleanController(CementBaseController): " or install them with `wo stack install --admin`") Log.error(self, "Unable to clean opcache", False) + def load(app): # register the plugin class.. this only happens if the plugin is enabled handler.register(WOCleanController) diff --git a/wo/cli/plugins/debug.py b/wo/cli/plugins/debug.py index 5bab61e..57da542 100644 --- a/wo/cli/plugins/debug.py +++ b/wo/cli/plugins/debug.py @@ -759,8 +759,8 @@ class WODebugController(CementBaseController): self.debug_fpm() if self.app.pargs.php73: self.debug_php73() - if self.app.pargs.fpm7: - self.debug_fpm7() + if self.app.pargs.fpm73: + self.debug_fpm73() if self.app.pargs.mysql: # MySQL debug will not work for remote MySQL if WOVariables.wo_mysql_host is "localhost": diff --git a/wo/cli/plugins/site.py b/wo/cli/plugins/site.py index a69883d..417342d 100644 --- a/wo/cli/plugins/site.py +++ b/wo/cli/plugins/site.py @@ -33,7 +33,7 @@ class WOSiteController(CementBaseController): arguments = [ (['site_name'], dict(help='Website name', nargs='?')), - ] + ] usage = "wo site (command) [options]" @expose(hide=True) @@ -160,15 +160,15 @@ class WOSiteController(CementBaseController): ssl = ("enabled" if siteinfo.is_ssl else "disabled") if (ssl == "enabled"): sslprovider = "Lets Encrypt" - sslexpiry = str(SSL.getExpirationDate(self,wo_domain)) + sslexpiry = str(SSL.getExpirationDate(self, wo_domain)) else: sslprovider = '' sslexpiry = '' data = dict(domain=wo_domain, webroot=wo_site_webroot, accesslog=access_log, errorlog=error_log, - dbname=wo_db_name, dbuser=wo_db_user,php_version=php_version, + dbname=wo_db_name, dbuser=wo_db_user, php_version=php_version, dbpass=wo_db_pass, hhvm=hhvm, - ssl=ssl, sslprovider=sslprovider, sslexpiry= sslexpiry, + ssl=ssl, sslprovider=sslprovider, sslexpiry=sslexpiry, type=sitetype + " " + cachetype + " ({0})" .format("enabled" if siteinfo.is_enabled else "disabled")) @@ -254,7 +254,7 @@ class WOSiteEditController(CementBaseController): (['site_name'], dict(help='domain name for the site', nargs='?')), - ] + ] @expose(hide=True) def default(self): @@ -282,7 +282,7 @@ class WOSiteEditController(CementBaseController): except CommandExecutionError as e: Log.error(self, "Failed invoke editor") if (WOGit.checkfilestatus(self, "/etc/nginx", - '/etc/nginx/sites-available/{0}'.format(wo_domain))): + '/etc/nginx/sites-available/{0}'.format(wo_domain))): WOGit.add(self, ["/etc/nginx"], msg="Edit website: {0}" .format(wo_domain)) # Reload NGINX @@ -333,7 +333,7 @@ class WOSiteCreateController(CementBaseController): action='store_true')), (['--hhvm'], dict(help="create HHVM site", action='store_true')), - (['-le','--letsencrypt'], + (['-le', '--letsencrypt'], dict(help="configure letsencrypt ssl for the site", action='store_true')), (['--user'], dict(help="provide user for wordpress site")), @@ -347,7 +347,7 @@ class WOSiteCreateController(CementBaseController): (['--experimental'], dict(help="Enable Experimenal packages without prompt", action='store_true')), - ] + ] @expose(hide=True) def default(self): @@ -417,7 +417,7 @@ class WOSiteCreateController(CementBaseController): wpsubdir=False, webroot=wo_site_webroot) data['basic'] = True - if stype in ['html', 'php' ]: + if stype in ['html', 'php']: data = dict(site_name=wo_domain, www_domain=wo_www_domain, static=True, basic=False, php73=False, wp=False, wpfc=False, wpsc=False, multisite=False, @@ -455,7 +455,8 @@ class WOSiteCreateController(CementBaseController): if data and self.app.pargs.php73: if (self.app.pargs.experimental): - Log.info(self, "Do you wish to install PHP 7.3 now for {0}?".format(wo_domain)) + Log.info( + self, "Do you wish to install PHP 7.3 now for {0}?".format(wo_domain)) # Check prompt check_prompt = input("Type \"y\" to continue [n]:") @@ -509,7 +510,7 @@ class WOSiteCreateController(CementBaseController): "disable it by changing cache later.\nDo you wish" " to enable Redis now for {0}?".format(wo_domain)) - # Check prompt + # Check prompt check_prompt = input("Type \"y\" to continue [n]:") if check_prompt != "Y" and check_prompt != "y": Log.error(self, "Not using Redis for site") @@ -536,7 +537,8 @@ class WOSiteCreateController(CementBaseController): hashbucket(self) except SiteError as e: # call cleanup actions on failure - Log.info(self, Log.FAIL + "There was a serious error encountered...") + Log.info(self, Log.FAIL + + "There was a serious error encountered...") Log.info(self, Log.FAIL + "Cleaning up afterwards...") doCleanupAction(self, domain=wo_domain, webroot=data['webroot']) @@ -548,7 +550,8 @@ class WOSiteCreateController(CementBaseController): addNewSite(self, wo_domain, stype, cache, wo_site_webroot) # Service Nginx Reload if not WOService.reload_service(self, 'nginx'): - Log.info(self, Log.FAIL + "There was a serious error encountered...") + Log.info(self, Log.FAIL + + "There was a serious error encountered...") Log.info(self, Log.FAIL + "Cleaning up afterwards...") doCleanupAction(self, domain=wo_domain) deleteSiteInfo(self, wo_domain) @@ -568,7 +571,6 @@ class WOSiteCreateController(CementBaseController): else: php_version = "7.2" - addNewSite(self, wo_domain, stype, cache, wo_site_webroot, hhvm=hhvm, php_version=php_version) @@ -584,7 +586,8 @@ class WOSiteCreateController(CementBaseController): except SiteError as e: # call cleanup actions on failure Log.debug(self, str(e)) - Log.info(self, Log.FAIL + "There was a serious error encountered...") + Log.info(self, Log.FAIL + + "There was a serious error encountered...") Log.info(self, Log.FAIL + "Cleaning up afterwards...") doCleanupAction(self, domain=wo_domain, webroot=data['webroot'], @@ -613,7 +616,8 @@ class WOSiteCreateController(CementBaseController): Log.debug(self, str(e)) Log.debug(self, "Error occured while generating " "wo-config.php") - Log.info(self, Log.FAIL + "There was a serious error encountered...") + Log.info(self, Log.FAIL + + "There was a serious error encountered...") Log.info(self, Log.FAIL + "Cleaning up afterwards...") doCleanupAction(self, domain=wo_domain, webroot=data['webroot'], @@ -636,7 +640,8 @@ class WOSiteCreateController(CementBaseController): except SiteError as e: # call cleanup actions on failure Log.debug(self, str(e)) - Log.info(self, Log.FAIL + "There was a serious error encountered...") + Log.info(self, Log.FAIL + + "There was a serious error encountered...") Log.info(self, Log.FAIL + "Cleaning up afterwards...") doCleanupAction(self, domain=wo_domain, webroot=data['webroot'], @@ -649,7 +654,8 @@ class WOSiteCreateController(CementBaseController): # Service Nginx Reload call cleanup if failed to reload nginx if not WOService.reload_service(self, 'nginx'): - Log.info(self, Log.FAIL + "There was a serious error encountered...") + Log.info(self, Log.FAIL + + "There was a serious error encountered...") Log.info(self, Log.FAIL + "Cleaning up afterwards...") doCleanupAction(self, domain=wo_domain, webroot=data['webroot']) @@ -672,7 +678,8 @@ class WOSiteCreateController(CementBaseController): setwebrootpermissions(self, data['webroot']) except SiteError as e: Log.debug(self, str(e)) - Log.info(self, Log.FAIL + "There was a serious error encountered...") + Log.info(self, Log.FAIL + + "There was a serious error encountered...") Log.info(self, Log.FAIL + "Cleaning up afterwards...") doCleanupAction(self, domain=wo_domain, webroot=data['webroot']) @@ -704,14 +711,15 @@ class WOSiteCreateController(CementBaseController): Log.error(self, "Check the log for details: " "`tail /var/log/wo/wordops.log` and please try again") - if self.app.pargs.letsencrypt : + if self.app.pargs.letsencrypt: if (self.app.pargs.experimental): if stype in ['wpsubdomain']: - Log.warn(self, "Wildcard domains are not supported in Lets Encrypt.\nWP SUBDOMAIN site will get SSL for primary site only.") + Log.warn( + self, "Wildcard domains are not supported in Lets Encrypt.\nWP SUBDOMAIN site will get SSL for primary site only.") Log.info(self, "Letsencrypt is currently in beta phase." - " \nDo you wish" - " to enable SSl now for {0}?".format(wo_domain)) + " \nDo you wish" + " to enable SSl now for {0}?".format(wo_domain)) # Check prompt check_prompt = input("Type \"y\" to continue [n]:") @@ -722,41 +730,41 @@ class WOSiteCreateController(CementBaseController): data['letsencrypt'] = True letsencrypt = True else: - data['letsencrypt'] = True - letsencrypt = True + data['letsencrypt'] = True + letsencrypt = True if data['letsencrypt'] is True: - setupLetsEncrypt(self, wo_domain) - httpsRedirect(self,wo_domain) - Log.info(self,"Creating Cron Job for cert auto-renewal") - WOCron.setcron_weekly(self,'wo site update --le=renew --all 2> /dev/null'.format(wo_domain),'Renew all' - ' letsencrypt SSL cert. Set by WordOps') + setupLetsEncrypt(self, wo_domain) + httpsRedirect(self, wo_domain) + Log.info(self, "Creating Cron Job for cert auto-renewal") + WOCron.setcron_weekly(self, 'wo site update --le=renew --all 2> /dev/null'.format(wo_domain), 'Renew all' + ' letsencrypt SSL cert. Set by WordOps') - if not WOService.reload_service(self, 'nginx'): + if not WOService.reload_service(self, 'nginx'): Log.error(self, "service nginx reload failed. " - "check issues with `nginx -t` command") + "check issues with `nginx -t` command") - Log.info(self, "Congratulations! Successfully Configured SSl for Site " + Log.info(self, "Congratulations! Successfully Configured SSl for Site " " https://{0}".format(wo_domain)) - if (SSL.getExpirationDays(self,wo_domain)>0): - Log.info(self, "Your cert will expire within " + str(SSL.getExpirationDays(self,wo_domain)) + " days.") - else: - Log.warn(self, "Your cert already EXPIRED ! .PLEASE renew soon . ") + if (SSL.getExpirationDays(self, wo_domain) > 0): + Log.info(self, "Your cert will expire within " + + str(SSL.getExpirationDays(self, wo_domain)) + " days.") + else: + Log.warn( + self, "Your cert already EXPIRED ! .PLEASE renew soon . ") - # Add nginx conf folder into GIT - WOGit.add(self, ["{0}/conf/nginx".format(wo_site_webroot)], + # Add nginx conf folder into GIT + WOGit.add(self, ["{0}/conf/nginx".format(wo_site_webroot)], msg="Adding letsencrypts config of site: {0}" - .format(wo_domain)) - updateSiteInfo(self, wo_domain, ssl=letsencrypt) + .format(wo_domain)) + updateSiteInfo(self, wo_domain, ssl=letsencrypt) elif data['letsencrypt'] is False: Log.info(self, "Not using Let\'s encrypt for Site " " http://{0}".format(wo_domain)) - - class WOSiteUpdateController(CementBaseController): class Meta: label = 'update' @@ -798,7 +806,7 @@ class WOSiteUpdateController(CementBaseController): dict(help='Use HHVM for site', action='store' or 'store_const', choices=('on', 'off'), const='on', nargs='?')), - (['-le','--letsencrypt'], + (['-le', '--letsencrypt'], dict(help="configure letsencrypt ssl for the site", action='store' or 'store_const', choices=('on', 'off', 'renew'), const='on', nargs='?')), @@ -809,7 +817,7 @@ class WOSiteUpdateController(CementBaseController): action='store_true')), (['--all'], dict(help="update all sites", action='store_true')), - ] + ] @expose(help="Update site type or cache") def default(self): @@ -852,7 +860,6 @@ class WOSiteUpdateController(CementBaseController): letsencrypt = False php73 = None - data = dict() try: stype, cache = detSitePar(vars(pargs)) @@ -905,9 +912,9 @@ class WOSiteUpdateController(CementBaseController): old_php73 = False if (pargs.password and not (pargs.html or - pargs.php or pargs.php73 or pargs.mysql or - pargs.wp or pargs.wpfc or pargs.wpsc or - pargs.wpsubdir or pargs.wpsubdomain)): + pargs.php or pargs.php73 or pargs.mysql or + pargs.wp or pargs.wpfc or pargs.wpsc or + pargs.wpsubdir or pargs.wpsubdomain)): try: updatewpuserpassword(self, wo_domain, wo_site_webroot) except SiteError as e: @@ -917,24 +924,24 @@ class WOSiteUpdateController(CementBaseController): if ((stype == "proxy" and stype == oldsitetype and self.app.pargs.hhvm) or (stype == "proxy" and - stype == oldsitetype )): - Log.info(self, Log.FAIL + - "Can not update proxy site to HHVM") - return 1 + stype == oldsitetype)): + Log.info(self, Log.FAIL + + "Can not update proxy site to HHVM") + return 1 if stype == "html" and stype == oldsitetype and self.app.pargs.hhvm: Log.info(self, Log.FAIL + "Can not update HTML site to HHVM") return 1 if ((stype == 'php' and oldsitetype not in ['html', 'proxy', 'php73']) or - # (stype == 'php73' and oldsitetype not in ['html', 'mysql', 'php', 'php73', 'wp', 'wpsubdir', 'wpsubdomain', ]) or + # (stype == 'php73' and oldsitetype not in ['html', 'mysql', 'php', 'php73', 'wp', 'wpsubdir', 'wpsubdomain', ]) or (stype == 'mysql' and oldsitetype not in ['html', 'php', - 'proxy','php73']) or + 'proxy', 'php73']) or (stype == 'wp' and oldsitetype not in ['html', 'php', 'mysql', 'proxy', 'wp', 'php73']) or (stype == 'wpsubdir' and oldsitetype in ['wpsubdomain']) or (stype == 'wpsubdomain' and oldsitetype in ['wpsubdir']) or - (stype == oldsitetype and cache == oldcachetype) and - not pargs.php73): + (stype == oldsitetype and cache == oldcachetype) and + not pargs.php73): Log.info(self, Log.FAIL + "can not update {0} {1} to {2} {3}". format(oldsitetype, oldcachetype, stype, cache)) return 1 @@ -1038,10 +1045,10 @@ class WOSiteUpdateController(CementBaseController): data['hhvm'] = False hhvm = False - if pargs.php73 == 'on' : + if pargs.php73 == 'on': data['php73'] = True php73 = True - check_php_version= '7.3' + check_php_version = '7.3' elif pargs.php73 == 'off': data['php73'] = False php73 = False @@ -1057,64 +1064,73 @@ class WOSiteUpdateController(CementBaseController): "site") pargs.php73 = False - #--letsencrypt=renew code goes here + # --letsencrypt=renew code goes here if pargs.letsencrypt == "renew" and not pargs.all: - expiry_days = SSL.getExpirationDays(self,wo_domain) + expiry_days = SSL.getExpirationDays(self, wo_domain) min_expiry_days = 30 if check_ssl: if (expiry_days <= min_expiry_days): - renewLetsEncrypt(self,wo_domain) + renewLetsEncrypt(self, wo_domain) else: - Log.error(self,"You have more than 30 days with the current certificate - refusing to run.") + Log.error( + self, "You have more than 30 days with the current certificate - refusing to run.") else: - Log.error(self,"Cannot renew - HTTPS is not configured for the given site. Install LE first...") + Log.error( + self, "Cannot renew - HTTPS is not configured for the given site. Install LE first...") if not WOService.reload_service(self, 'nginx'): - Log.error(self, "service nginx reload failed. " - "check issues with `nginx -t` command") + Log.error(self, "service nginx reload failed. " + "check issues with `nginx -t` command") Log.info(self, "SUCCESS: Certificate was successfully renewed For" " https://{0}".format(wo_domain)) - if (SSL.getExpirationDays(self,wo_domain)>0): - Log.info(self, "Your cert will expire within " + str(SSL.getExpirationDays(self,wo_domain)) + " days.") - Log.info(self, "Expiration date: " + str(SSL.getExpirationDate(self,wo_domain))) + if (SSL.getExpirationDays(self, wo_domain) > 0): + Log.info(self, "Your cert will expire within " + + str(SSL.getExpirationDays(self, wo_domain)) + " days.") + Log.info(self, "Expiration date: " + + str(SSL.getExpirationDate(self, wo_domain))) else: - Log.warn(self, "The certificate seems to be already expired. Please renew it as soon as possible...") + Log.warn( + self, "The certificate seems to be already expired. Please renew it as soon as possible...") return 0 if pargs.all and pargs.letsencrypt == "renew": if check_ssl: - expiry_days = SSL.getExpirationDays(self,wo_domain,True) + expiry_days = SSL.getExpirationDays(self, wo_domain, True) if expiry_days < 0: return 0 min_expiry_days = 30 if (expiry_days <= min_expiry_days): - renewLetsEncrypt(self,wo_domain) + renewLetsEncrypt(self, wo_domain) if not WOService.reload_service(self, 'nginx'): - Log.error(self, "service nginx reload failed. " - "check issues with `nginx -t` command") + Log.error(self, "service nginx reload failed. " + "check issues with `nginx -t` command") Log.info(self, "SUCCESS: Certificate was successfully renewed For" - " https://{0}".format(wo_domain)) + " https://{0}".format(wo_domain)) else: - Log.info(self,"You have more than 30 days with the current certificate - refusing to run.\n") + Log.info( + self, "You have more than 30 days with the current certificate - refusing to run.\n") - if (SSL.getExpirationDays(self,wo_domain)>0): - Log.info(self, "Your cert will expire within " + str(SSL.getExpirationDays(self,wo_domain)) + " days.") - Log.info(self, "Expiration date: \n\n" + str(SSL.getExpirationDate(self,wo_domain))) + if (SSL.getExpirationDays(self, wo_domain) > 0): + Log.info(self, "Your cert will expire within " + + str(SSL.getExpirationDays(self, wo_domain)) + " days.") + Log.info(self, "Expiration date: \n\n" + + str(SSL.getExpirationDate(self, wo_domain))) return 0 - #else: - # Log.warn(self, "Your cert already EXPIRED ! .PLEASE renew soon . ") + # else: + # Log.warn(self, "Your cert already EXPIRED ! .PLEASE renew soon . ") else: - Log.info(self,"SSL not configured for site http://{0}".format(wo_domain)) + Log.info( + self, "SSL not configured for site http://{0}".format(wo_domain)) return 0 if pargs.all and pargs.letsencrypt == "off": if letsencrypt is check_ssl: if letsencrypt is False: Log.error(self, "HTTPS is not configured for given " - "site",False) + "site", False) return 0 pass @@ -1129,10 +1145,10 @@ class WOSiteUpdateController(CementBaseController): if letsencrypt is check_ssl: if letsencrypt is False: Log.error(self, "SSl is not configured for given " - "site") + "site") elif letsencrypt is True: Log.error(self, "SSl is already configured for given " - "site") + "site") pargs.letsencrypt = False if pargs.hhvm: @@ -1162,10 +1178,11 @@ class WOSiteUpdateController(CementBaseController): data['php73'] = False php73 = False - if pargs.hhvm=="on" or pargs.letsencrypt=="on" or pargs.php73=="on": + if pargs.hhvm == "on" or pargs.letsencrypt == "on" or pargs.php73 == "on": if pargs.php73 == "on": if (not pargs.experimental): - Log.info(self, "Do you wish to enable PHP 7.3 now for {0}?".format(wo_domain)) + Log.info( + self, "Do you wish to enable PHP 7.3 now for {0}?".format(wo_domain)) check_prompt = input("Type \"y\" to continue [n]:") if check_prompt != "Y" and check_prompt != "y": @@ -1204,7 +1221,8 @@ class WOSiteUpdateController(CementBaseController): if (not pargs.experimental): if oldsitetype in ['wpsubdomain']: - Log.warn(self, "Wildcard domains are not supported in Lets Encrypt.\nWP SUBDOMAIN site will get SSL for primary site only.") + Log.warn( + self, "Wildcard domains are not supported in Lets Encrypt.\nWP SUBDOMAIN site will get SSL for primary site only.") Log.info(self, "Letsencrypt is currently in beta phase." " \nDo you wish" @@ -1222,8 +1240,6 @@ class WOSiteUpdateController(CementBaseController): data['letsencrypt'] = True letsencrypt = True - - if pargs.wpredis and data['currcachetype'] != 'wpredis': if (not pargs.experimental): Log.info(self, "Redis is experimental feature and it may not" @@ -1240,7 +1256,7 @@ class WOSiteUpdateController(CementBaseController): cache = 'basic' if ((hhvm is old_hhvm) and (php73 is old_php73) and - (stype == oldsitetype and cache == oldcachetype)): + (stype == oldsitetype and cache == oldcachetype)): return 1 if not data: @@ -1265,7 +1281,7 @@ class WOSiteUpdateController(CementBaseController): except Exception as e: Log.debug(self, str(e)) Log.info(self, Log.FAIL + "Check the log for details: " - "`tail /var/log/wo/wordops.log` and please try again") + "`tail /var/log/wo/wordops.log` and please try again") return 1 # setup NGINX configuration, and webroot @@ -1274,13 +1290,13 @@ class WOSiteUpdateController(CementBaseController): except SiteError as e: Log.debug(self, str(e)) Log.info(self, Log.FAIL + "Update site failed." - "Check the log for details:" - "`tail /var/log/wo/wordops.log` and please try again") + "Check the log for details:" + "`tail /var/log/wo/wordops.log` and please try again") return 1 if 'proxy' in data.keys() and data['proxy']: updateSiteInfo(self, wo_domain, stype=stype, cache=cache, - hhvm=hhvm,ssl=True if check_site.is_ssl else False) + hhvm=hhvm, ssl=True if check_site.is_ssl else False) Log.info(self, "Successfully updated site" " http://{0}".format(wo_domain)) return 0 @@ -1288,54 +1304,55 @@ class WOSiteUpdateController(CementBaseController): if pargs.letsencrypt: if data['letsencrypt'] is True: if not os.path.isfile("{0}/conf/nginx/ssl.conf.disabled" - .format(wo_site_webroot)): + .format(wo_site_webroot)): setupLetsEncrypt(self, wo_domain) else: WOFileUtils.mvfile(self, "{0}/conf/nginx/ssl.conf.disabled" - .format(wo_site_webroot), - '{0}/conf/nginx/ssl.conf' - .format(wo_site_webroot)) + .format(wo_site_webroot), + '{0}/conf/nginx/ssl.conf' + .format(wo_site_webroot)) - httpsRedirect(self,wo_domain) - Log.info(self,"Creating Cron Job for cert auto-renewal") - WOCron.setcron_weekly(self,'wo site update --le=renew --all 2> /dev/null'.format(wo_domain),'Renew all' - ' letsencrypt SSL cert. Set by WordOps') + httpsRedirect(self, wo_domain) + Log.info(self, "Creating Cron Job for cert auto-renewal") + WOCron.setcron_weekly(self, 'wo site update --le=renew --all 2> /dev/null'.format(wo_domain), 'Renew all' + ' letsencrypt SSL cert. Set by WordOps') if not WOService.reload_service(self, 'nginx'): - Log.error(self, "service nginx reload failed. " - "check issues with `nginx -t` command") + Log.error(self, "service nginx reload failed. " + "check issues with `nginx -t` command") Log.info(self, "Congratulations! Successfully Configured SSl for Site " " https://{0}".format(wo_domain)) - if (SSL.getExpirationDays(self,wo_domain)>0): - Log.info(self, "Your cert will expire within " + str(SSL.getExpirationDays(self,wo_domain)) + " days.") + if (SSL.getExpirationDays(self, wo_domain) > 0): + Log.info(self, "Your cert will expire within " + + str(SSL.getExpirationDays(self, wo_domain)) + " days.") else: - Log.warn(self, "Your cert already EXPIRED ! .PLEASE renew soon . ") + Log.warn( + self, "Your cert already EXPIRED ! .PLEASE renew soon . ") elif data['letsencrypt'] is False: if os.path.isfile("{0}/conf/nginx/ssl.conf" - .format(wo_site_webroot)): - Log.info(self,'Setting Nginx configuration') - WOFileUtils.mvfile(self, "{0}/conf/nginx/ssl.conf" - .format(wo_site_webroot), - '{0}/conf/nginx/ssl.conf.disabled' - .format(wo_site_webroot)) - httpsRedirect(self,wo_domain,False) - if not WOService.reload_service(self, 'nginx'): - Log.error(self, "service nginx reload failed. " - "check issues with `nginx -t` command") - #Log.info(self,"Removing Cron Job set for cert auto-renewal") - #WOCron.remove_cron(self,'wo site update {0} --le=renew --min_expiry_limit 30 2> \/dev\/null'.format(wo_domain)) - Log.info(self, "Successfully Disabled SSl for Site " - " http://{0}".format(wo_domain)) - + .format(wo_site_webroot)): + Log.info(self, 'Setting Nginx configuration') + WOFileUtils.mvfile(self, "{0}/conf/nginx/ssl.conf" + .format(wo_site_webroot), + '{0}/conf/nginx/ssl.conf.disabled' + .format(wo_site_webroot)) + httpsRedirect(self, wo_domain, False) + if not WOService.reload_service(self, 'nginx'): + Log.error(self, "service nginx reload failed. " + "check issues with `nginx -t` command") + # Log.info(self,"Removing Cron Job set for cert auto-renewal") + # WOCron.remove_cron(self,'wo site update {0} --le=renew --min_expiry_limit 30 2> \/dev\/null'.format(wo_domain)) + Log.info(self, "Successfully Disabled SSl for Site " + " http://{0}".format(wo_domain)) # Add nginx conf folder into GIT WOGit.add(self, ["{0}/conf/nginx".format(wo_site_webroot)], - msg="Adding letsencrypts config of site: {0}" - .format(wo_domain)) + msg="Adding letsencrypts config of site: {0}" + .format(wo_domain)) updateSiteInfo(self, wo_domain, ssl=letsencrypt) return 0 @@ -1353,7 +1370,7 @@ class WOSiteUpdateController(CementBaseController): " http://{0}".format(wo_domain)) return 0 - #if data['wo_db_name'] and not data['wp']: + # if data['wo_db_name'] and not data['wp']: if 'wo_db_name' in data.keys() and not data['wp']: try: data = setupdatabase(self, data) @@ -1409,10 +1426,11 @@ class WOSiteUpdateController(CementBaseController): return 1 if ((oldcachetype in ['wpsc', 'basic', 'wpredis'] and - (data['wpfc'])) or (oldsitetype == 'wp' and data['multisite'] and data['wpfc'])): + (data['wpfc'])) or (oldsitetype == 'wp' and data['multisite'] and data['wpfc'])): try: plugin_data = '{"log_level":"INFO","log_filesize":5,"enable_purge":1,"enable_map":0,"enable_log":0,"enable_stamp":0,"purge_homepage_on_new":1,"purge_homepage_on_edit":1,"purge_homepage_on_del":1,"purge_archive_on_new":1,"purge_archive_on_edit":0,"purge_archive_on_del":0,"purge_archive_on_new_comment":0,"purge_archive_on_deleted_comment":0,"purge_page_on_mod":1,"purge_page_on_new_comment":1,"purge_page_on_deleted_comment":1,"cache_method":"enable_fastcgi","purge_method":"get_request","redis_hostname":"127.0.0.1","redis_port":"6379","redis_prefix":"nginx-cache:"}' - setupwp_plugin(self, 'nginx-helper', 'rt_wp_nginx_helper_options', plugin_data, data) + setupwp_plugin( + self, 'nginx-helper', 'rt_wp_nginx_helper_options', plugin_data, data) except SiteError as e: Log.debug(self, str(e)) Log.info(self, Log.FAIL + "Update nginx-helper settings failed. " @@ -1421,10 +1439,11 @@ class WOSiteUpdateController(CementBaseController): return 1 elif ((oldcachetype in ['wpsc', 'basic', 'wpfc'] and - (data['wpredis'])) or (oldsitetype == 'wp' and data['multisite'] and data['wpredis'])): + (data['wpredis'])) or (oldsitetype == 'wp' and data['multisite'] and data['wpredis'])): try: plugin_data = '{"log_level":"INFO","log_filesize":5,"enable_purge":1,"enable_map":0,"enable_log":0,"enable_stamp":0,"purge_homepage_on_new":1,"purge_homepage_on_edit":1,"purge_homepage_on_del":1,"purge_archive_on_new":1,"purge_archive_on_edit":0,"purge_archive_on_del":0,"purge_archive_on_new_comment":0,"purge_archive_on_deleted_comment":0,"purge_page_on_mod":1,"purge_page_on_new_comment":1,"purge_page_on_deleted_comment":1,"cache_method":"enable_redis","purge_method":"get_request","redis_hostname":"127.0.0.1","redis_port":"6379","redis_prefix":"nginx-cache:"}' - setupwp_plugin(self, 'nginx-helper', 'rt_wp_nginx_helper_options', plugin_data, data) + setupwp_plugin( + self, 'nginx-helper', 'rt_wp_nginx_helper_options', plugin_data, data) except SiteError as e: Log.debug(self, str(e)) Log.info(self, Log.FAIL + "Update nginx-helper settings failed. " @@ -1434,7 +1453,8 @@ class WOSiteUpdateController(CementBaseController): else: try: plugin_data = '{"log_level":"INFO","log_filesize":5,"enable_purge":0,"enable_map":0,"enable_log":0,"enable_stamp":0,"purge_homepage_on_new":1,"purge_homepage_on_edit":1,"purge_homepage_on_del":1,"purge_archive_on_new":1,"purge_archive_on_edit":0,"purge_archive_on_del":0,"purge_archive_on_new_comment":0,"purge_archive_on_deleted_comment":0,"purge_page_on_mod":1,"purge_page_on_new_comment":1,"purge_page_on_deleted_comment":1,"cache_method":"enable_redis","purge_method":"get_request","redis_hostname":"127.0.0.1","redis_port":"6379","redis_prefix":"nginx-cache:"}' - setupwp_plugin(self, 'nginx-helper', 'rt_wp_nginx_helper_options', plugin_data, data) + setupwp_plugin( + self, 'nginx-helper', 'rt_wp_nginx_helper_options', plugin_data, data) except SiteError as e: Log.debug(self, str(e)) Log.info(self, Log.FAIL + "Update nginx-helper settings failed. " @@ -1475,14 +1495,18 @@ class WOSiteUpdateController(CementBaseController): if oldcachetype != 'wpredis' and data['wpredis']: try: if installwp_plugin(self, 'redis-cache', data): - #search for wp-config.php - if WOFileUtils.isexist(self,"{0}/wp-config.php".format(wo_site_webroot)): - config_path = '{0}/wp-config.php'.format(wo_site_webroot) - elif WOFileUtils.isexist(self,"{0}/htdocs/wp-config.php".format(wo_site_webroot)): - config_path = '{0}/htdocs/wp-config.php'.format(wo_site_webroot) + # search for wp-config.php + if WOFileUtils.isexist(self, "{0}/wp-config.php".format(wo_site_webroot)): + config_path = '{0}/wp-config.php'.format( + wo_site_webroot) + elif WOFileUtils.isexist(self, "{0}/htdocs/wp-config.php".format(wo_site_webroot)): + config_path = '{0}/htdocs/wp-config.php'.format( + wo_site_webroot) else: - Log.debug(self, "Updating wp-config.php failed. File could not be located.") - Log.error(self,"wp-config.php could not be located !!") + Log.debug( + self, "Updating wp-config.php failed. File could not be located.") + Log.error( + self, "wp-config.php could not be located !!") raise SiteError if WOShellExec.cmd_exec(self, "grep -q \"WP_CACHE_KEY_SALT\" {0}" @@ -1491,7 +1515,7 @@ class WOSiteUpdateController(CementBaseController): else: try: wpconfig = open("{0}".format(config_path), - encoding='utf-8', mode='a') + encoding='utf-8', mode='a') wpconfig.write("\n\ndefine( \'WP_CACHE_KEY_SALT\', \'{0}:\' );" .format(wo_domain)) wpconfig.close() @@ -1543,10 +1567,10 @@ class WOSiteUpdateController(CementBaseController): db_user=data['wo_db_user'], db_password=data['wo_db_pass'], db_host=data['wo_db_host'], hhvm=hhvm, - ssl=True if check_site.is_ssl else False,php_version=check_php_version) + ssl=True if check_site.is_ssl else False, php_version=check_php_version) else: updateSiteInfo(self, wo_domain, stype=stype, cache=cache, - hhvm=hhvm, ssl=True if check_site.is_ssl else False,php_version=check_php_version) + hhvm=hhvm, ssl=True if check_site.is_ssl else False, php_version=check_php_version) Log.info(self, "Successfully updated site" " http://{0}".format(wo_domain)) return 0 @@ -1564,7 +1588,7 @@ class WOSiteDeleteController(CementBaseController): (['--no-prompt'], dict(help="doesnt ask permission for delete", action='store_true')), - (['-f','--force'], + (['-f', '--force'], dict(help="forcefully delete site and configuration", action='store_true')), (['--all'], @@ -1573,7 +1597,7 @@ class WOSiteDeleteController(CementBaseController): dict(help="delete db only", action='store_true')), (['--files'], dict(help="delete webroot only", action='store_true')), - ] + ] @expose(help="Delete website configuration and files") @expose(hide=True) @@ -1599,7 +1623,7 @@ class WOSiteDeleteController(CementBaseController): Log.error(self, "site {0} does not exist".format(wo_domain)) if ((not self.app.pargs.db) and (not self.app.pargs.files) and - (not self.app.pargs.all)): + (not self.app.pargs.all)): self.app.pargs.all = True # Gather information from wo-db for wo_domain @@ -1636,7 +1660,8 @@ class WOSiteDeleteController(CementBaseController): mark_db_delete_prompt = True Log.info(self, "Deleting Database, {0}, user {1}" .format(wo_db_name, wo_db_user)) - deleteDB(self, wo_db_name, wo_db_user, wo_mysql_grant_host, False) + deleteDB(self, wo_db_name, wo_db_user, + wo_mysql_grant_host, False) updateSiteInfo(self, wo_domain, db_name='deleted', db_user='deleted', @@ -1676,7 +1701,7 @@ class WOSiteDeleteController(CementBaseController): removeNginxConf(self, wo_domain) deleteSiteInfo(self, wo_domain) Log.info(self, "Deleted site {0}".format(wo_domain)) - # else: + # else: # Log.error(self, " site {0} does not exists".format(wo_domain)) else: if (mark_db_delete_prompt or mark_webroot_delete_prompt or (mark_webroot_deleted and mark_db_deleted)): @@ -1697,25 +1722,25 @@ class WOSiteListController(CementBaseController): dict(help='List enabled websites', action='store_true')), (['--disabled'], dict(help="List disabled websites", action='store_true')), - ] + ] @expose(help="Lists websites") def default(self): - sites = getAllsites(self) - if not sites: - pass + sites = getAllsites(self) + if not sites: + pass - if self.app.pargs.enabled: - for site in sites: - if site.is_enabled: - Log.info(self, "{0}".format(site.sitename)) - elif self.app.pargs.disabled: - for site in sites: - if not site.is_enabled: - Log.info(self, "{0}".format(site.sitename)) - else: - for site in sites: - Log.info(self, "{0}".format(site.sitename)) + if self.app.pargs.enabled: + for site in sites: + if site.is_enabled: + Log.info(self, "{0}".format(site.sitename)) + elif self.app.pargs.disabled: + for site in sites: + if not site.is_enabled: + Log.info(self, "{0}".format(site.sitename)) + else: + for site in sites: + Log.info(self, "{0}".format(site.sitename)) def load(app): diff --git a/wo/cli/plugins/sync.py b/wo/cli/plugins/sync.py index dfa12fe..e0fd1f9 100644 --- a/wo/cli/plugins/sync.py +++ b/wo/cli/plugins/sync.py @@ -37,7 +37,7 @@ class WOSyncController(CementBaseController): # Read config files configfiles = glob.glob(wo_site_webroot + '/*-config.php') - #search for wp-config.php inside htdocs/ + # search for wp-config.php inside htdocs/ if not configfiles: Log.debug(self, "Config files not found in {0}/ " .format(wo_site_webroot)) From 8b0b4884a74f217136d46599735218e13a625003 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Mon, 4 Mar 2019 12:58:11 +0100 Subject: [PATCH 16/56] fix site function php73 install --- wo/cli/plugins/site_functions.py | 13 +++++++------ wo/cli/plugins/stack.py | 2 +- wo/core/variables.py | 8 ++++---- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/wo/cli/plugins/site_functions.py b/wo/cli/plugins/site_functions.py index 43c376c..13965b2 100644 --- a/wo/cli/plugins/site_functions.py +++ b/wo/cli/plugins/site_functions.py @@ -712,13 +712,14 @@ def site_package_check(self, stype): if not self.app.pargs.php73 and stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: Log.debug(self, "Setting apt_packages variable for PHP 7.2") - apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra + if not WOAptGet.is_installed(self, 'php7.2-fpm'): + apt_packages = apt_packages + WOVariables.wo_php - if self.app.pargs.php73 and stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']: - if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - Log.debug(self, "Setting apt_packages variable for PHP 7.3") - if not WOAptGet.is_installed(self, 'php7.3-fpm'): - apt_packages = apt_packages + WOVariables.wo_php73 + WOVariables.wo_php_extra + if self.app.pargs.php73 and stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']: + if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): + Log.debug(self, "Setting apt_packages variable for PHP 7.3") + if not WOAptGet.is_installed(self, 'php7.3-fpm'): + apt_packages = apt_packages + WOVariables.wo_php73 + WOVariables.wo_php_extra else: Log.debug(self, "Setting apt_packages variable for PHP 7.3") if not WOAptGet.is_installed(self, 'php7.3-fpm'): diff --git a/wo/cli/plugins/stack.py b/wo/cli/plugins/stack.py index 7ea9250..295f84d 100644 --- a/wo/cli/plugins/stack.py +++ b/wo/cli/plugins/stack.py @@ -637,7 +637,7 @@ class WOStackController(CementBaseController): "php73"): with open("/etc/nginx/conf.d/upstream.conf", "a") as php_file: php_file.write("upstream php73 {\nserver unix:/var/run/php/php73-fpm.sock;\n}\n" - "upstream debug73 {\nserver 127.0.0.1:9172;\n}\n") + "upstream debug73 {\nserver 127.0.0.1:9173;\n}\n") if set(WOVariables.wo_hhvm).issubset(set(apt_packages)): diff --git a/wo/core/variables.py b/wo/core/variables.py index e08bcc7..883546b 100644 --- a/wo/core/variables.py +++ b/wo/core/variables.py @@ -105,14 +105,14 @@ class WOVariables(): if (wo_platform_codename == 'trusty' or wo_platform_codename == 'xenial' or wo_platform_codename == 'bionic'): wo_php_repo = "ppa:ondrej/php" 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"] + "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_php73 = ["php7.3-fpm", "php7.3-curl", "php7.3-gd", "php7.3-imap", "php7.3-readline", "php7.3-common", "php7.3-recode", "php7.3-cli", "php7.3-mbstring", "php7.3-bcmath", "php7.3-mysql", "php7.3-opcache", "php7.3-zip", "php7.3-xml", "php7.3-soap"] - wo_php_extra = ["php-memcached", "php-imagick", + wo_php_extra = ["php-memcached", "php-imagick", "memcached" "graphviz", "php-xdebug", "php-msgpack", "php-redis"] elif wo_platform_distro == 'debian': wo_php_repo = ( From 03f6f1f371f068864a96cb2c41c0763907caaa87 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Mon, 4 Mar 2019 13:13:52 +0100 Subject: [PATCH 17/56] fix typo in variables --- wo/core/variables.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wo/core/variables.py b/wo/core/variables.py index 883546b..da63bbe 100644 --- a/wo/core/variables.py +++ b/wo/core/variables.py @@ -112,7 +112,7 @@ class WOVariables(): "php7.3-readline", "php7.3-common", "php7.3-recode", "php7.3-cli", "php7.3-mbstring", "php7.3-bcmath", "php7.3-mysql", "php7.3-opcache", "php7.3-zip", "php7.3-xml", "php7.3-soap"] - wo_php_extra = ["php-memcached", "php-imagick", "memcached" + wo_php_extra = ["php-memcached", "php-imagick", "memcached", "graphviz", "php-xdebug", "php-msgpack", "php-redis"] elif wo_platform_distro == 'debian': wo_php_repo = ( From 8a3a223423eaf16cb0f203a524f59fb027a40f94 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Mon, 4 Mar 2019 13:57:59 +0100 Subject: [PATCH 18/56] install wp-cli during initial setup --- install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install b/install index 33def6d..ed0d2fe 100644 --- a/install +++ b/install @@ -674,7 +674,7 @@ if [ ! -f /usr/local/bin/wo ]; then wo_lib_echo "Running post-install steps" | tee -ai $wo_install_log secure_wo_db | tee -ai $EE_INSTALL_LOG wo_git_init | tee -ai $wo_install_log - + wo_update_wp_cli | tee -ai $wo_install_log else ee -v 2>&1 | grep $wo_version_new &>> /dev/null if [[ $? -ne 0 ]];then From 4f0c34bcf1373f72c48e3bc05d886895841665ba Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Mon, 4 Mar 2019 17:19:12 +0100 Subject: [PATCH 19/56] [skip travis] add .editorconfig --- .editorconfig | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..3b0653a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = false +insert_final_newline = false \ No newline at end of file From 4f8c6182694bc907bfa8ffb08442d360dc56116d Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Tue, 5 Mar 2019 13:19:47 +0100 Subject: [PATCH 20/56] revert site.py changes --- CHANGELOG.md | 4 +- README.md | 2 +- install | 244 ++++++++++++++------------- setup.py | 4 +- wo/cli/templates/nginx-core.mustache | 9 +- wo/core/variables.py | 20 +-- 6 files changed, 149 insertions(+), 134 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 152af56..6ac6633 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,13 +4,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -### v3.X.X - [Unreleased] +### v3.9.3 - [Unreleased] #### Changed - Updating nginx fastcgi_cache template - Updating Nginx configuration for WordPress 5.0 - remove --experimental args +- MariaDB version bumped to 10.3 #### Added @@ -20,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), #### Fixed - Nginx variable $webp_suffix on fresh install +- wo update command ### v3.9.2 - November 30, 2018 diff --git a/README.md b/README.md index 8e916b0..37c2209 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ ## Key Features -- Easy Migration from EasyEngine v3 +- Easy Migration from EasyEngine v3 (migration script development in progress) - Automated WordPress, Nginx, PHP, MySQL & Redis installation - Optimized Nginx configuration with multiple cache backends support - Let's Encrypt SSL certificates diff --git a/install b/install index 710fb7a..0b8b421 100644 --- a/install +++ b/install @@ -7,8 +7,10 @@ # Copyright (c) 2019 - WordOps # This script is licensed under M.I.T # ------------------------------------------------------------------------- -# Version 3.9.1 - 2019-02-25 +# Version 3.9.3 - 2019-03-04 # ------------------------------------------------------------------------- +readonly wo_version_old="2.2.3" +readonly wo_version_new="3.9.3" # CONTENTS # --- # 1. VARIABLES AND DECLARATIONS @@ -20,19 +22,34 @@ # 1 - Set the CLI output colors ### -function wo_lib_echo() -{ - echo $(tput setaf 4)$@$(tput sgr0) +TPUT_RESET=$(tput sgr0) +TPUT_FAIL=$(tput setaf 1) + +wo_lib_echo () { + TPUT_ECHO=$(tput setaf 4) + echo "${TPUT_ECHO}${*}${TPUT_RESET}" } -function wo_lib_echo_info() +wo_lib_echo_info() { - echo $(tput setaf 7)$@$(tput sgr0) + TPUT_INFO=$(tput setaf 7) + echo "${TPUT_INFO}${*}${TPUT_RESET}" } -function wo_lib_echo_fail() +wo_lib_echo_fail() { - echo $(tput setaf 1)$@$(tput sgr0) + + echo "${TPUT_FAIL}${*}${TPUT_RESET}" +} + +### +# 1 - Capture errors +### + +wo_lib_error() +{ + echo "[ $(date) ] ${TPUT_FAIL}${*}${TPUT_RESET}" + exit "$2" } ### @@ -40,18 +57,13 @@ function wo_lib_echo_fail() ### 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" + wo_lib_echo_fail "Use: wget -qO wo wordops.se/tup && sudo bash wo" exit 100 fi -### -# 1 - Capture errors -### -function wo_lib_error() -{ - echo "[ $(date) ] $(tput setaf 1)$@$(tput sgr0)" - exit $2 -} +echo "" +wo_lib_echo "Welcome to WordOps install script v${wo_version_new}" +echo "" ### # 1- Update the apt sewers with fresh info @@ -72,8 +84,6 @@ fi ### wo_branch=$1 migration=0 -readonly wo_version_old="2.2.3" -readonly wo_version_new="3.9.2.3" 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}') @@ -93,7 +103,7 @@ fi ### # 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 +lsb_release -d | grep -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 @@ -103,53 +113,52 @@ fi # 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 /var/log/wo/{wordops.log,install.log} - + 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 ### # 2 - Setup the dependencies for installation #### -function wo_install_dep() +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 pigz gnupg2 || 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 software-properties-common pigz gnupg2 || wo_lib_error "There was an error during dependency installation, exit status " 1 + echo -ne ' Installing dependencies [..]\r' + if { + 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 pigz gnupg2 > /dev/null 2>&1 + else + apt-get -y install build-essential curl gzip dirmngr python3 python3-apt python3-setuptools python3-dev sqlite3 git tar software-properties-common pigz gnupg2 > /dev/null 2>&1 + fi + }; then echo -ne ' Installing dependencies [OK]\r' + else + echo -e " Installing dependencies [FAIL]" fi - locale-gen en &>> /dev/null - + # Support PFS if [ -f /etc/nginx/nginx.conf ]; then # Replace the default ciphers - sed -i 's/HIGH:!aNULL:!MD5:!kEDH;/ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-CHACHA20-POLY1305:EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH;/' /etc/nginx/nginx.conf + sed -i 's/HIGH:!aNULL:!MD5:!kEDH;/EECDH+CHACHA20:EECDH+AESGCM:EECDH+AES;/' /etc/nginx/nginx.conf # Replace the EasyEngine ciphers - sed -i 's/ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:ECDHE-RSA-DES-CBC3-SHA:ECDHE-ECDSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA;/ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-CHACHA20-POLY1305:EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH;/' /etc/nginx/nginx.conf + sed -i 's/ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:ECDHE-RSA-DES-CBC3-SHA:ECDHE-ECDSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA;/EECDH+CHACHA20:EECDH+AESGCM:EECDH+AES;/' /etc/nginx/nginx.conf # Change the TLS protocols - if [ "$wo_distro_version" == "bionic" ]; then - # Bionic supports TLSv1.3, so let's enable that - sed -i 's/TLSv1 TLSv1.1 TLSv1.2;/TLSv1.2 TLSv1.3;/g' /etc/nginx/nginx.conf - else - # If != Bionic then enable only TLSv1.2 - sed -i 's/TLSv1 TLSv1.1 TLSv1.2;/TLSv1.2;/g' /etc/nginx/nginx.conf - fi + sed -i 's/TLSv1 TLSv1.1 TLSv1.2;/TLSv1.2;/g' /etc/nginx/nginx.conf fi - + 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.2 support" apt-get update &>> /dev/null - apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php-memcached php7.2-imap php7.2-common php7.2-readline php-redis php7.2-mysql php7.2-cli php-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 graphviz php-pear php7.2-xdebug || wo_lib_error "Not all PHP packages could be installed. " 1 + apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php-memcached php7.2-imap php7.2-common php7.2-readline php-redis php7.2-mysql php7.2-cli php-imagick php7.2-mbstring php7.2-recode php7.2-bcmath php7.2-opcache php7.2-zip php7.2-xml php7.2-soap php-msgpack graphviz php-pear php-xdebug || wo_lib_error "Not all PHP packages could be installed. " 1 mkdir -p /var/log/php/7.2/ touch /var/log/php/7.2/slow.log /var/log/php/7.2/fpm.log systemctl php7.2-fpm restart &>> /dev/null - + 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 @@ -157,10 +166,10 @@ function wo_install_dep() 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 php-memcached php7.2-imap php7.2-common php7.2-readlne php-redis php7.2-mysql php7.2-cli php-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 graphviz php-pear php7.2-xdebug || wo_lib_error "Not all PHP packages could be installed." 1 + apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php-memcached php7.2-imap php7.2-common php7.2-readlne php-redis php7.2-mysql php7.2-cli php-imagick php7.2-mbstring php7.2-recode php7.2-bcmath php7.2-opcache php7.2-zip php7.2-xml php7.2-soap php-msgpack graphviz php-pear php-xdebug || wo_lib_error "Not all PHP packages could be installed." 1 systemctl php7.2-fpm restart &>> /dev/null fi - + ### # Webp mapping ### @@ -168,7 +177,7 @@ function wo_install_dep() mkdir -p /etc/nginx/conf.d echo -e 'map $http_accept $webp_suffix {\n default "";\n "~*webp" ".webp";\n}\n' > /etc/nginx/conf.d/webp.conf } - + # Let's Encrypt .well-known folder setup if [ ! -d /var/www/html/.well-known/acme-challenge ]; then mkdir -p /var/www/html/.well-known/acme-challenge @@ -179,7 +188,7 @@ function wo_install_dep() ### # 3 - Create/migrate the essentials ### -function wo_sync_db() +wo_sync_db() { ### # Switching from EE -> WO @@ -187,23 +196,23 @@ function wo_sync_db() 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 /etc/ee /var/lib/ee | pigz -9 > /var/lib/wo/ee-backup.tgz - + # Copy the EasyEngine database cp /var/lib/ee/ee.db /var/lib/wo/dbase-ee.db - + # Set the migration variable for the closing text migration=1 - + ### # Clean WO installation ### elif [ ! -d /var/lib/wo ]; then # Create the directory holding the WordOps database mkdir -p /var/lib/wo - + # Create an empty database for WordOps echo "CREATE TABLE sites ( id INTEGER PRIMARY KEY AUTOINCREMENT, @@ -223,24 +232,24 @@ function wo_sync_db() is_hhvm INT INT DEFAULT '0', php_version VARCHAR );" | sqlite3 /var/lib/wo/dbase.db - + if [ -f /var/lib/wo/dbase-ee.db ]; then # Copy the main EasyEngine database over since we are migrating cp /var/lib/wo/dbase-ee.db /var/lib/wo/dbase.db fi - + # Check site is enable/live or disable for site in $(ls /etc/nginx/sites-available/ | grep -v default); do - if [ -f /etc/nginx/sites-enabled/$site ]; then + if [ -f "/etc/nginx/sites-enabled/$site" ]; then wo_site_status='1' else wo_site_status='0' fi - + # Acquire information about the current nginx configuration wo_site_current_type=$(head -n1 /etc/nginx/sites-available/$site | grep "NGINX CONFIGURATION" | rev | cut -d' ' -f3,4,5,6,7 | rev | cut -d ' ' -f2,3,4,5) - + # Sniff out the vhost type and cache configuration if [ "$wo_site_current_type" = "HTML" ]; then wo_site_current="html" @@ -251,7 +260,7 @@ function wo_sync_db() elif [ "$wo_site_current_type" = "MYSQL" ]; then wo_site_current="mysql" wo_site_current_cache="basic" - + # Caching types on a single WordPress installation elif [ "$wo_site_current_type" = "WPSINGLE BASIC" ]; then wo_site_current="wp" @@ -262,7 +271,7 @@ function wo_sync_db() elif [ "$wo_site_current_type" = "WPSINGLE FAST CGI" ] || [ "$wo_site_current_type" = "WPSINGLE FASTCGI" ]; then wo_site_current="wp" wo_site_current_cache="wpfc" - + # Caching types on a single, subdirectory WordPress installation elif [ "$wo_site_current_type" = "WPSUBDIR BASIC" ]; then wo_site_current="wpsubdir" @@ -273,7 +282,7 @@ function wo_sync_db() elif [ "$wo_site_current_type" = "WPSUBDIR FAST CGI" ] || [ "$wo_site_current_type" = "WPSUBDIR FASTCGI" ]; then wo_site_current="wpsubdir" wo_site_current_cache="wpfc" - + # Caching types on a single, subdomain WordPress installation elif [ "$wo_site_current_type" = "WPSUBDOMAIN BASIC" ]; then wo_site_current="wpsubdomain" @@ -285,9 +294,9 @@ function wo_sync_db() wo_site_current="wpsubdomain" wo_site_current_cache="wpfc" fi - + wo_webroot="/var/www/$site" - + # 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 @@ -302,7 +311,7 @@ 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 - + ### # Copy the upstream config ### @@ -319,10 +328,10 @@ function wo_sync_db() sed -i 's/9170/9172/g' /etc/nginx/conf.d/upstream.conf } > /dev/null 2>&1 fi - + echo "UPDATE sites SET php_version = REPLACE(php_version, '5.6', '7.2');" | sqlite3 /var/lib/wo/dbase.db echo "UPDATE sites SET php_version = REPLACE(php_version, '7.0', '7.3');" | sqlite3 /var/lib/wo/dbase.db - + ### # ee-acme-sh by VirtuBox, https://virtubox.net/ ### @@ -330,7 +339,7 @@ function wo_sync_db() 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 @@ -349,7 +358,7 @@ function wo_sync_db() } # Once again, set the proper ACL on the WordOps configuration directory -function secure_wo_db() +secure_wo_db() { # The owner is root chown -R root:root /var/lib/wo/ @@ -358,7 +367,7 @@ function secure_wo_db() } # Update the WP-CLI version -function wo_update_wp_cli() +wo_update_wp_cli() { wo_lib_echo "Updating WP-CLI version to resolve compatibility issue." WP_CLI_PATH=$(command -v wp) @@ -369,35 +378,36 @@ function wo_update_wp_cli() else wget -qO /usr/local/bin/wp https://raw.githubusercontent.com/WordOps/wpcli-builds/gh-pages/phar/wp-cli.phar chmod +x /usr/local/bin/wp + ln -s /usr/local/bin/wp /usr/bin/ fi - - [ -d /etc/bash_completion ] && { + + [ -d /etc/bash_completion.d ] && { wget -qO /etc/bash_completion.d/wp-completion.bash https://raw.githubusercontent.com/wp-cli/wp-cli/master/utils/wp-completion.bash } } # Now, finally, let's install WordOps -function wo_install() +wo_install() { - rm -rf /tmp/easyengine &>> /dev/null - rm -rf /tmp/wordops &>> /dev/null - + rm -rf /tmp/easyengine + rm -rf /tmp/wordops + wo_lib_echo "Downloading WordOps straight from GitHub - fresh and brewed with love. Hold your horses..." [ -z "$wo_branch" ] && { wo_branch=master } - + git clone -b "$wo_branch" https://github.com/WordOps/WordOps.git /tmp/wordops --quiet > /dev/null \ || wo_lib_error "An error was encountered during the download, exit status" $? - + cd /tmp/wordops || exit 1 wo_lib_echo "The moment you've all been waiting for, time to install WordOps!" python3 setup.py install || wo_lib_error "An error was encountered during the installation, exit status " $? } -function wo_update_latest() +wo_update_latest() { - + if [ -f /etc/nginx/fastcgi_params ] then grep -q 'HTTP_PROXY' /etc/nginx/fastcgi_params @@ -407,7 +417,7 @@ function wo_update_latest() service nginx restart &>> /dev/null fi fi - + if [ -f /etc/ImageMagick/policy.xml ] then if [ ! -f /etc/ImageMagick/patch.txt ] @@ -416,7 +426,7 @@ function wo_update_latest() sed -i '//r /etc/ImageMagick/patch.txt' /etc/ImageMagick/policy.xml fi fi - + #Move ~/.my.cnf to /etc/mysql/conf.d/my.cnf if [ ! -f /etc/mysql/conf.d/my.cnf ] then @@ -442,11 +452,11 @@ function wo_update_latest() fi fi fi - - + + if [ -f /etc/nginx/nginx.conf ]; then wo_lib_echo "Updating Nginx configuration, please wait..." - + 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 if [[ $? -ne 0 ]]; then @@ -476,7 +486,7 @@ function wo_update_latest() 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 fi - + 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 if [[ $? -ne 0 ]]; then @@ -505,28 +515,28 @@ function wo_update_latest() systemctl restart nginx &>> /dev/null fi fi - + if [ -f /etc/nginx/nginx.conf ]; then sed -i "s/.*X-Powered-By.*/\tadd_header X-Powered-By \"WordOps $wo_version_new\";/" /etc/nginx/nginx.conf &>> /dev/null fi - + if [ -f /etc/nginx/conf.d/wo-plus.conf ]; then sed -i "s/.*X-Powered-By.*/\tadd_header X-Powered-By \"WordOps $wo_version_new\";/" /etc/nginx/conf.d/wo-plus.conf &>> /dev/null fi - + # Fix HHVM autostart on reboot dpkg --get-selections | grep -v deinstall | grep hhvm &>> /dev/null if [ $? -eq 0 ]; then update-rc.d hhvm defaults &>> /dev/null fi - + # Fix WordPress example.html issue # Ref: http://wptavern.com/xss-vulnerability-in-jetpack-and-the-twenty-fifteen-default-theme-affects-millions-of-wordpress-users dpkg --get-selections | grep -v deinstall | grep nginx &>> /dev/null if [ $? -eq 0 ]; then cp /usr/lib/wo/templates/locations.mustache /etc/nginx/common/locations.conf &>> /dev/null fi - + # Fix HHVM upstream issue that was preventing from using EasyEngine for site operations if [ -f /etc/nginx/conf.d/upstream.conf ]; then grep -Hr hhvm /etc/nginx/conf.d/upstream.conf &>> /dev/null @@ -534,7 +544,7 @@ function wo_update_latest() echo -e "upstream hhvm {\n# HHVM Pool\nserver 127.0.0.1:8000;\nserver 127.0.0.1:9000 backup;\n}\n" >> /etc/nginx/conf.d/upstream.conf fi fi - + # Fix HHVM server IP if [ -f /etc/hhvm/server.ini ]; then grep -Hr "hhvm.server.ip" /etc/hhvm/server.ini &>> /dev/null @@ -542,33 +552,33 @@ function wo_update_latest() echo -e "hhvm.server.ip = 127.0.0.1\n" >> /etc/hhvm/server.ini fi fi - + # Rename Redis Header if [ -f /etc/nginx/common/redis-hhvm.conf ]; then sed -i "s/X-Cache /X-SRCache-Fetch-Status /g" /etc/nginx/common/redis-hhvm.conf &>> /dev/null sed -i "s/X-Cache-2 /X-SRCache-Store-Status /g" /etc/nginx/common/redis-hhvm.conf &>> /dev/null fi - + if [ -f /etc/nginx/common/redis.conf ]; then sed -i "s/X-Cache /X-SRCache-Fetch-Status /g" /etc/nginx/common/redis.conf &>> /dev/null sed -i "s/X-Cache-2 /X-SRCache-Store-Status /g" /etc/nginx/common/redis.conf &>> /dev/null fi - - + + if [ -f /etc/nginx/common/redis-hhvm.conf ]; then # Update Timeout redis-hhvm.conf grep -0 'redis2_query expire $key 6h' /etc/nginx/common/redis-hhvm.conf &>> /dev/null if [ $? -eq 0 ]; then sed -i 's/redis2_query expire $key 6h/redis2_query expire $key 14400/g' /etc/nginx/common/redis-hhvm.conf &>> /dev/null fi - + #Fix for 3.3.4 redis-hhvm issue grep -0 'HTTP_ACCEPT_ENCODING' /etc/nginx/common/redis-hhvm.conf &>> /dev/null if [ $? -ne 0 ]; then sed -i 's/fastcgi_params;/fastcgi_params;\n fastcgi_param HTTP_ACCEPT_ENCODING "";/g' /etc/nginx/common/redis-hhvm.conf &>> /dev/null fi fi - + #Fix Redis-server security issue #http://redis.io/topics/security if [ -f /etc/redis/redis.conf ]; then @@ -578,14 +588,14 @@ function wo_update_latest() service redis-server restart &>> /dev/null fi fi - + # Let's Encrypt .well-known folder setup if [ ! -d /var/www/html/.well-known/acme-challenge ]; then mkdir -p /var/www/html/.well-known/acme-challenge chown -R www-data:www-data /var/www/html/.well-known fi - - + + # Fix for 3.3.2 renamed nginx.conf nginx -V 2>&1 &>>/dev/null if [[ $? -eq 0 ]]; then @@ -607,7 +617,7 @@ function wo_update_latest() fi fi fi - + # Support PFS if [ -f /etc/nginx/nginx.conf ]; then # Replace the default ciphers @@ -623,16 +633,16 @@ function wo_update_latest() sed -i 's/TLSv1 TLSv1.1 TLSv1.2;/TLSv1.2;/g' /etc/nginx/nginx.conf fi fi - + 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.2 support" apt-get update &>> /dev/null - apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php7.2-imap php-memcached php7.2-common php7.2-readline php-redis php7.2-mysql php7.2-cli php-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 graphviz php-pear php7.2-xdebug || wo_lib_error "Not all PHP packages could be installed. " 1 + apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php7.2-imap php-memcached php7.2-common php7.2-readline php-redis php7.2-mysql php7.2-cli php-imagick php7.2-mbstring php7.2-recode php7.2-bcmath php7.2-opcache php7.2-zip php7.2-xml php7.2-soap php-msgpack graphviz php-pear php-xdebug || wo_lib_error "Not all PHP packages could be installed. " 1 mkdir -p /var/log/php/7.2/ touch /var/log/php/7.2/slow.log /var/log/php/7.2/fpm.log systemctl php7.2-fpm restart &>> /dev/null - + 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 @@ -640,10 +650,10 @@ function wo_update_latest() 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 php-memcached php7.2-common php7.2-readline php-redis php7.2-mysql php7.2-cli php-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 graphviz php-pear php7.2-xdebug || wo_lib_error "Not all PHP packages could be installed." 1 + apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php7.2-imap php-memcached php7.2-common php7.2-readline php-redis php7.2-mysql php7.2-cli php-imagick php7.2-mbstring php7.2-recode php7.2-bcmath php7.2-opcache php7.2-zip php7.2-xml php7.2-soap php-msgpack graphviz php-pear php-xdebug || wo_lib_error "Not all PHP packages could be installed." 1 systemctl php7.2-fpm restart &>> /dev/null fi - + #Fix for SSL cert --all crontab -l | grep -q '\-\-min_expiry_limit' if [[ $? -eq 0 ]]; then @@ -654,7 +664,7 @@ function wo_update_latest() } # Do git intialisation -function wo_git_init() +wo_git_init() { # Nginx under git version control [ -d /etc/nginx ] && { @@ -672,7 +682,7 @@ function wo_git_init() } git add -A . git commit -am "Installed/Updated to WordOps" &>> /dev/null - + #PHP under git version control [ -d /etc/php ] && { cd /etc/php || exit 1 @@ -684,17 +694,19 @@ function wo_git_init() }> /dev/null } -if [ ! -f /usr/local/bin/wo ]; then - wo_lib_echo "Installing depedencies" | tee -ai $wo_install_log - wo_install_dep | tee -ai $wo_install_log - wo_lib_echo "Installing WordOps $wo_branch" | tee -ai $wo_install_log - wo_install | tee -ai $wo_install_log - wo_lib_echo "Running post-install steps" | tee -ai $wo_install_log - secure_wo_db | tee -ai $EE_INSTALL_LOG - wo_git_init | tee -ai $wo_install_log - +if [ ! -x /usr/local/bin/ee ]; then + if [ ! -x /usr/local/bin/wo ]; then + wo_lib_echo "Installing depedencies" | tee -ai $wo_install_log + wo_install_dep | tee -ai $wo_install_log + wo_lib_echo "Installing WordOps $wo_branch" | tee -ai $wo_install_log + wo_install | tee -ai $wo_install_log + wo_lib_echo "Running post-install steps" | tee -ai $wo_install_log + secure_wo_db | tee -ai $EE_INSTALL_LOG + wo_git_init | tee -ai $wo_install_log + wo_update_wp_cli | tee -ai $wo_install_log + fi else - ee -v 2>&1 | grep $wo_version_new &>> /dev/null + wo -v 2>&1 | grep $wo_version_new &>> /dev/null if [[ $? -ne 0 ]];then read -p "Update WordOps to $wo_version_new (y/n): " wo_ans if [ "$wo_ans" = "y" ] || [ "$wo_ans" = "Y" ]; then diff --git a/setup.py b/setup.py index 801c874..780b17e 100644 --- a/setup.py +++ b/setup.py @@ -55,10 +55,10 @@ except Exception as e: os.system("git config --global user.email {0}".format(wo_email)) if not os.path.isfile('/root/.gitconfig'): - shutil.copy2(os.path.expanduser("~")+'/.gitconfig', '/root/.gitconfig') + shutil.copy2(os.path.expanduser("~")+'/.gitconfig', '/root/.gitconfig') setup(name='wo', - version='3.9.1', + version='3.9.3', description=long_description, long_description=long_description, classifiers=[], diff --git a/wo/cli/templates/nginx-core.mustache b/wo/cli/templates/nginx-core.mustache index cef16cc..e262d87 100644 --- a/wo/cli/templates/nginx-core.mustache +++ b/wo/cli/templates/nginx-core.mustache @@ -18,13 +18,14 @@ fastcgi_read_timeout 300; client_max_body_size 100m; # SSL Settings -ssl_protocols TLSv1.1 TLSv1.2; -ssl_session_cache shared:SSL:10m; -ssl_session_timeout 10m; +ssl_protocols TLSv1.2; +ssl_ciphers 'EECDH+CHACHA20:EECDH+AESGCM:EECDH+AES'; +ssl_session_cache shared:SSL:50m; +ssl_session_timeout 1d; +ssl_session_tickets off; {{#Ubuntu}} ssl_prefer_server_ciphers on; {{/Ubuntu}} -ssl_ciphers "ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-CHACHA20-POLY1305:EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH"; # Log format Settings log_format rt_cache '$remote_addr $upstream_response_time $upstream_cache_status [$time_local] ' diff --git a/wo/core/variables.py b/wo/core/variables.py index 4139c21..46c55ab 100644 --- a/wo/core/variables.py +++ b/wo/core/variables.py @@ -11,11 +11,11 @@ import datetime class WOVariables(): """Intialization of core variables""" - # WordOps version - wo_version = "3.9.2" + # WordOps version + wo_version = "3.9.3" # WordOps packages versions - wo_wp_cli = "2.0.1" - wo_adminer = "4.6.3" + wo_wp_cli = "2.1.0" + wo_adminer = "4.7.1" # Get WPCLI path wo_wpcli_path = os.popen('which wp | tr "\n" " "').read() @@ -68,9 +68,9 @@ class WOVariables(): wo_mysql_host = "" config = configparser.RawConfigParser() if os.path.exists('/etc/mysql/conf.d/my.cnf'): - cnfpath = "/etc/mysql/conf.d/my.cnf" + cnfpath = "/etc/mysql/conf.d/my.cnf" else: - cnfpath = os.path.expanduser("~")+"/.my.cnf" + cnfpath = os.path.expanduser("~")+"/.my.cnf" if [cnfpath] == config.read(cnfpath): try: wo_mysql_host = config.get('client', 'host') @@ -104,15 +104,15 @@ class WOVariables(): if wo_platform_distro == 'ubuntu': if (wo_platform_codename == 'trusty' or wo_platform_codename == 'xenial' or wo_platform_codename == 'bionic'): wo_php_repo = "ppa:ondrej/php" - wo_php = ["php7.2-fpm", "php-sodium", "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_php72 = ["php7.2-fpm", "php-sodium", "php7.2-curl", "php7.2-gd", "php7.2-imap", + wo_php72 = ["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", + wo_php_extra = ["php-memcached", "php-imagick", "memcached", "graphviz", "php-pear", "php-xdebug", "php-msgpack", "php-redis"] elif wo_platform_distro == 'debian': wo_php_repo = ("deb https://packages.sury.org/php/ {codename} main".format(codename=wo_platform_codename)) @@ -162,7 +162,7 @@ class WOVariables(): .format(codename=wo_platform_codename)) if (wo_platform_codename == 'trusty' or wo_platform_codename == 'xenial' or wo_platform_codename == 'bionic' or wo_platform_distro == 'debian'): - wo_redis = ['redis-server', 'php7.2-redis'] + wo_redis = ['redis-server', 'php-redis'] # Repo path wo_repo_file = "wo-repo.list" From 698d982fc2bf4485a0d3a239d0f9d78091990758 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Tue, 5 Mar 2019 13:41:14 +0100 Subject: [PATCH 21/56] [skip travis] update README.md --- CHANGELOG.md | 6 +++--- README.md | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ac6633..841c6d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,14 +8,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), #### Changed -- Updating nginx fastcgi_cache template +- Updating Nginx fastcgi_cache template - Updating Nginx configuration for WordPress 5.0 - remove --experimental args - MariaDB version bumped to 10.3 #### Added -- Add webp image support with nginx mapping +- Add WebP image support with Nginx mapping - Add PHP 7.3 support #### Fixed @@ -27,7 +27,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), #### Changed -- Rebranded the fork to WordOps +- Re-branded the fork to WordOps - Codebase cleanup - Set PHP 7.2 as the default - Included support for newer OS releases diff --git a/README.md b/README.md index 37c2209..835aa0a 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,9 @@ WordOps made some fundamental changes: - We've deprecated the mail stack. Less is more. As an alternative, take a look at [iRedMail](https://www.iredmail.org/) or [Caesonia](https://github.com/vedetta-com/caesonia). And an alternative for Roundcube is [Rainloop](https://www.rainloop.net/). - Support for w3tc is dropped as a security precaution. -- We are currently migrating the PHP 5.x series to PHP 7.2 and PHP 7.3. We'll offer an easy to use migration script once we are confident enough to unleash this daemon. For now, new sites get installed with PHP 7.2 as the default. +- PHP 5.6 has been replaced by PHP 7.2 and PHP 7.0 will be replaced by PHP 7.3. + +We will not overwrite previous php versions Nginx upstreams to avoid issues during the migration from EEv3. A step by step guide will be published soon to explain how to fully migrate from EasyEngine v3 to WordOps ## Usage From 79d45044f9702ba65f00208f9ccff0c4464f1da2 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Sat, 2 Mar 2019 20:38:31 +0100 Subject: [PATCH 22/56] fix stack issues * fix php7.2 stack detection * add php7.3 as php7.0 replacement --- wo/cli/controllers/base.py | 2 +- wo/cli/plugins/debug.py | 140 +++---- wo/cli/plugins/info.py | 49 +-- wo/cli/plugins/site.py | 242 +++--------- wo/cli/plugins/site_functions.py | 60 +-- wo/cli/plugins/stack.py | 465 ++++++++++++------------ wo/cli/plugins/stack_services.py | 163 +++++---- wo/cli/templates/php.mustache | 2 +- wo/cli/templates/php7.mustache | 2 +- wo/cli/templates/redis-php7.mustache | 2 +- wo/cli/templates/redis.mustache | 2 +- wo/cli/templates/upstream.mustache | 14 +- wo/cli/templates/wpcommon-php7.mustache | 2 +- wo/cli/templates/wpfc-php7.mustache | 2 +- wo/cli/templates/wpfc.mustache | 2 +- wo/cli/templates/wpsc-php7.mustache | 2 +- wo/cli/templates/wpsc.mustache | 2 +- wo/core/services.py | 7 +- wo/core/variables.py | 35 +- 19 files changed, 544 insertions(+), 651 deletions(-) diff --git a/wo/cli/controllers/base.py b/wo/cli/controllers/base.py index ad49a25..9a2dbc0 100644 --- a/wo/cli/controllers/base.py +++ b/wo/cli/controllers/base.py @@ -6,7 +6,7 @@ VERSION = WOVariables.wo_version BANNER = """ WordOps v%s -Copyright (c) 2018 WordOps. +Copyright (c) 2019 WordOps. """ % VERSION diff --git a/wo/cli/plugins/debug.py b/wo/cli/plugins/debug.py index 218bb08..6cfe596 100644 --- a/wo/cli/plugins/debug.py +++ b/wo/cli/plugins/debug.py @@ -49,7 +49,7 @@ class WODebugController(CementBaseController): dict(help='start/stop debugging fastcgi configuration', action='store' or 'store_const', choices=('on', 'off'), const='on', nargs='?')), - (['--php72'], + (['--php73'], dict(help='start/stop debugging server PHP 7.2 configuration', action='store' or 'store_const', choices=('on', 'off'), const='on', nargs='?')), @@ -80,7 +80,7 @@ class WODebugController(CementBaseController): action='store', dest='interval')), (['site_name'], dict(help='Website Name', nargs='?', default=None)) - ] + ] usage = "wo debug [] [options] " @expose(hide=True) @@ -100,7 +100,7 @@ class WODebugController(CementBaseController): for ip_addr in debug_address: if not ("debug_connection "+ip_addr in open('/etc/nginx/' - 'nginx.conf', encoding='utf-8').read()): + 'nginx.conf', encoding='utf-8').read()): Log.info(self, "Setting up Nginx debug connection" " for "+ip_addr) WOShellExec.cmd_exec(self, "sed -i \"/events {{/a\\ \\ \\ " @@ -187,26 +187,28 @@ class WODebugController(CementBaseController): # Change upstream.conf nc = NginxConfig() nc.loadf('/etc/nginx/conf.d/upstream.conf') - nc.set([('upstream','php',), 'server'], '127.0.0.1:9001') + nc.set([('upstream', 'php',), 'server'], '127.0.0.1:9001') if os.path.isfile("/etc/nginx/common/wpfc-hhvm.conf"): - nc.set([('upstream','hhvm',), 'server'], '127.0.0.1:9001') + nc.set([('upstream', 'hhvm',), 'server'], '127.0.0.1:9001') nc.savef('/etc/nginx/conf.d/upstream.conf') # Enable xdebug - WOFileUtils.searchreplace(self, "/etc/{0}/mods-available/".format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5") + - "xdebug.ini", - ";zend_extension", - "zend_extension") + WOFileUtils.searchreplace(self, "/etc/{0}/mods-available/".format("php/7.2" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5") + + "xdebug.ini", + ";zend_extension", + "zend_extension") # Fix slow log is not enabled default in PHP5.6 config = configparser.ConfigParser() - config.read('/etc/{0}/fpm/pool.d/debug.conf'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) - config['debug']['slowlog'] = '/var/log/{0}/slow.log'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5") + config.read('/etc/{0}/fpm/pool.d/debug.conf'.format("php/7.2" if (WOVariables.wo_platform_codename == + 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) + config['debug']['slowlog'] = '/var/log/{0}/slow.log'.format("php/7.2" if ( + WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5") config['debug']['request_slowlog_timeout'] = '10s' - with open('/etc/{0}/fpm/pool.d/debug.conf'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5"), + with open('/etc/{0}/fpm/pool.d/debug.conf'.format("php/7.2" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5"), encoding='utf-8', mode='w') as confifile: Log.debug(self, "Writting debug.conf configuration into " - "/etc/{0}/fpm/pool.d/debug.conf".format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) + "/etc/{0}/fpm/pool.d/debug.conf".format("php/7.2" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) config.write(confifile) self.trigger_php = True @@ -214,7 +216,8 @@ class WODebugController(CementBaseController): else: Log.info(self, "PHP debug is already enabled") - self.msg = self.msg + ['/var/log/{0}/slow.log'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")] + self.msg = self.msg + ['/var/log/{0}/slow.log'.format("php/7.2" if ( + WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")] # PHP global debug stop elif (self.app.pargs.php == 'off' and not self.app.pargs.site_name): @@ -226,13 +229,13 @@ class WODebugController(CementBaseController): # Change upstream.conf nc = NginxConfig() nc.loadf('/etc/nginx/conf.d/upstream.conf') - nc.set([('upstream','php',), 'server'], '127.0.0.1:9000') + nc.set([('upstream', 'php',), 'server'], '127.0.0.1:9000') if os.path.isfile("/etc/nginx/common/wpfc-hhvm.conf"): - nc.set([('upstream','hhvm',), 'server'], '127.0.0.1:8000') + nc.set([('upstream', 'hhvm',), 'server'], '127.0.0.1:8000') nc.savef('/etc/nginx/conf.d/upstream.conf') # Disable xdebug - WOFileUtils.searchreplace(self, "/etc/{0}/mods-available/".format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5") + + WOFileUtils.searchreplace(self, "/etc/{0}/mods-available/".format("php/7.2" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5") + "xdebug.ini", "zend_extension", ";zend_extension") @@ -248,38 +251,43 @@ class WODebugController(CementBaseController): # PHP5-FPM start global debug if (self.app.pargs.fpm == 'on' and not self.app.pargs.site_name): if not WOShellExec.cmd_exec(self, "grep \"log_level = debug\" " - "/etc/{0}/fpm/php-fpm.conf".format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")): + "/etc/{0}/fpm/php-fpm.conf".format("php/7.2" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")): Log.info(self, "Setting up PHP5-FPM log_level = debug") config = configparser.ConfigParser() - config.read('/etc/{0}/fpm/php-fpm.conf'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) + config.read('/etc/{0}/fpm/php-fpm.conf'.format("php/7.2" if (WOVariables.wo_platform_codename == + 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) config.remove_option('global', 'include') config['global']['log_level'] = 'debug' - config['global']['include'] = '/etc/{0}/fpm/pool.d/*.conf'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5") - with open('/etc/{0}/fpm/php-fpm.conf'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5"), + config['global']['include'] = '/etc/{0}/fpm/pool.d/*.conf'.format("php/7.2" if ( + WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5") + with open('/etc/{0}/fpm/php-fpm.conf'.format("php/7.2" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5"), encoding='utf-8', mode='w') as configfile: Log.debug(self, "Writting php5-FPM configuration into " - "/etc/{0}/fpm/php-fpm.conf".format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) + "/etc/{0}/fpm/php-fpm.conf".format("php/7.2" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) config.write(configfile) self.trigger_php = True else: Log.info(self, "PHP5-FPM log_level = debug already setup") - self.msg = self.msg + ['/var/log/{0}/fpm.log'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")] + self.msg = self.msg + ['/var/log/{0}/fpm.log'.format("php/7.2" if ( + WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")] # PHP5-FPM stop global debug elif (self.app.pargs.fpm == 'off' and not self.app.pargs.site_name): if WOShellExec.cmd_exec(self, "grep \"log_level = debug\" " - "/etc/{0}/fpm/php-fpm.conf".format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")): + "/etc/{0}/fpm/php-fpm.conf".format("php/7.2" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")): Log.info(self, "Disabling PHP5-FPM log_level = debug") config = configparser.ConfigParser() - config.read('/etc/{0}/fpm/php-fpm.conf'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) + config.read('/etc/{0}/fpm/php-fpm.conf'.format("php/7.2" if (WOVariables.wo_platform_codename == + 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) config.remove_option('global', 'include') config['global']['log_level'] = 'notice' - config['global']['include'] = '/etc/{0}/fpm/pool.d/*.conf'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5") - with open('/etc/{0}/fpm/php-fpm.conf'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5"), + config['global']['include'] = '/etc/{0}/fpm/pool.d/*.conf'.format("php/7.2" if ( + WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5") + with open('/etc/{0}/fpm/php-fpm.conf'.format("php/7.2" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5"), encoding='utf-8', mode='w') as configfile: Log.debug(self, "writting php5 configuration into " - "/etc/{0}/fpm/php-fpm.conf".format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) + "/etc/{0}/fpm/php-fpm.conf".format("php/7.2" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) config.write(configfile) self.trigger_php = True @@ -287,13 +295,13 @@ class WODebugController(CementBaseController): Log.info(self, "PHP5-FPM log_level = debug already disabled") @expose(hide=True) - def debug_php72(self): + def debug_php73(self): """Start/Stop PHP debug""" # PHP global debug start - if (self.app.pargs.php72 == 'on' and not self.app.pargs.site_name): + if (self.app.pargs.php73 == 'on' and not self.app.pargs.site_name): if (WOVariables.wo_platform_codename == 'wheezy' or WOVariables.wo_platform_codename == 'precise'): - Log.error(self,"PHP 7.2 not supported.") + Log.error(self, "PHP 7.2 not supported.") if not (WOShellExec.cmd_exec(self, "sed -n \"/upstream php7" "{/,/}/p \" /etc/nginx/" "conf.d/upstream.conf " @@ -304,16 +312,16 @@ class WODebugController(CementBaseController): # Change upstream.conf nc = NginxConfig() nc.loadf('/etc/nginx/conf.d/upstream.conf') - nc.set([('upstream','php72',), 'server'], '127.0.0.1:9172') + nc.set([('upstream', 'php73',), 'server'], '127.0.0.1:9172') if os.path.isfile("/etc/nginx/common/wpfc-hhvm.conf"): - nc.set([('upstream','hhvm',), 'server'], '127.0.0.1:9172') + nc.set([('upstream', 'hhvm',), 'server'], '127.0.0.1:9172') nc.savef('/etc/nginx/conf.d/upstream.conf') # Enable xdebug WOFileUtils.searchreplace(self, "/etc/php/7.2/mods-available/" - "xdebug.ini", - ";zend_extension", - "zend_extension") + "xdebug.ini", + ";zend_extension", + "zend_extension") # Fix slow log is not enabled default in PHP5.6 config = configparser.ConfigParser() @@ -334,8 +342,8 @@ class WODebugController(CementBaseController): 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): - if WOShellExec.cmd_exec(self, " sed -n \"/upstream php72 {/,/}/p\" " + elif (self.app.pargs.php73 == 'off' and not self.app.pargs.site_name): + if WOShellExec.cmd_exec(self, " sed -n \"/upstream php73 {/,/}/p\" " "/etc/nginx/conf.d/upstream.conf " "| grep 9172"): Log.info(self, "Disabling PHP 7.2 debug") @@ -343,9 +351,9 @@ class WODebugController(CementBaseController): # Change upstream.conf nc = NginxConfig() nc.loadf('/etc/nginx/conf.d/upstream.conf') - nc.set([('upstream','php72',), 'server'], '127.0.0.1:9072') + nc.set([('upstream', 'php73',), 'server'], '127.0.0.1:9072') if os.path.isfile("/etc/nginx/common/wpfc-hhvm.conf"): - nc.set([('upstream','hhvm',), 'server'], '127.0.0.1:8000') + nc.set([('upstream', 'hhvm',), 'server'], '127.0.0.1:8000') nc.savef('/etc/nginx/conf.d/upstream.conf') # Disable xdebug @@ -565,7 +573,7 @@ class WODebugController(CementBaseController): if ('{0}{1}/logs/error.log'.format(WOVariables.wo_webroot, self.app.pargs.site_name) - not in self.msg): + not in self.msg): self.msg = self.msg + ['{0}{1}/logs/error.log' .format(WOVariables.wo_webroot, self.app.pargs.site_name)] @@ -595,9 +603,9 @@ class WODebugController(CementBaseController): if self.app.pargs.php: self.app.pargs.php = 'off' self.debug_php() - if self.app.pargs.php7: - self.app.pargs.php7 = 'off' - self.debug_php7() + if self.app.pargs.php73: + self.app.pargs.php73 = 'off' + self.debug_php73() if self.app.pargs.fpm: self.app.pargs.fpm = 'off' self.debug_fpm() @@ -626,12 +634,12 @@ class WODebugController(CementBaseController): # Reload PHP if self.trigger_php: if WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic': - if WOAptGet.is_installed(self,'php5.6-fpm'): - WOService.reload_service(self, 'php5.6-fpm') - if WOAptGet.is_installed(self,'php7.2-fpm'): + if WOAptGet.is_installed(self, 'php7.2-fpm'): + WOService.reload_service(self, 'php7.2-fpm') + if WOAptGet.is_installed(self, 'php7.2-fpm'): WOService.reload_service(self, 'php7.2-fpm') else: - WOService.reload_service(self, 'php5-fpm') + WOService.reload_service(self, 'php7.2-fpm') self.app.close(0) @expose(hide=True) @@ -644,12 +652,12 @@ class WODebugController(CementBaseController): self.trigger_php = False if ((not self.app.pargs.nginx) and (not self.app.pargs.php) and (not self.app.pargs.php7) - and (not self.app.pargs.fpm) and (not self.app.pargs.fpm7) and (not self.app.pargs.mysql) - and (not self.app.pargs.wp) and (not self.app.pargs.rewrite) - and (not self.app.pargs.all) - and (not self.app.pargs.site_name) - and (not self.app.pargs.import_slow_log) - and (not self.app.pargs.interval)): + and (not self.app.pargs.fpm) and (not self.app.pargs.fpm7) and (not self.app.pargs.mysql) + and (not self.app.pargs.wp) and (not self.app.pargs.rewrite) + and (not self.app.pargs.all) + and (not self.app.pargs.site_name) + and (not self.app.pargs.import_slow_log) + and (not self.app.pargs.interval)): if self.app.pargs.stop or self.app.pargs.start: print("--start/stop option is deprecated since ee v3.0.5") self.app.args.print_help() @@ -716,8 +724,8 @@ class WODebugController(CementBaseController): self.app.pargs.nginx = 'on' self.app.pargs.php = 'on' self.app.pargs.fpm = 'on' - if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and WOAptGet.is_installed(self,'php7.2-fpm'): - self.app.pargs.php7 = 'on' + if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and WOAptGet.is_installed(self, 'php7.2-fpm'): + self.app.pargs.php73 = 'on' self.app.pargs.fpm7 = 'on' self.app.pargs.mysql = 'on' self.app.pargs.rewrite = 'on' @@ -728,16 +736,16 @@ class WODebugController(CementBaseController): self.app.pargs.nginx = 'off' self.app.pargs.php = 'off' self.app.pargs.fpm = 'off' - if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and WOAptGet.is_installed(self,'php7.2-fpm'): - self.app.pargs.php7 = 'off' + if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and WOAptGet.is_installed(self, 'php7.2-fpm'): + self.app.pargs.php73 = 'off' self.app.pargs.fpm7 = 'off' self.app.pargs.mysql = 'off' self.app.pargs.rewrite = 'off' - if ((not self.app.pargs.nginx) and (not self.app.pargs.php) and (not self.app.pargs.php7) - and (not self.app.pargs.fpm) and (not self.app.pargs.fpm7) and (not self.app.pargs.mysql) - and (not self.app.pargs.wp) and (not self.app.pargs.rewrite) - and self.app.pargs.site_name): + if ((not self.app.pargs.nginx) and (not self.app.pargs.php) and (not self.app.pargs.php73) + and (not self.app.pargs.fpm) and (not self.app.pargs.fpm7) and (not self.app.pargs.mysql) + and (not self.app.pargs.wp) and (not self.app.pargs.rewrite) + and self.app.pargs.site_name): self.app.args.print_help() # self.app.pargs.nginx = 'on' # self.app.pargs.wp = 'on' @@ -749,8 +757,8 @@ class WODebugController(CementBaseController): self.debug_php() if self.app.pargs.fpm: self.debug_fpm() - if self.app.pargs.php7: - self.debug_php7() + if self.app.pargs.php73: + self.debug_php73() if self.app.pargs.fpm7: self.debug_fpm7() if self.app.pargs.mysql: @@ -774,9 +782,9 @@ class WODebugController(CementBaseController): # Reload PHP if self.trigger_php: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - if WOAptGet.is_installed(self,'php5.6-fpm'): + if WOAptGet.is_installed(self, 'php5.6-fpm'): WOService.restart_service(self, 'php5.6-fpm') - if WOAptGet.is_installed(self,'php7.2-fpm'): + if WOAptGet.is_installed(self, 'php7.2-fpm'): WOService.restart_service(self, 'php7.2-fpm') else: WOService.restart_service(self, 'php5-fpm') diff --git a/wo/cli/plugins/info.py b/wo/cli/plugins/info.py index f70f444..127f847 100644 --- a/wo/cli/plugins/info.py +++ b/wo/cli/plugins/info.py @@ -27,15 +27,15 @@ class WOInfoController(CementBaseController): dict(help='Get MySQL configuration information', action='store_true')), (['--php'], - dict(help='Get PHP configuration information', - action='store_true')), - (['--php72'], dict(help='Get PHP 7.2 configuration information', action='store_true')), + (['--php73'], + dict(help='Get PHP 7.3 configuration information', + action='store_true')), (['--nginx'], dict(help='Get Nginx configuration information', action='store_true')), - ] + ] usage = "wo info [options]" @expose(hide=True) @@ -66,17 +66,19 @@ class WOInfoController(CementBaseController): @expose(hide=True) def info_php(self): """Display PHP information""" - version = os.popen("{0} -v 2>/dev/null | head -n1 | cut -d' ' -f2 |".format("php5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php") + + version = os.popen("{0} -v 2>/dev/null | head -n1 | cut -d' ' -f2 |".format("php7.2" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php") + " cut -d'+' -f1 | tr -d '\n'").read config = configparser.ConfigParser() - config.read('/etc/{0}/fpm/php.ini'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) + config.read('/etc/{0}/fpm/php.ini'.format("php/7.2" if (WOVariables.wo_platform_codename == + 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) 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/{0}/fpm/pool.d/www.conf'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) + config.read('/etc/{0}/fpm/pool.d/www.conf'.format("php/7.2" if (WOVariables.wo_platform_codename == + 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) www_listen = config['www']['listen'] www_ping_path = config['www']['ping.path'] www_pm_status_path = config['www']['pm.status_path'] @@ -94,7 +96,8 @@ class WOInfoController(CementBaseController): except Exception as e: www_xdebug = 'off' - config.read('/etc/{0}/fpm/pool.d/debug.conf'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) + config.read('/etc/{0}/fpm/pool.d/debug.conf'.format("php/7.2" if (WOVariables.wo_platform_codename == + 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) debug_listen = config['debug']['listen'] debug_ping_path = config['debug']['ping.path'] debug_pm_status_path = config['debug']['pm.status_path'] @@ -138,19 +141,19 @@ class WOInfoController(CementBaseController): self.app.render((data), 'info_php.mustache') @expose(hide=True) - def info_php72(self): + def info_php73(self): """Display PHP information""" - version = os.popen("php7.2 -v 2>/dev/null | head -n1 | cut -d' ' -f2 |" + version = os.popen("php7.3 -v 2>/dev/null | head -n1 | cut -d' ' -f2 |" " cut -d'+' -f1 | tr -d '\n'").read config = configparser.ConfigParser() - config.read('/etc/php/7.2/fpm/php.ini') + config.read('/etc/php/7.3/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.2/fpm/pool.d/www.conf') + config.read('/etc/php/7.3/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 +171,7 @@ class WOInfoController(CementBaseController): except Exception as e: www_xdebug = 'off' - config.read('/etc/php/7.2/fpm/pool.d/debug.conf') + config.read('/etc/php/7.3/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'] @@ -243,12 +246,12 @@ class WOInfoController(CementBaseController): def default(self): """default function for info""" if (not self.app.pargs.nginx and not self.app.pargs.php - and not self.app.pargs.mysql and not self.app.pargs.php72): + and not self.app.pargs.mysql and not self.app.pargs.php73): self.app.pargs.nginx = True self.app.pargs.php = True self.app.pargs.mysql = True if WOAptGet.is_installed(self, 'php7.2-fpm'): - self.app.pargs.php = True + self.app.pargs.php = True if self.app.pargs.nginx: if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self, 'nginx-common'): @@ -258,21 +261,21 @@ class WOInfoController(CementBaseController): if self.app.pargs.php: if (WOVariables.wo_platform_distro == 'debian' or WOVariables.wo_platform_codename == 'precise'): - if WOAptGet.is_installed(self, 'php5-fpm'): + if WOAptGet.is_installed(self, 'php7.2-fpm'): self.info_php() else: - Log.error(self, "PHP5 is not installed") + Log.error(self, "PHP 7.2 is not installed") else: - if WOAptGet.is_installed(self, 'php5.6-fpm'): + if WOAptGet.is_installed(self, 'php7.2-fpm'): self.info_php() else: - Log.error(self, "PHP5.6 is not installed") + Log.error(self, "PHP 7.2 is not installed") - if self.app.pargs.php72: - if WOAptGet.is_installed(self, 'php7.2-fpm'): - self.info_php72() + if self.app.pargs.php73: + if WOAptGet.is_installed(self, 'php7.3-fpm'): + self.info_php73() else: - Log.error(self, "PHP 7.2 is not installed") + Log.error(self, "PHP 7.3 is not installed") if self.app.pargs.mysql: if WOShellExec.cmd_exec(self, "mysqladmin ping"): diff --git a/wo/cli/plugins/site.py b/wo/cli/plugins/site.py index 1a7752e..1a70bfc 100644 --- a/wo/cli/plugins/site.py +++ b/wo/cli/plugins/site.py @@ -309,8 +309,8 @@ class WOSiteCreateController(CementBaseController): dict(help="create html site", action='store_true')), (['--php'], dict(help="create php site", action='store_true')), - (['--php72'], - dict(help="create php 7.2 site", action='store_true')), + (['--php73'], + dict(help="create php 7.3 site", action='store_true')), (['--mysql'], dict(help="create mysql site", action='store_true')), (['--wp'], @@ -344,9 +344,6 @@ class WOSiteCreateController(CementBaseController): dest='wppass')), (['--proxy'], dict(help="create proxy for site", nargs='+')), - (['--experimental'], - dict(help="Enable Experimenal packages without prompt", - action='store_true')), ] @expose(hide=True) @@ -410,16 +407,16 @@ class WOSiteCreateController(CementBaseController): data['port'] = port wo_site_webroot = "" - if self.app.pargs.php72: + if self.app.pargs.php73: data = dict(site_name=wo_domain, www_domain=wo_www_domain, - static=False, basic=False, php72=True, wp=False, + static=False, basic=False, php73=True, wp=False, wpfc=False, wpsc=False, multisite=False, wpsubdir=False, webroot=wo_site_webroot) data['basic'] = True if stype in ['html', 'php' ]: data = dict(site_name=wo_domain, www_domain=wo_www_domain, - static=True, basic=False, php72=False, wp=False, + static=True, basic=False, php73=False, wp=False, wpfc=False, wpsc=False, multisite=False, wpsubdir=False, webroot=wo_site_webroot) @@ -430,7 +427,7 @@ class WOSiteCreateController(CementBaseController): elif stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']: data = dict(site_name=wo_domain, www_domain=wo_www_domain, - static=False, basic=True, wp=False, wpfc=False, + static=False, basic=True, wp=False, wpfc=False, wpsc=False, wpredis=False, multisite=False, wpsubdir=False, webroot=wo_site_webroot, wo_db_name='', wo_db_user='', wo_db_pass='', @@ -453,49 +450,14 @@ class WOSiteCreateController(CementBaseController): if stype == "html" and self.app.pargs.hhvm: Log.error(self, "Can not create HTML site with HHVM") - if data and self.app.pargs.php72: - if (not self.app.pargs.experimental): - Log.info(self, "Do you wish to install PHP 7.2 now for {0}?".format(wo_domain)) - - # Check prompt - check_prompt = input("Type \"y\" to continue [n]:") - if check_prompt != "Y" and check_prompt != "y": - Log.info(self, "Not using PHP 7.2 for site.") - data['php72'] = False - data['basic'] = True - php72 = 0 - self.app.pargs.php72 = False - else: - data['php72'] = True - php72 = 1 - else: - data['php72'] = True - php72 = 1 - elif data: - data['php72'] = False - php72 = 0 + if data and self.app.pargs.php73: + data['php73'] = True + php73 = 1 if (not self.app.pargs.wpfc) and (not self.app.pargs.wpsc) and (not self.app.pargs.wpredis) and (not self.app.pargs.hhvm): data['basic'] = True if data and self.app.pargs.hhvm: - if (not self.app.pargs.experimental): - Log.info(self, "HHVM is experimental feature and it may not " - "work with all plugins of your site.\nYou can " - "disable it by passing --hhvm=off later.\nDo you wish" - " to enable HHVM now for {0}?".format(wo_domain)) - - # Check prompt - check_prompt = input("Type \"y\" to continue [n]:") - if check_prompt != "Y" and check_prompt != "y": - Log.info(self, "Not using HHVM for site.") - data['hhvm'] = False - hhvm = 0 - self.app.pargs.hhvm = False - else: - data['hhvm'] = True - hhvm = 1 - else: data['hhvm'] = True hhvm = 1 @@ -503,20 +465,7 @@ class WOSiteCreateController(CementBaseController): data['hhvm'] = False hhvm = 0 - if (cache == 'wpredis' and (not self.app.pargs.experimental)): - Log.info(self, "Redis is experimental feature and it may not " - "work with all CSS/JS/Cache of your site.\nYou can " - "disable it by changing cache later.\nDo you wish" - " to enable Redis now for {0}?".format(wo_domain)) - - # Check prompt - check_prompt = input("Type \"y\" to continue [n]:") - if check_prompt != "Y" and check_prompt != "y": - Log.error(self, "Not using Redis for site") - cache = 'basic' - data['wpredis'] = False - data['basic'] = True - self.app.pargs.wpredis = False + if cache == 'wpredis': # Check rerequired packages are installed or not wo_auth = site_package_check(self, stype) @@ -563,8 +512,8 @@ class WOSiteCreateController(CementBaseController): " http://{0}".format(wo_domain)) return - if data['php72']: - php_version = "7.2" + if data['php73']: + php_version = "7.3" else: php_version = "7.2" @@ -705,23 +654,6 @@ class WOSiteCreateController(CementBaseController): "`tail /var/log/wo/wordops.log` and please try again") if self.app.pargs.letsencrypt : - if (not self.app.pargs.experimental): - if stype in ['wpsubdomain']: - Log.warn(self, "Wildcard domains are not supported in Lets Encrypt.\nWP SUBDOMAIN site will get SSL for primary site only.") - - Log.info(self, "Letsencrypt is currently in beta phase." - " \nDo you wish" - " to enable SSl now for {0}?".format(wo_domain)) - - # Check prompt - check_prompt = input("Type \"y\" to continue [n]:") - if check_prompt != "Y" and check_prompt != "y": - data['letsencrypt'] = False - letsencrypt = False - else: - data['letsencrypt'] = True - letsencrypt = True - else: data['letsencrypt'] = True letsencrypt = True @@ -775,8 +707,8 @@ class WOSiteUpdateController(CementBaseController): dict(help="update to html site", action='store_true')), (['--php'], dict(help="update to php site", action='store_true')), - (['--php72'], - dict(help="update to php7 site", + (['--php73'], + dict(help="update to PHP 7.3 site", action='store' or 'store_const', choices=('on', 'off'), const='on', nargs='?')), (['--mysql'], @@ -804,9 +736,6 @@ class WOSiteUpdateController(CementBaseController): choices=('on', 'off', 'renew'), const='on', nargs='?')), (['--proxy'], dict(help="update to proxy site", nargs='+')), - (['--experimental'], - dict(help="Enable Experimenal packages without prompt", - action='store_true')), (['--all'], dict(help="update all sites", action='store_true')), ] @@ -822,9 +751,9 @@ class WOSiteUpdateController(CementBaseController): if pargs.html: Log.error(self, "No site can be updated to html") - if not (pargs.php or pargs.php72 or + if not (pargs.php or pargs.php73 or pargs.mysql or pargs.wp or pargs.wpsubdir or - pargs.wpsubdomain or pargs.wpfc or pargs.wpsc or + pargs.wpsubdomain or pargs.wpfc or pargs.wpsc or pargs.hhvm or pargs.wpredis or pargs.letsencrypt): Log.error(self, "Please provide options to update sites.") @@ -850,7 +779,7 @@ class WOSiteUpdateController(CementBaseController): def doupdatesite(self, pargs): hhvm = None letsencrypt = False - php72 = None + php73 = None data = dict() @@ -900,13 +829,13 @@ class WOSiteUpdateController(CementBaseController): check_php_version = check_site.php_version if check_php_version == "7.2": - old_php72 = True + old_php73 = True else: - old_php72 = False + old_php73 = False if (pargs.password and not (pargs.html or - pargs.php or pargs.php72 or pargs.mysql or - pargs.wp or pargs.wpfc or pargs.wpsc or + pargs.php or pargs.php73 or pargs.mysql or + pargs.wp or pargs.wpfc or pargs.wpsc or pargs.wpsubdir or pargs.wpsubdomain)): try: updatewpuserpassword(self, wo_domain, wo_site_webroot) @@ -925,16 +854,16 @@ class WOSiteUpdateController(CementBaseController): Log.info(self, Log.FAIL + "Can not update HTML site to HHVM") return 1 - if ((stype == 'php' and oldsitetype not in ['html', 'proxy', 'php72']) or - # (stype == 'php72' and oldsitetype not in ['html', 'mysql', 'php', 'php72', 'wp', 'wpsubdir', 'wpsubdomain', ]) or + if ((stype == 'php' and oldsitetype not in ['html', 'proxy', 'php73']) or + # (stype == 'php73' and oldsitetype not in ['html', 'mysql', 'php', 'php73', 'wp', 'wpsubdir', 'wpsubdomain', ]) or (stype == 'mysql' and oldsitetype not in ['html', 'php', - 'proxy','php72']) or + 'proxy','php73']) or (stype == 'wp' and oldsitetype not in ['html', 'php', 'mysql', - 'proxy', 'wp', 'php72']) or + 'proxy', 'wp', 'php73']) or (stype == 'wpsubdir' and oldsitetype in ['wpsubdomain']) or (stype == 'wpsubdomain' and oldsitetype in ['wpsubdir']) or (stype == oldsitetype and cache == oldcachetype) and - not pargs.php72): + not pargs.php73): Log.info(self, Log.FAIL + "can not update {0} {1} to {2} {3}". format(oldsitetype, oldcachetype, stype, cache)) return 1 @@ -952,7 +881,7 @@ class WOSiteUpdateController(CementBaseController): if stype == 'php': data = dict(site_name=wo_domain, www_domain=wo_www_domain, - static=False, basic=True, wp=False, wpfc=False, + static=False, basic=True, wp=False, wpfc=False, wpsc=False, wpredis=False, multisite=False, wpsubdir=False, webroot=wo_site_webroot, currsitetype=oldsitetype, currcachetype=oldcachetype) @@ -960,7 +889,7 @@ class WOSiteUpdateController(CementBaseController): elif stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']: data = dict(site_name=wo_domain, www_domain=wo_www_domain, - static=False, basic=True, wp=False, wpfc=False, + static=False, basic=True, wp=False, wpfc=False, wpsc=False, wpredis=False, multisite=False, wpsubdir=False, webroot=wo_site_webroot, wo_db_name='', wo_db_user='', wo_db_pass='', @@ -976,7 +905,7 @@ class WOSiteUpdateController(CementBaseController): if stype == 'wpsubdir': data['wpsubdir'] = True - if pargs.hhvm or pargs.php72: + if pargs.hhvm or pargs.php73: if not data: data = dict(site_name=wo_domain, www_domain=wo_www_domain, currsitetype=oldsitetype, @@ -1038,24 +967,24 @@ class WOSiteUpdateController(CementBaseController): data['hhvm'] = False hhvm = False - if pargs.php72 == 'on' : - data['php72'] = True - php72 = True - check_php_version= '7.2' - elif pargs.php72 == 'off': - data['php72'] = False - php72 = False - check_php_version = '5.6' + if pargs.php73 == 'on' : + data['php73'] = True + php73 = True + check_php_version= '7.3' + elif pargs.php73 == 'off': + data['php73'] = False + php73 = False + check_php_version = '7.2' - if pargs.php72: - if php72 is old_php72: - if php72 is False: - Log.info(self, "PHP 7.2 is already disabled for given " + if pargs.php73: + if php73 is old_php73: + if php73 is False: + Log.info(self, "PHP 7.3 is already disabled for given " "site") - elif php72 is True: - Log.info(self, "PHP 7.2 is already enabled for given " + elif php73 is True: + Log.info(self, "PHP 7.3 is already enabled for given " "site") - pargs.php72 = False + pargs.php73 = False #--letsencrypt=renew code goes here if pargs.letsencrypt == "renew" and not pargs.all: @@ -1154,92 +1083,31 @@ class WOSiteUpdateController(CementBaseController): data['hhvm'] = False hhvm = False - if data and (not pargs.php72): - if old_php72 is True: - data['php72'] = True - php72 = True + if data and (not pargs.php73): + if old_php73 is True: + data['php73'] = True + php73 = True else: - data['php72'] = False - php72 = False + data['php73'] = False + php73 = False - if pargs.hhvm=="on" or pargs.letsencrypt=="on" or pargs.php72=="on": - if pargs.php72 == "on": - if (not pargs.experimental): - Log.info(self, "Do you wish to enable PHP 7.2 now for {0}?".format(wo_domain)) - - check_prompt = input("Type \"y\" to continue [n]:") - if check_prompt != "Y" and check_prompt != "y": - Log.info(self, "Not using PHP 7.2 for site") - data['php72'] = False - php72 = False - else: - data['php72'] = True - php72 = True - else: - data['php72'] = True - php72 = True + if pargs.hhvm=="on" or pargs.letsencrypt=="on" or pargs.php73=="on": + if pargs.php73 == "on": + data['php73'] = True + php73 = True if pargs.hhvm == "on": - if (not pargs.experimental): - Log.info(self, "HHVM is experimental feature and it may not" - " work with all plugins of your site.\nYou can " - "disable it by passing --hhvm=off later.\nDo you wish" - " to enable HHVM now for {0}?".format(wo_domain)) - - # Check prompt - check_prompt = input("Type \"y\" to continue [n]:") - if check_prompt != "Y" and check_prompt != "y": - Log.info(self, "Not using HHVM for site") - data['hhvm'] = False - hhvm = False - else: - data['hhvm'] = True - hhvm = True - else: data['hhvm'] = True hhvm = True if pargs.letsencrypt == "on": - - if (not pargs.experimental): - - if oldsitetype in ['wpsubdomain']: - Log.warn(self, "Wildcard domains are not supported in Lets Encrypt.\nWP SUBDOMAIN site will get SSL for primary site only.") - - Log.info(self, "Letsencrypt is currently in beta phase." - " \nDo you wish" - " to enable SSl now for {0}?".format(wo_domain)) - - check_prompt = input("Type \"y\" to continue [n]:") - if check_prompt != "Y" and check_prompt != "y": - Log.info(self, "Not using letsencrypt for site") - data['letsencrypt'] = False - letsencrypt = False - else: - data['letsencrypt'] = True - letsencrypt = True - else: data['letsencrypt'] = True letsencrypt = True if pargs.wpredis and data['currcachetype'] != 'wpredis': - if (not pargs.experimental): - Log.info(self, "Redis is experimental feature and it may not" - " work with all plugins of your site.\nYou can " - "disable it by changing cache type later.\nDo you wish" - " to enable Redis now for {0}?".format(wo_domain)) - - # Check prompt - check_prompt = input("Type \"y\" to continue [n]: ") - if check_prompt != "Y" and check_prompt != "y": - Log.error(self, "Not using Redis for site") - data['wpredis'] = False - data['basic'] = True - cache = 'basic' - - if ((hhvm is old_hhvm) and (php72 is old_php72) and + if ((hhvm is old_hhvm) and (php73 is old_php73) and (stype == oldsitetype and cache == oldcachetype)): return 1 diff --git a/wo/cli/plugins/site_functions.py b/wo/cli/plugins/site_functions.py index 79b301c..7d128be 100644 --- a/wo/cli/plugins/site_functions.py +++ b/wo/cli/plugins/site_functions.py @@ -72,7 +72,7 @@ def setupdomain(self, data): wo_site_nginx_conf = open('/etc/nginx/sites-available/{0}' .format(wo_domain_name), encoding='utf-8', mode='w') - if not data['php72']: + if not data['php73']: self.app.render((data), 'virtualconf.mustache', out=wo_site_nginx_conf) else: @@ -623,7 +623,7 @@ def sitebackup(self, data): .format(data['site_name']), backup_path) if data['currsitetype'] in ['html', 'php', 'proxy', 'mysql']: - if data['php72'] is True and not data['wp']: + if data['php73'] is True and not data['wp']: Log.info(self, "Backing up Webroot \t\t", end='') WOFileUtils.copyfiles(self, wo_site_webroot + '/htdocs', backup_path + '/htdocs') Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]") @@ -663,7 +663,7 @@ def sitebackup(self, data): Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]") # move wp-config.php/wo-config.php to backup if data['currsitetype'] in ['mysql', 'proxy']: - if data['php72'] is True and not data['wp']: + if data['php73'] is True and not data['wp']: WOFileUtils.copyfile(self, configfiles[0], backup_path) else: WOFileUtils.mvfile(self, configfiles[0], backup_path) @@ -677,7 +677,7 @@ def site_package_check(self, stype): stack = WOStackController() stack.app = self.app if stype in ['html', 'proxy', 'php', 'mysql', 'wp', 'wpsubdir', - 'wpsubdomain', 'php72']: + 'wpsubdomain', 'php73']: Log.debug(self, "Setting apt_packages variable for Nginx") # Check if server has nginx-custom package @@ -708,22 +708,22 @@ def site_package_check(self, stype): wo_nginx.write('fastcgi_param \tSCRIPT_FILENAME ' '\t$request_filename;\n') - if self.app.pargs.php and self.app.pargs.php72: + if self.app.pargs.php and self.app.pargs.php73: Log.error(self,"Error: two different PHP versions cannot be combined within the same WordOps site") - if not self.app.pargs.php72 and stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: + if not self.app.pargs.php73 and stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: Log.debug(self, "Setting apt_packages variable for PHP") - apt_packages = apt_packages + WOVariables.wo_php72 + WOVariables.wo_php_extra + apt_packages = apt_packages + WOVariables.wo_php73 + WOVariables.wo_php_extra - if self.app.pargs.php72 and stype in [ 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: + if self.app.pargs.php73 and stype in [ 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - Log.debug(self, "Setting apt_packages variable for PHP 7.2") - if not WOAptGet.is_installed(self, 'php7.2-fpm'): - apt_packages = apt_packages + WOVariables.wo_php72 + WOVariables.wo_php_extra + Log.debug(self, "Setting apt_packages variable for PHP 7.3") + if not WOAptGet.is_installed(self, 'php7.3-fpm'): + apt_packages = apt_packages + WOVariables.wo_php73 + WOVariables.wo_php_extra else: - Log.debug(self, "Setting apt_packages variable for PHP 7.2") - if not WOAptGet.is_installed(self, 'php7.2-fpm'): - apt_packages = apt_packages + WOVariables.wo_php72 + Log.debug(self, "Setting apt_packages variable for PHP 7.3") + if not WOAptGet.is_installed(self, 'php7.3-fpm'): + apt_packages = apt_packages + WOVariables.wo_php73 if stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']: Log.debug(self, "Setting apt_packages variable for MySQL") @@ -736,7 +736,7 @@ def site_package_check(self, stype): if stype in ['wp', 'wpsubdir', 'wpsubdomain']: Log.debug(self, "Setting packages variable for WP-CLI") - if not WOShellExec.cmd_exec(self, "which wp"): + if not WOShellExec.cmd_exec(self, "command -v wp"): packages = packages + [["https://github.com/wp-cli/wp-cli/" "releases/download/v{0}/" "wp-cli-{0}.phar" @@ -830,13 +830,13 @@ def site_package_check(self, stype): hhvm_file.write("upstream hhvm {\nserver 127.0.0.1:8000;\n" "server 127.0.0.1:9000 backup;\n}\n") - if self.app.pargs.php72: + if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'wheezy' or WOVariables.wo_platform_codename == 'precise'): Log.error(self,"PHP 7.0 is not supported in your Platform") - Log.debug(self, "Setting apt_packages variable for PHP 7.0") - if not WOAptGet.is_installed(self, 'php7.2-fpm'): - apt_packages = apt_packages + WOVariables.wo_php72 + WOVariables.wo_php_extra + Log.debug(self, "Setting apt_packages variable for PHP 7.3") + if not WOAptGet.is_installed(self, 'php7.3-fpm'): + apt_packages = apt_packages + WOVariables.wo_php73 + WOVariables.wo_php_extra if os.path.isdir("/etc/nginx/common") and (not os.path.isfile("/etc/nginx/common/php7.conf")): @@ -894,9 +894,9 @@ def site_package_check(self, stype): if os.path.isfile("/etc/nginx/conf.d/upstream.conf"): if not WOFileUtils.grep(self, "/etc/nginx/conf.d/upstream.conf", - "php72"): + "php73"): with open("/etc/nginx/conf.d/upstream.conf", "a") as php_file: - php_file.write("upstream php72 {\nserver 127.0.0.1:9072;\n}\n" + php_file.write("upstream php73 {\nserver 127.0.0.1:9072;\n}\n" "upstream debug72 {\nserver 127.0.0.1:9172;\n}\n") return(stack.install(apt_packages=apt_packages, packages=packages, @@ -1032,7 +1032,7 @@ def detSitePar(opts): cachelist = list() for key, val in opts.items(): if val and key in ['html', 'php', 'mysql', 'wp', - 'wpsubdir', 'wpsubdomain','php72']: + 'wpsubdir', 'wpsubdomain','php73']: typelist.append(key) elif val and key in ['wpfc', 'wpsc', 'wpredis']: cachelist.append(key) @@ -1046,7 +1046,7 @@ def detSitePar(opts): cachetype = 'basic' else: cachetype = cachelist[0] - elif False not in [x in ('php72','mysql','html') for x in typelist]: + elif False not in [x in ('php73','mysql','html') for x in typelist]: sitetype = 'mysql' if not cachelist: cachetype = 'basic' @@ -1058,7 +1058,7 @@ def detSitePar(opts): cachetype = 'basic' else: cachetype = cachelist[0] - elif False not in [x in ('php72','mysql') for x in typelist]: + elif False not in [x in ('php73','mysql') for x in typelist]: sitetype = 'mysql' if not cachelist: cachetype = 'basic' @@ -1076,8 +1076,8 @@ def detSitePar(opts): cachetype = 'basic' else: cachetype = cachelist[0] - elif False not in [x in ('php72','html') for x in typelist]: - sitetype = 'php72' + elif False not in [x in ('php73','html') for x in typelist]: + sitetype = 'php73' if not cachelist: cachetype = 'basic' else: @@ -1094,19 +1094,19 @@ def detSitePar(opts): cachetype = 'basic' else: cachetype = cachelist[0] - elif False not in [x in ('wp','php72') for x in typelist]: + elif False not in [x in ('wp','php73') for x in typelist]: sitetype = 'wp' if not cachelist: cachetype = 'basic' else: cachetype = cachelist[0] - elif False not in [x in ('wpsubdir','php72') for x in typelist]: + elif False not in [x in ('wpsubdir','php73') for x in typelist]: sitetype = 'wpsubdir' if not cachelist: cachetype = 'basic' else: cachetype = cachelist[0] - elif False not in [x in ('wpsubdomain','php72') for x in typelist]: + elif False not in [x in ('wpsubdomain','php73') for x in typelist]: sitetype = 'wpsubdomain' if not cachelist: cachetype = 'basic' @@ -1118,7 +1118,7 @@ def detSitePar(opts): if not typelist and not cachelist: sitetype = None cachetype = None - elif (not typelist or "php72" in typelist) and cachelist: + elif (not typelist or "php73" in typelist) and cachelist: sitetype = 'wp' cachetype = cachelist[0] elif typelist and (not cachelist): diff --git a/wo/cli/plugins/stack.py b/wo/cli/plugins/stack.py index c7334d4..63cf56c 100644 --- a/wo/cli/plugins/stack.py +++ b/wo/cli/plugins/stack.py @@ -53,12 +53,12 @@ class WOStackController(CementBaseController): dict(help='Install admin tools stack', action='store_true')), (['--nginx'], dict(help='Install Nginx stack', action='store_true')), -# (['--nginxmainline'], -# dict(help='Install Nginx mainline stack', action='store_true')), + # (['--nginxmainline'], + # dict(help='Install Nginx mainline stack', action='store_true')), (['--php'], - dict(help='Install PHP stack', action='store_true')), - (['--php72'], dict(help='Install PHP 7.2 stack', action='store_true')), + (['--php73'], + dict(help='Install PHP 7.3 stack', action='store_true')), (['--mysql'], dict(help='Install MySQL stack', action='store_true')), (['--hhvm'], @@ -75,7 +75,7 @@ class WOStackController(CementBaseController): dict(help='Install Redis', action='store_true')), (['--phpredisadmin'], dict(help='Install phpRedisAdmin', action='store_true')), - ] + ] usage = "ee stack (command) [options]" @expose(hide=True) @@ -96,11 +96,11 @@ class WOStackController(CementBaseController): mysql_pref_file.write(mysql_pref) WORepo.add(self, repo_url=WOVariables.wo_mysql_repo) Log.debug(self, 'Adding key for {0}' - .format(WOVariables.wo_mysql_repo)) + .format(WOVariables.wo_mysql_repo)) WORepo.add_key(self, '0xcbcb082a1bb943db', - keyserver="keyserver.ubuntu.com") + keyserver="keyserver.ubuntu.com") WORepo.add_key(self, '0xF1656F24C74CD1D8', - keyserver="keyserver.ubuntu.com") + keyserver="keyserver.ubuntu.com") chars = ''.join(random.sample(string.ascii_letters, 8)) Log.debug(self, "Pre-seeding MySQL") Log.debug(self, "echo \"mariadb-server-10.1 " @@ -154,7 +154,7 @@ class WOStackController(CementBaseController): WORepo.add_key(self, WOVariables.wo_nginx_key) if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - if set(WOVariables.wo_php72).issubset(set(apt_packages)): + if set(WOVariables.wo_php73).issubset(set(apt_packages)): Log.info(self, "Adding repository for PHP, please wait...") Log.debug(self, 'Adding ppa for PHP') WORepo.add(self, ppa=WOVariables.wo_php_repo) @@ -173,7 +173,7 @@ class WOStackController(CementBaseController): WORepo.add(self, ppa=WOVariables.wo_php_repo) if WOVariables.wo_platform_codename == 'jessie': - if set(WOVariables.wo_php72).issubset(set(apt_packages)): + if set(WOVariables.wo_php73).issubset(set(apt_packages)): Log.debug(self, 'Adding repo_url of php 7.0 for debian') WORepo.add(self, repo_url=WOVariables.wo_php_repo) Log.debug(self, 'Adding Dotdeb/php GPG key') @@ -243,8 +243,8 @@ class WOStackController(CementBaseController): self.app.render((data), 'fastcgi.mustache', out=wo_nginx) wo_nginx.close() - data = dict(php="9000", debug="9001", hhvm="8000",php72="9072",debug7="9172", - hhvmconf=False, php7conf= True if WOAptGet.is_installed(self,'php7.2-fpm') else False ) + data = dict(php="9000", debug="9001", hhvm="8000", php73="9072", debug7="9172", + hhvmconf=False, php7conf=True if WOAptGet.is_installed(self, 'php7.2-fpm') else False) Log.debug(self, 'Writting the nginx configuration to ' 'file /etc/nginx/conf.d/upstream.conf') wo_nginx = open('/etc/nginx/conf.d/upstream.conf', @@ -315,56 +315,56 @@ class WOStackController(CementBaseController): out=wo_nginx) wo_nginx.close() - #php7 conf + # php7 conf if (WOVariables.wo_platform_codename == 'stretch' or WOVariables.wo_platform_codename == 'jessie' or WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and (not - os.path.isfile("/etc/nginx/common/php7.conf")): + os.path.isfile("/etc/nginx/common/php7.conf")): #data = dict() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/locations-php7.conf') + 'file /etc/nginx/common/locations-php7.conf') wo_nginx = open('/etc/nginx/common/locations-php7.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'locations-php7.mustache', - out=wo_nginx) + out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/php7.conf') + 'file /etc/nginx/common/php7.conf') wo_nginx = open('/etc/nginx/common/php7.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'php7.mustache', - out=wo_nginx) + out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpcommon-php7.conf') + 'file /etc/nginx/common/wpcommon-php7.conf') wo_nginx = open('/etc/nginx/common/wpcommon-php7.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'wpcommon-php7.mustache', - out=wo_nginx) + out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpfc-php7.conf') + 'file /etc/nginx/common/wpfc-php7.conf') wo_nginx = open('/etc/nginx/common/wpfc-php7.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'wpfc-php7.mustache', - out=wo_nginx) + out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpsc-php7.conf') + 'file /etc/nginx/common/wpsc-php7.conf') wo_nginx = open('/etc/nginx/common/wpsc-php7.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'wpsc-php7.mustache', - out=wo_nginx) + out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' 'file /etc/nginx/common/redis-php7.conf') wo_nginx = open('/etc/nginx/common/redis-php7.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'redis-php7.mustache', - out=wo_nginx) + out=wo_nginx) wo_nginx.close() # Nginx-Plus does not have nginx package structure like this @@ -393,8 +393,8 @@ class WOStackController(CementBaseController): wo_nginx.close() passwd = ''.join([random.choice - (string.ascii_letters + string.digits) - for n in range(6)]) + (string.ascii_letters + string.digits) + for n in range(6)]) try: WOShellExec.cmd_exec(self, "printf \"WordOps:" "$(openssl passwd -crypt " @@ -433,14 +433,14 @@ class WOStackController(CementBaseController): '22222.access.log', '{0}22222/' 'logs/access.log' - .format(WOVariables.wo_webroot)] + .format(WOVariables.wo_webroot)] ) WOFileUtils.create_symlink(self, ['/var/log/nginx/' '22222.error.log', '{0}22222/' 'logs/error.log' - .format(WOVariables.wo_webroot)] + .format(WOVariables.wo_webroot)] ) try: @@ -474,7 +474,8 @@ class WOStackController(CementBaseController): .format(WOVariables.wo_webroot)) except CommandExecutionError as e: - Log.error(self, "Failed to generate HTTPS certificate for 22222") + Log.error( + self, "Failed to generate HTTPS certificate for 22222") # Nginx Configation into GIT WOGit.add(self, @@ -482,12 +483,12 @@ class WOStackController(CementBaseController): WOService.reload_service(self, 'nginx') if set(["nginx-plus"]).issubset(set(apt_packages)) or set(["nginx"]).issubset(set(apt_packages)): WOShellExec.cmd_exec(self, "sed -i -e 's/^user/#user/'" - " -e '/^#user/a user" - "\ www-data\;'" - " /etc/nginx/nginx.conf") + " -e '/^#user/a user" + "\ www-data\;'" + " /etc/nginx/nginx.conf") if not WOShellExec.cmd_exec(self, "cat /etc/nginx/" - "nginx.conf | grep -q " - "'/etc/nginx/sites-enabled'"): + "nginx.conf | grep -q " + "'/etc/nginx/sites-enabled'"): WOShellExec.cmd_exec(self, "sed -i '/\/etc\/" "nginx\/conf\.d\/\*" "\.conf/a \ include" @@ -505,17 +506,17 @@ class WOStackController(CementBaseController): wo_nginx.close() print("HTTP Auth User Name: WordOps" - + "\nHTTP Auth Password : {0}".format(passwd)) + + "\nHTTP Auth Password : {0}".format(passwd)) WOService.reload_service(self, 'nginx') else: self.msg = (self.msg + ["HTTP Auth User Name: WordOps"] - + ["HTTP Auth Password : {0}".format(passwd)]) + + ["HTTP Auth Password : {0}".format(passwd)]) else: WOService.restart_service(self, 'nginx') - if WOAptGet.is_installed(self,'redis-server'): + if WOAptGet.is_installed(self, 'redis-server'): if os.path.isfile("/etc/nginx/nginx.conf") and (not - os.path.isfile("/etc/nginx/common/redis.conf")): + os.path.isfile("/etc/nginx/common/redis.conf")): data = dict() Log.debug(self, 'Writting the nginx configuration to ' @@ -527,7 +528,7 @@ class WOStackController(CementBaseController): wo_nginx.close() if os.path.isfile("/etc/nginx/nginx.conf") and (not - os.path.isfile("/etc/nginx/common/redis-hhvm.conf")): + os.path.isfile("/etc/nginx/common/redis-hhvm.conf")): data = dict() Log.debug(self, 'Writting the nginx configuration to ' @@ -540,14 +541,14 @@ class WOStackController(CementBaseController): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): if os.path.isfile("/etc/nginx/nginx.conf") and (not - os.path.isfile("/etc/nginx/common/redis-php7.conf")): + os.path.isfile("/etc/nginx/common/redis-php7.conf")): data = dict() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/redis-php7.conf') + 'file /etc/nginx/common/redis-php7.conf') wo_nginx = open('/etc/nginx/common/redis-php7.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'redis-php7.mustache', - out=wo_nginx) + out=wo_nginx) wo_nginx.close() if os.path.isfile("/etc/nginx/conf.d/upstream.conf"): @@ -561,16 +562,16 @@ class WOStackController(CementBaseController): " keepalive 10;\n}\n") if os.path.isfile("/etc/nginx/nginx.conf") and (not - os.path.isfile("/etc/nginx/conf.d/redis.conf")): + os.path.isfile("/etc/nginx/conf.d/redis.conf")): with open("/etc/nginx/conf.d/redis.conf", "a") as redis_file: redis_file.write("# Log format Settings\n" "log_format rt_cache_redis '$remote_addr $upstream_response_time $srcache_fetch_status [$time_local] '\n" "'$http_host \"$request\" $status $body_bytes_sent '\n" "'\"$http_referer\" \"$http_user_agent\"';\n") - #setup nginx common folder for php7 - if self.app.pargs.php72: + # setup nginx common folder for php7 + if self.app.pargs.php73: if os.path.isdir("/etc/nginx/common") and (not - os.path.isfile("/etc/nginx/common/php7.conf")): + os.path.isfile("/etc/nginx/common/php7.conf")): data = dict() Log.debug(self, 'Writting the nginx configuration to ' 'file /etc/nginx/common/locations-php7.conf') @@ -581,15 +582,15 @@ class WOStackController(CementBaseController): wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/php7.conf') + 'file /etc/nginx/common/php7.conf') wo_nginx = open('/etc/nginx/common/php7.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'php7.mustache', - out=wo_nginx) + out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpcommon-php7.conf') + 'file /etc/nginx/common/wpcommon-php7.conf') wo_nginx = open('/etc/nginx/common/wpcommon-php7.conf', encoding='utf-8', mode='w') self.app.render((data), 'wpcommon-php7.mustache', @@ -597,37 +598,37 @@ class WOStackController(CementBaseController): wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpfc-php7.conf') + 'file /etc/nginx/common/wpfc-php7.conf') wo_nginx = open('/etc/nginx/common/wpfc-php7.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'wpfc-php7.mustache', - out=wo_nginx) + out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpsc-php7.conf') + 'file /etc/nginx/common/wpsc-php7.conf') wo_nginx = open('/etc/nginx/common/wpsc-php7.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'wpsc-php7.mustache', - out=wo_nginx) + out=wo_nginx) wo_nginx.close() if os.path.isdir("/etc/nginx/common") and (not os.path.isfile("/etc/nginx/common/redis-php7.conf")): data = dict() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/redis-php7.conf') + 'file /etc/nginx/common/redis-php7.conf') wo_nginx = open('/etc/nginx/common/redis-php7.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'redis-php7.mustache', - out=wo_nginx) + out=wo_nginx) wo_nginx.close() if os.path.isfile("/etc/nginx/conf.d/upstream.conf"): if not WOFileUtils.grep(self, "/etc/nginx/conf.d/upstream.conf", - "php72"): + "php73"): with open("/etc/nginx/conf.d/upstream.conf", "a") as php_file: - php_file.write("upstream php72 {\nserver 127.0.0.1:9072;\n}\n" - "upstream debug72 {\nserver 127.0.0.1:9172;\n}\n") + php_file.write("upstream php73 {\nserver 127.0.0.1:9072;\n}\n" + "upstream debug72 {\nserver 127.0.0.1:9172;\n}\n") if set(WOVariables.wo_hhvm).issubset(set(apt_packages)): @@ -637,7 +638,7 @@ class WOStackController(CementBaseController): "9000", "8000") if (WOVariables.wo_platform_codename != 'xenial' or WOVariables.wo_platform_codename != 'bionic'): WOFileUtils.searchreplace(self, "/etc/nginx/hhvm.conf", - "9000", "8000") + "9000", "8000") with open("/etc/hhvm/php.ini", "a") as hhvm_file: hhvm_file.write("hhvm.log.header = true\n" @@ -675,7 +676,7 @@ class WOStackController(CementBaseController): WOService.restart_service(self, 'hhvm') if os.path.isfile("/etc/nginx/nginx.conf") and (not - os.path.isfile("/etc/nginx/common/php-hhvm.conf")): + os.path.isfile("/etc/nginx/common/php-hhvm.conf")): data = dict() Log.debug(self, 'Writting the nginx configuration to ' @@ -708,7 +709,7 @@ class WOStackController(CementBaseController): if set(WOVariables.wo_redis).issubset(set(apt_packages)): if os.path.isfile("/etc/nginx/nginx.conf") and (not - os.path.isfile("/etc/nginx/common/redis.conf")): + os.path.isfile("/etc/nginx/common/redis.conf")): data = dict() Log.debug(self, 'Writting the nginx configuration to ' @@ -720,7 +721,7 @@ class WOStackController(CementBaseController): wo_nginx.close() if os.path.isfile("/etc/nginx/nginx.conf") and (not - os.path.isfile("/etc/nginx/common/redis-hhvm.conf")): + os.path.isfile("/etc/nginx/common/redis-hhvm.conf")): data = dict() Log.debug(self, 'Writting the nginx configuration to ' @@ -742,7 +743,7 @@ class WOStackController(CementBaseController): " keepalive 10;\n}\n") if os.path.isfile("/etc/nginx/nginx.conf") and (not - os.path.isfile("/etc/nginx/conf.d/redis.conf")): + os.path.isfile("/etc/nginx/conf.d/redis.conf")): with open("/etc/nginx/conf.d/redis.conf", "a") as redis_file: redis_file.write("# Log format Settings\n" "log_format rt_cache_redis '$remote_addr $upstream_response_time $srcache_fetch_status [$time_local] '\n" @@ -772,11 +773,11 @@ class WOStackController(CementBaseController): # Parse /etc/php/7.2/fpm/php-fpm.conf data = dict(pid="/run/php/php7.2-fpm.pid", error_log="/var/log/php/7.2/fpm.log", - include="/etc/php/7.2/fpm/pool.d/*.conf") + include="/etc/php/7.2/fpm/pool.d/*.conf") Log.debug(self, "writting php5 configuration into " - "/etc/php/7.2/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') + encoding='utf-8', mode='w') self.app.render((data), 'php-fpm.mustache', out=wo_php_fpm) wo_php_fpm.close() @@ -793,7 +794,10 @@ class WOStackController(CementBaseController): config['www']['pm.max_spare_servers'] = '5' config['www']['request_terminate_timeout'] = '100' config['www']['pm'] = 'ondemand' - config['www']['listen'] = '127.0.0.1:9072' + config['www']['chdir'] = '/' + config['www']['prefix'] = '/var/run/php' + config['www']['listen'] = 'php73-fpm.sock' + config['www']['listen.backlog'] = '32768' with codecs.open('/etc/php/7.2/fpm/pool.d/www.conf', encoding='utf-8', mode='w') as configfile: Log.debug(self, "Writing PHP 7.2 configuration into " @@ -829,9 +833,9 @@ class WOStackController(CementBaseController): # Disable xdebug 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") + "xdebug.ini", + "zend_extension", + ";zend_extension") # PHP and Debug pull configuration if not os.path.exists('{0}22222/htdocs/fpm/status/' @@ -870,41 +874,41 @@ class WOStackController(CementBaseController): WOGit.add(self, ["/etc/php"], msg="Adding PHP into Git") WOService.restart_service(self, 'php7.2-fpm') - #PHP7.0 configuration for debian - if (WOVariables.wo_platform_codename == 'jessie' ) and set(WOVariables.wo_php72).issubset(set(apt_packages)): + # PHP7.3 configuration for debian + if (WOVariables.wo_platform_codename == 'jessie') and set(WOVariables.wo_php73).issubset(set(apt_packages)): # Create log directories - 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/') + if not os.path.exists('/var/log/php/7.3/'): + Log.debug(self, 'Creating directory /var/log/php/7.3/') + os.makedirs('/var/log/php/7.3/') - # Parse etc/php/7.2/fpm/php.ini + # Parse etc/php/7.3/fpm/php.ini config = configparser.ConfigParser() - Log.debug(self, "configuring php file /etc/php/7.2/fpm/php.ini") - config.read('/etc/php/7.2/fpm/php.ini') + Log.debug(self, "configuring php file /etc/php/7.3/fpm/php.ini") + config.read('/etc/php/7.3/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.2/fpm/php.ini', + with open('/etc/php/7.3/fpm/php.ini', encoding='utf-8', mode='w') as configfile: Log.debug(self, "Writting php configuration into " - "/etc/php/7.2/fpm/php.ini") + "/etc/php/7.3/fpm/php.ini") config.write(configfile) - # Parse /etc/php/7.2/fpm/php-fpm.conf - data = dict(pid="/run/php/php7.2-fpm.pid", error_log="/var/log/php7.2-fpm.log", - include="/etc/php/7.2/fpm/pool.d/*.conf") + # Parse /etc/php/7.3/fpm/php-fpm.conf + data = dict(pid="/run/php/php7.3-fpm.pid", error_log="/var/log/php7.3-fpm.log", + include="/etc/php/7.3/fpm/pool.d/*.conf") Log.debug(self, "writting php 7.0 configuration into " - "/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') + "/etc/php/7.3/fpm/php-fpm.conf") + wo_php_fpm = open('/etc/php/7.3/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.2/fpm/pool.d/www.conf + # Parse /etc/php/7.3/fpm/pool.d/www.conf config = configparser.ConfigParser() - config.read_file(codecs.open('/etc/php/7.2/fpm/pool.d/www.conf', + config.read_file(codecs.open('/etc/php/7.3/fpm/pool.d/www.conf', "r", "utf8")) config['www']['ping.path'] = '/ping' config['www']['pm.status_path'] = '/status' @@ -915,31 +919,34 @@ class WOStackController(CementBaseController): config['www']['pm.max_spare_servers'] = '30' config['www']['request_terminate_timeout'] = '300' config['www']['pm'] = 'ondemand' - config['www']['listen'] = '127.0.0.1:9072' - with codecs.open('/etc/php/7.2/fpm/pool.d/www.conf', + config['www']['chdir'] = '/' + config['www']['prefix'] = '/var/run/php' + config['www']['listen'] = 'php73-fpm.sock' + config['www']['listen.backlog'] = '32768' + with codecs.open('/etc/php/7.3/fpm/pool.d/www.conf', encoding='utf-8', mode='w') as configfile: Log.debug(self, "writting PHP5 configuration into " - "/etc/php/7.2/fpm/pool.d/www.conf") + "/etc/php/7.3/fpm/pool.d/www.conf") config.write(configfile) - # 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/" + # Generate /etc/php/7.3/fpm/pool.d/debug.conf + WOFileUtils.copyfile(self, "/etc/php/7.3/fpm/pool.d/www.conf", + "/etc/php/7.3/fpm/pool.d/debug.conf") + WOFileUtils.searchreplace(self, "/etc/php/7.3/fpm/pool.d/" "debug.conf", "[www]", "[debug]") config = configparser.ConfigParser() - config.read('/etc/php/7.2/fpm/pool.d/debug.conf') - config['debug']['listen'] = '127.0.0.1:9172' + config.read('/etc/php/7.3/fpm/pool.d/debug.conf') + config['debug']['listen'] = '127.0.0.1:9182' config['debug']['rlimit_core'] = 'unlimited' - config['debug']['slowlog'] = '/var/log/php/7.2/slow.log' + config['debug']['slowlog'] = '/var/log/php/7.3/slow.log' config['debug']['request_slowlog_timeout'] = '10s' - with open('/etc/php/7.2/fpm/pool.d/debug.conf', + with open('/etc/php/7.3/fpm/pool.d/debug.conf', encoding='utf-8', mode='w') as confifile: Log.debug(self, "writting PHP5 configuration into " - "/etc/php/7.2/fpm/pool.d/debug.conf") + "/etc/php/7.3/fpm/pool.d/debug.conf") config.write(confifile) - with open("/etc/php/7.2/fpm/pool.d/debug.conf", + with open("/etc/php/7.3/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_" @@ -949,11 +956,11 @@ class WOStackController(CementBaseController): "profiler_enable] = off\n") # Disable xdebug - 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") + if not WOShellExec.cmd_exec(self, "grep -q \';zend_extension\' /etc/php/7.3/mods-available/xdebug.ini"): + WOFileUtils.searchreplace(self, "/etc/php/7.3/mods-available/" + "xdebug.ini", + "zend_extension", + ";zend_extension") # PHP and Debug pull configuration if not os.path.exists('{0}22222/htdocs/fpm/status/' @@ -990,10 +997,10 @@ class WOStackController(CementBaseController): WOVariables.wo_php_user, recursive=True) WOGit.add(self, ["/etc/php"], msg="Adding PHP into Git") - WOService.restart_service(self, 'php7.2-fpm') + WOService.restart_service(self, 'php7.3-fpm') - #preconfiguration for php7.2 - if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and set(WOVariables.wo_php72).issubset(set(apt_packages)): + # preconfiguration for php7.2 + if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and set(WOVariables.wo_php).issubset(set(apt_packages)): # Create log directories if not os.path.exists('/var/log/php/7.2/'): Log.debug(self, 'Creating directory /var/log/php/7.2/') @@ -1016,11 +1023,11 @@ class WOStackController(CementBaseController): # Parse /etc/php/7.2/fpm/php-fpm.conf data = dict(pid="/run/php/php7.2-fpm.pid", error_log="/var/log/php/7.2/fpm.log", - include="/etc/php/7.2/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.2/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') + encoding='utf-8', mode='w') self.app.render((data), 'php-fpm.mustache', out=wo_php_fpm) wo_php_fpm.close() @@ -1073,9 +1080,9 @@ class WOStackController(CementBaseController): # Disable xdebug 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") + "xdebug.ini", + "zend_extension", + ";zend_extension") # PHP and Debug pull configuration if not os.path.exists('{0}22222/htdocs/fpm/status/' @@ -1114,8 +1121,6 @@ class WOStackController(CementBaseController): WOGit.add(self, ["/etc/php"], msg="Adding PHP into Git") WOService.restart_service(self, 'php7.2-fpm') - - if set(WOVariables.wo_mysql).issubset(set(apt_packages)): if not os.path.isfile("/etc/mysql/my.cnf"): config = ("[mysqld]\nwait_timeout = 30\n" @@ -1169,12 +1174,12 @@ class WOStackController(CementBaseController): '{0}22222/htdocs/db/pma/config.inc.php file ' .format(WOVariables.wo_webroot)) blowfish_key = ''.join([random.choice - (string.ascii_letters + string.digits) - for n in range(10)]) + (string.ascii_letters + string.digits) + for n in range(10)]) WOFileUtils.searchreplace(self, '{0}22222/htdocs/db/pma/config.inc.php' .format(WOVariables.wo_webroot), - "$cfg[\'blowfish_secret\'] = \'\';","$cfg[\'blowfish_secret\'] = \'{0}\';" + "$cfg[\'blowfish_secret\'] = \'\';", "$cfg[\'blowfish_secret\'] = \'{0}\';" .format(blowfish_key)) Log.debug(self, 'Setting HOST Server For Mysql to ' '{0}22222/htdocs/db/pma/config.inc.php file ' @@ -1182,7 +1187,7 @@ class WOStackController(CementBaseController): WOFileUtils.searchreplace(self, '{0}22222/htdocs/db/pma/config.inc.php' .format(WOVariables.wo_webroot), - "$cfg[\'Servers\'][$i][\'host\'] = \'localhost\';","$cfg[\'Servers\'][$i][\'host\'] = \'{0}\';" + "$cfg[\'Servers\'][$i][\'host\'] = \'localhost\';", "$cfg[\'Servers\'][$i][\'host\'] = \'{0}\';" .format(WOVariables.wo_mysql_host)) Log.debug(self, 'Setting Privileges of webroot permission to ' '{0}22222/htdocs/db/pma file ' @@ -1273,7 +1278,7 @@ class WOStackController(CementBaseController): WOMysql.execute(self, 'grant select on *.* to \'anemometer\'' '@\'{0}\' IDENTIFIED' ' BY \'{1}\''.format(self.app.config.get('mysql', - 'grant-host'),chars)) + 'grant-host'), chars)) Log.debug(self, "grant all on slow-query-log.*" " to anemometer@root_user IDENTIFIED BY password ") WOMysql.execute(self, 'grant all on slow_query_log.* to' @@ -1338,12 +1343,12 @@ class WOStackController(CementBaseController): try: # Default action for stack installation if ((not self.app.pargs.web) and (not self.app.pargs.admin) and - (not self.app.pargs.nginx) and (not self.app.pargs.php) and - (not self.app.pargs.mysql) and (not self.app.pargs.wpcli) and - (not self.app.pargs.phpmyadmin) and (not self.app.pargs.hhvm) and - (not self.app.pargs.adminer) and (not self.app.pargs.utils) and - (not self.app.pargs.redis) and (not self.app.pargs.phpredisadmin) and - (not self.app.pargs.php72)): + (not self.app.pargs.nginx) and (not self.app.pargs.php) and + (not self.app.pargs.mysql) and (not self.app.pargs.wpcli) and + (not self.app.pargs.phpmyadmin) and (not self.app.pargs.hhvm) and + (not self.app.pargs.adminer) and (not self.app.pargs.utils) and + (not self.app.pargs.redis) and (not self.app.pargs.phpredisadmin) and + (not self.app.pargs.php73)): self.app.pargs.web = True self.app.pargs.admin = True @@ -1385,7 +1390,7 @@ class WOStackController(CementBaseController): self.post_pref(apt, packages) elif WOAptGet.is_installed(self, 'nginx'): Log.info(self, "WordOps detected an already installed nginx package." - "It may or may not have required modules.\n") + "It may or may not have required modules.\n") apt = ["nginx"] + WOVariables.wo_nginx self.post_pref(apt, packages) else: @@ -1393,43 +1398,45 @@ class WOStackController(CementBaseController): if self.app.pargs.php: Log.debug(self, "Setting apt_packages variable for PHP") - if not (WOAptGet.is_installed(self, 'php5-fpm') or WOAptGet.is_installed(self, 'php5.6-fpm')): + if not (WOAptGet.is_installed(self, 'php5-fpm') or WOAptGet.is_installed(self, 'php7.2-fpm')): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - apt_packages = apt_packages + WOVariables.wo_php72 + WOVariables.wo_php_extra + apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra else: apt_packages = apt_packages + WOVariables.wo_php else: Log.debug(self, "PHP already installed") Log.info(self, "PHP already installed") - #PHP 7.0 for Debian (jessie+) - if self.app.pargs.php72 and WOVariables.wo_platform_distro == 'debian': + # PHP 7.3 for Debian (jessie+) + if self.app.pargs.php73 and WOVariables.wo_platform_distro == 'debian': if (WOVariables.wo_platform_codename == 'jessie'): - Log.debug(self, "Setting apt_packages variable for PHP 7.2") - if not WOAptGet.is_installed(self, 'php7.2-fpm') : - apt_packages = apt_packages + WOVariables.wo_php72 + Log.debug(self, "Setting apt_packages variable for PHP 7.3") + if not WOAptGet.is_installed(self, 'php7.3-fpm'): + apt_packages = apt_packages + WOVariables.wo_php73 if not WOAptGet.is_installed(self, 'php5-fpm'): apt_packages = apt_packages + WOVariables.wo_php else: - Log.debug(self, "PHP 7.2 already installed") - Log.info(self, "PHP 7.2 already installed") + Log.debug(self, "PHP 7.3 already installed") + Log.info(self, "PHP 7.3 already installed") else: - Log.debug(self, "PHP 7.2 Not Available for your Distribution") - Log.info(self, "PHP 7.2 Not Available for your Distribution") + Log.debug( + self, "PHP 7.3 Not Available for your Distribution") + Log.info(self, "PHP 7.3 Not Available for your Distribution") - #PHP 7.0 for Ubuntu - if self.app.pargs.php72 and not WOVariables.wo_platform_distro == 'debian': + # PHP 7.3 for Ubuntu + if self.app.pargs.php73 and not WOVariables.wo_platform_distro == 'debian': if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - Log.debug(self, "Setting apt_packages variable for PHP 7.2") - if not WOAptGet.is_installed(self, 'php7.2-fpm') : - apt_packages = apt_packages + WOVariables.wo_php72 + WOVariables.wo_php_extra + Log.debug(self, "Setting apt_packages variable for PHP 7.3") + if not WOAptGet.is_installed(self, 'php7.3-fpm'): + apt_packages = apt_packages + WOVariables.wo_php73 + WOVariables.wo_php_extra else: - Log.debug(self, "PHP 7.2 already installed") - Log.info(self, "PHP 7.2 already installed") + Log.debug(self, "PHP 7.3 already installed") + Log.info(self, "PHP 7.3 already installed") else: - Log.debug(self, "Unfortunately PHP 7.2 is not available for your Ubuntu or Debian version.") - Log.info(self, "Unfortunately PHP 7.2 is not available for your Ubuntu or Debian version.") - + Log.debug( + self, "Unfortunately PHP 7.3 is not available for your Ubuntu or Debian version.") + Log.info( + self, "Unfortunately PHP 7.3 is not available for your Ubuntu or Debian version.") if self.app.pargs.hhvm: Log.debug(self, "Setting apt packages variable for HHVM") @@ -1458,7 +1465,7 @@ class WOStackController(CementBaseController): if self.app.pargs.wpcli: Log.debug(self, "Setting packages variable for WP-CLI") - if not WOShellExec.cmd_exec(self, "which wp"): + if not WOShellExec.cmd_exec(self, "command -v wp"): packages = packages + [["https://github.com/wp-cli/wp-cli/" "releases/download/v{0}/" "wp-cli-{0}.phar" @@ -1478,7 +1485,7 @@ class WOStackController(CementBaseController): Log.debug(self, "Setting packages varible for phpRedisAdmin") packages = packages + [["https://github.com/ErikDubbelboer/" "phpRedisAdmin/archive/master.tar.gz", - "/tmp/pra.tar.gz","phpRedisAdmin"], + "/tmp/pra.tar.gz", "phpRedisAdmin"], ["https://github.com/nrk/predis/" "archive/v1.0.1.tar.gz", "/tmp/predis.tar.gz", "Predis"]] @@ -1492,7 +1499,7 @@ class WOStackController(CementBaseController): "htdocs/db/adminer/index.php" .format(WOVariables.wo_webroot), "Adminer"]] - + if self.app.pargs.utils: Log.debug(self, "Setting packages variable for utils") packages = packages + [["https://storage.googleapis.com/google-code-archive-downloads/" @@ -1563,19 +1570,21 @@ class WOStackController(CementBaseController): if os.path.isfile("/etc/redis/redis.conf"): if WOVariables.wo_ram < 512: Log.debug(self, "Setting maxmemory variable to {0} in redis.conf" - .format(int(WOVariables.wo_ram*1024*1024*0.1))) + .format(int(WOVariables.wo_ram*1024*1024*0.1))) WOShellExec.cmd_exec(self, "sed -i 's/# maxmemory /maxmemory {0}/' /etc/redis/redis.conf" .format(int(WOVariables.wo_ram*1024*1024*0.1))) - Log.debug(self, "Setting maxmemory-policy variable to allkeys-lru in redis.conf") + Log.debug( + self, "Setting maxmemory-policy variable to allkeys-lru in redis.conf") WOShellExec.cmd_exec(self, "sed -i 's/# maxmemory-policy.*/maxmemory-policy allkeys-lru/' " "/etc/redis/redis.conf") WOService.restart_service(self, 'redis-server') else: Log.debug(self, "Setting maxmemory variable to {0} in redis.conf" - .format(int(WOVariables.wo_ram*1024*1024*0.2))) + .format(int(WOVariables.wo_ram*1024*1024*0.2))) WOShellExec.cmd_exec(self, "sed -i 's/# maxmemory /maxmemory {0}/' /etc/redis/redis.conf" .format(int(WOVariables.wo_ram*1024*1024*0.2))) - Log.debug(self, "Setting maxmemory-policy variable to allkeys-lru in redis.conf") + Log.debug( + self, "Setting maxmemory-policy variable to allkeys-lru in redis.conf") WOShellExec.cmd_exec(self, "sed -i 's/# maxmemory-policy.*/maxmemory-policy allkeys-lru/' " "/etc/redis/redis.conf") WOService.restart_service(self, 'redis-server') @@ -1594,12 +1603,12 @@ class WOStackController(CementBaseController): packages = [] if ((not self.app.pargs.web) and (not self.app.pargs.admin) and - (not self.app.pargs.nginx) and (not self.app.pargs.php) and - (not self.app.pargs.php72) and (not self.app.pargs.mysql) and - (not self.app.pargs.wpcli) and (not self.app.pargs.phpmyadmin) and - (not self.app.pargs.hhvm) and (not self.app.pargs.adminer) and - (not self.app.pargs.utils) and (not self.app.pargs.all) and - (not self.app.pargs.redis) and (not self.app.pargs.phpredisadmin)): + (not self.app.pargs.nginx) and (not self.app.pargs.php) and + (not self.app.pargs.php73) and (not self.app.pargs.mysql) and + (not self.app.pargs.wpcli) and (not self.app.pargs.phpmyadmin) and + (not self.app.pargs.hhvm) and (not self.app.pargs.adminer) and + (not self.app.pargs.utils) and (not self.app.pargs.all) and + (not self.app.pargs.redis) and (not self.app.pargs.phpredisadmin)): self.app.pargs.web = True self.app.pargs.admin = True @@ -1607,7 +1616,7 @@ class WOStackController(CementBaseController): self.app.pargs.web = True self.app.pargs.admin = True if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - self.app.pargs.php72 = True + self.app.pargs.php73 = True if self.app.pargs.web: self.app.pargs.nginx = True @@ -1625,35 +1634,35 @@ class WOStackController(CementBaseController): Log.debug(self, "Removing apt_packages variable of Nginx") apt_packages = apt_packages + WOVariables.wo_nginx else: - Log.error(self,"Cannot Remove! Nginx Stable version not found.") + Log.error(self, "Cannot Remove! Nginx Stable version not found.") if self.app.pargs.php: Log.debug(self, "Removing apt_packages variable of PHP") if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - apt_packages = apt_packages + WOVariables.wo_php72 + apt_packages = apt_packages + WOVariables.wo_php if not WOAptGet.is_installed(self, 'php7.2-fpm'): apt_packages = apt_packages + WOVariables.wo_php_extra else: apt_packages = apt_packages + WOVariables.wo_php - #PHP7.0 for debian(jessie+) - if self.app.pargs.php72: + # PHP7.3 for debian(jessie+) + if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'jessie'): - Log.debug(self, "Removing apt_packages variable of PHP 7.0") - apt_packages = apt_packages + WOVariables.wo_php72 - if not WOAptGet.is_installed(self, 'php5-fpm'): + Log.debug(self, "Removing apt_packages variable of PHP 7.3") + apt_packages = apt_packages + WOVariables.wo_php73 + if not WOAptGet.is_installed(self, 'php7.3-fpm'): apt_packages = apt_packages + WOVariables.wo_php_extra else: - Log.info(self,"PHP 7.0 not supported.") + Log.info(self, "PHP 7.3 not supported.") - if self.app.pargs.php72: + if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - Log.debug(self, "Removing apt_packages variable of PHP 7.0") - apt_packages = apt_packages + WOVariables.wo_php72 - if not WOAptGet.is_installed(self, 'php5.6-fpm'): + Log.debug(self, "Removing apt_packages variable of PHP 7.3") + apt_packages = apt_packages + WOVariables.wo_php73 + if not WOAptGet.is_installed(self, 'php7.3-fpm'): apt_packages = apt_packages + WOVariables.wo_php_extra else: - Log.info(self,"PHP 7.0 not supported.") + Log.info(self, "PHP 7.3 not supported.") if self.app.pargs.hhvm: if WOAptGet.is_installed(self, 'hhvm'): @@ -1712,7 +1721,7 @@ class WOStackController(CementBaseController): if wo_prompt == 'YES' or wo_prompt == 'yes': - if (set(["nginx-custom"]).issubset(set(apt_packages))) : + if (set(["nginx-custom"]).issubset(set(apt_packages))): WOService.stop_service(self, 'nginx') if len(packages): @@ -1725,16 +1734,16 @@ class WOStackController(CementBaseController): WOAptGet.remove(self, apt_packages) WOAptGet.auto_remove(self) - Log.info(self, "Successfully removed packages") - #Added for Ondrej Repo missing package Fix - if self.app.pargs.php72: - if WOAptGet.is_installed(self, 'php5.6-fpm'): - Log.info(self, "PHP5.6-fpm found on system.") - Log.info(self, "Verifying and installing missing packages,") - WOShellExec.cmd_exec(self, "apt-get install -y php-memcached php-igbinary") - + # Added for Ondrej Repo missing package Fix + if self.app.pargs.php: + if WOAptGet.is_installed(self, 'php7.2-fpm'): + Log.info(self, "PHP7.2-fpm found on system.") + Log.info( + self, "Verifying and installing missing packages,") + WOShellExec.cmd_exec( + self, "apt-get install -y php-memcached php-igbinary") @expose(help="Purge packages") def purge(self): @@ -1744,12 +1753,12 @@ class WOStackController(CementBaseController): # Default action for stack purge if ((not self.app.pargs.web) and (not self.app.pargs.admin) and - (not self.app.pargs.nginx) and (not self.app.pargs.php) and - (not self.app.pargs.php7) and (not self.app.pargs.mysql) and - (not self.app.pargs.wpcli) and (not self.app.pargs.phpmyadmin) and - (not self.app.pargs.hhvm) and (not self.app.pargs.adminer) and - (not self.app.pargs.utils) and (not self.app.pargs.all) and - (not self.app.pargs.redis) and (not self.app.pargs.phpredisadmin)): + (not self.app.pargs.nginx) and (not self.app.pargs.php) and + (not self.app.pargs.php73) and (not self.app.pargs.mysql) and + (not self.app.pargs.wpcli) and (not self.app.pargs.phpmyadmin) and + (not self.app.pargs.hhvm) and (not self.app.pargs.adminer) and + (not self.app.pargs.utils) and (not self.app.pargs.all) and + (not self.app.pargs.redis) and (not self.app.pargs.phpredisadmin)): self.app.pargs.web = True self.app.pargs.admin = True @@ -1757,7 +1766,7 @@ class WOStackController(CementBaseController): self.app.pargs.web = True self.app.pargs.admin = True if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - self.app.pargs.php7 = True + self.app.pargs.php73 = True if self.app.pargs.web: self.app.pargs.nginx = True @@ -1775,32 +1784,32 @@ class WOStackController(CementBaseController): Log.debug(self, "Purge apt_packages variable of Nginx") apt_packages = apt_packages + WOVariables.wo_nginx else: - Log.error(self,"Cannot Purge! Nginx Stable version not found.") + Log.error(self, "Cannot Purge! Nginx Stable version not found.") if self.app.pargs.php: Log.debug(self, "Purge apt_packages variable PHP") if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): apt_packages = apt_packages + WOVariables.wo_php_extra else: - apt_packages = apt_packages + WOVariables.wo_php72 + apt_packages = apt_packages + WOVariables.wo_php73 - #For debian --php7 - if self.app.pargs.php72: + # For debian --php73 + if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'jessie'): - Log.debug(self, "Removing apt_packages variable of PHP 7.0") - apt_packages = apt_packages + WOVariables.wo_php72 - if not WOAptGet.is_installed(self, 'php5-fpm'): + Log.debug(self, "Removing apt_packages variable of PHP 7.3") + apt_packages = apt_packages + WOVariables.wo_php73 + if not WOAptGet.is_installed(self, 'php7.2-fpm'): apt_packages = apt_packages + WOVariables.wo_php_extra else: - Log.info(self,"PHP 7.2 not supported.") + Log.info(self, "PHP 7.3 not supported.") - if self.app.pargs.php72: + if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - Log.debug(self, "Removing apt_packages variable of PHP 7.0") - apt_packages = apt_packages + WOVariables.wo_php72 - if not WOAptGet.is_installed(self, 'php5.6-fpm'): + Log.debug(self, "Removing apt_packages variable of PHP 7.3") + apt_packages = apt_packages + WOVariables.wo_php73 + if not WOAptGet.is_installed(self, 'php7.3-fpm'): apt_packages = apt_packages + WOVariables.wo_php_extra else: - Log.info(self,"PHP 7.2 not supported.") + Log.info(self, "PHP 7.3 not supported.") if self.app.pargs.hhvm: if WOAptGet.is_installed(self, 'hhvm'): Log.debug(self, "Purge apt_packages varible of HHVM") @@ -1855,7 +1864,7 @@ class WOStackController(CementBaseController): if wo_prompt == 'YES' or wo_prompt == 'yes': - if (set(["nginx-custom"]).issubset(set(apt_packages))) : + if (set(["nginx-custom"]).issubset(set(apt_packages))): WOService.stop_service(self, 'nginx') if len(apt_packages): @@ -1867,16 +1876,16 @@ class WOStackController(CementBaseController): WOFileUtils.remove(self, packages) WOAptGet.auto_remove(self) - Log.info(self, "Successfully purged packages") - #Added for php Ondrej repo missing package fix - if self.app.pargs.php72: - if WOAptGet.is_installed(self, 'php5.6-fpm'): - Log.info(self, "PHP5.6-fpm found on system.") - Log.info(self, "Verifying and installing missing packages,") - WOShellExec.cmd_exec(self, "apt-get install -y php-memcached php-igbinary") - + # Added for php Ondrej repo missing package fix + if self.app.pargs.php73: + if WOAptGet.is_installed(self, 'php7.3-fpm'): + Log.info(self, "PHP7.3-fpm found on system.") + Log.info( + self, "Verifying and installing missing packages,") + WOShellExec.cmd_exec( + self, "apt-get install -y php-memcached php-igbinary") def load(app): @@ -1887,4 +1896,4 @@ def load(app): handler.register(WOStackUpgradeController) # register a hook (function) to run after arguments are parsed. - hook.register('post_argument_parsing', wo_stack_hook) \ No newline at end of file + hook.register('post_argument_parsing', wo_stack_hook) diff --git a/wo/cli/plugins/stack_services.py b/wo/cli/plugins/stack_services.py index 10183d6..a2cf3c5 100644 --- a/wo/cli/plugins/stack_services.py +++ b/wo/cli/plugins/stack_services.py @@ -15,13 +15,13 @@ class WOStackStatusController(CementBaseController): arguments = [ (['--memcache'], dict(help='start/stop/restart memcache', action='store_true')), - ] + ] @expose(help="Start stack services") def start(self): """Start services""" services = [] - if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php7 + if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php73 or self.app.pargs.mysql or self.app.pargs.hhvm or self.app.pargs.memcache or self.app.pargs.redis): self.app.pargs.nginx = True @@ -29,43 +29,43 @@ class WOStackStatusController(CementBaseController): self.app.pargs.mysql = True if self.app.pargs.nginx: - if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self,'nginx-mainline'): + if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self, 'nginx-mainline'): services = services + ['nginx'] else: Log.info(self, "Nginx is not 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'): - services = services + ['php5-fpm'] + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: - Log.info(self, "PHP5-FPM is not installed") + Log.info(self, "PHP7.2-FPM is not installed") else: - if WOAptGet.is_installed(self, 'php5.6-fpm'): - services = services + ['php5.6-fpm'] + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: - Log.info(self, "PHP5.6-FPM is not installed") + Log.info(self, "PHP7.2-FPM is not installed") if WOAptGet.is_installed(self, 'php7.2-fpm'): services = services + ['php7.2-fpm'] else: Log.info(self, "PHP7.2-FPM is not installed") - if self.app.pargs.php7: + if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] else: - Log.info(self, "PHP7.2-FPM is not installed") + Log.info(self, "PHP7.3-FPM is not installed") else: - Log.info(self, "Your platform does not support PHP 7") + Log.info(self, "Your platform does not support PHP 7.3") if self.app.pargs.mysql: if ((WOVariables.wo_mysql_host is "localhost") or - (WOVariables.wo_mysql_host is "127.0.0.1")): + (WOVariables.wo_mysql_host is "127.0.0.1")): if (WOAptGet.is_installed(self, 'mysql-server') or - WOAptGet.is_installed(self, 'percona-server-server-5.6') or - WOAptGet.is_installed(self, 'mariadb-server')): + WOAptGet.is_installed(self, 'percona-server-server-5.6') or + WOAptGet.is_installed(self, 'mariadb-server')): services = services + ['mysql'] else: Log.info(self, "MySQL is not installed") @@ -98,7 +98,7 @@ class WOStackStatusController(CementBaseController): def stop(self): """Stop services""" services = [] - if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php7 + if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php73 or self.app.pargs.mysql or self.app.pargs.hhvm or self.app.pargs.memcache or self.app.pargs.redis): self.app.pargs.nginx = True @@ -106,43 +106,43 @@ class WOStackStatusController(CementBaseController): self.app.pargs.mysql = True if self.app.pargs.nginx: - if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self,'nginx-mainline'): + if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self, 'nginx-mainline'): services = services + ['nginx'] else: Log.info(self, "Nginx is not 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'): - services = services + ['php5-fpm'] + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: Log.info(self, "PHP5-FPM is not installed") else: - if WOAptGet.is_installed(self, 'php5.6-fpm'): - services = services + ['php5.6-fpm'] + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: - Log.info(self, "PHP5.6-FPM is not installed") + Log.info(self, "PHP7.2-FPM is not installed") if WOAptGet.is_installed(self, 'php7.2-fpm'): services = services + ['php7.2-fpm'] else: Log.info(self, "PHP7.2-FPM is not installed") - if self.app.pargs.php7: + if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] else: - Log.info(self, "PHP7.2-FPM is not installed") + Log.info(self, "PHP7.3-FPM is not installed") else: - Log.info(self, "Your platform does not support PHP 7") + Log.info(self, "Your platform does not support PHP 7.3") if self.app.pargs.mysql: if ((WOVariables.wo_mysql_host is "localhost") or - (WOVariables.wo_mysql_host is "127.0.0.1")): + (WOVariables.wo_mysql_host is "127.0.0.1")): if (WOAptGet.is_installed(self, 'mysql-server') or - WOAptGet.is_installed(self, 'percona-server-server-5.6') or - WOAptGet.is_installed(self, 'mariadb-server')): + WOAptGet.is_installed(self, 'percona-server-server-5.6') or + WOAptGet.is_installed(self, 'mariadb-server')): services = services + ['mysql'] else: Log.info(self, "MySQL is not installed") @@ -175,7 +175,7 @@ class WOStackStatusController(CementBaseController): def restart(self): """Restart services""" services = [] - if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php7 + if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php73 or self.app.pargs.mysql or self.app.pargs.hhvm or self.app.pargs.memcache or self.app.pargs.redis): self.app.pargs.nginx = True @@ -183,44 +183,43 @@ class WOStackStatusController(CementBaseController): self.app.pargs.mysql = True if self.app.pargs.nginx: - if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self,'nginx-mainline'): + if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self, 'nginx-mainline'): services = services + ['nginx'] else: Log.info(self, "Nginx is not 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'): - services = services + ['php5-fpm'] + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: - Log.info(self, "PHP5-FPM is not installed") + Log.info(self, "PHP7.2-FPM is not installed") else: - if WOAptGet.is_installed(self, 'php5.6-fpm'): - services = services + ['php5.6-fpm'] + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: - Log.info(self, "PHP5.6-FPM is not installed") + Log.info(self, "PHP7.2-FPM is not installed") if WOAptGet.is_installed(self, 'php7.2-fpm'): services = services + ['php7.2-fpm'] else: Log.info(self, "PHP7.2-FPM is not installed") - if self.app.pargs.php7: + if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] else: - Log.info(self, "PHP7.2-FPM is not installed") + Log.info(self, "PHP7.3-FPM is not installed") else: - Log.info(self, "Your platform does not support PHP 7") - + Log.info(self, "Your platform does not support PHP 7.3") if self.app.pargs.mysql: if ((WOVariables.wo_mysql_host is "localhost") or - (WOVariables.wo_mysql_host is "127.0.0.1")): + (WOVariables.wo_mysql_host is "127.0.0.1")): if (WOAptGet.is_installed(self, 'mysql-server') or - WOAptGet.is_installed(self, 'percona-server-server-5.6') or - WOAptGet.is_installed(self, 'mariadb-server')): + WOAptGet.is_installed(self, 'percona-server-server-5.6') or + WOAptGet.is_installed(self, 'mariadb-server')): services = services + ['mysql'] else: Log.info(self, "MySQL is not installed") @@ -253,7 +252,7 @@ class WOStackStatusController(CementBaseController): def status(self): """Status of services""" services = [] - if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php7 + if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php73 or self.app.pargs.mysql or self.app.pargs.hhvm or self.app.pargs.memcache or self.app.pargs.redis): self.app.pargs.nginx = True @@ -262,43 +261,43 @@ class WOStackStatusController(CementBaseController): self.app.pargs.hhvm = True if self.app.pargs.nginx: - if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self,'nginx-mainline'): + if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self, 'nginx-mainline'): services = services + ['nginx'] else: Log.info(self, "Nginx is not 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'): - services = services + ['php5-fpm'] + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: - Log.info(self, "PHP5-FPM is not installed") + Log.info(self, "PHP7.2-FPM is not installed") else: - if WOAptGet.is_installed(self, 'php5.6-fpm'): - services = services + ['php5.6-fpm'] + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: - Log.info(self, "PHP5.6-FPM is not installed") + Log.info(self, "PHP7.2-FPM is not installed") if WOAptGet.is_installed(self, 'php7.2-fpm'): services = services + ['php7.2-fpm'] else: Log.info(self, "PHP7.2-FPM is not installed") - if self.app.pargs.php7: + if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] else: - Log.info(self, "PHP7.2-FPM is not installed") + Log.info(self, "PHP7.3-FPM is not installed") else: - Log.info(self, "Your platform does not support PHP 7") + Log.info(self, "Your platform does not support PHP 7.3") if self.app.pargs.mysql: if ((WOVariables.wo_mysql_host is "localhost") or - (WOVariables.wo_mysql_host is "127.0.0.1")): + (WOVariables.wo_mysql_host is "127.0.0.1")): if (WOAptGet.is_installed(self, 'mysql-server') or - WOAptGet.is_installed(self, 'percona-server-server-5.6') or - WOAptGet.is_installed(self, 'mariadb-server')): + WOAptGet.is_installed(self, 'percona-server-server-5.6') or + WOAptGet.is_installed(self, 'mariadb-server')): services = services + ['mysql'] else: Log.info(self, "MySQL is not installed") @@ -331,51 +330,51 @@ class WOStackStatusController(CementBaseController): def reload(self): """Reload service""" services = [] - if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php7 - or self.app.pargs.mysql or self.app.pargs.hhvm or self.app.pargs.memcache + if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php73 + or self.app.pargs.mysql or self.app.pargs.hhvm or self.app.pargs.memcache or self.app.pargs.redis): self.app.pargs.nginx = True self.app.pargs.php = True self.app.pargs.mysql = True if self.app.pargs.nginx: - if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self,'nginx-mainline'): + if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self, 'nginx-mainline'): services = services + ['nginx'] else: Log.info(self, "Nginx is not 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'): - services = services + ['php5-fpm'] + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: - Log.info(self, "PHP5-FPM is not installed") + Log.info(self, "PHP7.2-FPM is not installed") else: - if WOAptGet.is_installed(self, 'php5.6-fpm'): - services = services + ['php5.6-fpm'] + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: - Log.info(self, "PHP5.6-FPM is not installed") + Log.info(self, "php7.2-fpm is not installed") if WOAptGet.is_installed(self, 'php7.2-fpm'): services = services + ['php7.2-fpm'] else: Log.info(self, "PHP7.2-FPM is not installed") - if self.app.pargs.php7: + if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] else: - Log.info(self, "PHP7.2-FPM is not installed") + Log.info(self, "PHP7.3-FPM is not installed") else: Log.info(self, "Your platform does not support PHP 7") if self.app.pargs.mysql: if ((WOVariables.wo_mysql_host is "localhost") or - (WOVariables.wo_mysql_host is "127.0.0.1")): + (WOVariables.wo_mysql_host is "127.0.0.1")): if (WOAptGet.is_installed(self, 'mysql-server') or - WOAptGet.is_installed(self, 'percona-server-server-5.6') or - WOAptGet.is_installed(self, 'mariadb-server')): + WOAptGet.is_installed(self, 'percona-server-server-5.6') or + WOAptGet.is_installed(self, 'mariadb-server')): services = services + ['mysql'] else: Log.info(self, "MySQL is not installed") @@ -391,7 +390,7 @@ class WOStackStatusController(CementBaseController): services = services + ['memcached'] else: Log.info(self, "Memcache is not installed") - + if self.app.pargs.redis: if WOAptGet.is_installed(self, 'redis-server'): services = services + ['redis-server'] diff --git a/wo/cli/templates/php.mustache b/wo/cli/templates/php.mustache index 65f75fe..7288f48 100644 --- a/wo/cli/templates/php.mustache +++ b/wo/cli/templates/php.mustache @@ -6,5 +6,5 @@ location / { location ~ \.php$ { try_files $uri =404; include fastcgi_params; - fastcgi_pass php; + fastcgi_pass php72; } diff --git a/wo/cli/templates/php7.mustache b/wo/cli/templates/php7.mustache index 871d3c5..d0ab167 100644 --- a/wo/cli/templates/php7.mustache +++ b/wo/cli/templates/php7.mustache @@ -6,5 +6,5 @@ location / { location ~ \.php$ { try_files $uri =404; include fastcgi_params; - fastcgi_pass php7; + fastcgi_pass php73; } diff --git a/wo/cli/templates/redis-php7.mustache b/wo/cli/templates/redis-php7.mustache index 93d5943..42779bb 100644 --- a/wo/cli/templates/redis-php7.mustache +++ b/wo/cli/templates/redis-php7.mustache @@ -52,5 +52,5 @@ location ~ \.php$ { more_set_headers 'X-SRCache-Store-Status $srcache_store_status'; include fastcgi_params; - fastcgi_pass php7; + fastcgi_pass php73; } diff --git a/wo/cli/templates/redis.mustache b/wo/cli/templates/redis.mustache index e29e02f..273a1c3 100644 --- a/wo/cli/templates/redis.mustache +++ b/wo/cli/templates/redis.mustache @@ -53,5 +53,5 @@ location ~ \.php$ { more_set_headers 'X-SRCache-Store-Status $srcache_store_status'; include fastcgi_params; - fastcgi_pass php; + fastcgi_pass php72; } diff --git a/wo/cli/templates/upstream.mustache b/wo/cli/templates/upstream.mustache index 3db3ead..9e8f1e4 100644 --- a/wo/cli/templates/upstream.mustache +++ b/wo/cli/templates/upstream.mustache @@ -1,18 +1,24 @@ # Common upstream settings upstream php { -server 127.0.0.1:9072; +server 127.0.0.1:9000; } upstream debug { # Debug Pool -server 127.0.0.1:9172; +server 127.0.0.1:9100; +} +upstream php72 { +server unix:/var/run/php/php72-fpm.sock; +} +upstream php73 { +server unix:/var/run/php/php73-fpm.sock; } {{#php7conf}} upstream php7 { -server 127.0.0.1:9072; +server 127.0.0.1:9070; } upstream debug7 { # Debug Pool -server 127.0.0.1:9172; +server 127.0.0.1:9170; } {{/php7conf}} diff --git a/wo/cli/templates/wpcommon-php7.mustache b/wo/cli/templates/wpcommon-php7.mustache index 1b4b0fc..e99977b 100644 --- a/wo/cli/templates/wpcommon-php7.mustache +++ b/wo/cli/templates/wpcommon-php7.mustache @@ -4,7 +4,7 @@ location = /wp-login.php { limit_req zone=one burst=1 nodelay; include fastcgi_params; - fastcgi_pass php7; + fastcgi_pass php73; } # Disable wp-config.txt location = /wp-config.txt { diff --git a/wo/cli/templates/wpfc-php7.mustache b/wo/cli/templates/wpfc-php7.mustache index b62d088..55c999d 100644 --- a/wo/cli/templates/wpfc-php7.mustache +++ b/wo/cli/templates/wpfc-php7.mustache @@ -26,7 +26,7 @@ location ~ ^/wp-content/cache/minify/(.+\.(css|js))$ { location ~ \.php$ { try_files $uri =404; include fastcgi_params; - fastcgi_pass php7; + fastcgi_pass php73; fastcgi_cache_bypass $skip_cache; fastcgi_no_cache $skip_cache; fastcgi_cache WORDPRESS; diff --git a/wo/cli/templates/wpfc.mustache b/wo/cli/templates/wpfc.mustache index ec03b0c..666c177 100644 --- a/wo/cli/templates/wpfc.mustache +++ b/wo/cli/templates/wpfc.mustache @@ -26,7 +26,7 @@ location ~ ^/wp-content/cache/minify/(.+\.(css|js))$ { location ~ \.php$ { try_files $uri =404; include fastcgi_params; - fastcgi_pass php; + fastcgi_pass php72; fastcgi_cache_bypass $skip_cache; fastcgi_no_cache $skip_cache; fastcgi_cache WORDPRESS; diff --git a/wo/cli/templates/wpsc-php7.mustache b/wo/cli/templates/wpsc-php7.mustache index 7cca3f8..80f96cc 100644 --- a/wo/cli/templates/wpsc-php7.mustache +++ b/wo/cli/templates/wpsc-php7.mustache @@ -25,7 +25,7 @@ location / { location ~ \.php$ { try_files $uri =404; include fastcgi_params; - fastcgi_pass php7; + fastcgi_pass php73; # Following line is needed by WP Super Cache plugin fastcgi_param SERVER_NAME $http_host; } diff --git a/wo/cli/templates/wpsc.mustache b/wo/cli/templates/wpsc.mustache index e5b1648..acbbfe8 100644 --- a/wo/cli/templates/wpsc.mustache +++ b/wo/cli/templates/wpsc.mustache @@ -25,7 +25,7 @@ location / { location ~ \.php$ { try_files $uri =404; include fastcgi_params; - fastcgi_pass php; + fastcgi_pass php72; # Following line is needed by WP Super Cache plugin fastcgi_param SERVER_NAME $http_host; } diff --git a/wo/core/services.py b/wo/core/services.py index ad5d8b8..c028880 100644 --- a/wo/core/services.py +++ b/wo/core/services.py @@ -100,8 +100,8 @@ class WOService(): Log.info(self, "Reload : {0:10}".format(service_name), end='') retcode = subprocess.getstatusoutput(service_cmd) if retcode[0] == 0: - Log.info(self, "[" + Log.ENDC + "OK" + Log.OKBLUE + "]") - return True + Log.info(self, "[" + Log.ENDC + "OK" + Log.OKBLUE + "]") + return True else: Log.debug(self, "{0}".format(retcode[1])) Log.info(self, "[" + Log.FAIL + "Failed" + Log.OKBLUE+"]") @@ -113,11 +113,10 @@ class WOService(): def get_service_status(self, service_name): - try: is_exist = subprocess.getstatusoutput('which {0}' .format(service_name)) - if is_exist[0] == 0 or service_name in ['php7.0-fpm', 'php5.6-fpm']: + if is_exist[0] == 0 or service_name in ['php7.2-fpm', 'php7.3-fpm']: retcode = subprocess.getstatusoutput('service {0} status' .format(service_name)) if retcode[0] == 0: diff --git a/wo/core/variables.py b/wo/core/variables.py index 46c55ab..9a17c74 100644 --- a/wo/core/variables.py +++ b/wo/core/variables.py @@ -18,7 +18,7 @@ class WOVariables(): wo_adminer = "4.7.1" # Get WPCLI path - wo_wpcli_path = os.popen('which wp | tr "\n" " "').read() + wo_wpcli_path = os.popen('command -v wp | tr "\n" " "').read() if wo_wpcli_path == '': wo_wpcli_path = '/usr/bin/wp ' @@ -89,7 +89,7 @@ class WOVariables(): "/rtCamp:/EasyEngine/xUbuntu_16.04/ /") elif wo_platform_codename == 'bionic': wo_nginx_repo = ("deb http://download.opensuse.org/repositories/home:" - "/rtCamp:/EasyEngine/xUbuntu_18.04/ /") + "/rtCamp:/EasyEngine/xUbuntu_18.04/ /") elif wo_platform_codename == 'jessie': wo_nginx_repo = ("deb http://download.opensuse.org/repositories/home:" "/rtCamp:/EasyEngine/Debian_8.0/ /") @@ -115,29 +115,30 @@ class WOVariables(): wo_php_extra = ["php-memcached", "php-imagick", "memcached", "graphviz", "php-pear", "php-xdebug", "php-msgpack", "php-redis"] elif wo_platform_distro == 'debian': - wo_php_repo = ("deb https://packages.sury.org/php/ {codename} main".format(codename=wo_platform_codename)) + wo_php_repo = ( + "deb https://packages.sury.org/php/ {codename} main".format(codename=wo_platform_codename)) wo_php = ["php7.2-fpm", "php7.2-curl", "php7.2-gd", "php7.2-imap", - "php-sodium", "php7.2-common", "php7.2-readline", "php7.2-redis", - "php7.2-mysql", "php7.2-cli", "php7.2-memcache", "php7.2-imagick", + "php7.2-common", "php7.2-readline", "php-redis", + "php7.2-mysql", "php7.2-cli", "php-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_php72 = ["php7.2-fpm", "php7.2-curl", "php7.2-gd", "php7.2-imap", - "php-sodium", "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"] + "php7.2-soap", "php7.2-msgpack", + "graphviz", "php-pear", "php-xdebug"] + wo_php73 = ["php7.3-fpm", "php7.3-curl", "php7.3-gd", "php7.3-imap", + "php7.3-common", "php7.3-readline", "php-redis", + "php7.3-mysql", "php7.3-cli", "php-imagick", + "php7.3-mbstring", "php7.3-recode", "php7.3-bcmath", "php7.3-opcache", "php7.3-zip", "php7.3-xml", + "php7.3-soap", "php7.3-msgpack", + "graphviz", "php-pear", "php-xdebug"] wo_php_extra = [] # MySQL repo and packages if wo_platform_distro == 'ubuntu': wo_mysql_repo = ("deb [arch=amd64,i386,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/" - "10.1/ubuntu {codename} main" + "10.3/ubuntu {codename} main" .format(codename=wo_platform_codename)) elif wo_platform_distro == 'debian': wo_mysql_repo = ("deb [arch=amd64,i386,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/" - "10.1/debian {codename} main" + "10.3/debian {codename} main" .format(codename=wo_platform_codename)) wo_mysql = ["mariadb-server", "percona-toolkit"] @@ -146,7 +147,7 @@ class WOVariables(): if wo_platform_distro == 'ubuntu': 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)) + .format(codename=wo_platform_codename)) else: wo_hhvm_repo = ("deb http://dl.hhvm.com/debian {codename} main" .format(codename=wo_platform_codename)) @@ -159,7 +160,7 @@ class WOVariables(): else: wo_redis_repo = ("deb https://packages.sury.org/php/ {codename} all" - .format(codename=wo_platform_codename)) + .format(codename=wo_platform_codename)) if (wo_platform_codename == 'trusty' or wo_platform_codename == 'xenial' or wo_platform_codename == 'bionic' or wo_platform_distro == 'debian'): wo_redis = ['redis-server', 'php-redis'] From f1e8b922f4cc3772c6583a3ea86792d1da6dbe97 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Sun, 3 Mar 2019 00:08:51 +0100 Subject: [PATCH 23/56] restore previous version --- wo/cli/plugins/site.py | 146 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 139 insertions(+), 7 deletions(-) diff --git a/wo/cli/plugins/site.py b/wo/cli/plugins/site.py index 1a70bfc..30e3559 100644 --- a/wo/cli/plugins/site.py +++ b/wo/cli/plugins/site.py @@ -344,6 +344,9 @@ class WOSiteCreateController(CementBaseController): dest='wppass')), (['--proxy'], dict(help="create proxy for site", nargs='+')), + (['--experimental'], + dict(help="Enable Experimenal packages without prompt", + action='store_true')), ] @expose(hide=True) @@ -451,13 +454,48 @@ class WOSiteCreateController(CementBaseController): Log.error(self, "Can not create HTML site with HHVM") if data and self.app.pargs.php73: + if (not self.app.pargs.experimental): + Log.info(self, "Do you wish to install PHP 7.2 now for {0}?".format(wo_domain)) + + # Check prompt + check_prompt = input("Type \"y\" to continue [n]:") + if check_prompt != "Y" and check_prompt != "y": + Log.info(self, "Not using PHP 7.2 for site.") + data['php73'] = False + data['basic'] = True + php73 = 0 + self.app.pargs.php73 = False + else: data['php73'] = True php73 = 1 + else: + data['php73'] = True + php73 = 1 + elif data: + data['php73'] = False + php73 = 0 if (not self.app.pargs.wpfc) and (not self.app.pargs.wpsc) and (not self.app.pargs.wpredis) and (not self.app.pargs.hhvm): data['basic'] = True if data and self.app.pargs.hhvm: + if (not self.app.pargs.experimental): + Log.info(self, "HHVM is experimental feature and it may not " + "work with all plugins of your site.\nYou can " + "disable it by passing --hhvm=off later.\nDo you wish" + " to enable HHVM now for {0}?".format(wo_domain)) + + # Check prompt + check_prompt = input("Type \"y\" to continue [n]:") + if check_prompt != "Y" and check_prompt != "y": + Log.info(self, "Not using HHVM for site.") + data['hhvm'] = False + hhvm = 0 + self.app.pargs.hhvm = False + else: + data['hhvm'] = True + hhvm = 1 + else: data['hhvm'] = True hhvm = 1 @@ -465,7 +503,20 @@ class WOSiteCreateController(CementBaseController): data['hhvm'] = False hhvm = 0 - if cache == 'wpredis': + if (cache == 'wpredis' and (not self.app.pargs.experimental)): + Log.info(self, "Redis is experimental feature and it may not " + "work with all CSS/JS/Cache of your site.\nYou can " + "disable it by changing cache later.\nDo you wish" + " to enable Redis now for {0}?".format(wo_domain)) + + # Check prompt + check_prompt = input("Type \"y\" to continue [n]:") + if check_prompt != "Y" and check_prompt != "y": + Log.error(self, "Not using Redis for site") + cache = 'basic' + data['wpredis'] = False + data['basic'] = True + self.app.pargs.wpredis = False # Check rerequired packages are installed or not wo_auth = site_package_check(self, stype) @@ -513,7 +564,7 @@ class WOSiteCreateController(CementBaseController): return if data['php73']: - php_version = "7.3" + php_version = "7.2" else: php_version = "7.2" @@ -654,6 +705,23 @@ class WOSiteCreateController(CementBaseController): "`tail /var/log/wo/wordops.log` and please try again") if self.app.pargs.letsencrypt : + if (not self.app.pargs.experimental): + if stype in ['wpsubdomain']: + Log.warn(self, "Wildcard domains are not supported in Lets Encrypt.\nWP SUBDOMAIN site will get SSL for primary site only.") + + Log.info(self, "Letsencrypt is currently in beta phase." + " \nDo you wish" + " to enable SSl now for {0}?".format(wo_domain)) + + # Check prompt + check_prompt = input("Type \"y\" to continue [n]:") + if check_prompt != "Y" and check_prompt != "y": + data['letsencrypt'] = False + letsencrypt = False + else: + data['letsencrypt'] = True + letsencrypt = True + else: data['letsencrypt'] = True letsencrypt = True @@ -708,7 +776,7 @@ class WOSiteUpdateController(CementBaseController): (['--php'], dict(help="update to php site", action='store_true')), (['--php73'], - dict(help="update to PHP 7.3 site", + dict(help="update to php7 site", action='store' or 'store_const', choices=('on', 'off'), const='on', nargs='?')), (['--mysql'], @@ -736,6 +804,9 @@ class WOSiteUpdateController(CementBaseController): choices=('on', 'off', 'renew'), const='on', nargs='?')), (['--proxy'], dict(help="update to proxy site", nargs='+')), + (['--experimental'], + dict(help="Enable Experimenal packages without prompt", + action='store_true')), (['--all'], dict(help="update all sites", action='store_true')), ] @@ -970,19 +1041,19 @@ class WOSiteUpdateController(CementBaseController): if pargs.php73 == 'on' : data['php73'] = True php73 = True - check_php_version= '7.3' + check_php_version= '7.2' elif pargs.php73 == 'off': data['php73'] = False php73 = False - check_php_version = '7.2' + check_php_version = '5.6' if pargs.php73: if php73 is old_php73: if php73 is False: - Log.info(self, "PHP 7.3 is already disabled for given " + Log.info(self, "PHP 7.2 is already disabled for given " "site") elif php73 is True: - Log.info(self, "PHP 7.3 is already enabled for given " + Log.info(self, "PHP 7.2 is already enabled for given " "site") pargs.php73 = False @@ -1093,20 +1164,81 @@ class WOSiteUpdateController(CementBaseController): if pargs.hhvm=="on" or pargs.letsencrypt=="on" or pargs.php73=="on": if pargs.php73 == "on": + if (not pargs.experimental): + Log.info(self, "Do you wish to enable PHP 7.2 now for {0}?".format(wo_domain)) + + check_prompt = input("Type \"y\" to continue [n]:") + if check_prompt != "Y" and check_prompt != "y": + Log.info(self, "Not using PHP 7.2 for site") + data['php73'] = False + php73 = False + else: data['php73'] = True php73 = True + else: + data['php73'] = True + php73 = True if pargs.hhvm == "on": + if (not pargs.experimental): + Log.info(self, "HHVM is experimental feature and it may not" + " work with all plugins of your site.\nYou can " + "disable it by passing --hhvm=off later.\nDo you wish" + " to enable HHVM now for {0}?".format(wo_domain)) + + # Check prompt + check_prompt = input("Type \"y\" to continue [n]:") + if check_prompt != "Y" and check_prompt != "y": + Log.info(self, "Not using HHVM for site") + data['hhvm'] = False + hhvm = False + else: + data['hhvm'] = True + hhvm = True + else: data['hhvm'] = True hhvm = True if pargs.letsencrypt == "on": + + if (not pargs.experimental): + + if oldsitetype in ['wpsubdomain']: + Log.warn(self, "Wildcard domains are not supported in Lets Encrypt.\nWP SUBDOMAIN site will get SSL for primary site only.") + + Log.info(self, "Letsencrypt is currently in beta phase." + " \nDo you wish" + " to enable SSl now for {0}?".format(wo_domain)) + + check_prompt = input("Type \"y\" to continue [n]:") + if check_prompt != "Y" and check_prompt != "y": + Log.info(self, "Not using letsencrypt for site") + data['letsencrypt'] = False + letsencrypt = False + else: + data['letsencrypt'] = True + letsencrypt = True + else: data['letsencrypt'] = True letsencrypt = True if pargs.wpredis and data['currcachetype'] != 'wpredis': + if (not pargs.experimental): + Log.info(self, "Redis is experimental feature and it may not" + " work with all plugins of your site.\nYou can " + "disable it by changing cache type later.\nDo you wish" + " to enable Redis now for {0}?".format(wo_domain)) + + # Check prompt + check_prompt = input("Type \"y\" to continue [n]: ") + if check_prompt != "Y" and check_prompt != "y": + Log.error(self, "Not using Redis for site") + data['wpredis'] = False + data['basic'] = True + cache = 'basic' + if ((hhvm is old_hhvm) and (php73 is old_php73) and (stype == oldsitetype and cache == oldcachetype)): return 1 From f397509835608451860f9d80838de62890221eba Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Sun, 3 Mar 2019 00:16:20 +0100 Subject: [PATCH 24/56] fix indentation --- wo/cli/plugins/site.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/wo/cli/plugins/site.py b/wo/cli/plugins/site.py index 30e3559..e9cb632 100644 --- a/wo/cli/plugins/site.py +++ b/wo/cli/plugins/site.py @@ -310,7 +310,7 @@ class WOSiteCreateController(CementBaseController): (['--php'], dict(help="create php site", action='store_true')), (['--php73'], - dict(help="create php 7.3 site", action='store_true')), + dict(help="create php 7.2 site", action='store_true')), (['--mysql'], dict(help="create mysql site", action='store_true')), (['--wp'], @@ -454,7 +454,7 @@ class WOSiteCreateController(CementBaseController): Log.error(self, "Can not create HTML site with HHVM") if data and self.app.pargs.php73: - if (not self.app.pargs.experimental): + if (self.app.pargs.experimental): Log.info(self, "Do you wish to install PHP 7.2 now for {0}?".format(wo_domain)) # Check prompt @@ -503,7 +503,7 @@ class WOSiteCreateController(CementBaseController): data['hhvm'] = False hhvm = 0 - if (cache == 'wpredis' and (not self.app.pargs.experimental)): + if (cache == 'wpredis' and (self.app.pargs.experimental)): Log.info(self, "Redis is experimental feature and it may not " "work with all CSS/JS/Cache of your site.\nYou can " "disable it by changing cache later.\nDo you wish" @@ -705,9 +705,9 @@ class WOSiteCreateController(CementBaseController): "`tail /var/log/wo/wordops.log` and please try again") if self.app.pargs.letsencrypt : - if (not self.app.pargs.experimental): + if (self.app.pargs.experimental): if stype in ['wpsubdomain']: - Log.warn(self, "Wildcard domains are not supported in Lets Encrypt.\nWP SUBDOMAIN site will get SSL for primary site only.") + Log.warn(self, "Wildcard domains are not supported in Lets Encrypt.\nWP SUBDOMAIN site will get SSL for primary site only.") Log.info(self, "Letsencrypt is currently in beta phase." " \nDo you wish" @@ -776,7 +776,7 @@ class WOSiteUpdateController(CementBaseController): (['--php'], dict(help="update to php site", action='store_true')), (['--php73'], - dict(help="update to php7 site", + dict(help="update to php73 site", action='store' or 'store_const', choices=('on', 'off'), const='on', nargs='?')), (['--mysql'], @@ -1041,19 +1041,19 @@ class WOSiteUpdateController(CementBaseController): if pargs.php73 == 'on' : data['php73'] = True php73 = True - check_php_version= '7.2' + check_php_version= '7.3' elif pargs.php73 == 'off': data['php73'] = False php73 = False - check_php_version = '5.6' + check_php_version = '7.2' if pargs.php73: if php73 is old_php73: if php73 is False: - Log.info(self, "PHP 7.2 is already disabled for given " + Log.info(self, "PHP 7.3 is already disabled for given " "site") elif php73 is True: - Log.info(self, "PHP 7.2 is already enabled for given " + Log.info(self, "PHP 7.3 is already enabled for given " "site") pargs.php73 = False @@ -1165,11 +1165,11 @@ class WOSiteUpdateController(CementBaseController): if pargs.hhvm=="on" or pargs.letsencrypt=="on" or pargs.php73=="on": if pargs.php73 == "on": if (not pargs.experimental): - Log.info(self, "Do you wish to enable PHP 7.2 now for {0}?".format(wo_domain)) + Log.info(self, "Do you wish to enable PHP 7.3 now for {0}?".format(wo_domain)) check_prompt = input("Type \"y\" to continue [n]:") if check_prompt != "Y" and check_prompt != "y": - Log.info(self, "Not using PHP 7.2 for site") + Log.info(self, "Not using PHP 7.3 for site") data['php73'] = False php73 = False else: @@ -1225,7 +1225,7 @@ class WOSiteUpdateController(CementBaseController): if pargs.wpredis and data['currcachetype'] != 'wpredis': - if (not pargs.experimental): + if (pargs.experimental): Log.info(self, "Redis is experimental feature and it may not" " work with all plugins of your site.\nYou can " "disable it by changing cache type later.\nDo you wish" From 838f1c741d74cc561e55436aeec946d092a8572b Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Sun, 3 Mar 2019 14:54:12 +0100 Subject: [PATCH 25/56] testing php73 stack * add new travis test * remove temporarily few travis test to speed up the build * --experimental args isn't required anymore --- .travis.yml | 43 +++++++++++++----------------- wo/cli/plugins/site.py | 4 +-- wo/cli/plugins/site_functions.py | 18 ++++++------- wo/cli/plugins/stack.py | 16 +++++------ wo/cli/templates/wpcommon.mustache | 2 +- 5 files changed, 38 insertions(+), 45 deletions(-) diff --git a/.travis.yml b/.travis.yml index 62880fc..29431b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ before_script: - sudo rm -rf /etc/mysql/ - sudo bash -c 'echo example.com > /etc/hostname' - sudo apt-get -qq purge mysql* graphviz* - - sudo apt-get -qq autoremove + - sudo apt-get -qq autoremove --purge - sudo apt-get update script: @@ -20,7 +20,7 @@ script: - unset LANG - sudo bash -c 'echo -e "[user]\n\tname = abc\n\temail = root@localhost.com" > /home/travis/.gitconfig' - sudo echo "Travis Banch = $TRAVIS_BRANCH" - - sudo apt-get install -y --force-yes git python3-setuptools python3-dev python3-apt + - sudo apt-get install -y --force-yes git python3-setuptools python3-dev python3-apt ccze - sudo bash install $TRAVIS_BRANCH - sudo wo --help - sudo wo stack install || sudo tail -n50 /var/log/wo/wordops.log @@ -30,31 +30,24 @@ script: - sudo wo site create html.net --html || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site create php.com --php || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site create mysql.com --mysql || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create site1.com --wp || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create mysql.com --mysql --php73 || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wp1.com --wp || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wp1.com --wp --php73 ```|| sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create site2.net --wp --wpsc || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create site4.com --wpfc || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create site4.net --wp --wpfc || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create site4.org --wpfc --wp || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create site5.com --wpsubdir || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wpsc1.net --wp --wpsc || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wpfc1.com --wpfc || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wpfc2.net --wp --wpfc || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wpfc3.org --wpfc --wp || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wpsubdir1.com --wpsubdir || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create site6.com --wpsubdir --wpsc || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create site8.com --wpsubdir --wpfc || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create site8.net --wpfc --wpsubdir || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create site9.com --wpsubdomain || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wpsubdirwpsc1.com --wpsubdir --wpsc || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wpsubdirwpsc2.com --wpsubdir --wpfc || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wpsubdirwpfc3.net --wpfc --wpsubdir || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wpsubdomain1.com --wpsubdomain || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create site10.org --wpsubdomain --wpsc || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create site12.org --wpsubdomain --wpfc || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create site12.in --wpfc --wpsubdomain || sudo tail -n50 /var/log/wo/wordops.log - - - yes | sudo wo site create site.hhvm.pagespeed2.com --wpsc --hhvm || sudo tail -n50 /var/log/wo/wordops.log - - yes | sudo wo site create site.hhvm.pagespeed4.com --wpfc --hhvm || sudo tail -n50 /var/log/wo/wordops.log - - yes | sudo wo site create site.hhvm.pagespeed5.com --wpsubdir --hhvm || sudo tail -n50 /var/log/wo/wordops.log - - yes | sudo wo site create site.hhvm.pagespeed6.com --wpsubdir --wpsc --hhvm || sudo tail -n50 /var/log/wo/wordops.log - - yes | sudo wo site create site.hhvm.pagespeed8.com --wpsubdir --wpfc --hhvm || sudo tail -n50 /var/log/wo/wordops.log - - yes | sudo wo site create site.hhvm.pagespeed9.com --wpsubdomain --hhvm || sudo tail -n50 /var/log/wo/wordops.log - - yes | sudo wo site create site.hhvm.pagespeed10.org --wpsubdomain --wpsc --hhvm || sudo tail -n50 /var/log/wo/wordops.log - - yes | sudo wo site create site.hhvm.pagespeed12.in --wpfc --wpsubdomain --hhvm || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wpsubdomainwpsc.org --wpsubdomain --wpsc || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wpsubdomainwpfc.org --wpsubdomain --wpfc || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wpsubdomainwpfc2.in --wpfc --wpsubdomain || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site create site1.localtest.me --php --mysql || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site create site2.localtest.me --mysql --html || sudo tail -n50 /var/log/wo/wordops.log @@ -101,4 +94,4 @@ script: - sudo ls /var/www/ - sudo wp --allow-root --info - - sudo bash -c 'cat /var/log/wo/wordops.log' + - sudo bash -c 'cat /var/log/wo/wordops.log | ccze -A' diff --git a/wo/cli/plugins/site.py b/wo/cli/plugins/site.py index e9cb632..c5b010c 100644 --- a/wo/cli/plugins/site.py +++ b/wo/cli/plugins/site.py @@ -455,7 +455,7 @@ class WOSiteCreateController(CementBaseController): if data and self.app.pargs.php73: if (self.app.pargs.experimental): - Log.info(self, "Do you wish to install PHP 7.2 now for {0}?".format(wo_domain)) + Log.info(self, "Do you wish to install PHP 7.3 now for {0}?".format(wo_domain)) # Check prompt check_prompt = input("Type \"y\" to continue [n]:") @@ -899,7 +899,7 @@ class WOSiteUpdateController(CementBaseController): check_ssl = check_site.is_ssl check_php_version = check_site.php_version - if check_php_version == "7.2": + if check_php_version == "7.3": old_php73 = True else: old_php73 = False diff --git a/wo/cli/plugins/site_functions.py b/wo/cli/plugins/site_functions.py index 7d128be..4137fb9 100644 --- a/wo/cli/plugins/site_functions.py +++ b/wo/cli/plugins/site_functions.py @@ -711,18 +711,18 @@ def site_package_check(self, stype): if self.app.pargs.php and self.app.pargs.php73: Log.error(self,"Error: two different PHP versions cannot be combined within the same WordOps site") - if not self.app.pargs.php73 and stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: - Log.debug(self, "Setting apt_packages variable for PHP") - apt_packages = apt_packages + WOVariables.wo_php73 + WOVariables.wo_php_extra + if not self.app.pargs.php and stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: + Log.debug(self, "Setting apt_packages variable for PHP 7.2") + apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra - if self.app.pargs.php73 and stype in [ 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: + if self.app.pargs.php and stype in [ 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - Log.debug(self, "Setting apt_packages variable for PHP 7.3") + Log.debug(self, "Setting apt_packages variable for PHP 7.2") if not WOAptGet.is_installed(self, 'php7.3-fpm'): - apt_packages = apt_packages + WOVariables.wo_php73 + WOVariables.wo_php_extra + apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra else: - Log.debug(self, "Setting apt_packages variable for PHP 7.3") - if not WOAptGet.is_installed(self, 'php7.3-fpm'): + Log.debug(self, "Setting apt_packages variable for PHP 7.2") + if not WOAptGet.is_installed(self, 'php7.2-fpm'): apt_packages = apt_packages + WOVariables.wo_php73 if stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']: @@ -832,7 +832,7 @@ def site_package_check(self, stype): if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'wheezy' or WOVariables.wo_platform_codename == 'precise'): - Log.error(self,"PHP 7.0 is not supported in your Platform") + Log.error(self,"PHP 7.3 is not supported in your Platform") Log.debug(self, "Setting apt_packages variable for PHP 7.3") if not WOAptGet.is_installed(self, 'php7.3-fpm'): diff --git a/wo/cli/plugins/stack.py b/wo/cli/plugins/stack.py index 63cf56c..2b6c167 100644 --- a/wo/cli/plugins/stack.py +++ b/wo/cli/plugins/stack.py @@ -155,12 +155,12 @@ class WOStackController(CementBaseController): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): if set(WOVariables.wo_php73).issubset(set(apt_packages)): - Log.info(self, "Adding repository for PHP, please wait...") + Log.info(self, "Adding repository for PHP 7.3, please wait...") Log.debug(self, 'Adding ppa for PHP') WORepo.add(self, ppa=WOVariables.wo_php_repo) else: if set(WOVariables.wo_php).issubset(set(apt_packages)): - Log.info(self, "Adding repository for PHP, please wait...") + Log.info(self, "Adding repository for PHP 7.2, please wait...") # Add repository for php if WOVariables.wo_platform_distro == 'debian': if WOVariables.wo_platform_codename != 'jessie': @@ -174,7 +174,7 @@ class WOStackController(CementBaseController): if WOVariables.wo_platform_codename == 'jessie': if set(WOVariables.wo_php73).issubset(set(apt_packages)): - Log.debug(self, 'Adding repo_url of php 7.0 for debian') + Log.debug(self, 'Adding repo_url of php 7.3 for debian') WORepo.add(self, repo_url=WOVariables.wo_php_repo) Log.debug(self, 'Adding Dotdeb/php GPG key') WORepo.add_key(self, '89DF5277') @@ -1397,15 +1397,15 @@ class WOStackController(CementBaseController): Log.debug(self, "Nginx Stable already installed") if self.app.pargs.php: - Log.debug(self, "Setting apt_packages variable for PHP") + Log.debug(self, "Setting apt_packages variable for PHP 7.2") if not (WOAptGet.is_installed(self, 'php5-fpm') or WOAptGet.is_installed(self, 'php7.2-fpm')): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra else: apt_packages = apt_packages + WOVariables.wo_php else: - Log.debug(self, "PHP already installed") - Log.info(self, "PHP already installed") + Log.debug(self, "PHP 7.2 already installed") + Log.info(self, "PHP 7.2 already installed") # PHP 7.3 for Debian (jessie+) if self.app.pargs.php73 and WOVariables.wo_platform_distro == 'debian': @@ -1434,9 +1434,9 @@ class WOStackController(CementBaseController): Log.info(self, "PHP 7.3 already installed") else: Log.debug( - self, "Unfortunately PHP 7.3 is not available for your Ubuntu or Debian version.") + self, "Unfortunately PHP 7.3 is not available for your Ubuntu or Debian version.") Log.info( - self, "Unfortunately PHP 7.3 is not available for your Ubuntu or Debian version.") + self, "Unfortunately PHP 7.3 is not available for your Ubuntu or Debian version.") if self.app.pargs.hhvm: Log.debug(self, "Setting apt packages variable for HHVM") diff --git a/wo/cli/templates/wpcommon.mustache b/wo/cli/templates/wpcommon.mustache index 1444c22..dd4e641 100644 --- a/wo/cli/templates/wpcommon.mustache +++ b/wo/cli/templates/wpcommon.mustache @@ -25,7 +25,7 @@ location /wp-content/uploads { try_files $uri$webp_suffix $uri =404; } location ~ \.php$ { -#Prevent Direct Access Of PHP Files From Web Browsers + #Prevent Direct Access Of PHP Files From Web Browsers deny all; } } From 5f9f366b1f17d02bfb9b5baf3b67887fb7c22766 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Sun, 3 Mar 2019 15:00:38 +0100 Subject: [PATCH 26/56] fix typo in travis config --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 29431b6..c2c50b1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,9 +30,9 @@ script: - sudo wo site create html.net --html || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site create php.com --php || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site create mysql.com --mysql || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create mysql.com --mysql --php73 || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create mysqlphp73.com --mysql --php73 || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site create wp1.com --wp || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create wp1.com --wp --php73 ```|| sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wpphp73.com --wp --php73 || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site create wpsc1.net --wp --wpsc || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site create wpfc1.com --wpfc || sudo tail -n50 /var/log/wo/wordops.log From 037bb0c454c9437ab9431a96ddee07705489ef3d Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Sun, 3 Mar 2019 15:25:52 +0100 Subject: [PATCH 27/56] update to mariadb 10.3 --- wo/cli/plugins/stack.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wo/cli/plugins/stack.py b/wo/cli/plugins/stack.py index 2b6c167..9f5ec60 100644 --- a/wo/cli/plugins/stack.py +++ b/wo/cli/plugins/stack.py @@ -103,12 +103,12 @@ class WOStackController(CementBaseController): keyserver="keyserver.ubuntu.com") chars = ''.join(random.sample(string.ascii_letters, 8)) Log.debug(self, "Pre-seeding MySQL") - Log.debug(self, "echo \"mariadb-server-10.1 " + Log.debug(self, "echo \"mariadb-server-10.3 " "mysql-server/root_password " "password \" | " "debconf-set-selections") try: - WOShellExec.cmd_exec(self, "echo \"mariadb-server-10.1 " + WOShellExec.cmd_exec(self, "echo \"mariadb-server-10.3 " "mysql-server/root_password " "password {chars}\" | " "debconf-set-selections" @@ -117,12 +117,12 @@ class WOStackController(CementBaseController): except CommandExecutionError as e: Log.error("Failed to initialize MySQL package") - Log.debug(self, "echo \"mariadb-server-10.1 " + Log.debug(self, "echo \"mariadb-server-10.3 " "mysql-server/root_password_again " "password \" | " "debconf-set-selections") try: - WOShellExec.cmd_exec(self, "echo \"mariadb-server-10.1 " + WOShellExec.cmd_exec(self, "echo \"mariadb-server-10.3 " "mysql-server/root_password_again " "password {chars}\" | " "debconf-set-selections" From 1b4b90040cb973d100fc3e354378da8d9fe37488 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Sun, 3 Mar 2019 16:10:21 +0100 Subject: [PATCH 28/56] move wp-cli executable --- wo/core/variables.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wo/core/variables.py b/wo/core/variables.py index 9a17c74..f3410ea 100644 --- a/wo/core/variables.py +++ b/wo/core/variables.py @@ -20,7 +20,7 @@ class WOVariables(): # Get WPCLI path wo_wpcli_path = os.popen('command -v wp | tr "\n" " "').read() if wo_wpcli_path == '': - wo_wpcli_path = '/usr/bin/wp ' + wo_wpcli_path = '/usr/local/bin/wp ' # Current date and time of System wo_date = datetime.datetime.now().strftime('%d%b%Y%H%M%S') From a49b9701bdfb3a40430daa7c497d206535631988 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Mon, 4 Mar 2019 06:44:21 +0100 Subject: [PATCH 29/56] reworked php7.3 stack * replace previous stack php7 variables * properly set stack php = php7.2 and php73 = php7.3 * rename upstream php72 and php73 to avoid issues when migrating from EEv3 * use unix socket in nginx upstream instead of TCP/IP --- wo/cli/plugins/debug.py | 100 ++++++++--------- wo/cli/plugins/info.py | 2 +- wo/cli/plugins/site.py | 14 +-- wo/cli/plugins/site_functions.py | 16 +-- wo/cli/plugins/stack.py | 137 ++++++++++++----------- wo/cli/plugins/stack_services.py | 34 +++--- wo/cli/plugins/stack_upgrade.py | 8 +- wo/cli/templates/22222.mustache | 2 +- wo/cli/templates/locations-php7.mustache | 2 +- wo/cli/templates/locations.mustache | 2 +- wo/cli/templates/upstream.mustache | 2 +- wo/cli/templates/wpcommon.mustache | 2 +- wo/cli/templates/wpfc-php7.mustache | 21 +--- wo/cli/templates/wpfc.mustache | 21 +--- wo/core/variables.py | 4 +- 15 files changed, 167 insertions(+), 200 deletions(-) diff --git a/wo/cli/plugins/debug.py b/wo/cli/plugins/debug.py index 6cfe596..5bab61e 100644 --- a/wo/cli/plugins/debug.py +++ b/wo/cli/plugins/debug.py @@ -42,7 +42,7 @@ class WODebugController(CementBaseController): action='store' or 'store_const', choices=('on', 'off'), const='on', nargs='?')), (['--php'], - dict(help='start/stop debugging server PHP configuration', + dict(help='start/stop debugging server PHP 7.2 configuration', action='store' or 'store_const', choices=('on', 'off'), const='on', nargs='?')), (['--fpm'], @@ -50,11 +50,11 @@ class WODebugController(CementBaseController): action='store' or 'store_const', choices=('on', 'off'), const='on', nargs='?')), (['--php73'], - dict(help='start/stop debugging server PHP 7.2 configuration', + dict(help='start/stop debugging server PHP 7.3 configuration', action='store' or 'store_const', choices=('on', 'off'), const='on', nargs='?')), - (['--fpm7'], - dict(help='start/stop debugging fastcgi 7.2 configuration', + (['--fpm73'], + dict(help='start/stop debugging fastcgi 7.3 configuration', action='store' or 'store_const', choices=('on', 'off'), const='on', nargs='?')), (['--mysql'], @@ -301,37 +301,37 @@ class WODebugController(CementBaseController): if (self.app.pargs.php73 == 'on' and not self.app.pargs.site_name): if (WOVariables.wo_platform_codename == 'wheezy' or WOVariables.wo_platform_codename == 'precise'): - Log.error(self, "PHP 7.2 not supported.") - if not (WOShellExec.cmd_exec(self, "sed -n \"/upstream php7" + Log.error(self, "PHP 7.3 not supported.") + if not (WOShellExec.cmd_exec(self, "sed -n \"/upstream php73" "{/,/}/p \" /etc/nginx/" "conf.d/upstream.conf " - "| grep 9172")): + "| grep 9173")): - Log.info(self, "Enabling PHP 7.2 debug") + Log.info(self, "Enabling PHP 7.3 debug") # Change upstream.conf nc = NginxConfig() nc.loadf('/etc/nginx/conf.d/upstream.conf') - nc.set([('upstream', 'php73',), 'server'], '127.0.0.1:9172') + nc.set([('upstream', 'php73',), 'server'], '127.0.0.1:9173') if os.path.isfile("/etc/nginx/common/wpfc-hhvm.conf"): - nc.set([('upstream', 'hhvm',), 'server'], '127.0.0.1:9172') + nc.set([('upstream', 'hhvm',), 'server'], '127.0.0.1:9173') nc.savef('/etc/nginx/conf.d/upstream.conf') # Enable xdebug - WOFileUtils.searchreplace(self, "/etc/php/7.2/mods-available/" + WOFileUtils.searchreplace(self, "/etc/php/7.3/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.2/fpm/pool.d/debug.conf') - config['debug']['slowlog'] = '/var/log/php/7.2/slow.log' + config.read('/etc/php/7.3/fpm/pool.d/debug.conf') + config['debug']['slowlog'] = '/var/log/php/7.3/slow.log' config['debug']['request_slowlog_timeout'] = '10s' - with open('/etc/php/7.2/fpm/pool.d/debug.conf', + with open('/etc/php/7.3/fpm/pool.d/debug.conf', encoding='utf-8', mode='w') as confifile: Log.debug(self, "Writting debug.conf configuration into " - "/etc/php/7.2/fpm/pool.d/debug.conf") + "/etc/php/7.3/fpm/pool.d/debug.conf") config.write(confifile) self.trigger_php = True @@ -339,11 +339,11 @@ class WODebugController(CementBaseController): else: Log.info(self, "PHP debug is already enabled") - self.msg = self.msg + ['/var/log/php/7.2/slow.log'] + self.msg = self.msg + ['/var/log/php/7.3/slow.log'] # PHP global debug stop elif (self.app.pargs.php73 == 'off' and not self.app.pargs.site_name): - if WOShellExec.cmd_exec(self, " sed -n \"/upstream php73 {/,/}/p\" " + if WOShellExec.cmd_exec(self, " sed -n \"/upstream php72 {/,/}/p\" " "/etc/nginx/conf.d/upstream.conf " "| grep 9172"): Log.info(self, "Disabling PHP 7.2 debug") @@ -351,7 +351,7 @@ class WODebugController(CementBaseController): # Change upstream.conf nc = NginxConfig() nc.loadf('/etc/nginx/conf.d/upstream.conf') - nc.set([('upstream', 'php73',), 'server'], '127.0.0.1:9072') + nc.set([('upstream', 'php72',), 'server'], 'unix:/var/run/php/php72-fpm.sock') if os.path.isfile("/etc/nginx/common/wpfc-hhvm.conf"): nc.set([('upstream', 'hhvm',), 'server'], '127.0.0.1:8000') nc.savef('/etc/nginx/conf.d/upstream.conf') @@ -368,47 +368,47 @@ class WODebugController(CementBaseController): Log.info(self, "PHP 7.2 debug is already disabled") @expose(hide=True) - def debug_fpm7(self): + def debug_fpm73(self): """Start/Stop PHP5-FPM debug""" # PHP5-FPM start global debug - if (self.app.pargs.fpm7 == 'on' and not self.app.pargs.site_name): + if (self.app.pargs.fpm73 == 'on' and not self.app.pargs.site_name): if not WOShellExec.cmd_exec(self, "grep \"log_level = debug\" " - "/etc/php/7.2/fpm/php-fpm.conf"): - Log.info(self, "Setting up PHP7.2-FPM log_level = debug") + "/etc/php/7.3/fpm/php-fpm.conf"): + Log.info(self, "Setting up PHP7.3-FPM log_level = debug") config = configparser.ConfigParser() - config.read('/etc/php/7.2/fpm/php-fpm.conf') + config.read('/etc/php/7.3/fpm/php-fpm.conf') config.remove_option('global', 'include') config['global']['log_level'] = 'debug' - config['global']['include'] = '/etc/php/7.2/fpm/pool.d/*.conf' - with open('/etc/php/7.2/fpm/php-fpm.conf', + config['global']['include'] = '/etc/php/7.3/fpm/pool.d/*.conf' + with open('/etc/php/7.3/fpm/php-fpm.conf', encoding='utf-8', mode='w') as configfile: Log.debug(self, "Writing the PHP configuration into " - "/etc/php/7.2/fpm/php-fpm.conf") + "/etc/php/7.3/fpm/php-fpm.conf") config.write(configfile) self.trigger_php = True else: - Log.info(self, "PHP7.2-FPM log_level = debug already setup") + Log.info(self, "PHP7.3-FPM log_level = debug already setup") - self.msg = self.msg + ['/var/log/php/7.2/fpm.log'] + self.msg = self.msg + ['/var/log/php/7.3/fpm.log'] # PHP5-FPM stop global debug - elif (self.app.pargs.fpm7 == 'off' and not self.app.pargs.site_name): + elif (self.app.pargs.fpm73 == 'off' and not self.app.pargs.site_name): if WOShellExec.cmd_exec(self, "grep \"log_level = debug\" " - "/etc/php/7.2/fpm/php-fpm.conf"): - Log.info(self, "Disabling PHP7.2-FPM log_level = debug") + "/etc/php/7.3/fpm/php-fpm.conf"): + Log.info(self, "Disabling PHP7.3-FPM log_level = debug") config = configparser.ConfigParser() - config.read('/etc/php/7.2/fpm/php-fpm.conf') + config.read('/etc/php/7.3/fpm/php-fpm.conf') config.remove_option('global', 'include') config['global']['log_level'] = 'notice' - config['global']['include'] = '/etc/php/7.2/fpm/pool.d/*.conf' - with open('/etc/php/7.2/fpm/php-fpm.conf', + config['global']['include'] = '/etc/php/7.3/fpm/pool.d/*.conf' + with open('/etc/php/7.3/fpm/php-fpm.conf', encoding='utf-8', mode='w') as configfile: - Log.debug(self, "Writing the php7.2 configuration into " - "/etc/php/7.2/fpm/php-fpm.conf") + Log.debug(self, "Writing the php7.3 configuration into " + "/etc/php/7.3/fpm/php-fpm.conf") config.write(configfile) self.trigger_php = True else: - Log.info(self, "PHP7.2-FPM log_level = debug already disabled") + Log.info(self, "PHP7.3-FPM log_level = debug already disabled") @expose(hide=True) def debug_mysql(self): @@ -609,9 +609,9 @@ class WODebugController(CementBaseController): if self.app.pargs.fpm: self.app.pargs.fpm = 'off' self.debug_fpm() - if self.app.pargs.fpm7: - self.app.pargs.fpm7 = 'off' - self.debug_fpm7() + if self.app.pargs.fpm73: + self.app.pargs.fpm73 = 'off' + self.debug_fpm73() if self.app.pargs.mysql: # MySQL debug will not work for remote MySQL if WOVariables.wo_mysql_host is "localhost": @@ -636,8 +636,8 @@ class WODebugController(CementBaseController): if WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic': if WOAptGet.is_installed(self, 'php7.2-fpm'): WOService.reload_service(self, 'php7.2-fpm') - if WOAptGet.is_installed(self, 'php7.2-fpm'): - WOService.reload_service(self, 'php7.2-fpm') + if WOAptGet.is_installed(self, 'php7.3-fpm'): + WOService.reload_service(self, 'php7.3-fpm') else: WOService.reload_service(self, 'php7.2-fpm') self.app.close(0) @@ -651,8 +651,8 @@ class WODebugController(CementBaseController): self.trigger_nginx = False self.trigger_php = False - if ((not self.app.pargs.nginx) and (not self.app.pargs.php) and (not self.app.pargs.php7) - and (not self.app.pargs.fpm) and (not self.app.pargs.fpm7) and (not self.app.pargs.mysql) + if ((not self.app.pargs.nginx) and (not self.app.pargs.php) and (not self.app.pargs.php73) + and (not self.app.pargs.fpm) and (not self.app.pargs.fpm73) and (not self.app.pargs.mysql) and (not self.app.pargs.wp) and (not self.app.pargs.rewrite) and (not self.app.pargs.all) and (not self.app.pargs.site_name) @@ -726,7 +726,7 @@ class WODebugController(CementBaseController): self.app.pargs.fpm = 'on' if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and WOAptGet.is_installed(self, 'php7.2-fpm'): self.app.pargs.php73 = 'on' - self.app.pargs.fpm7 = 'on' + self.app.pargs.fpm73 = 'on' self.app.pargs.mysql = 'on' self.app.pargs.rewrite = 'on' @@ -738,12 +738,12 @@ class WODebugController(CementBaseController): self.app.pargs.fpm = 'off' if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and WOAptGet.is_installed(self, 'php7.2-fpm'): self.app.pargs.php73 = 'off' - self.app.pargs.fpm7 = 'off' + self.app.pargs.fpm73 = 'off' self.app.pargs.mysql = 'off' self.app.pargs.rewrite = 'off' if ((not self.app.pargs.nginx) and (not self.app.pargs.php) and (not self.app.pargs.php73) - and (not self.app.pargs.fpm) and (not self.app.pargs.fpm7) and (not self.app.pargs.mysql) + and (not self.app.pargs.fpm) and (not self.app.pargs.fpm73) and (not self.app.pargs.mysql) and (not self.app.pargs.wp) and (not self.app.pargs.rewrite) and self.app.pargs.site_name): self.app.args.print_help() @@ -782,12 +782,12 @@ class WODebugController(CementBaseController): # Reload PHP if self.trigger_php: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - if WOAptGet.is_installed(self, 'php5.6-fpm'): - WOService.restart_service(self, 'php5.6-fpm') if WOAptGet.is_installed(self, 'php7.2-fpm'): WOService.restart_service(self, 'php7.2-fpm') + if WOAptGet.is_installed(self, 'php7.3-fpm'): + WOService.restart_service(self, 'php7.3-fpm') else: - WOService.restart_service(self, 'php5-fpm') + WOService.restart_service(self, 'php7.2-fpm') if WOVariables.wo_platform_codename == 'jessie': WOService.restart_service(self, 'php7.2-fpm') diff --git a/wo/cli/plugins/info.py b/wo/cli/plugins/info.py index 127f847..1576b04 100644 --- a/wo/cli/plugins/info.py +++ b/wo/cli/plugins/info.py @@ -250,7 +250,7 @@ class WOInfoController(CementBaseController): self.app.pargs.nginx = True self.app.pargs.php = True self.app.pargs.mysql = True - if WOAptGet.is_installed(self, 'php7.2-fpm'): + if WOAptGet.is_installed(self, 'php7.3-fpm'): self.app.pargs.php = True if self.app.pargs.nginx: diff --git a/wo/cli/plugins/site.py b/wo/cli/plugins/site.py index c5b010c..a69883d 100644 --- a/wo/cli/plugins/site.py +++ b/wo/cli/plugins/site.py @@ -308,9 +308,9 @@ class WOSiteCreateController(CementBaseController): (['--html'], dict(help="create html site", action='store_true')), (['--php'], - dict(help="create php site", action='store_true')), - (['--php73'], dict(help="create php 7.2 site", action='store_true')), + (['--php73'], + dict(help="create php 7.3 site", action='store_true')), (['--mysql'], dict(help="create mysql site", action='store_true')), (['--wp'], @@ -461,10 +461,10 @@ class WOSiteCreateController(CementBaseController): check_prompt = input("Type \"y\" to continue [n]:") if check_prompt != "Y" and check_prompt != "y": Log.info(self, "Not using PHP 7.2 for site.") - data['php73'] = False + data['php73'] = True data['basic'] = True - php73 = 0 - self.app.pargs.php73 = False + php73 = 1 + self.app.pargs.php73 = True else: data['php73'] = True php73 = 1 @@ -564,7 +564,7 @@ class WOSiteCreateController(CementBaseController): return if data['php73']: - php_version = "7.2" + php_version = "7.3" else: php_version = "7.2" @@ -1225,7 +1225,7 @@ class WOSiteUpdateController(CementBaseController): if pargs.wpredis and data['currcachetype'] != 'wpredis': - if (pargs.experimental): + if (not pargs.experimental): Log.info(self, "Redis is experimental feature and it may not" " work with all plugins of your site.\nYou can " "disable it by changing cache type later.\nDo you wish" diff --git a/wo/cli/plugins/site_functions.py b/wo/cli/plugins/site_functions.py index 4137fb9..f724e69 100644 --- a/wo/cli/plugins/site_functions.py +++ b/wo/cli/plugins/site_functions.py @@ -711,18 +711,18 @@ def site_package_check(self, stype): if self.app.pargs.php and self.app.pargs.php73: Log.error(self,"Error: two different PHP versions cannot be combined within the same WordOps site") - if not self.app.pargs.php and stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: + if not self.app.pargs.php73 and stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: Log.debug(self, "Setting apt_packages variable for PHP 7.2") apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra - if self.app.pargs.php and stype in [ 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: + if self.app.pargs.php73 and stype in [ 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - Log.debug(self, "Setting apt_packages variable for PHP 7.2") + Log.debug(self, "Setting apt_packages variable for PHP 7.3") if not WOAptGet.is_installed(self, 'php7.3-fpm'): - apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra + apt_packages = apt_packages + WOVariables.wo_php73 + WOVariables.wo_php_extra else: - Log.debug(self, "Setting apt_packages variable for PHP 7.2") - if not WOAptGet.is_installed(self, 'php7.2-fpm'): + Log.debug(self, "Setting apt_packages variable for PHP 7.3") + if not WOAptGet.is_installed(self, 'php7.3-fpm'): apt_packages = apt_packages + WOVariables.wo_php73 if stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']: @@ -896,8 +896,8 @@ def site_package_check(self, stype): if not WOFileUtils.grep(self, "/etc/nginx/conf.d/upstream.conf", "php73"): with open("/etc/nginx/conf.d/upstream.conf", "a") as php_file: - php_file.write("upstream php73 {\nserver 127.0.0.1:9072;\n}\n" - "upstream debug72 {\nserver 127.0.0.1:9172;\n}\n") + php_file.write("upstream php73 {\nserver unix:/var/run/php/php73-fpm.sock;\n}\n" + "upstream debug73 {\nserver 127.0.0.1:9173;\n}\n") return(stack.install(apt_packages=apt_packages, packages=packages, disp_msg=False)) diff --git a/wo/cli/plugins/stack.py b/wo/cli/plugins/stack.py index 9f5ec60..adc094f 100644 --- a/wo/cli/plugins/stack.py +++ b/wo/cli/plugins/stack.py @@ -76,7 +76,7 @@ class WOStackController(CementBaseController): (['--phpredisadmin'], dict(help='Install phpRedisAdmin', action='store_true')), ] - usage = "ee stack (command) [options]" + usage = "wo stack (command) [options]" @expose(hide=True) def default(self): @@ -154,13 +154,14 @@ class WOStackController(CementBaseController): WORepo.add_key(self, WOVariables.wo_nginx_key) if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - if set(WOVariables.wo_php73).issubset(set(apt_packages)): - Log.info(self, "Adding repository for PHP 7.3, please wait...") + if set(WOVariables.wo_php73).issubset(set(apt_packages)) \ + or set(WOVariables.wo_php).issubset(set(apt_packages)): + Log.info(self, "Adding repository for PHP, please wait...") Log.debug(self, 'Adding ppa for PHP') WORepo.add(self, ppa=WOVariables.wo_php_repo) else: if set(WOVariables.wo_php).issubset(set(apt_packages)): - Log.info(self, "Adding repository for PHP 7.2, please wait...") + Log.info(self, "Adding repository for PHP, please wait...") # Add repository for php if WOVariables.wo_platform_distro == 'debian': if WOVariables.wo_platform_codename != 'jessie': @@ -244,7 +245,7 @@ class WOStackController(CementBaseController): wo_nginx.close() data = dict(php="9000", debug="9001", hhvm="8000", php73="9072", debug7="9172", - hhvmconf=False, php7conf=True if WOAptGet.is_installed(self, 'php7.2-fpm') else False) + hhvmconf=False, php7conf=True if WOAptGet.is_installed(self, 'php7.3-fpm') else False) Log.debug(self, 'Writting the nginx configuration to ' 'file /etc/nginx/conf.d/upstream.conf') wo_nginx = open('/etc/nginx/conf.d/upstream.conf', @@ -627,8 +628,8 @@ class WOStackController(CementBaseController): if not WOFileUtils.grep(self, "/etc/nginx/conf.d/upstream.conf", "php73"): with open("/etc/nginx/conf.d/upstream.conf", "a") as php_file: - php_file.write("upstream php73 {\nserver 127.0.0.1:9072;\n}\n" - "upstream debug72 {\nserver 127.0.0.1:9172;\n}\n") + php_file.write("upstream php73 {\nserver unix:/var/run/php/php73-fpm.sock;\n}\n" + "upstream debug73 {\nserver 127.0.0.1:9172;\n}\n") if set(WOVariables.wo_hhvm).issubset(set(apt_packages)): @@ -774,7 +775,7 @@ class WOStackController(CementBaseController): # Parse /etc/php/7.2/fpm/php-fpm.conf data = dict(pid="/run/php/php7.2-fpm.pid", error_log="/var/log/php/7.2/fpm.log", include="/etc/php/7.2/fpm/pool.d/*.conf") - Log.debug(self, "writting php5 configuration into " + Log.debug(self, "writting php7.2 configuration into " "/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') @@ -796,7 +797,7 @@ class WOStackController(CementBaseController): config['www']['pm'] = 'ondemand' config['www']['chdir'] = '/' config['www']['prefix'] = '/var/run/php' - config['www']['listen'] = 'php73-fpm.sock' + config['www']['listen'] = 'php72-fpm.sock' config['www']['listen.backlog'] = '32768' with codecs.open('/etc/php/7.2/fpm/pool.d/www.conf', encoding='utf-8', mode='w') as configfile: @@ -899,7 +900,7 @@ class WOStackController(CementBaseController): # Parse /etc/php/7.3/fpm/php-fpm.conf data = dict(pid="/run/php/php7.3-fpm.pid", error_log="/var/log/php7.3-fpm.log", include="/etc/php/7.3/fpm/pool.d/*.conf") - Log.debug(self, "writting php 7.0 configuration into " + Log.debug(self, "writting php 7.3 configuration into " "/etc/php/7.3/fpm/php-fpm.conf") wo_php_fpm = open('/etc/php/7.3/fpm/php-fpm.conf', encoding='utf-8', mode='w') @@ -925,7 +926,7 @@ class WOStackController(CementBaseController): config['www']['listen.backlog'] = '32768' with codecs.open('/etc/php/7.3/fpm/pool.d/www.conf', encoding='utf-8', mode='w') as configfile: - Log.debug(self, "writting PHP5 configuration into " + Log.debug(self, "writting PHP 7.3 configuration into " "/etc/php/7.3/fpm/pool.d/www.conf") config.write(configfile) @@ -936,13 +937,13 @@ class WOStackController(CementBaseController): "debug.conf", "[www]", "[debug]") config = configparser.ConfigParser() config.read('/etc/php/7.3/fpm/pool.d/debug.conf') - config['debug']['listen'] = '127.0.0.1:9182' + config['debug']['listen'] = '127.0.0.1:9173' config['debug']['rlimit_core'] = 'unlimited' config['debug']['slowlog'] = '/var/log/php/7.3/slow.log' config['debug']['request_slowlog_timeout'] = '10s' with open('/etc/php/7.3/fpm/pool.d/debug.conf', encoding='utf-8', mode='w') as confifile: - Log.debug(self, "writting PHP5 configuration into " + Log.debug(self, "writting PHP 7.3 configuration into " "/etc/php/7.3/fpm/pool.d/debug.conf") config.write(confifile) @@ -999,41 +1000,41 @@ class WOStackController(CementBaseController): WOGit.add(self, ["/etc/php"], msg="Adding PHP into Git") WOService.restart_service(self, 'php7.3-fpm') - # preconfiguration for php7.2 + # preconfiguration for php7.3 if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and set(WOVariables.wo_php).issubset(set(apt_packages)): # Create log directories - 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/') + if not os.path.exists('/var/log/php/7.3/'): + Log.debug(self, 'Creating directory /var/log/php/7.3/') + os.makedirs('/var/log/php/7.3/') # Parse etc/php/7.2/fpm/php.ini config = configparser.ConfigParser() - Log.debug(self, "configuring php file /etc/php/7.2/fpm/php.ini") - config.read('/etc/php/7.2/fpm/php.ini') + Log.debug(self, "configuring php file /etc/php/7.3/fpm/php.ini") + config.read('/etc/php/7.3/fpm/php.ini') config['PHP']['expose_php'] = 'Off' config['PHP']['post_max_size'] = '64M' config['PHP']['upload_max_filesize'] = '64M' config['PHP']['max_execution_time'] = '30' config['PHP']['date.timezone'] = WOVariables.wo_timezone - with open('/etc/php/7.2/fpm/php.ini', + with open('/etc/php/7.3/fpm/php.ini', encoding='utf-8', mode='w') as configfile: Log.debug(self, "Writting php configuration into " - "/etc/php/7.2/fpm/php.ini") + "/etc/php/7.3/fpm/php.ini") config.write(configfile) # Parse /etc/php/7.2/fpm/php-fpm.conf - data = dict(pid="/run/php/php7.2-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.2/fpm/php-fpm.conf") - wo_php_fpm = open('/etc/php/7.2/fpm/php-fpm.conf', + data = dict(pid="/run/php/php7.3-fpm.pid", error_log="/var/log/php/7.3/fpm.log", + include="/etc/php/7.3/fpm/pool.d/*.conf") + Log.debug(self, "writting php 7.3 configuration into " + "/etc/php/7.3/fpm/php-fpm.conf") + wo_php_fpm = open('/etc/php/7.3/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.2/fpm/pool.d/www.conf + # Parse /etc/php/7.3/fpm/pool.d/www.conf config = configparser.ConfigParser() - config.read_file(codecs.open('/etc/php/7.2/fpm/pool.d/www.conf', + config.read_file(codecs.open('/etc/php/7.3/fpm/pool.d/www.conf', "r", "utf8")) config['www']['ping.path'] = '/ping' config['www']['pm.status_path'] = '/status' @@ -1044,31 +1045,34 @@ class WOStackController(CementBaseController): config['www']['pm.max_spare_servers'] = '5' config['www']['request_terminate_timeout'] = '100' config['www']['pm'] = 'ondemand' - config['www']['listen'] = '127.0.0.1:9072' - with codecs.open('/etc/php/7.2/fpm/pool.d/www.conf', + config['www']['chdir'] = '/' + config['www']['prefix'] = '/var/run/php' + config['www']['listen'] = 'php73-fpm.sock' + config['www']['listen.backlog'] = '32768' + with codecs.open('/etc/php/7.3/fpm/pool.d/www.conf', encoding='utf-8', mode='w') as configfile: - Log.debug(self, "writting PHP5 configuration into " - "/etc/php/7.2/fpm/pool.d/www.conf") + Log.debug(self, "writting PHP 7.3 configuration into " + "/etc/php/7.3/fpm/pool.d/www.conf") config.write(configfile) - # 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/" + # Generate /etc/php/7.3/fpm/pool.d/debug.conf + WOFileUtils.copyfile(self, "/etc/php/7.3/fpm/pool.d/www.conf", + "/etc/php/7.3/fpm/pool.d/debug.conf") + WOFileUtils.searchreplace(self, "/etc/php/7.3/fpm/pool.d/" "debug.conf", "[www]", "[debug]") config = configparser.ConfigParser() - config.read('/etc/php/7.2/fpm/pool.d/debug.conf') - config['debug']['listen'] = '127.0.0.1:9172' + config.read('/etc/php/7.3/fpm/pool.d/debug.conf') + config['debug']['listen'] = '127.0.0.1:9173' config['debug']['rlimit_core'] = 'unlimited' - config['debug']['slowlog'] = '/var/log/php/7.2/slow.log' + config['debug']['slowlog'] = '/var/log/php/7.3/slow.log' config['debug']['request_slowlog_timeout'] = '10s' - with open('/etc/php/7.2/fpm/pool.d/debug.conf', + with open('/etc/php/7.3/fpm/pool.d/debug.conf', encoding='utf-8', mode='w') as confifile: - Log.debug(self, "writting PHP5 configuration into " - "/etc/php/7.2/fpm/pool.d/debug.conf") + Log.debug(self, "writting PHP 7.3 configuration into " + "/etc/php/7.3/fpm/pool.d/debug.conf") config.write(confifile) - with open("/etc/php/7.2/fpm/pool.d/debug.conf", + with open("/etc/php/7.3/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_" @@ -1078,8 +1082,8 @@ class WOStackController(CementBaseController): "profiler_enable] = off\n") # Disable xdebug - 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/" + if not WOShellExec.cmd_exec(self, "grep -q \';zend_extension\' /etc/php/7.3/mods-available/xdebug.ini"): + WOFileUtils.searchreplace(self, "/etc/php/7.3/mods-available/" "xdebug.ini", "zend_extension", ";zend_extension") @@ -1119,7 +1123,7 @@ class WOStackController(CementBaseController): WOVariables.wo_php_user, recursive=True) WOGit.add(self, ["/etc/php"], msg="Adding PHP into Git") - WOService.restart_service(self, 'php7.2-fpm') + WOService.restart_service(self, 'php7.3-fpm') if set(WOVariables.wo_mysql).issubset(set(apt_packages)): if not os.path.isfile("/etc/mysql/my.cnf"): @@ -1147,9 +1151,9 @@ class WOStackController(CementBaseController): WOService.reload_service(self, 'mysql') if len(packages): - if any('/usr/bin/wp' == x[1] for x in packages): - Log.debug(self, "Setting Privileges to /usr/bin/wp file ") - WOFileUtils.chmod(self, "/usr/bin/wp", 0o775) + if any('/usr/local/bin/wp' == x[1] for x in packages): + Log.debug(self, "Setting Privileges to /usr/local/bin/wp file ") + WOFileUtils.chmod(self, "/usr/local/bin/wp", 0o775) if any('/tmp/pma.tar.gz' == x[1] for x in packages): @@ -1175,7 +1179,7 @@ class WOStackController(CementBaseController): .format(WOVariables.wo_webroot)) blowfish_key = ''.join([random.choice (string.ascii_letters + string.digits) - for n in range(10)]) + for n in range(25)]) WOFileUtils.searchreplace(self, '{0}22222/htdocs/db/pma/config.inc.php' .format(WOVariables.wo_webroot), @@ -1398,7 +1402,7 @@ class WOStackController(CementBaseController): if self.app.pargs.php: Log.debug(self, "Setting apt_packages variable for PHP 7.2") - if not (WOAptGet.is_installed(self, 'php5-fpm') or WOAptGet.is_installed(self, 'php7.2-fpm')): + if not (WOAptGet.is_installed(self, 'php7.2-fpm') or WOAptGet.is_installed(self, 'php7.2-fpm')): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra else: @@ -1413,7 +1417,7 @@ class WOStackController(CementBaseController): Log.debug(self, "Setting apt_packages variable for PHP 7.3") if not WOAptGet.is_installed(self, 'php7.3-fpm'): apt_packages = apt_packages + WOVariables.wo_php73 - if not WOAptGet.is_installed(self, 'php5-fpm'): + if not WOAptGet.is_installed(self, 'php7.2-fpm'): apt_packages = apt_packages + WOVariables.wo_php else: Log.debug(self, "PHP 7.3 already installed") @@ -1429,6 +1433,8 @@ class WOStackController(CementBaseController): Log.debug(self, "Setting apt_packages variable for PHP 7.3") if not WOAptGet.is_installed(self, 'php7.3-fpm'): apt_packages = apt_packages + WOVariables.wo_php73 + WOVariables.wo_php_extra + if not WOAptGet.is_installed(self, 'php7.2-fpm'): + apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra else: Log.debug(self, "PHP 7.3 already installed") Log.info(self, "PHP 7.3 already installed") @@ -1640,7 +1646,7 @@ class WOStackController(CementBaseController): Log.debug(self, "Removing apt_packages variable of PHP") if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): apt_packages = apt_packages + WOVariables.wo_php - if not WOAptGet.is_installed(self, 'php7.2-fpm'): + if not WOAptGet.is_installed(self, 'php7.3-fpm'): apt_packages = apt_packages + WOVariables.wo_php_extra else: apt_packages = apt_packages + WOVariables.wo_php @@ -1650,7 +1656,7 @@ class WOStackController(CementBaseController): if (WOVariables.wo_platform_codename == 'jessie'): Log.debug(self, "Removing apt_packages variable of PHP 7.3") apt_packages = apt_packages + WOVariables.wo_php73 - if not WOAptGet.is_installed(self, 'php7.3-fpm'): + if not WOAptGet.is_installed(self, 'php7.2-fpm'): apt_packages = apt_packages + WOVariables.wo_php_extra else: Log.info(self, "PHP 7.3 not supported.") @@ -1659,7 +1665,7 @@ class WOStackController(CementBaseController): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): Log.debug(self, "Removing apt_packages variable of PHP 7.3") apt_packages = apt_packages + WOVariables.wo_php73 - if not WOAptGet.is_installed(self, 'php7.3-fpm'): + if not WOAptGet.is_installed(self, 'php7.2-fpm'): apt_packages = apt_packages + WOVariables.wo_php_extra else: Log.info(self, "PHP 7.3 not supported.") @@ -1788,9 +1794,11 @@ class WOStackController(CementBaseController): if self.app.pargs.php: Log.debug(self, "Purge apt_packages variable PHP") if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - apt_packages = apt_packages + WOVariables.wo_php_extra + apt_packages = apt_packages + WOVariables.wo_php + if not WOAptGet.is_installed(self, 'php7.3-fpm'): + apt_packages = apt_packages + WOVariables.wo_php_extra else: - apt_packages = apt_packages + WOVariables.wo_php73 + apt_packages = apt_packages + WOVariables.wo_php # For debian --php73 if self.app.pargs.php73: @@ -1806,7 +1814,7 @@ class WOStackController(CementBaseController): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): Log.debug(self, "Removing apt_packages variable of PHP 7.3") apt_packages = apt_packages + WOVariables.wo_php73 - if not WOAptGet.is_installed(self, 'php7.3-fpm'): + if not WOAptGet.is_installed(self, 'php7.2-fpm'): apt_packages = apt_packages + WOVariables.wo_php_extra else: Log.info(self, "PHP 7.3 not supported.") @@ -1814,14 +1822,7 @@ class WOStackController(CementBaseController): if WOAptGet.is_installed(self, 'hhvm'): Log.debug(self, "Purge apt_packages varible of HHVM") apt_packages = apt_packages + WOVariables.wo_hhvm - if self.app.pargs.redis: - Log.debug(self, "Purge apt_packages variable of Redis") - apt_packages = apt_packages + WOVariables.wo_redis - if self.app.pargs.mysql: - Log.debug(self, "Purge apt_packages variable MySQL") - apt_packages = apt_packages + WOVariables.wo_mysql - packages = packages + ['/usr/bin/mysqltuner'] - if self.app.pargs.wpcli: + Log.debug(self, "Purge package variable WPCLI") if os.path.isfile('/usr/bin/wp'): packages = packages + ['/usr/bin/wp'] @@ -1880,8 +1881,8 @@ class WOStackController(CementBaseController): # Added for php Ondrej repo missing package fix if self.app.pargs.php73: - if WOAptGet.is_installed(self, 'php7.3-fpm'): - Log.info(self, "PHP7.3-fpm found on system.") + if WOAptGet.is_installed(self, 'php7.2-fpm'): + Log.info(self, "PHP7.2-fpm found on system.") Log.info( self, "Verifying and installing missing packages,") WOShellExec.cmd_exec( diff --git a/wo/cli/plugins/stack_services.py b/wo/cli/plugins/stack_services.py index a2cf3c5..bf9fbe6 100644 --- a/wo/cli/plugins/stack_services.py +++ b/wo/cli/plugins/stack_services.py @@ -46,10 +46,10 @@ class WOStackStatusController(CementBaseController): else: Log.info(self, "PHP7.2-FPM is not installed") - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] else: - Log.info(self, "PHP7.2-FPM is not installed") + Log.info(self, "PHP7.3-FPM is not installed") if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): @@ -116,17 +116,17 @@ class WOStackStatusController(CementBaseController): if WOAptGet.is_installed(self, 'php7.2-fpm'): services = services + ['php7.2-fpm'] else: - Log.info(self, "PHP5-FPM is not installed") + Log.info(self, "PHP7.2-FPM is not installed") else: if WOAptGet.is_installed(self, 'php7.2-fpm'): services = services + ['php7.2-fpm'] else: Log.info(self, "PHP7.2-FPM is not installed") - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] else: - Log.info(self, "PHP7.2-FPM is not installed") + Log.info(self, "PHP7.3-FPM is not installed") if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): @@ -200,10 +200,10 @@ class WOStackStatusController(CementBaseController): else: Log.info(self, "PHP7.2-FPM is not installed") - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] else: - Log.info(self, "PHP7.2-FPM is not installed") + Log.info(self, "PHP7.3-FPM is not installed") if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): @@ -278,10 +278,10 @@ class WOStackStatusController(CementBaseController): else: Log.info(self, "PHP7.2-FPM is not installed") - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] else: - Log.info(self, "PHP7.2-FPM is not installed") + Log.info(self, "PHP7.3-FPM is not installed") if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): @@ -355,10 +355,10 @@ class WOStackStatusController(CementBaseController): else: Log.info(self, "php7.2-fpm is not installed") - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] else: - Log.info(self, "PHP7.2-FPM is not installed") + Log.info(self, "PHP7.3-FPM is not installed") if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): @@ -367,7 +367,7 @@ class WOStackStatusController(CementBaseController): else: Log.info(self, "PHP7.3-FPM is not installed") else: - Log.info(self, "Your platform does not support PHP 7") + Log.info(self, "Your platform does not support PHP 7.3") if self.app.pargs.mysql: if ((WOVariables.wo_mysql_host is "localhost") or diff --git a/wo/cli/plugins/stack_upgrade.py b/wo/cli/plugins/stack_upgrade.py index d97bac8..f4b4b6e 100644 --- a/wo/cli/plugins/stack_upgrade.py +++ b/wo/cli/plugins/stack_upgrade.py @@ -89,8 +89,8 @@ class WOStackUpgradeController(CementBaseController): if ((not self.app.pargs.web) and (not self.app.pargs.nginx) and (not self.app.pargs.php) and (not self.app.pargs.mysql) and - (not self.app.pargs.hhvm) and (not self.app.pargs.all) and - (not self.app.pargs.wpcli) and (not self.app.pargs.redis) and + (not self.app.pargs.hhvm) and (not self.app.pargs.all) and + (not self.app.pargs.wpcli) and (not self.app.pargs.redis) and (not self.app.pargs.nginxmainline)): self.app.pargs.web = True @@ -178,13 +178,13 @@ class WOStackUpgradeController(CementBaseController): if len(packages): if self.app.pargs.wpcli: - WOFileUtils.remove(self,['/usr/bin/wp']) + WOFileUtils.remove(self,['/usr/local/bin/wp']) Log.debug(self, "Downloading following: {0}".format(packages)) WODownload.download(self, packages) if self.app.pargs.wpcli: - WOFileUtils.chmod(self, "/usr/bin/wp", 0o775) + WOFileUtils.chmod(self, "/usr/local/bin/wp", 0o775) Log.info(self, "Successfully updated packages") else: diff --git a/wo/cli/templates/22222.mustache b/wo/cli/templates/22222.mustache index 346c164..ab7da89 100644 --- a/wo/cli/templates/22222.mustache +++ b/wo/cli/templates/22222.mustache @@ -39,6 +39,6 @@ server { location ~ \.php$ { try_files $uri =404; include fastcgi_params; - fastcgi_pass php; + fastcgi_pass php72; } } diff --git a/wo/cli/templates/locations-php7.mustache b/wo/cli/templates/locations-php7.mustache index 58c0011..04bd05d 100644 --- a/wo/cli/templates/locations-php7.mustache +++ b/wo/cli/templates/locations-php7.mustache @@ -59,7 +59,7 @@ location = /nginx_status { } location ~ ^/(status|ping)$ { include fastcgi_params; - fastcgi_pass php7; + fastcgi_pass php73; include common/acl.conf; } # WordOps (wo) utilities diff --git a/wo/cli/templates/locations.mustache b/wo/cli/templates/locations.mustache index 36155bf..7d8c6bb 100644 --- a/wo/cli/templates/locations.mustache +++ b/wo/cli/templates/locations.mustache @@ -59,7 +59,7 @@ location = /nginx_status { } location ~ ^/(status|ping)$ { include fastcgi_params; - fastcgi_pass php; + fastcgi_pass php72; include common/acl.conf; } # WordOps (wo) utilities diff --git a/wo/cli/templates/upstream.mustache b/wo/cli/templates/upstream.mustache index 9e8f1e4..00a1ba0 100644 --- a/wo/cli/templates/upstream.mustache +++ b/wo/cli/templates/upstream.mustache @@ -4,7 +4,7 @@ server 127.0.0.1:9000; } upstream debug { # Debug Pool -server 127.0.0.1:9100; +server 127.0.0.1:9001; } upstream php72 { server unix:/var/run/php/php72-fpm.sock; diff --git a/wo/cli/templates/wpcommon.mustache b/wo/cli/templates/wpcommon.mustache index dd4e641..89f0e92 100644 --- a/wo/cli/templates/wpcommon.mustache +++ b/wo/cli/templates/wpcommon.mustache @@ -4,7 +4,7 @@ location = /wp-login.php { limit_req zone=one burst=1 nodelay; include fastcgi_params; - fastcgi_pass php; + fastcgi_pass php72; } # Disable wp-config.txt location = /wp-config.txt { diff --git a/wo/cli/templates/wpfc-php7.mustache b/wo/cli/templates/wpfc-php7.mustache index 55c999d..438aab2 100644 --- a/wo/cli/templates/wpfc-php7.mustache +++ b/wo/cli/templates/wpfc-php7.mustache @@ -1,28 +1,11 @@ # WPFC NGINX CONFIGURATION # DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE -set $skip_cache 0; -# POST requests and URL with a query string should always go to php -if ($request_method = POST) { - set $skip_cache 1; -} -if ($query_string != "") { - set $skip_cache 1; -} -# Don't cache URL containing the following segments -if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*\.php|index.php|/feed/|.*sitemap.*\.xml)") { - set $skip_cache 1; -} -# Don't use the cache for logged in users or recent commenter or customer with items in cart -if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in|[a-z0-9]+_items_in_cart") { - set $skip_cache 1; -} +# $skip_cache variable set in /etc/nginx/conf.d/map-wp-fastcgi-cache.conf + # Use cached or actual file if they exists, Otherwise pass request to WordPress location / { try_files $uri $uri/ /index.php$is_args$args; } -location ~ ^/wp-content/cache/minify/(.+\.(css|js))$ { - try_files $uri /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1; -} location ~ \.php$ { try_files $uri =404; include fastcgi_params; diff --git a/wo/cli/templates/wpfc.mustache b/wo/cli/templates/wpfc.mustache index 666c177..6ad47d0 100644 --- a/wo/cli/templates/wpfc.mustache +++ b/wo/cli/templates/wpfc.mustache @@ -1,28 +1,11 @@ # WPFC NGINX CONFIGURATION # DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE -set $skip_cache 0; -# POST requests and URL with a query string should always go to php -if ($request_method = POST) { - set $skip_cache 1; -} -if ($query_string != "") { - set $skip_cache 1; -} -# Don't cache URL containing the following segments -if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*\.php|index.php|/feed/|.*sitemap.*\.xml)") { - set $skip_cache 1; -} -# Don't use the cache for logged in users or recent commenter or customer with items in cart -if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in|[a-z0-9]+_items_in_cart") { - set $skip_cache 1; -} +# $skip_cache variable set in /etc/nginx/conf.d/map-wp-fastcgi-cache.conf + # Use cached or actual file if they exists, Otherwise pass request to WordPress location / { try_files $uri $uri/ /index.php$is_args$args; } -location ~ ^/wp-content/cache/minify/(.+\.(css|js))$ { - try_files $uri /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1; -} location ~ \.php$ { try_files $uri =404; include fastcgi_params; diff --git a/wo/core/variables.py b/wo/core/variables.py index f3410ea..818d578 100644 --- a/wo/core/variables.py +++ b/wo/core/variables.py @@ -121,13 +121,13 @@ class WOVariables(): "php7.2-common", "php7.2-readline", "php-redis", "php7.2-mysql", "php7.2-cli", "php-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", + "php7.2-soap", "php-msgpack", "graphviz", "php-pear", "php-xdebug"] wo_php73 = ["php7.3-fpm", "php7.3-curl", "php7.3-gd", "php7.3-imap", "php7.3-common", "php7.3-readline", "php-redis", "php7.3-mysql", "php7.3-cli", "php-imagick", "php7.3-mbstring", "php7.3-recode", "php7.3-bcmath", "php7.3-opcache", "php7.3-zip", "php7.3-xml", - "php7.3-soap", "php7.3-msgpack", + "php7.3-soap", "php-msgpack", "graphviz", "php-pear", "php-xdebug"] wo_php_extra = [] From 853bf76f37b7eeaa2f9a502c5f76f6c6a1e23f6e Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Mon, 4 Mar 2019 07:03:14 +0100 Subject: [PATCH 30/56] fix identation --- wo/cli/plugins/stack.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wo/cli/plugins/stack.py b/wo/cli/plugins/stack.py index adc094f..773d07e 100644 --- a/wo/cli/plugins/stack.py +++ b/wo/cli/plugins/stack.py @@ -1433,7 +1433,7 @@ class WOStackController(CementBaseController): Log.debug(self, "Setting apt_packages variable for PHP 7.3") if not WOAptGet.is_installed(self, 'php7.3-fpm'): apt_packages = apt_packages + WOVariables.wo_php73 + WOVariables.wo_php_extra - if not WOAptGet.is_installed(self, 'php7.2-fpm'): + if not WOAptGet.is_installed(self, 'php7.2-fpm'): apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra else: Log.debug(self, "PHP 7.3 already installed") From 53be5bad2df20cf479f8e9a11456e4a5490507c2 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Mon, 4 Mar 2019 07:12:57 +0100 Subject: [PATCH 31/56] fix indentation and wp-cli path --- install | 2 +- wo/cli/plugins/site_functions.py | 77 ++++++++++++++++---------------- wo/cli/plugins/stack.py | 14 +++--- wo/cli/plugins/stack_upgrade.py | 8 ++-- 4 files changed, 50 insertions(+), 51 deletions(-) diff --git a/install b/install index 0b8b421..246948a 100644 --- a/install +++ b/install @@ -597,7 +597,7 @@ wo_update_latest() # Fix for 3.3.2 renamed nginx.conf - nginx -V 2>&1 &>>/dev/null + nginx -V &>>/dev/null 2>&1 if [[ $? -eq 0 ]]; then nginx -t 2>&1 | grep 'open() "/etc/nginx/nginx.conf" failed' &>>/dev/null if [[ $? -eq 0 ]]; then diff --git a/wo/cli/plugins/site_functions.py b/wo/cli/plugins/site_functions.py index f724e69..43c376c 100644 --- a/wo/cli/plugins/site_functions.py +++ b/wo/cli/plugins/site_functions.py @@ -54,9 +54,9 @@ def check_domain_exists(self, domain): def setupdomain(self, data): - #for debug purpose - # for key, value in data.items() : - # print (key, value) + # for debug purpose + # for key, value in data.items() : + # print (key, value) wo_domain_name = data['site_name'] wo_site_webroot = data['webroot'] if 'webroot' in data.keys() else '' @@ -100,7 +100,6 @@ def setupdomain(self, data): raise SiteError("created nginx configuration failed for site." " check with `nginx -t`") - # create symbolic link for WOFileUtils.create_symlink(self, ['/etc/nginx/sites-available/{0}' .format(wo_domain_name), @@ -323,9 +322,9 @@ def setupwordpress(self, data): .format(wo_domain_name) if data['wpredis'] else ''), log=False - ): + ): pass - else : + else: raise SiteError("generate wp-config failed for wp single site") except CommandExecutionError as e: raise SiteError("generate wp-config failed for wp single site") @@ -346,46 +345,45 @@ def setupwordpress(self, data): "\n\ndefine(\'WP_DEBUG\', false);")) try: if WOShellExec.cmd_exec(self, "bash -c \"php {0} --allow-root" - .format(WOVariables.wo_wpcli_path) - + " core config " - + "--dbname=\'{0}\' --dbprefix=\'{1}\' " - "--dbhost=\'{2}\' " - .format(data['wo_db_name'], wo_wp_prefix, - data['wo_db_host']) - + "--dbuser=\'{0}\' --dbpass=\'{1}\' " - "--extra-php< Date: Mon, 4 Mar 2019 11:39:04 +0100 Subject: [PATCH 32/56] add fastcgi-cache mapping --- wo/cli/plugins/stack.py | 8 ++++++ wo/cli/templates/fastcgi-cache.mustache | 38 +++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 wo/cli/templates/fastcgi-cache.mustache diff --git a/wo/cli/plugins/stack.py b/wo/cli/plugins/stack.py index 16b0dea..7ea9250 100644 --- a/wo/cli/plugins/stack.py +++ b/wo/cli/plugins/stack.py @@ -253,6 +253,14 @@ class WOStackController(CementBaseController): self.app.render((data), 'upstream.mustache', out=wo_nginx) wo_nginx.close() + Log.debug(self, 'Writting the nginx configuration to ' + 'file /etc/nginx/conf.d/map-wp-fastcgi-cache.conf') + wo_nginx = open('/etc/nginx/conf.d/map-wp-fastcgi-cache.conf', + encoding='utf-8', mode='w') + self.app.render((data), 'fastcgi-cache.mustache', + out=wo_nginx) + wo_nginx.close() + # Setup Nginx common directory if not os.path.exists('/etc/nginx/common'): Log.debug(self, 'Creating directory' diff --git a/wo/cli/templates/fastcgi-cache.mustache b/wo/cli/templates/fastcgi-cache.mustache new file mode 100644 index 0000000..7dc99c2 --- /dev/null +++ b/wo/cli/templates/fastcgi-cache.mustache @@ -0,0 +1,38 @@ +# NGINX CONFIGURATION FOR FASTCGI_CACHE EXCEPTION +# DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE +map $http_x_requested_with $http_request_no_cache { + default 0; + XMLHttpRequest 1; +} +map $http_cookie $cookie_no_cache { + default 0; + "~*wordpress_[a-f0-9]+" 1; + "~*wp-postpass" 1; + "~*wordpress_logged_in" 1; + "~*wordpress_no_cache" 1; + "~*comment_author" 1; + "~*woocommerce_items_in_cart" 1; + "~*woocommerce_cart_hash" 1; + "~*wptouch_switch_toogle" 1; + "~*comment_author_email_" 1; +} +map $request_uri $uri_no_cache { + default 0; + "~*/wp-admin/" 1; + "~*/wp-[a-zA-Z0-9-]+.php" 1; + "~*/feed/" 1; + "~*/index.php" 1; + "~*/[a-z0-9_-]+-sitemap([0-9]+)?.xml" 1; + "~*/sitemap(_index)?.xml" 1; + "~*/wp-comments-popup.php" 1; + "~*/wp-links-opml.php" 1; + "~*/xmlrpc.php" 1; +} +map $is_args $query_no_cache { + default 1; + "" 0; +} +map $http_request_no_cache$cookie_no_cache$uri_no_cache$query_no_cache $skip_cache { + default 1; + 0000 0; +} From 65f6e7a2a0a7830580f2292353bdff3225013f97 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Mon, 4 Mar 2019 12:18:20 +0100 Subject: [PATCH 33/56] improve install script & site.py * remove php7.2 installation * cleanup code * improve code quality according to shellcheck warnings --- install | 48 ++---- wo/cli/plugins/clean.py | 2 + wo/cli/plugins/debug.py | 4 +- wo/cli/plugins/site.py | 347 +++++++++++++++++++++------------------- wo/cli/plugins/sync.py | 2 +- 5 files changed, 207 insertions(+), 196 deletions(-) diff --git a/install b/install index 246948a..6583c31 100644 --- a/install +++ b/install @@ -149,27 +149,7 @@ wo_install_dep() # Change the TLS protocols sed -i 's/TLSv1 TLSv1.1 TLSv1.2;/TLSv1.2;/g' /etc/nginx/nginx.conf fi - - 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.2 support" - apt-get update &>> /dev/null - apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php-memcached php7.2-imap php7.2-common php7.2-readline php-redis php7.2-mysql php7.2-cli php-imagick php7.2-mbstring php7.2-recode php7.2-bcmath php7.2-opcache php7.2-zip php7.2-xml php7.2-soap php-msgpack graphviz php-pear php-xdebug || wo_lib_error "Not all PHP packages could be installed. " 1 - mkdir -p /var/log/php/7.2/ - touch /var/log/php/7.2/slow.log /var/log/php/7.2/fpm.log - systemctl php7.2-fpm restart &>> /dev/null - - 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 php-memcached php7.2-imap php7.2-common php7.2-readlne php-redis php7.2-mysql php7.2-cli php-imagick php7.2-mbstring php7.2-recode php7.2-bcmath php7.2-opcache php7.2-zip php7.2-xml php7.2-soap php-msgpack graphviz php-pear php-xdebug || wo_lib_error "Not all PHP packages could be installed." 1 - systemctl php7.2-fpm restart &>> /dev/null - fi - + ### # Webp mapping ### @@ -475,11 +455,11 @@ wo_update_latest() DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confmiss" -o Dpkg::Options::="--force-confold" -y install nginx-custom nginx-ee service nginx restart &>> /dev/null fi - dpkg --get-selections | grep -v deinstall | grep nginx-common - if [ $? -eq 0 ]; then + CHECK_NGINX_COMMON=$(dpkg --get-selections | grep -v deinstall | grep nginx-common) + if [ -n "$CHECK_NGINX_COMMON" ]; then apt-get update - dpkg --get-selections | grep -v deinstall | grep nginx-mainline - if [ $? -eq 0 ]; then + CHECK_NGINX_MAILINE=$(dpkg --get-selections | grep -v deinstall | grep nginx-mainline) + if [ -n "$CHECK_NGINX_MAILINE" ]; then apt-get remove -y nginx-mainline fi service nginx stop &>> /dev/null @@ -503,11 +483,11 @@ wo_update_latest() apt-get -o Dpkg::Options::="--force-confmiss" -o Dpkg::Options::="--force-confold" -y install nginx-custom systemctl restart nginx &>> /dev/null fi - dpkg --get-selections | grep -v deinstall | grep nginx-common - if [ $? -eq 0 ]; then + CHECK_NGINX_COMMON=$(dpkg --get-selections | grep -v deinstall | grep nginx-common) + if [ -n "$CHECK_NGINX_COMMON" ]; then apt-get update - dpkg --get-selections | grep -v deinstall | grep nginx-mainline - if [ $? -eq 0 ]; then + CHECK_NGINX_MAILINE=$(dpkg --get-selections | grep -v deinstall | grep nginx-mainline) + if [ -n "$CHECK_NGINX_MAILINE" ]; then apt-get remove -y nginx-mainline fi systemctl stop nginx &>> /dev/null @@ -525,8 +505,8 @@ wo_update_latest() fi # Fix HHVM autostart on reboot - dpkg --get-selections | grep -v deinstall | grep hhvm &>> /dev/null - if [ $? -eq 0 ]; then + CHECK_HHVM_INSTALL=$(dpkg --get-selections | grep -v deinstall | grep hhvm &>> /dev/null) + if [ -n "$CHECK_HHVM_INSTALL" ]; then update-rc.d hhvm defaults &>> /dev/null fi @@ -655,6 +635,8 @@ wo_update_latest() fi #Fix for SSL cert --all + + # Fix for SSL cert --all crontab -l | grep -q '\-\-min_expiry_limit' if [[ $? -eq 0 ]]; then crontab -l > /var/spool/cron/cron-backup.txt #backup cron before editing @@ -684,6 +666,8 @@ wo_git_init() git commit -am "Installed/Updated to WordOps" &>> /dev/null #PHP under git version control + + # PHP under git version control [ -d /etc/php ] && { cd /etc/php || exit 1 if [ ! -d /etc/php/.git ]; then @@ -711,7 +695,7 @@ else read -p "Update WordOps to $wo_version_new (y/n): " wo_ans if [ "$wo_ans" = "y" ] || [ "$wo_ans" = "Y" ]; then wo_install_dep | tee -ai $wo_install_log - wo_sync_db 2&>>1 $EE_INSTALL_LOG + wo_sync_db >> $EE_INSTALL_LOG 2>&1 secure_wo_db | tee -ai $EE_INSTALL_LOG wo_upgrade_php | tee -ai $wo_install_log wo_install | tee -ai $wo_install_log diff --git a/wo/cli/plugins/clean.py b/wo/cli/plugins/clean.py index 38ddf61..8780e8e 100644 --- a/wo/cli/plugins/clean.py +++ b/wo/cli/plugins/clean.py @@ -53,6 +53,7 @@ class WOCleanController(CementBaseController): self.clean_opcache() if self.app.pargs.redis: self.clean_redis() + @expose(hide=True) def clean_redis(self): """This function clears Redis cache""" @@ -97,6 +98,7 @@ class WOCleanController(CementBaseController): " or install them with `wo stack install --admin`") Log.error(self, "Unable to clean opcache", False) + def load(app): # register the plugin class.. this only happens if the plugin is enabled handler.register(WOCleanController) diff --git a/wo/cli/plugins/debug.py b/wo/cli/plugins/debug.py index 5bab61e..57da542 100644 --- a/wo/cli/plugins/debug.py +++ b/wo/cli/plugins/debug.py @@ -759,8 +759,8 @@ class WODebugController(CementBaseController): self.debug_fpm() if self.app.pargs.php73: self.debug_php73() - if self.app.pargs.fpm7: - self.debug_fpm7() + if self.app.pargs.fpm73: + self.debug_fpm73() if self.app.pargs.mysql: # MySQL debug will not work for remote MySQL if WOVariables.wo_mysql_host is "localhost": diff --git a/wo/cli/plugins/site.py b/wo/cli/plugins/site.py index a69883d..417342d 100644 --- a/wo/cli/plugins/site.py +++ b/wo/cli/plugins/site.py @@ -33,7 +33,7 @@ class WOSiteController(CementBaseController): arguments = [ (['site_name'], dict(help='Website name', nargs='?')), - ] + ] usage = "wo site (command) [options]" @expose(hide=True) @@ -160,15 +160,15 @@ class WOSiteController(CementBaseController): ssl = ("enabled" if siteinfo.is_ssl else "disabled") if (ssl == "enabled"): sslprovider = "Lets Encrypt" - sslexpiry = str(SSL.getExpirationDate(self,wo_domain)) + sslexpiry = str(SSL.getExpirationDate(self, wo_domain)) else: sslprovider = '' sslexpiry = '' data = dict(domain=wo_domain, webroot=wo_site_webroot, accesslog=access_log, errorlog=error_log, - dbname=wo_db_name, dbuser=wo_db_user,php_version=php_version, + dbname=wo_db_name, dbuser=wo_db_user, php_version=php_version, dbpass=wo_db_pass, hhvm=hhvm, - ssl=ssl, sslprovider=sslprovider, sslexpiry= sslexpiry, + ssl=ssl, sslprovider=sslprovider, sslexpiry=sslexpiry, type=sitetype + " " + cachetype + " ({0})" .format("enabled" if siteinfo.is_enabled else "disabled")) @@ -254,7 +254,7 @@ class WOSiteEditController(CementBaseController): (['site_name'], dict(help='domain name for the site', nargs='?')), - ] + ] @expose(hide=True) def default(self): @@ -282,7 +282,7 @@ class WOSiteEditController(CementBaseController): except CommandExecutionError as e: Log.error(self, "Failed invoke editor") if (WOGit.checkfilestatus(self, "/etc/nginx", - '/etc/nginx/sites-available/{0}'.format(wo_domain))): + '/etc/nginx/sites-available/{0}'.format(wo_domain))): WOGit.add(self, ["/etc/nginx"], msg="Edit website: {0}" .format(wo_domain)) # Reload NGINX @@ -333,7 +333,7 @@ class WOSiteCreateController(CementBaseController): action='store_true')), (['--hhvm'], dict(help="create HHVM site", action='store_true')), - (['-le','--letsencrypt'], + (['-le', '--letsencrypt'], dict(help="configure letsencrypt ssl for the site", action='store_true')), (['--user'], dict(help="provide user for wordpress site")), @@ -347,7 +347,7 @@ class WOSiteCreateController(CementBaseController): (['--experimental'], dict(help="Enable Experimenal packages without prompt", action='store_true')), - ] + ] @expose(hide=True) def default(self): @@ -417,7 +417,7 @@ class WOSiteCreateController(CementBaseController): wpsubdir=False, webroot=wo_site_webroot) data['basic'] = True - if stype in ['html', 'php' ]: + if stype in ['html', 'php']: data = dict(site_name=wo_domain, www_domain=wo_www_domain, static=True, basic=False, php73=False, wp=False, wpfc=False, wpsc=False, multisite=False, @@ -455,7 +455,8 @@ class WOSiteCreateController(CementBaseController): if data and self.app.pargs.php73: if (self.app.pargs.experimental): - Log.info(self, "Do you wish to install PHP 7.3 now for {0}?".format(wo_domain)) + Log.info( + self, "Do you wish to install PHP 7.3 now for {0}?".format(wo_domain)) # Check prompt check_prompt = input("Type \"y\" to continue [n]:") @@ -509,7 +510,7 @@ class WOSiteCreateController(CementBaseController): "disable it by changing cache later.\nDo you wish" " to enable Redis now for {0}?".format(wo_domain)) - # Check prompt + # Check prompt check_prompt = input("Type \"y\" to continue [n]:") if check_prompt != "Y" and check_prompt != "y": Log.error(self, "Not using Redis for site") @@ -536,7 +537,8 @@ class WOSiteCreateController(CementBaseController): hashbucket(self) except SiteError as e: # call cleanup actions on failure - Log.info(self, Log.FAIL + "There was a serious error encountered...") + Log.info(self, Log.FAIL + + "There was a serious error encountered...") Log.info(self, Log.FAIL + "Cleaning up afterwards...") doCleanupAction(self, domain=wo_domain, webroot=data['webroot']) @@ -548,7 +550,8 @@ class WOSiteCreateController(CementBaseController): addNewSite(self, wo_domain, stype, cache, wo_site_webroot) # Service Nginx Reload if not WOService.reload_service(self, 'nginx'): - Log.info(self, Log.FAIL + "There was a serious error encountered...") + Log.info(self, Log.FAIL + + "There was a serious error encountered...") Log.info(self, Log.FAIL + "Cleaning up afterwards...") doCleanupAction(self, domain=wo_domain) deleteSiteInfo(self, wo_domain) @@ -568,7 +571,6 @@ class WOSiteCreateController(CementBaseController): else: php_version = "7.2" - addNewSite(self, wo_domain, stype, cache, wo_site_webroot, hhvm=hhvm, php_version=php_version) @@ -584,7 +586,8 @@ class WOSiteCreateController(CementBaseController): except SiteError as e: # call cleanup actions on failure Log.debug(self, str(e)) - Log.info(self, Log.FAIL + "There was a serious error encountered...") + Log.info(self, Log.FAIL + + "There was a serious error encountered...") Log.info(self, Log.FAIL + "Cleaning up afterwards...") doCleanupAction(self, domain=wo_domain, webroot=data['webroot'], @@ -613,7 +616,8 @@ class WOSiteCreateController(CementBaseController): Log.debug(self, str(e)) Log.debug(self, "Error occured while generating " "wo-config.php") - Log.info(self, Log.FAIL + "There was a serious error encountered...") + Log.info(self, Log.FAIL + + "There was a serious error encountered...") Log.info(self, Log.FAIL + "Cleaning up afterwards...") doCleanupAction(self, domain=wo_domain, webroot=data['webroot'], @@ -636,7 +640,8 @@ class WOSiteCreateController(CementBaseController): except SiteError as e: # call cleanup actions on failure Log.debug(self, str(e)) - Log.info(self, Log.FAIL + "There was a serious error encountered...") + Log.info(self, Log.FAIL + + "There was a serious error encountered...") Log.info(self, Log.FAIL + "Cleaning up afterwards...") doCleanupAction(self, domain=wo_domain, webroot=data['webroot'], @@ -649,7 +654,8 @@ class WOSiteCreateController(CementBaseController): # Service Nginx Reload call cleanup if failed to reload nginx if not WOService.reload_service(self, 'nginx'): - Log.info(self, Log.FAIL + "There was a serious error encountered...") + Log.info(self, Log.FAIL + + "There was a serious error encountered...") Log.info(self, Log.FAIL + "Cleaning up afterwards...") doCleanupAction(self, domain=wo_domain, webroot=data['webroot']) @@ -672,7 +678,8 @@ class WOSiteCreateController(CementBaseController): setwebrootpermissions(self, data['webroot']) except SiteError as e: Log.debug(self, str(e)) - Log.info(self, Log.FAIL + "There was a serious error encountered...") + Log.info(self, Log.FAIL + + "There was a serious error encountered...") Log.info(self, Log.FAIL + "Cleaning up afterwards...") doCleanupAction(self, domain=wo_domain, webroot=data['webroot']) @@ -704,14 +711,15 @@ class WOSiteCreateController(CementBaseController): Log.error(self, "Check the log for details: " "`tail /var/log/wo/wordops.log` and please try again") - if self.app.pargs.letsencrypt : + if self.app.pargs.letsencrypt: if (self.app.pargs.experimental): if stype in ['wpsubdomain']: - Log.warn(self, "Wildcard domains are not supported in Lets Encrypt.\nWP SUBDOMAIN site will get SSL for primary site only.") + Log.warn( + self, "Wildcard domains are not supported in Lets Encrypt.\nWP SUBDOMAIN site will get SSL for primary site only.") Log.info(self, "Letsencrypt is currently in beta phase." - " \nDo you wish" - " to enable SSl now for {0}?".format(wo_domain)) + " \nDo you wish" + " to enable SSl now for {0}?".format(wo_domain)) # Check prompt check_prompt = input("Type \"y\" to continue [n]:") @@ -722,41 +730,41 @@ class WOSiteCreateController(CementBaseController): data['letsencrypt'] = True letsencrypt = True else: - data['letsencrypt'] = True - letsencrypt = True + data['letsencrypt'] = True + letsencrypt = True if data['letsencrypt'] is True: - setupLetsEncrypt(self, wo_domain) - httpsRedirect(self,wo_domain) - Log.info(self,"Creating Cron Job for cert auto-renewal") - WOCron.setcron_weekly(self,'wo site update --le=renew --all 2> /dev/null'.format(wo_domain),'Renew all' - ' letsencrypt SSL cert. Set by WordOps') + setupLetsEncrypt(self, wo_domain) + httpsRedirect(self, wo_domain) + Log.info(self, "Creating Cron Job for cert auto-renewal") + WOCron.setcron_weekly(self, 'wo site update --le=renew --all 2> /dev/null'.format(wo_domain), 'Renew all' + ' letsencrypt SSL cert. Set by WordOps') - if not WOService.reload_service(self, 'nginx'): + if not WOService.reload_service(self, 'nginx'): Log.error(self, "service nginx reload failed. " - "check issues with `nginx -t` command") + "check issues with `nginx -t` command") - Log.info(self, "Congratulations! Successfully Configured SSl for Site " + Log.info(self, "Congratulations! Successfully Configured SSl for Site " " https://{0}".format(wo_domain)) - if (SSL.getExpirationDays(self,wo_domain)>0): - Log.info(self, "Your cert will expire within " + str(SSL.getExpirationDays(self,wo_domain)) + " days.") - else: - Log.warn(self, "Your cert already EXPIRED ! .PLEASE renew soon . ") + if (SSL.getExpirationDays(self, wo_domain) > 0): + Log.info(self, "Your cert will expire within " + + str(SSL.getExpirationDays(self, wo_domain)) + " days.") + else: + Log.warn( + self, "Your cert already EXPIRED ! .PLEASE renew soon . ") - # Add nginx conf folder into GIT - WOGit.add(self, ["{0}/conf/nginx".format(wo_site_webroot)], + # Add nginx conf folder into GIT + WOGit.add(self, ["{0}/conf/nginx".format(wo_site_webroot)], msg="Adding letsencrypts config of site: {0}" - .format(wo_domain)) - updateSiteInfo(self, wo_domain, ssl=letsencrypt) + .format(wo_domain)) + updateSiteInfo(self, wo_domain, ssl=letsencrypt) elif data['letsencrypt'] is False: Log.info(self, "Not using Let\'s encrypt for Site " " http://{0}".format(wo_domain)) - - class WOSiteUpdateController(CementBaseController): class Meta: label = 'update' @@ -798,7 +806,7 @@ class WOSiteUpdateController(CementBaseController): dict(help='Use HHVM for site', action='store' or 'store_const', choices=('on', 'off'), const='on', nargs='?')), - (['-le','--letsencrypt'], + (['-le', '--letsencrypt'], dict(help="configure letsencrypt ssl for the site", action='store' or 'store_const', choices=('on', 'off', 'renew'), const='on', nargs='?')), @@ -809,7 +817,7 @@ class WOSiteUpdateController(CementBaseController): action='store_true')), (['--all'], dict(help="update all sites", action='store_true')), - ] + ] @expose(help="Update site type or cache") def default(self): @@ -852,7 +860,6 @@ class WOSiteUpdateController(CementBaseController): letsencrypt = False php73 = None - data = dict() try: stype, cache = detSitePar(vars(pargs)) @@ -905,9 +912,9 @@ class WOSiteUpdateController(CementBaseController): old_php73 = False if (pargs.password and not (pargs.html or - pargs.php or pargs.php73 or pargs.mysql or - pargs.wp or pargs.wpfc or pargs.wpsc or - pargs.wpsubdir or pargs.wpsubdomain)): + pargs.php or pargs.php73 or pargs.mysql or + pargs.wp or pargs.wpfc or pargs.wpsc or + pargs.wpsubdir or pargs.wpsubdomain)): try: updatewpuserpassword(self, wo_domain, wo_site_webroot) except SiteError as e: @@ -917,24 +924,24 @@ class WOSiteUpdateController(CementBaseController): if ((stype == "proxy" and stype == oldsitetype and self.app.pargs.hhvm) or (stype == "proxy" and - stype == oldsitetype )): - Log.info(self, Log.FAIL + - "Can not update proxy site to HHVM") - return 1 + stype == oldsitetype)): + Log.info(self, Log.FAIL + + "Can not update proxy site to HHVM") + return 1 if stype == "html" and stype == oldsitetype and self.app.pargs.hhvm: Log.info(self, Log.FAIL + "Can not update HTML site to HHVM") return 1 if ((stype == 'php' and oldsitetype not in ['html', 'proxy', 'php73']) or - # (stype == 'php73' and oldsitetype not in ['html', 'mysql', 'php', 'php73', 'wp', 'wpsubdir', 'wpsubdomain', ]) or + # (stype == 'php73' and oldsitetype not in ['html', 'mysql', 'php', 'php73', 'wp', 'wpsubdir', 'wpsubdomain', ]) or (stype == 'mysql' and oldsitetype not in ['html', 'php', - 'proxy','php73']) or + 'proxy', 'php73']) or (stype == 'wp' and oldsitetype not in ['html', 'php', 'mysql', 'proxy', 'wp', 'php73']) or (stype == 'wpsubdir' and oldsitetype in ['wpsubdomain']) or (stype == 'wpsubdomain' and oldsitetype in ['wpsubdir']) or - (stype == oldsitetype and cache == oldcachetype) and - not pargs.php73): + (stype == oldsitetype and cache == oldcachetype) and + not pargs.php73): Log.info(self, Log.FAIL + "can not update {0} {1} to {2} {3}". format(oldsitetype, oldcachetype, stype, cache)) return 1 @@ -1038,10 +1045,10 @@ class WOSiteUpdateController(CementBaseController): data['hhvm'] = False hhvm = False - if pargs.php73 == 'on' : + if pargs.php73 == 'on': data['php73'] = True php73 = True - check_php_version= '7.3' + check_php_version = '7.3' elif pargs.php73 == 'off': data['php73'] = False php73 = False @@ -1057,64 +1064,73 @@ class WOSiteUpdateController(CementBaseController): "site") pargs.php73 = False - #--letsencrypt=renew code goes here + # --letsencrypt=renew code goes here if pargs.letsencrypt == "renew" and not pargs.all: - expiry_days = SSL.getExpirationDays(self,wo_domain) + expiry_days = SSL.getExpirationDays(self, wo_domain) min_expiry_days = 30 if check_ssl: if (expiry_days <= min_expiry_days): - renewLetsEncrypt(self,wo_domain) + renewLetsEncrypt(self, wo_domain) else: - Log.error(self,"You have more than 30 days with the current certificate - refusing to run.") + Log.error( + self, "You have more than 30 days with the current certificate - refusing to run.") else: - Log.error(self,"Cannot renew - HTTPS is not configured for the given site. Install LE first...") + Log.error( + self, "Cannot renew - HTTPS is not configured for the given site. Install LE first...") if not WOService.reload_service(self, 'nginx'): - Log.error(self, "service nginx reload failed. " - "check issues with `nginx -t` command") + Log.error(self, "service nginx reload failed. " + "check issues with `nginx -t` command") Log.info(self, "SUCCESS: Certificate was successfully renewed For" " https://{0}".format(wo_domain)) - if (SSL.getExpirationDays(self,wo_domain)>0): - Log.info(self, "Your cert will expire within " + str(SSL.getExpirationDays(self,wo_domain)) + " days.") - Log.info(self, "Expiration date: " + str(SSL.getExpirationDate(self,wo_domain))) + if (SSL.getExpirationDays(self, wo_domain) > 0): + Log.info(self, "Your cert will expire within " + + str(SSL.getExpirationDays(self, wo_domain)) + " days.") + Log.info(self, "Expiration date: " + + str(SSL.getExpirationDate(self, wo_domain))) else: - Log.warn(self, "The certificate seems to be already expired. Please renew it as soon as possible...") + Log.warn( + self, "The certificate seems to be already expired. Please renew it as soon as possible...") return 0 if pargs.all and pargs.letsencrypt == "renew": if check_ssl: - expiry_days = SSL.getExpirationDays(self,wo_domain,True) + expiry_days = SSL.getExpirationDays(self, wo_domain, True) if expiry_days < 0: return 0 min_expiry_days = 30 if (expiry_days <= min_expiry_days): - renewLetsEncrypt(self,wo_domain) + renewLetsEncrypt(self, wo_domain) if not WOService.reload_service(self, 'nginx'): - Log.error(self, "service nginx reload failed. " - "check issues with `nginx -t` command") + Log.error(self, "service nginx reload failed. " + "check issues with `nginx -t` command") Log.info(self, "SUCCESS: Certificate was successfully renewed For" - " https://{0}".format(wo_domain)) + " https://{0}".format(wo_domain)) else: - Log.info(self,"You have more than 30 days with the current certificate - refusing to run.\n") + Log.info( + self, "You have more than 30 days with the current certificate - refusing to run.\n") - if (SSL.getExpirationDays(self,wo_domain)>0): - Log.info(self, "Your cert will expire within " + str(SSL.getExpirationDays(self,wo_domain)) + " days.") - Log.info(self, "Expiration date: \n\n" + str(SSL.getExpirationDate(self,wo_domain))) + if (SSL.getExpirationDays(self, wo_domain) > 0): + Log.info(self, "Your cert will expire within " + + str(SSL.getExpirationDays(self, wo_domain)) + " days.") + Log.info(self, "Expiration date: \n\n" + + str(SSL.getExpirationDate(self, wo_domain))) return 0 - #else: - # Log.warn(self, "Your cert already EXPIRED ! .PLEASE renew soon . ") + # else: + # Log.warn(self, "Your cert already EXPIRED ! .PLEASE renew soon . ") else: - Log.info(self,"SSL not configured for site http://{0}".format(wo_domain)) + Log.info( + self, "SSL not configured for site http://{0}".format(wo_domain)) return 0 if pargs.all and pargs.letsencrypt == "off": if letsencrypt is check_ssl: if letsencrypt is False: Log.error(self, "HTTPS is not configured for given " - "site",False) + "site", False) return 0 pass @@ -1129,10 +1145,10 @@ class WOSiteUpdateController(CementBaseController): if letsencrypt is check_ssl: if letsencrypt is False: Log.error(self, "SSl is not configured for given " - "site") + "site") elif letsencrypt is True: Log.error(self, "SSl is already configured for given " - "site") + "site") pargs.letsencrypt = False if pargs.hhvm: @@ -1162,10 +1178,11 @@ class WOSiteUpdateController(CementBaseController): data['php73'] = False php73 = False - if pargs.hhvm=="on" or pargs.letsencrypt=="on" or pargs.php73=="on": + if pargs.hhvm == "on" or pargs.letsencrypt == "on" or pargs.php73 == "on": if pargs.php73 == "on": if (not pargs.experimental): - Log.info(self, "Do you wish to enable PHP 7.3 now for {0}?".format(wo_domain)) + Log.info( + self, "Do you wish to enable PHP 7.3 now for {0}?".format(wo_domain)) check_prompt = input("Type \"y\" to continue [n]:") if check_prompt != "Y" and check_prompt != "y": @@ -1204,7 +1221,8 @@ class WOSiteUpdateController(CementBaseController): if (not pargs.experimental): if oldsitetype in ['wpsubdomain']: - Log.warn(self, "Wildcard domains are not supported in Lets Encrypt.\nWP SUBDOMAIN site will get SSL for primary site only.") + Log.warn( + self, "Wildcard domains are not supported in Lets Encrypt.\nWP SUBDOMAIN site will get SSL for primary site only.") Log.info(self, "Letsencrypt is currently in beta phase." " \nDo you wish" @@ -1222,8 +1240,6 @@ class WOSiteUpdateController(CementBaseController): data['letsencrypt'] = True letsencrypt = True - - if pargs.wpredis and data['currcachetype'] != 'wpredis': if (not pargs.experimental): Log.info(self, "Redis is experimental feature and it may not" @@ -1240,7 +1256,7 @@ class WOSiteUpdateController(CementBaseController): cache = 'basic' if ((hhvm is old_hhvm) and (php73 is old_php73) and - (stype == oldsitetype and cache == oldcachetype)): + (stype == oldsitetype and cache == oldcachetype)): return 1 if not data: @@ -1265,7 +1281,7 @@ class WOSiteUpdateController(CementBaseController): except Exception as e: Log.debug(self, str(e)) Log.info(self, Log.FAIL + "Check the log for details: " - "`tail /var/log/wo/wordops.log` and please try again") + "`tail /var/log/wo/wordops.log` and please try again") return 1 # setup NGINX configuration, and webroot @@ -1274,13 +1290,13 @@ class WOSiteUpdateController(CementBaseController): except SiteError as e: Log.debug(self, str(e)) Log.info(self, Log.FAIL + "Update site failed." - "Check the log for details:" - "`tail /var/log/wo/wordops.log` and please try again") + "Check the log for details:" + "`tail /var/log/wo/wordops.log` and please try again") return 1 if 'proxy' in data.keys() and data['proxy']: updateSiteInfo(self, wo_domain, stype=stype, cache=cache, - hhvm=hhvm,ssl=True if check_site.is_ssl else False) + hhvm=hhvm, ssl=True if check_site.is_ssl else False) Log.info(self, "Successfully updated site" " http://{0}".format(wo_domain)) return 0 @@ -1288,54 +1304,55 @@ class WOSiteUpdateController(CementBaseController): if pargs.letsencrypt: if data['letsencrypt'] is True: if not os.path.isfile("{0}/conf/nginx/ssl.conf.disabled" - .format(wo_site_webroot)): + .format(wo_site_webroot)): setupLetsEncrypt(self, wo_domain) else: WOFileUtils.mvfile(self, "{0}/conf/nginx/ssl.conf.disabled" - .format(wo_site_webroot), - '{0}/conf/nginx/ssl.conf' - .format(wo_site_webroot)) + .format(wo_site_webroot), + '{0}/conf/nginx/ssl.conf' + .format(wo_site_webroot)) - httpsRedirect(self,wo_domain) - Log.info(self,"Creating Cron Job for cert auto-renewal") - WOCron.setcron_weekly(self,'wo site update --le=renew --all 2> /dev/null'.format(wo_domain),'Renew all' - ' letsencrypt SSL cert. Set by WordOps') + httpsRedirect(self, wo_domain) + Log.info(self, "Creating Cron Job for cert auto-renewal") + WOCron.setcron_weekly(self, 'wo site update --le=renew --all 2> /dev/null'.format(wo_domain), 'Renew all' + ' letsencrypt SSL cert. Set by WordOps') if not WOService.reload_service(self, 'nginx'): - Log.error(self, "service nginx reload failed. " - "check issues with `nginx -t` command") + Log.error(self, "service nginx reload failed. " + "check issues with `nginx -t` command") Log.info(self, "Congratulations! Successfully Configured SSl for Site " " https://{0}".format(wo_domain)) - if (SSL.getExpirationDays(self,wo_domain)>0): - Log.info(self, "Your cert will expire within " + str(SSL.getExpirationDays(self,wo_domain)) + " days.") + if (SSL.getExpirationDays(self, wo_domain) > 0): + Log.info(self, "Your cert will expire within " + + str(SSL.getExpirationDays(self, wo_domain)) + " days.") else: - Log.warn(self, "Your cert already EXPIRED ! .PLEASE renew soon . ") + Log.warn( + self, "Your cert already EXPIRED ! .PLEASE renew soon . ") elif data['letsencrypt'] is False: if os.path.isfile("{0}/conf/nginx/ssl.conf" - .format(wo_site_webroot)): - Log.info(self,'Setting Nginx configuration') - WOFileUtils.mvfile(self, "{0}/conf/nginx/ssl.conf" - .format(wo_site_webroot), - '{0}/conf/nginx/ssl.conf.disabled' - .format(wo_site_webroot)) - httpsRedirect(self,wo_domain,False) - if not WOService.reload_service(self, 'nginx'): - Log.error(self, "service nginx reload failed. " - "check issues with `nginx -t` command") - #Log.info(self,"Removing Cron Job set for cert auto-renewal") - #WOCron.remove_cron(self,'wo site update {0} --le=renew --min_expiry_limit 30 2> \/dev\/null'.format(wo_domain)) - Log.info(self, "Successfully Disabled SSl for Site " - " http://{0}".format(wo_domain)) - + .format(wo_site_webroot)): + Log.info(self, 'Setting Nginx configuration') + WOFileUtils.mvfile(self, "{0}/conf/nginx/ssl.conf" + .format(wo_site_webroot), + '{0}/conf/nginx/ssl.conf.disabled' + .format(wo_site_webroot)) + httpsRedirect(self, wo_domain, False) + if not WOService.reload_service(self, 'nginx'): + Log.error(self, "service nginx reload failed. " + "check issues with `nginx -t` command") + # Log.info(self,"Removing Cron Job set for cert auto-renewal") + # WOCron.remove_cron(self,'wo site update {0} --le=renew --min_expiry_limit 30 2> \/dev\/null'.format(wo_domain)) + Log.info(self, "Successfully Disabled SSl for Site " + " http://{0}".format(wo_domain)) # Add nginx conf folder into GIT WOGit.add(self, ["{0}/conf/nginx".format(wo_site_webroot)], - msg="Adding letsencrypts config of site: {0}" - .format(wo_domain)) + msg="Adding letsencrypts config of site: {0}" + .format(wo_domain)) updateSiteInfo(self, wo_domain, ssl=letsencrypt) return 0 @@ -1353,7 +1370,7 @@ class WOSiteUpdateController(CementBaseController): " http://{0}".format(wo_domain)) return 0 - #if data['wo_db_name'] and not data['wp']: + # if data['wo_db_name'] and not data['wp']: if 'wo_db_name' in data.keys() and not data['wp']: try: data = setupdatabase(self, data) @@ -1409,10 +1426,11 @@ class WOSiteUpdateController(CementBaseController): return 1 if ((oldcachetype in ['wpsc', 'basic', 'wpredis'] and - (data['wpfc'])) or (oldsitetype == 'wp' and data['multisite'] and data['wpfc'])): + (data['wpfc'])) or (oldsitetype == 'wp' and data['multisite'] and data['wpfc'])): try: plugin_data = '{"log_level":"INFO","log_filesize":5,"enable_purge":1,"enable_map":0,"enable_log":0,"enable_stamp":0,"purge_homepage_on_new":1,"purge_homepage_on_edit":1,"purge_homepage_on_del":1,"purge_archive_on_new":1,"purge_archive_on_edit":0,"purge_archive_on_del":0,"purge_archive_on_new_comment":0,"purge_archive_on_deleted_comment":0,"purge_page_on_mod":1,"purge_page_on_new_comment":1,"purge_page_on_deleted_comment":1,"cache_method":"enable_fastcgi","purge_method":"get_request","redis_hostname":"127.0.0.1","redis_port":"6379","redis_prefix":"nginx-cache:"}' - setupwp_plugin(self, 'nginx-helper', 'rt_wp_nginx_helper_options', plugin_data, data) + setupwp_plugin( + self, 'nginx-helper', 'rt_wp_nginx_helper_options', plugin_data, data) except SiteError as e: Log.debug(self, str(e)) Log.info(self, Log.FAIL + "Update nginx-helper settings failed. " @@ -1421,10 +1439,11 @@ class WOSiteUpdateController(CementBaseController): return 1 elif ((oldcachetype in ['wpsc', 'basic', 'wpfc'] and - (data['wpredis'])) or (oldsitetype == 'wp' and data['multisite'] and data['wpredis'])): + (data['wpredis'])) or (oldsitetype == 'wp' and data['multisite'] and data['wpredis'])): try: plugin_data = '{"log_level":"INFO","log_filesize":5,"enable_purge":1,"enable_map":0,"enable_log":0,"enable_stamp":0,"purge_homepage_on_new":1,"purge_homepage_on_edit":1,"purge_homepage_on_del":1,"purge_archive_on_new":1,"purge_archive_on_edit":0,"purge_archive_on_del":0,"purge_archive_on_new_comment":0,"purge_archive_on_deleted_comment":0,"purge_page_on_mod":1,"purge_page_on_new_comment":1,"purge_page_on_deleted_comment":1,"cache_method":"enable_redis","purge_method":"get_request","redis_hostname":"127.0.0.1","redis_port":"6379","redis_prefix":"nginx-cache:"}' - setupwp_plugin(self, 'nginx-helper', 'rt_wp_nginx_helper_options', plugin_data, data) + setupwp_plugin( + self, 'nginx-helper', 'rt_wp_nginx_helper_options', plugin_data, data) except SiteError as e: Log.debug(self, str(e)) Log.info(self, Log.FAIL + "Update nginx-helper settings failed. " @@ -1434,7 +1453,8 @@ class WOSiteUpdateController(CementBaseController): else: try: plugin_data = '{"log_level":"INFO","log_filesize":5,"enable_purge":0,"enable_map":0,"enable_log":0,"enable_stamp":0,"purge_homepage_on_new":1,"purge_homepage_on_edit":1,"purge_homepage_on_del":1,"purge_archive_on_new":1,"purge_archive_on_edit":0,"purge_archive_on_del":0,"purge_archive_on_new_comment":0,"purge_archive_on_deleted_comment":0,"purge_page_on_mod":1,"purge_page_on_new_comment":1,"purge_page_on_deleted_comment":1,"cache_method":"enable_redis","purge_method":"get_request","redis_hostname":"127.0.0.1","redis_port":"6379","redis_prefix":"nginx-cache:"}' - setupwp_plugin(self, 'nginx-helper', 'rt_wp_nginx_helper_options', plugin_data, data) + setupwp_plugin( + self, 'nginx-helper', 'rt_wp_nginx_helper_options', plugin_data, data) except SiteError as e: Log.debug(self, str(e)) Log.info(self, Log.FAIL + "Update nginx-helper settings failed. " @@ -1475,14 +1495,18 @@ class WOSiteUpdateController(CementBaseController): if oldcachetype != 'wpredis' and data['wpredis']: try: if installwp_plugin(self, 'redis-cache', data): - #search for wp-config.php - if WOFileUtils.isexist(self,"{0}/wp-config.php".format(wo_site_webroot)): - config_path = '{0}/wp-config.php'.format(wo_site_webroot) - elif WOFileUtils.isexist(self,"{0}/htdocs/wp-config.php".format(wo_site_webroot)): - config_path = '{0}/htdocs/wp-config.php'.format(wo_site_webroot) + # search for wp-config.php + if WOFileUtils.isexist(self, "{0}/wp-config.php".format(wo_site_webroot)): + config_path = '{0}/wp-config.php'.format( + wo_site_webroot) + elif WOFileUtils.isexist(self, "{0}/htdocs/wp-config.php".format(wo_site_webroot)): + config_path = '{0}/htdocs/wp-config.php'.format( + wo_site_webroot) else: - Log.debug(self, "Updating wp-config.php failed. File could not be located.") - Log.error(self,"wp-config.php could not be located !!") + Log.debug( + self, "Updating wp-config.php failed. File could not be located.") + Log.error( + self, "wp-config.php could not be located !!") raise SiteError if WOShellExec.cmd_exec(self, "grep -q \"WP_CACHE_KEY_SALT\" {0}" @@ -1491,7 +1515,7 @@ class WOSiteUpdateController(CementBaseController): else: try: wpconfig = open("{0}".format(config_path), - encoding='utf-8', mode='a') + encoding='utf-8', mode='a') wpconfig.write("\n\ndefine( \'WP_CACHE_KEY_SALT\', \'{0}:\' );" .format(wo_domain)) wpconfig.close() @@ -1543,10 +1567,10 @@ class WOSiteUpdateController(CementBaseController): db_user=data['wo_db_user'], db_password=data['wo_db_pass'], db_host=data['wo_db_host'], hhvm=hhvm, - ssl=True if check_site.is_ssl else False,php_version=check_php_version) + ssl=True if check_site.is_ssl else False, php_version=check_php_version) else: updateSiteInfo(self, wo_domain, stype=stype, cache=cache, - hhvm=hhvm, ssl=True if check_site.is_ssl else False,php_version=check_php_version) + hhvm=hhvm, ssl=True if check_site.is_ssl else False, php_version=check_php_version) Log.info(self, "Successfully updated site" " http://{0}".format(wo_domain)) return 0 @@ -1564,7 +1588,7 @@ class WOSiteDeleteController(CementBaseController): (['--no-prompt'], dict(help="doesnt ask permission for delete", action='store_true')), - (['-f','--force'], + (['-f', '--force'], dict(help="forcefully delete site and configuration", action='store_true')), (['--all'], @@ -1573,7 +1597,7 @@ class WOSiteDeleteController(CementBaseController): dict(help="delete db only", action='store_true')), (['--files'], dict(help="delete webroot only", action='store_true')), - ] + ] @expose(help="Delete website configuration and files") @expose(hide=True) @@ -1599,7 +1623,7 @@ class WOSiteDeleteController(CementBaseController): Log.error(self, "site {0} does not exist".format(wo_domain)) if ((not self.app.pargs.db) and (not self.app.pargs.files) and - (not self.app.pargs.all)): + (not self.app.pargs.all)): self.app.pargs.all = True # Gather information from wo-db for wo_domain @@ -1636,7 +1660,8 @@ class WOSiteDeleteController(CementBaseController): mark_db_delete_prompt = True Log.info(self, "Deleting Database, {0}, user {1}" .format(wo_db_name, wo_db_user)) - deleteDB(self, wo_db_name, wo_db_user, wo_mysql_grant_host, False) + deleteDB(self, wo_db_name, wo_db_user, + wo_mysql_grant_host, False) updateSiteInfo(self, wo_domain, db_name='deleted', db_user='deleted', @@ -1676,7 +1701,7 @@ class WOSiteDeleteController(CementBaseController): removeNginxConf(self, wo_domain) deleteSiteInfo(self, wo_domain) Log.info(self, "Deleted site {0}".format(wo_domain)) - # else: + # else: # Log.error(self, " site {0} does not exists".format(wo_domain)) else: if (mark_db_delete_prompt or mark_webroot_delete_prompt or (mark_webroot_deleted and mark_db_deleted)): @@ -1697,25 +1722,25 @@ class WOSiteListController(CementBaseController): dict(help='List enabled websites', action='store_true')), (['--disabled'], dict(help="List disabled websites", action='store_true')), - ] + ] @expose(help="Lists websites") def default(self): - sites = getAllsites(self) - if not sites: - pass + sites = getAllsites(self) + if not sites: + pass - if self.app.pargs.enabled: - for site in sites: - if site.is_enabled: - Log.info(self, "{0}".format(site.sitename)) - elif self.app.pargs.disabled: - for site in sites: - if not site.is_enabled: - Log.info(self, "{0}".format(site.sitename)) - else: - for site in sites: - Log.info(self, "{0}".format(site.sitename)) + if self.app.pargs.enabled: + for site in sites: + if site.is_enabled: + Log.info(self, "{0}".format(site.sitename)) + elif self.app.pargs.disabled: + for site in sites: + if not site.is_enabled: + Log.info(self, "{0}".format(site.sitename)) + else: + for site in sites: + Log.info(self, "{0}".format(site.sitename)) def load(app): diff --git a/wo/cli/plugins/sync.py b/wo/cli/plugins/sync.py index dfa12fe..e0fd1f9 100644 --- a/wo/cli/plugins/sync.py +++ b/wo/cli/plugins/sync.py @@ -37,7 +37,7 @@ class WOSyncController(CementBaseController): # Read config files configfiles = glob.glob(wo_site_webroot + '/*-config.php') - #search for wp-config.php inside htdocs/ + # search for wp-config.php inside htdocs/ if not configfiles: Log.debug(self, "Config files not found in {0}/ " .format(wo_site_webroot)) From 2b9e19a9e2bb9821231ffc479595c9286a3f7096 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Mon, 4 Mar 2019 12:58:11 +0100 Subject: [PATCH 34/56] fix site function php73 install --- wo/cli/plugins/site_functions.py | 13 +++++++------ wo/cli/plugins/stack.py | 2 +- wo/core/variables.py | 12 ++++++------ 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/wo/cli/plugins/site_functions.py b/wo/cli/plugins/site_functions.py index 43c376c..13965b2 100644 --- a/wo/cli/plugins/site_functions.py +++ b/wo/cli/plugins/site_functions.py @@ -712,13 +712,14 @@ def site_package_check(self, stype): if not self.app.pargs.php73 and stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: Log.debug(self, "Setting apt_packages variable for PHP 7.2") - apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra + if not WOAptGet.is_installed(self, 'php7.2-fpm'): + apt_packages = apt_packages + WOVariables.wo_php - if self.app.pargs.php73 and stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']: - if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - Log.debug(self, "Setting apt_packages variable for PHP 7.3") - if not WOAptGet.is_installed(self, 'php7.3-fpm'): - apt_packages = apt_packages + WOVariables.wo_php73 + WOVariables.wo_php_extra + if self.app.pargs.php73 and stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']: + if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): + Log.debug(self, "Setting apt_packages variable for PHP 7.3") + if not WOAptGet.is_installed(self, 'php7.3-fpm'): + apt_packages = apt_packages + WOVariables.wo_php73 + WOVariables.wo_php_extra else: Log.debug(self, "Setting apt_packages variable for PHP 7.3") if not WOAptGet.is_installed(self, 'php7.3-fpm'): diff --git a/wo/cli/plugins/stack.py b/wo/cli/plugins/stack.py index 7ea9250..295f84d 100644 --- a/wo/cli/plugins/stack.py +++ b/wo/cli/plugins/stack.py @@ -637,7 +637,7 @@ class WOStackController(CementBaseController): "php73"): with open("/etc/nginx/conf.d/upstream.conf", "a") as php_file: php_file.write("upstream php73 {\nserver unix:/var/run/php/php73-fpm.sock;\n}\n" - "upstream debug73 {\nserver 127.0.0.1:9172;\n}\n") + "upstream debug73 {\nserver 127.0.0.1:9173;\n}\n") if set(WOVariables.wo_hhvm).issubset(set(apt_packages)): diff --git a/wo/core/variables.py b/wo/core/variables.py index 818d578..d66e842 100644 --- a/wo/core/variables.py +++ b/wo/core/variables.py @@ -108,12 +108,12 @@ class WOVariables(): "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_php72 = ["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", "memcached", - "graphviz", "php-pear", "php-xdebug", "php-msgpack", "php-redis"] + wo_php73 = ["php7.3-fpm", "php7.3-curl", "php7.3-gd", "php7.3-imap", + "php7.3-readline", "php7.3-common", "php7.3-recode", + "php7.3-cli", "php7.3-mbstring", + "php7.3-bcmath", "php7.3-mysql", "php7.3-opcache", "php7.3-zip", "php7.3-xml", "php7.3-soap"] + wo_php_extra = ["php-memcached", "php-imagick", "memcached" + "graphviz", "php-xdebug", "php-msgpack", "php-redis"] elif wo_platform_distro == 'debian': wo_php_repo = ( "deb https://packages.sury.org/php/ {codename} main".format(codename=wo_platform_codename)) From d21be1ce63578bcb47b16670dd4fbb476fb5e367 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Mon, 4 Mar 2019 13:13:52 +0100 Subject: [PATCH 35/56] fix typo in variables --- wo/core/variables.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wo/core/variables.py b/wo/core/variables.py index d66e842..feab156 100644 --- a/wo/core/variables.py +++ b/wo/core/variables.py @@ -112,7 +112,7 @@ class WOVariables(): "php7.3-readline", "php7.3-common", "php7.3-recode", "php7.3-cli", "php7.3-mbstring", "php7.3-bcmath", "php7.3-mysql", "php7.3-opcache", "php7.3-zip", "php7.3-xml", "php7.3-soap"] - wo_php_extra = ["php-memcached", "php-imagick", "memcached" + wo_php_extra = ["php-memcached", "php-imagick", "memcached", "graphviz", "php-xdebug", "php-msgpack", "php-redis"] elif wo_platform_distro == 'debian': wo_php_repo = ( From b6eacac49aa2badd12b8bac497631a972e8b1d16 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Mon, 4 Mar 2019 13:57:59 +0100 Subject: [PATCH 36/56] install wp-cli during initial setup --- install | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/install b/install index 6583c31..29447cc 100644 --- a/install +++ b/install @@ -678,17 +678,15 @@ wo_git_init() }> /dev/null } -if [ ! -x /usr/local/bin/ee ]; then - if [ ! -x /usr/local/bin/wo ]; then - wo_lib_echo "Installing depedencies" | tee -ai $wo_install_log - wo_install_dep | tee -ai $wo_install_log - wo_lib_echo "Installing WordOps $wo_branch" | tee -ai $wo_install_log - wo_install | tee -ai $wo_install_log - wo_lib_echo "Running post-install steps" | tee -ai $wo_install_log - secure_wo_db | tee -ai $EE_INSTALL_LOG - wo_git_init | tee -ai $wo_install_log - wo_update_wp_cli | tee -ai $wo_install_log - fi +if [ ! -f /usr/local/bin/wo ]; then + wo_lib_echo "Installing depedencies" | tee -ai $wo_install_log + wo_install_dep | tee -ai $wo_install_log + wo_lib_echo "Installing WordOps $wo_branch" | tee -ai $wo_install_log + wo_install | tee -ai $wo_install_log + wo_lib_echo "Running post-install steps" | tee -ai $wo_install_log + secure_wo_db | tee -ai $EE_INSTALL_LOG + wo_git_init | tee -ai $wo_install_log + wo_update_wp_cli | tee -ai $wo_install_log else wo -v 2>&1 | grep $wo_version_new &>> /dev/null if [[ $? -ne 0 ]];then From b8a22621b0557aaa03e19e55ea1987423ebfe880 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Mon, 4 Mar 2019 17:19:12 +0100 Subject: [PATCH 37/56] [skip travis] add .editorconfig --- .editorconfig | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..3b0653a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = false +insert_final_newline = false \ No newline at end of file From 5eb1e3b123c01b9f8df9d99ac7595f9d01719953 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Tue, 5 Mar 2019 17:03:23 +0100 Subject: [PATCH 38/56] update stack for php7.2/7.3 --- install | 104 +++++++++--------- wo/cli/plugins/stack.py | 116 ++++++++++----------- wo/cli/templates/virtualconf-php7.mustache | 6 +- wo/cli/templates/virtualconf.mustache | 6 +- 4 files changed, 114 insertions(+), 118 deletions(-) diff --git a/install b/install index 9187beb..b283cc3 100644 --- a/install +++ b/install @@ -7,7 +7,7 @@ # Copyright (c) 2019 - WordOps # This script is licensed under M.I.T # ------------------------------------------------------------------------- -# Version 3.9.3 - 2019-03-04 +# Version 3.9.3 - 2019-03-05 # ------------------------------------------------------------------------- readonly wo_version_old="2.2.3" readonly wo_version_new="3.9.3" @@ -82,7 +82,7 @@ fi ### # 1 - Define variables for later use ### -wo_branch=$1 +wo_branch="$1" migration=0 readonly wo_log_dir=/var/log/wo/ readonly wo_install_log=/var/log/wo/install.log @@ -96,17 +96,13 @@ if [ "$wo_linux_distro" != "Ubuntu" ] && [ "$wo_linux_distro" != "Debian" ]; the 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" wo_lib_echo_fail "other Linux distributions and perhaps even Unix deratives." - 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 - -### -# 1 - WordOps (wo) only supports Ubuntu/Debian versions that are eligible for support -### -lsb_release -d | grep -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 +else + check_wo_linux_distro=$(lsb_release -sc | grep -E "trusty|xenial|bionic|jessie|stretch") + if [ -z "$check_wo_linux_distro" ]; 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 fi ### @@ -149,7 +145,7 @@ wo_install_dep() # Change the TLS protocols sed -i 's/TLSv1 TLSv1.1 TLSv1.2;/TLSv1.2;/g' /etc/nginx/nginx.conf fi - + ### # Webp mapping ### @@ -407,10 +403,10 @@ wo_update_latest() fi fi - #Move ~/.my.cnf to /etc/mysql/conf.d/my.cnf + # Move ~/.my.cnf to /etc/mysql/conf.d/my.cnf if [ ! -f /etc/mysql/conf.d/my.cnf ] then - #create conf.d folder if not exist + # create conf.d folder if not exist if [ ! -d /etc/mysql/conf.d ]; then mkdir -p /etc/mysql/conf.d chmod 755 /etc/mysql/conf.d @@ -559,8 +555,8 @@ wo_update_latest() fi fi - #Fix Redis-server security issue - #http://redis.io/topics/security + # Fix Redis-server security issue + # http://redis.io/topics/security if [ -f /etc/redis/redis.conf ]; then grep -0 -v "#" /etc/redis/redis.confse | grep 'bind' &>> /dev/null if [ $? -ne 0 ]; then @@ -614,27 +610,7 @@ wo_update_latest() fi fi - 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.2 support" - apt-get update &>> /dev/null - apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php7.2-imap php-memcached php7.2-common php7.2-readline php-redis php7.2-mysql php7.2-cli php-imagick php7.2-mbstring php7.2-recode php7.2-bcmath php7.2-opcache php7.2-zip php7.2-xml php7.2-soap php-msgpack graphviz php-pear php-xdebug || wo_lib_error "Not all PHP packages could be installed. " 1 - mkdir -p /var/log/php/7.2/ - touch /var/log/php/7.2/slow.log /var/log/php/7.2/fpm.log - systemctl php7.2-fpm restart &>> /dev/null - - 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 php-memcached php7.2-common php7.2-readline php-redis php7.2-mysql php7.2-cli php-imagick php7.2-mbstring php7.2-recode php7.2-bcmath php7.2-opcache php7.2-zip php7.2-xml php7.2-soap php-msgpack graphviz php-pear php-xdebug || wo_lib_error "Not all PHP packages could be installed." 1 - systemctl php7.2-fpm restart &>> /dev/null - fi - - # Fix for SSL cert --all + # Fix for SSL cert --all crontab -l | grep -q '\-\-min_expiry_limit' if [[ $? -eq 0 ]]; then crontab -l > /var/spool/cron/cron-backup.txt #backup cron before editing @@ -662,7 +638,7 @@ wo_git_init() } git add -A . git commit -am "Installed/Updated to WordOps" &>> /dev/null - + # PHP under git version control [ -d /etc/php ] && { cd /etc/php || exit 1 @@ -674,16 +650,12 @@ wo_git_init() }> /dev/null } -if [ ! -f /usr/local/bin/wo ]; then - wo_lib_echo "Installing depedencies" | tee -ai $wo_install_log - wo_install_dep | tee -ai $wo_install_log - wo_lib_echo "Installing WordOps $wo_branch" | tee -ai $wo_install_log - wo_install | tee -ai $wo_install_log - wo_lib_echo "Running post-install steps" | tee -ai $wo_install_log - secure_wo_db | tee -ai $EE_INSTALL_LOG - wo_git_init | tee -ai $wo_install_log - wo_update_wp_cli | tee -ai $wo_install_log -else +### +# 4 - WO MAIN SETUP +### + +# 1 - WO already installed +if [ -x /usr/local/bin/wo ]; then wo -v 2>&1 | grep $wo_version_new &>> /dev/null if [[ $? -ne 0 ]];then read -p "Update WordOps to $wo_version_new (y/n): " wo_ans @@ -704,6 +676,40 @@ else else wo_lib_error "You already have WordOps $wo_version_new, exit status = " 1 fi +else + # 2 - Migration from EEv3 + if [ -x /usr/local/bin/ee ]; then + ee -v 2>&1 | grep $wo_version_new &>> /dev/null + if [[ $? -ne 0 ]];then + read -p "Update WordOps to $wo_version_new (y/n): " wo_ans + if [ "$wo_ans" = "y" ] || [ "$wo_ans" = "Y" ]; then + wo_install_dep | tee -ai $wo_install_log + wo_sync_db >> $EE_INSTALL_LOG 2>&1 + secure_wo_db | tee -ai $EE_INSTALL_LOG + wo_upgrade_php | tee -ai $wo_install_log + wo_install | tee -ai $wo_install_log + wo_update_latest | tee -ai $wo_install_log + wo_git_init | tee -ai $wo_install_log + service nginx reload &>> /dev/null + service php7.2-fpm restart &>> /dev/null + wo_update_wp_cli | tee -ai $wo_install_log + else + wo_lib_error "Not updating WordOps to $wo_version_new, exit status = " 1 + fi + else + wo_lib_error "You already have WordOps $wo_version_new, exit status = " 1 + fi + else + # 3 - Fresh WO setup + wo_lib_echo "Installing depedencies" | tee -ai $wo_install_log + wo_install_dep | tee -ai $wo_install_log + wo_lib_echo "Installing WordOps $wo_branch" | tee -ai $wo_install_log + wo_install | tee -ai $wo_install_log + wo_lib_echo "Running post-install steps" | tee -ai $wo_install_log + secure_wo_db | tee -ai $EE_INSTALL_LOG + wo_git_init | tee -ai $wo_install_log + wo_update_wp_cli | tee -ai $wo_install_log + fi fi wo sync | tee -ai $WO_INSTALL_LOG diff --git a/wo/cli/plugins/stack.py b/wo/cli/plugins/stack.py index 295f84d..0a5b415 100644 --- a/wo/cli/plugins/stack.py +++ b/wo/cli/plugins/stack.py @@ -277,48 +277,48 @@ class WOStackController(CementBaseController): wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/locations.conf') - wo_nginx = open('/etc/nginx/common/locations.conf', + 'file /etc/nginx/common/locations-php72.conf') + wo_nginx = open('/etc/nginx/common/locations-php72.conf', encoding='utf-8', mode='w') self.app.render((data), 'locations.mustache', out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/php.conf') - wo_nginx = open('/etc/nginx/common/php.conf', + 'file /etc/nginx/common/php72.conf') + wo_nginx = open('/etc/nginx/common/php72.conf', encoding='utf-8', mode='w') self.app.render((data), 'php.mustache', out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpcommon.conf') - wo_nginx = open('/etc/nginx/common/wpcommon.conf', + 'file /etc/nginx/common/wpcommon-php72.conf') + wo_nginx = open('/etc/nginx/common/wpcommon-php72.conf', encoding='utf-8', mode='w') self.app.render((data), 'wpcommon.mustache', out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpfc.conf') - wo_nginx = open('/etc/nginx/common/wpfc.conf', + 'file /etc/nginx/common/wpfc-php72.conf') + wo_nginx = open('/etc/nginx/common/wpfc-php72.conf', encoding='utf-8', mode='w') self.app.render((data), 'wpfc.mustache', out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpsc.conf') - wo_nginx = open('/etc/nginx/common/wpsc.conf', + 'file /etc/nginx/common/wpsc-php72.conf') + wo_nginx = open('/etc/nginx/common/wpsc-php72.conf', encoding='utf-8', mode='w') self.app.render((data), 'wpsc.mustache', out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpsubdir.conf') - wo_nginx = open('/etc/nginx/common/wpsubdir.conf', + 'file /etc/nginx/common/wpsubdir-php72.conf') + wo_nginx = open('/etc/nginx/common/wpsubdir-php72.conf', encoding='utf-8', mode='w') self.app.render((data), 'wpsubdir.mustache', out=wo_nginx) @@ -329,48 +329,48 @@ class WOStackController(CementBaseController): os.path.isfile("/etc/nginx/common/php7.conf")): # data = dict() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/locations-php7.conf') - wo_nginx = open('/etc/nginx/common/locations-php7.conf', + 'file /etc/nginx/common/locations-php73.conf') + wo_nginx = open('/etc/nginx/common/locations-php73.conf', encoding='utf-8', mode='w') self.app.render((data), 'locations-php7.mustache', out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/php7.conf') - wo_nginx = open('/etc/nginx/common/php7.conf', + 'file /etc/nginx/common/php73.conf') + wo_nginx = open('/etc/nginx/common/php73.conf', encoding='utf-8', mode='w') self.app.render((data), 'php7.mustache', out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpcommon-php7.conf') - wo_nginx = open('/etc/nginx/common/wpcommon-php7.conf', + 'file /etc/nginx/common/wpcommon-php73.conf') + wo_nginx = open('/etc/nginx/common/wpcommon-php73.conf', encoding='utf-8', mode='w') self.app.render((data), 'wpcommon-php7.mustache', out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpfc-php7.conf') - wo_nginx = open('/etc/nginx/common/wpfc-php7.conf', + 'file /etc/nginx/common/wpfc-php73.conf') + wo_nginx = open('/etc/nginx/common/wpfc-php73.conf', encoding='utf-8', mode='w') self.app.render((data), 'wpfc-php7.mustache', out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpsc-php7.conf') - wo_nginx = open('/etc/nginx/common/wpsc-php7.conf', + 'file /etc/nginx/common/wpsc-php73.conf') + wo_nginx = open('/etc/nginx/common/wpsc-php73.conf', encoding='utf-8', mode='w') self.app.render((data), 'wpsc-php7.mustache', out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/redis-php7.conf') - wo_nginx = open('/etc/nginx/common/redis-php7.conf', + 'file /etc/nginx/common/redis-php73.conf') + wo_nginx = open('/etc/nginx/common/redis-php73.conf', encoding='utf-8', mode='w') self.app.render((data), 'redis-php7.mustache', out=wo_nginx) @@ -457,7 +457,7 @@ class WOStackController(CementBaseController): "{0}22222/cert/22222.key 2048" .format(WOVariables.wo_webroot)) WOShellExec.cmd_exec(self, "openssl req -new -batch " - "-subj /commonName=127.0.0.1/ " + "-subj /commonName=localhost.localdomain/ " "-key {0}22222/cert/22222.key " "-out {0}22222/cert/" "22222.csr" @@ -529,8 +529,8 @@ class WOStackController(CementBaseController): data = dict() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/redis.conf') - wo_nginx = open('/etc/nginx/common/redis.conf', + 'file /etc/nginx/common/redis-php72.conf') + wo_nginx = open('/etc/nginx/common/redis-php72.conf', encoding='utf-8', mode='w') self.app.render((data), 'redis.mustache', out=wo_nginx) @@ -550,11 +550,11 @@ class WOStackController(CementBaseController): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): if os.path.isfile("/etc/nginx/nginx.conf") and (not - os.path.isfile("/etc/nginx/common/redis-php7.conf")): + os.path.isfile("/etc/nginx/common/redis-php73.conf")): data = dict() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/redis-php7.conf') - wo_nginx = open('/etc/nginx/common/redis-php7.conf', + 'file /etc/nginx/common/redis-php73.conf') + wo_nginx = open('/etc/nginx/common/redis-php73.conf', encoding='utf-8', mode='w') self.app.render((data), 'redis-php7.mustache', out=wo_nginx) @@ -580,53 +580,53 @@ class WOStackController(CementBaseController): # setup nginx common folder for php7 if self.app.pargs.php73: if os.path.isdir("/etc/nginx/common") and (not - os.path.isfile("/etc/nginx/common/php7.conf")): + os.path.isfile("/etc/nginx/common/php73.conf")): data = dict() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/locations-php7.conf') - wo_nginx = open('/etc/nginx/common/locations-php7.conf', + 'file /etc/nginx/common/locations-php73.conf') + wo_nginx = open('/etc/nginx/common/locations-php73.conf', encoding='utf-8', mode='w') self.app.render((data), 'locations-php7.mustache', out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/php7.conf') - wo_nginx = open('/etc/nginx/common/php7.conf', + 'file /etc/nginx/common/php73.conf') + wo_nginx = open('/etc/nginx/common/php73.conf', encoding='utf-8', mode='w') self.app.render((data), 'php7.mustache', out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpcommon-php7.conf') - wo_nginx = open('/etc/nginx/common/wpcommon-php7.conf', + 'file /etc/nginx/common/wpcommon-php73.conf') + wo_nginx = open('/etc/nginx/common/wpcommon-php73.conf', encoding='utf-8', mode='w') self.app.render((data), 'wpcommon-php7.mustache', out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpfc-php7.conf') - wo_nginx = open('/etc/nginx/common/wpfc-php7.conf', + 'file /etc/nginx/common/wpfc-php73.conf') + wo_nginx = open('/etc/nginx/common/wpfc-php73.conf', encoding='utf-8', mode='w') self.app.render((data), 'wpfc-php7.mustache', out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpsc-php7.conf') - wo_nginx = open('/etc/nginx/common/wpsc-php7.conf', + 'file /etc/nginx/common/wpsc-php73.conf') + wo_nginx = open('/etc/nginx/common/wpsc-php73.conf', encoding='utf-8', mode='w') self.app.render((data), 'wpsc-php7.mustache', out=wo_nginx) wo_nginx.close() - if os.path.isdir("/etc/nginx/common") and (not os.path.isfile("/etc/nginx/common/redis-php7.conf")): + if os.path.isdir("/etc/nginx/common") and (not os.path.isfile("/etc/nginx/common/redis-php73.conf")): data = dict() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/redis-php7.conf') - wo_nginx = open('/etc/nginx/common/redis-php7.conf', + 'file /etc/nginx/common/redis-php73.conf') + wo_nginx = open('/etc/nginx/common/redis-php73.conf', encoding='utf-8', mode='w') self.app.render((data), 'redis-php7.mustache', out=wo_nginx) @@ -718,19 +718,19 @@ class WOStackController(CementBaseController): if set(WOVariables.wo_redis).issubset(set(apt_packages)): if os.path.isfile("/etc/nginx/nginx.conf") and (not - os.path.isfile("/etc/nginx/common/redis.conf")): + os.path.isfile("/etc/nginx/common/redis-php72.conf")): data = dict() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/redis.conf') - wo_nginx = open('/etc/nginx/common/redis.conf', + 'file /etc/nginx/common/redis-php72.conf') + wo_nginx = open('/etc/nginx/common/redis-php72.conf', encoding='utf-8', mode='w') self.app.render((data), 'redis.mustache', out=wo_nginx) wo_nginx.close() if os.path.isfile("/etc/nginx/nginx.conf") and (not - os.path.isfile("/etc/nginx/common/redis-hhvm.conf")): + os.path.isfile("/etc/nginx/common/redis-hhvm.conf")): data = dict() Log.debug(self, 'Writting the nginx configuration to ' @@ -752,8 +752,8 @@ class WOStackController(CementBaseController): " keepalive 10;\n}\n") if os.path.isfile("/etc/nginx/nginx.conf") and (not - os.path.isfile("/etc/nginx/conf.d/redis.conf")): - with open("/etc/nginx/conf.d/redis.conf", "a") as redis_file: + os.path.isfile("/etc/nginx/conf.d/redis-php72.conf")): + with open("/etc/nginx/conf.d/redis-php72.conf", "a") as redis_file: redis_file.write("# Log format Settings\n" "log_format rt_cache_redis '$remote_addr $upstream_response_time $srcache_fetch_status [$time_local] '\n" "'$http_host \"$request\" $status $body_bytes_sent '\n" @@ -1436,7 +1436,7 @@ class WOStackController(CementBaseController): Log.info(self, "PHP 7.3 Not Available for your Distribution") # PHP 7.3 for Ubuntu - if self.app.pargs.php73 and not WOVariables.wo_platform_distro == 'debian': + if self.app.pargs.php73 and WOVariables.wo_platform_distro == 'ubuntu': if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): Log.debug(self, "Setting apt_packages variable for PHP 7.3") if not WOAptGet.is_installed(self, 'php7.3-fpm'): @@ -1673,7 +1673,7 @@ class WOStackController(CementBaseController): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): Log.debug(self, "Removing apt_packages variable of PHP 7.3") apt_packages = apt_packages + WOVariables.wo_php73 - if not WOAptGet.is_installed(self, 'php7.2-fpm'): + if not WOAptGet.is_installed(self, 'php7.3-fpm'): apt_packages = apt_packages + WOVariables.wo_php_extra else: Log.info(self, "PHP 7.3 not supported.") @@ -1802,7 +1802,7 @@ class WOStackController(CementBaseController): if self.app.pargs.php: Log.debug(self, "Purge apt_packages variable PHP") if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - apt_packages = apt_packages + WOVariables.wo_php + apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra if not WOAptGet.is_installed(self, 'php7.3-fpm'): apt_packages = apt_packages + WOVariables.wo_php_extra else: @@ -1887,16 +1887,6 @@ class WOStackController(CementBaseController): Log.info(self, "Successfully purged packages") - # Added for php Ondrej repo missing package fix - if self.app.pargs.php73: - if WOAptGet.is_installed(self, 'php7.2-fpm'): - Log.info(self, "PHP7.2-fpm found on system.") - Log.info( - self, "Verifying and installing missing packages,") - WOShellExec.cmd_exec( - self, "apt-get install -y php-memcached php-igbinary") - - def load(app): # register the plugin class.. this only happens if the plugin is enabled handler.register(WOStackController) diff --git a/wo/cli/templates/virtualconf-php7.mustache b/wo/cli/templates/virtualconf-php7.mustache index 13b663a..bc58b9c 100644 --- a/wo/cli/templates/virtualconf-php7.mustache +++ b/wo/cli/templates/virtualconf-php7.mustache @@ -38,10 +38,10 @@ server { } {{/static}} - {{^static}}include {{^hhvm}}{{#basic}}common/php7.conf;{{/basic}}{{#wpfc}}common/wpfc-php7.conf;{{/wpfc}} {{#wpsc}}common/wpsc-php7.conf;{{/wpsc}}{{#wpredis}}common/redis-php7.conf;{{/wpredis}} {{/hhvm}}{{#hhvm}}{{#basic}}common/php-hhvm.conf;{{/basic}}{{#wpfc}}common/wpfc-hhvm.conf;{{/wpfc}} {{#wpsc}}common/wpsc-hhvm.conf;{{/wpsc}}{{#wpredis}}common/redis-hhvm.conf;{{/wpredis}} {{/hhvm}} + {{^static}}include {{^hhvm}}{{#basic}}common/php73.conf;{{/basic}}{{#wpfc}}common/wpfc-php73.conf;{{/wpfc}} {{#wpsc}}common/wpsc-php73.conf;{{/wpsc}}{{#wpredis}}common/redis-php73.conf;{{/wpredis}} {{/hhvm}}{{#hhvm}}{{#basic}}common/php-hhvm.conf;{{/basic}}{{#wpfc}}common/wpfc-hhvm.conf;{{/wpfc}} {{#wpsc}}common/wpsc-hhvm.conf;{{/wpsc}}{{#wpredis}}common/redis-hhvm.conf;{{/wpredis}} {{/hhvm}} {{#wpsubdir}}include common/wpsubdir.conf;{{/wpsubdir}}{{/static}} - {{#wp}}include common/wpcommon-php7.conf;{{/wp}} - {{^proxy}}include common/locations-php7.conf;{{/proxy}} + {{#wp}}include common/wpcommon-php73.conf;{{/wp}} + {{^proxy}}include common/locations-php73.conf;{{/proxy}} {{^vma}}{{^rc}}include {{webroot}}/conf/nginx/*.conf;{{/rc}}{{/vma}} {{/proxy}} } diff --git a/wo/cli/templates/virtualconf.mustache b/wo/cli/templates/virtualconf.mustache index 47702e3..2fbd321 100644 --- a/wo/cli/templates/virtualconf.mustache +++ b/wo/cli/templates/virtualconf.mustache @@ -38,9 +38,9 @@ server { } {{/static}} - {{^static}}include {{^hhvm}}{{#basic}}common/php.conf;{{/basic}}{{#wpfc}}common/wpfc.conf;{{/wpfc}} {{#wpsc}}common/wpsc.conf;{{/wpsc}}{{#wpredis}}common/redis.conf;{{/wpredis}} {{/hhvm}}{{#hhvm}}{{#basic}}common/php-hhvm.conf;{{/basic}}{{#wpfc}}common/wpfc-hhvm.conf;{{/wpfc}} {{#wpsc}}common/wpsc-hhvm.conf;{{/wpsc}}{{#wpredis}}common/redis-hhvm.conf;{{/wpredis}} {{/hhvm}} {{#wpsubdir}}include common/wpsubdir.conf;{{/wpsubdir}}{{/static}} - {{#wp}}include common/wpcommon.conf;{{/wp}} - {{^proxy}}include common/locations.conf;{{/proxy}} + {{^static}}include {{^hhvm}}{{#basic}}common/php72.conf;{{/basic}}{{#wpfc}}common/wpfc-php72.conf;{{/wpfc}} {{#wpsc}}common/wpsc-php72.conf;{{/wpsc}}{{#wpredis}}common/redis-php72.conf;{{/wpredis}} {{/hhvm}}{{#hhvm}}{{#basic}}common/php-hhvm.conf;{{/basic}}{{#wpfc}}common/wpfc-hhvm.conf;{{/wpfc}} {{#wpsc}}common/wpsc-hhvm.conf;{{/wpsc}}{{#wpredis}}common/redis-hhvm.conf;{{/wpredis}} {{/hhvm}} {{#wpsubdir}}include common/wpsubdir.conf;{{/wpsubdir}}{{/static}} + {{#wp}}include common/wpcommon-php72.conf;{{/wp}} + {{^proxy}}include common/locations-php72.conf;{{/proxy}} {{^vma}}{{^rc}}include {{webroot}}/conf/nginx/*.conf;{{/rc}}{{/vma}} {{/proxy}} } From d5a16145cab949ea4552edef6300c6b86339af8d Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Tue, 5 Mar 2019 17:18:38 +0100 Subject: [PATCH 39/56] add php_extra to default install --- wo/cli/plugins/site_functions.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/wo/cli/plugins/site_functions.py b/wo/cli/plugins/site_functions.py index 13965b2..2034ebf 100644 --- a/wo/cli/plugins/site_functions.py +++ b/wo/cli/plugins/site_functions.py @@ -711,9 +711,15 @@ def site_package_check(self, stype): Log.error(self, "Error: two different PHP versions cannot be combined within the same WordOps site") if not self.app.pargs.php73 and stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: - Log.debug(self, "Setting apt_packages variable for PHP 7.2") - if not WOAptGet.is_installed(self, 'php7.2-fpm'): - apt_packages = apt_packages + WOVariables.wo_php + if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): + Log.debug(self, "Setting apt_packages variable for PHP 7.2") + if not WOAptGet.is_installed(self, 'php7.2-fpm'): + apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra + + else: + Log.debug(self, "Setting apt_packages variable for PHP 7.2") + if not WOAptGet.is_installed(self, 'php7.2-fpm'): + apt_packages = apt_packages + WOVariables.wo_php if self.app.pargs.php73 and stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): From 08a9f0b4536b445ae67372771a452171d24483dc Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Tue, 5 Mar 2019 18:32:57 +0100 Subject: [PATCH 40/56] fix new configuration files * nginx configurations for php7.3 are named -php73.conf * properly set php7.3 stack installation during site creation * remove outdated verification for debian wheezy or ubuntu precise --- wo/cli/plugins/site_functions.py | 61 +++++++++++++++----------------- 1 file changed, 29 insertions(+), 32 deletions(-) diff --git a/wo/cli/plugins/site_functions.py b/wo/cli/plugins/site_functions.py index 2034ebf..d15b315 100644 --- a/wo/cli/plugins/site_functions.py +++ b/wo/cli/plugins/site_functions.py @@ -338,8 +338,6 @@ def setupwordpress(self, data): + "--dbuser=\'{0}\' --dbpass= " "--extra-php< Date: Tue, 5 Mar 2019 19:13:21 +0100 Subject: [PATCH 41/56] another fix for php7.3 stack --- wo/cli/plugins/stack.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/wo/cli/plugins/stack.py b/wo/cli/plugins/stack.py index 0a5b415..7ef7294 100644 --- a/wo/cli/plugins/stack.py +++ b/wo/cli/plugins/stack.py @@ -1009,7 +1009,7 @@ class WOStackController(CementBaseController): WOService.restart_service(self, 'php7.3-fpm') # preconfiguration for php7.3 - if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and set(WOVariables.wo_php).issubset(set(apt_packages)): + if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and set(WOVariables.wo_php73).issubset(set(apt_packages)): # Create log directories if not os.path.exists('/var/log/php/7.3/'): Log.debug(self, 'Creating directory /var/log/php/7.3/') @@ -1653,9 +1653,8 @@ class WOStackController(CementBaseController): if self.app.pargs.php: Log.debug(self, "Removing apt_packages variable of PHP") if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - apt_packages = apt_packages + WOVariables.wo_php - if not WOAptGet.is_installed(self, 'php7.3-fpm'): - apt_packages = apt_packages + WOVariables.wo_php_extra + if not WOAptGet.is_installed(self, 'php7.2-fpm'): + apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra else: apt_packages = apt_packages + WOVariables.wo_php @@ -1672,9 +1671,8 @@ class WOStackController(CementBaseController): if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): Log.debug(self, "Removing apt_packages variable of PHP 7.3") - apt_packages = apt_packages + WOVariables.wo_php73 if not WOAptGet.is_installed(self, 'php7.3-fpm'): - apt_packages = apt_packages + WOVariables.wo_php_extra + apt_packages = apt_packages + WOVariables.wo_php73 + WOVariables.wo_php_extra else: Log.info(self, "PHP 7.3 not supported.") @@ -1821,9 +1819,8 @@ class WOStackController(CementBaseController): if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): Log.debug(self, "Removing apt_packages variable of PHP 7.3") - apt_packages = apt_packages + WOVariables.wo_php73 - if not WOAptGet.is_installed(self, 'php7.2-fpm'): - apt_packages = apt_packages + WOVariables.wo_php_extra + if not WOAptGet.is_installed(self, 'php7.3-fpm'): + apt_packages = apt_packages + WOVariables.wo_php73 + WOVariables.wo_php_extra else: Log.info(self, "PHP 7.3 not supported.") if self.app.pargs.hhvm: From c47373f21da2a3c3a23605ba027dde27b0f8aaf1 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Tue, 5 Mar 2019 20:11:05 +0100 Subject: [PATCH 42/56] update wpsc template and fix multisite * update wpsc template the same way than fastcgi_cache * fix wp multisite stacks --- install | 2 ++ wo/cli/plugins/site_functions.py | 6 +++--- wo/cli/templates/fastcgi-cache.mustache | 17 +++++++++++++++++ wo/cli/templates/fastcgi.mustache | 4 +++- wo/cli/templates/wpsc-php7.mustache | 17 +---------------- wo/cli/templates/wpsc.mustache | 17 +---------------- 6 files changed, 27 insertions(+), 36 deletions(-) diff --git a/install b/install index b283cc3..c843fc6 100644 --- a/install +++ b/install @@ -131,8 +131,10 @@ wo_install_dep() apt-get -y install build-essential curl gzip dirmngr python3 python3-apt python3-setuptools python3-dev sqlite3 git tar software-properties-common pigz gnupg2 > /dev/null 2>&1 fi }; then echo -ne ' Installing dependencies [OK]\r' + echo -ne '\n' else echo -e " Installing dependencies [FAIL]" + echo -ne '\n' fi locale-gen en &>> /dev/null diff --git a/wo/cli/plugins/site_functions.py b/wo/cli/plugins/site_functions.py index d15b315..68ff719 100644 --- a/wo/cli/plugins/site_functions.py +++ b/wo/cli/plugins/site_functions.py @@ -335,8 +335,8 @@ def setupwordpress(self, data): + "core config " + "--dbname=\'{0}\' --dbprefix=\'{1}\' --dbhost=\'{2}\' " .format(data['wo_db_name'], wo_wp_prefix, data['wo_db_host']) - + "--dbuser=\'{0}\' --dbpass= " - "--extra-php< Date: Tue, 5 Mar 2019 20:22:47 +0100 Subject: [PATCH 43/56] template fix for --wpsubdir --- wo/cli/templates/virtualconf-php7.mustache | 2 +- wo/cli/templates/virtualconf.mustache | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wo/cli/templates/virtualconf-php7.mustache b/wo/cli/templates/virtualconf-php7.mustache index bc58b9c..43baa33 100644 --- a/wo/cli/templates/virtualconf-php7.mustache +++ b/wo/cli/templates/virtualconf-php7.mustache @@ -39,7 +39,7 @@ server { {{/static}} {{^static}}include {{^hhvm}}{{#basic}}common/php73.conf;{{/basic}}{{#wpfc}}common/wpfc-php73.conf;{{/wpfc}} {{#wpsc}}common/wpsc-php73.conf;{{/wpsc}}{{#wpredis}}common/redis-php73.conf;{{/wpredis}} {{/hhvm}}{{#hhvm}}{{#basic}}common/php-hhvm.conf;{{/basic}}{{#wpfc}}common/wpfc-hhvm.conf;{{/wpfc}} {{#wpsc}}common/wpsc-hhvm.conf;{{/wpsc}}{{#wpredis}}common/redis-hhvm.conf;{{/wpredis}} {{/hhvm}} - {{#wpsubdir}}include common/wpsubdir.conf;{{/wpsubdir}}{{/static}} + {{#wpsubdir}}include common/wpsubdir-php73.conf;{{/wpsubdir}}{{/static}} {{#wp}}include common/wpcommon-php73.conf;{{/wp}} {{^proxy}}include common/locations-php73.conf;{{/proxy}} {{^vma}}{{^rc}}include {{webroot}}/conf/nginx/*.conf;{{/rc}}{{/vma}} diff --git a/wo/cli/templates/virtualconf.mustache b/wo/cli/templates/virtualconf.mustache index 2fbd321..3e41457 100644 --- a/wo/cli/templates/virtualconf.mustache +++ b/wo/cli/templates/virtualconf.mustache @@ -38,7 +38,7 @@ server { } {{/static}} - {{^static}}include {{^hhvm}}{{#basic}}common/php72.conf;{{/basic}}{{#wpfc}}common/wpfc-php72.conf;{{/wpfc}} {{#wpsc}}common/wpsc-php72.conf;{{/wpsc}}{{#wpredis}}common/redis-php72.conf;{{/wpredis}} {{/hhvm}}{{#hhvm}}{{#basic}}common/php-hhvm.conf;{{/basic}}{{#wpfc}}common/wpfc-hhvm.conf;{{/wpfc}} {{#wpsc}}common/wpsc-hhvm.conf;{{/wpsc}}{{#wpredis}}common/redis-hhvm.conf;{{/wpredis}} {{/hhvm}} {{#wpsubdir}}include common/wpsubdir.conf;{{/wpsubdir}}{{/static}} + {{^static}}include {{^hhvm}}{{#basic}}common/php72.conf;{{/basic}}{{#wpfc}}common/wpfc-php72.conf;{{/wpfc}} {{#wpsc}}common/wpsc-php72.conf;{{/wpsc}}{{#wpredis}}common/redis-php72.conf;{{/wpredis}} {{/hhvm}}{{#hhvm}}{{#basic}}common/php-hhvm.conf;{{/basic}}{{#wpfc}}common/wpfc-hhvm.conf;{{/wpfc}} {{#wpsc}}common/wpsc-hhvm.conf;{{/wpsc}}{{#wpredis}}common/redis-hhvm.conf;{{/wpredis}} {{/hhvm}} {{#wpsubdir}}include common/wpsubdir-php72.conf;{{/wpsubdir}}{{/static}} {{#wp}}include common/wpcommon-php72.conf;{{/wp}} {{^proxy}}include common/locations-php72.conf;{{/proxy}} {{^vma}}{{^rc}}include {{webroot}}/conf/nginx/*.conf;{{/rc}}{{/vma}} From 050201ae77b62b14963d4952ec75b1ca8762eb00 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Wed, 6 Mar 2019 15:32:07 +0100 Subject: [PATCH 44/56] new nginx templates and wo man --- docs/wo.8 | 34 +++++++++++----------- wo/cli/plugins/stack.py | 19 ++++++++---- wo/cli/templates/redis-php7.mustache | 18 ++---------- wo/cli/templates/redis.mustache | 18 ++---------- wo/cli/templates/virtualconf-php7.mustache | 2 +- wo/cli/templates/virtualconf.mustache | 2 +- wo/cli/templates/webp.mustache | 7 +++++ wo/cli/templates/wpfc-hhvm.mustache | 18 ++---------- wo/cli/templates/wpfc-php7.mustache | 3 +- wo/cli/templates/wpfc.mustache | 3 +- wo/cli/templates/wpsc-hhvm.mustache | 18 ++---------- wo/cli/templates/wpsc-php7.mustache | 1 + wo/cli/templates/wpsc.mustache | 1 + 13 files changed, 54 insertions(+), 90 deletions(-) create mode 100644 wo/cli/templates/webp.mustache diff --git a/docs/wo.8 b/docs/wo.8 index dc08d30..a6128b8 100644 --- a/docs/wo.8 +++ b/docs/wo.8 @@ -5,15 +5,15 @@ .SH SYNOPSIS wo [ --version | --help | info | stack | site | debug | update | clean | import_slow_log | log | secure | sync] .TP -wo stack [ install | remove | purge | migrate | upgrade] [ --web | --mail | --all | --nginx | --php | --php72 | --mysql | --admin | --postfix | --mailscanner | --adminer | --redis | --hhvm | --phpmyadmin | --phpredisadmin | --wpcli | --utils ] +wo stack [ install | remove | purge | migrate | upgrade] [ --web | --all | --nginx | --php | --php73 | --mysql | --admin | --adminer | --redis | --hhvm | --phpmyadmin | --phpredisadmin | --wpcli | --utils ] .TP -wo stack [ status | start | stop | reload | restart ] [--all | --nginx | --php | --php72 |--mysql | --devcot | --web | --postfix | --memcache | --redis] +wo stack [ status | start | stop | reload | restart ] [--all | --nginx | --php | --php73 |--mysql | --web | --memcache | --redis] .TP wo site [ list | info | show | enable | disable | edit | cd | show ] [ example.com ] .TP -wo site create example.com [ --html | --php | --php72 | --mysql] [[--wp | --wpsubdir | --wpsubdomain ] [--wpsc | --w3tc | --wpfc | --wpredis | --hhvm | --letsencrypt/-le]] +wo site create example.com [ --html | --php | --php73 | --mysql] [[--wp | --wpsubdir | --wpsubdomain ] [--wpsc | --wpfc | --wpredis | --hhvm | --letsencrypt/-le]] .TP -wo site update example.com [ --php | --php72 |--mysql] [[--wp | --wpsubdir | --wpsubdomain ] [--wpsc | --w3tc | --wpfc | --wpredis | --hhvm ] [--password] [--letsencrypt=on/off/renew]] +wo site update example.com [ --php | --php73 |--mysql] [[--wp | --wpsubdir | --wpsubdomain ] [--wpsc | --wpfc | --wpredis | --hhvm ] [--password] [--letsencrypt=on/off/renew]] .TP wo site delete example.com [--db | --files | --all | --no-prompt | --force/-f ] .TP @@ -46,19 +46,19 @@ Display WordOps (wo) help. .TP .B stack .TP -.B install [ --all | --web | --mail | --nginx | --php | --php72 |--mysql | --redis | --postfix | --adminer | --phpmyadmin | --phpredismyadmin | --wpcli | --utils ] +.B install [ --all | --web | --nginx | --php | --php73 |--mysql | --redis | --adminer | --phpmyadmin | --phpredismyadmin | --wpcli | --utils ] .br Install Nginx PHP5 MySQL Postfix stack Packages if not used with .br any options.Installs specific package if used with option. .TP -.B remove [ --all | --web | --mail | --nginx | --php | --php72 |--mysql | --redis | --postfix | --adminer | --phpmyadmin | --phpredismyadmin | --wpcli | --utils ] +.B remove [ --all | --web | --nginx | --php | --php73 |--mysql | --redis | --adminer | --phpmyadmin | --phpredismyadmin | --wpcli | --utils ] .br Remove Nginx PHP5 MySQL Postfix stack Packages if not used with .br any options. Remove specific package if used with option. .TP -.B purge [ --all | --web | --mail | --nginx | --php | --php72 |--mysql | --redis | --postfix | --adminer | --phpmyadmin | --phpredismyadmin | --wpcli | --utils ] +.B purge [ --all | --web | --nginx | --php | --php73 |--mysql | --redis | --adminer | --phpmyadmin | --phpredismyadmin | --wpcli | --utils ] .br Purge Nginx PHP5 MySQL Postfix stack Packages if not used with any .br @@ -66,23 +66,23 @@ options.Purge specific package if used with option. .TP .B status .br -Display status of NGINX, PHP5-FPM, MySQL, Postfix, Redis-Server services. +Display status of NGINX, PHP7.2-FPM, MySQL, Redis-Server services. .TP .B start .br -Start services NGINX, PHP5-FPM, MySQL, Postfix, Redis-Server. +Start services NGINX, PHP7.2-FPM, MySQL, Redis-Server. .TP .B stop .br -Stop services NGINX, PHP5-FPM, MySQL, Postfix, Redis-Server. +Stop services NGINX, PHP7.2-FPM, MySQL, Redis-Server. .TP .B reload .br -Reload services NGINX, PHP5-FPM, MySQL, Postfix, Redis-Server. +Reload services NGINX, PHP7.2-FPM, MySQL, Redis-Server. .TP .B restart .br -Restart services NGINX, PHP5-FPM, MySQL, Postfix, Redis-Server. +Restart services NGINX, PHP7.2-FPM, MySQL, Redis-Server. .TP .B site .br @@ -129,13 +129,13 @@ Disable site by Destroying softlink with site file in .br Edit NGINX configuration of site. .TP -.B create [ example.com ] [ --html | --php | --php72 |--mysql] [[--wp | --wpsubdir | --wpsubdomain ] [--wpsc | --w3tc | --wpfc | --wpredis | --hhvm ]] +.B create [ example.com ] [ --html | --php | --php73 |--mysql] [[--wp | --wpsubdir | --wpsubdomain ] [--wpsc | --wpfc | --wpredis | --hhvm ]] .br Create new site according to given options. If no options provided .br create static site with html only. .TP -.B update [ example.com ] [ --html | --php | --php72 |--mysql] [[--wp | --wpsubdir | --wpsubdomain ] [ --wpsc | --w3tc | --wpfc | --wpredis | --hhvm ] [--password]] +.B update [ example.com ] [ --html | --php | --php73 |--mysql] [[--wp | --wpsubdir | --wpsubdomain ] [ --wpsc | --wpfc | --wpredis | --hhvm ] [--password]] .br Update site configuration according to specified options. .TP @@ -143,7 +143,7 @@ Update site configuration according to specified options. .br Delete site i.e webroot, database, ad configuration permanently. .TP -.B debug [ -i | --nginx=on/off | --php=on/off | --php72=on/off | --mysql=on/off | --rewrite=on/off | --fpm=on/off | --fpm7=on/off ] +.B debug [ -i | --nginx=on/off | --php=on/off | --php73=on/off | --mysql=on/off | --rewrite=on/off | --fpm=on/off | --fpm7=on/off ] .br Starts server level debugging. If this is used without arguments it will start debugging .br @@ -182,7 +182,7 @@ used with wo debug command. used to start or stop nginx debugging. .br used with wo debug command. used to start or stop php debugging. .TP -.B --php72=on/off +.B --php73=on/off .br used with wo debug command. used to start or stop php72 debugging. .TP @@ -315,4 +315,4 @@ Report bugs at .br .B Rajdeep Sharma .I \ -.br \ No newline at end of file +.br diff --git a/wo/cli/plugins/stack.py b/wo/cli/plugins/stack.py index 7ef7294..ac2dbbb 100644 --- a/wo/cli/plugins/stack.py +++ b/wo/cli/plugins/stack.py @@ -254,13 +254,22 @@ class WOStackController(CementBaseController): wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/conf.d/map-wp-fastcgi-cache.conf') - wo_nginx = open('/etc/nginx/conf.d/map-wp-fastcgi-cache.conf', + 'file /etc/nginx/conf.d/map-wp.conf') + wo_nginx = open('/etc/nginx/conf.d/map-wp.conf', encoding='utf-8', mode='w') - self.app.render((data), 'fastcgi-cache.mustache', + self.app.render((data), 'map-wp.mustache', out=wo_nginx) wo_nginx.close() + if not (os.path.isfile('/etc/nginx/conf.d/webp.conf')): + Log.debug(self, 'Writting the nginx configuration to ' + 'file /etc/nginx/conf.d/webp.conf') + wo_nginx = open('/etc/nginx/conf.d/webp.conf', + encoding='utf-8', mode='w') + self.app.render((data), 'webp.mustache', + out=wo_nginx) + wo_nginx.close() + # Setup Nginx common directory if not os.path.exists('/etc/nginx/common'): Log.debug(self, 'Creating directory' @@ -317,8 +326,8 @@ class WOStackController(CementBaseController): wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpsubdir-php72.conf') - wo_nginx = open('/etc/nginx/common/wpsubdir-php72.conf', + 'file /etc/nginx/common/wpsubdir.conf') + wo_nginx = open('/etc/nginx/common/wpsubdir.conf', encoding='utf-8', mode='w') self.app.render((data), 'wpsubdir.mustache', out=wo_nginx) diff --git a/wo/cli/templates/redis-php7.mustache b/wo/cli/templates/redis-php7.mustache index 42779bb..217509d 100644 --- a/wo/cli/templates/redis-php7.mustache +++ b/wo/cli/templates/redis-php7.mustache @@ -1,21 +1,7 @@ # Redis NGINX CONFIGURATION # DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE -set $skip_cache 0; -# POST requests and URL with a query string should always go to php -if ($request_method = POST) { - set $skip_cache 1; -} -if ($query_string != "") { - set $skip_cache 1; -} -# Don't cache URL containing the following segments -if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*\.php|index.php|/feed/|.*sitemap.*\.xml)") { - set $skip_cache 1; -} -# Don't use the cache for logged in users or recent commenter or customer with items in cart -if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in|[a-z0-9]+_items_in_cart") { - set $skip_cache 1; -} +# $skip_cache variable set in /etc/nginx/conf.d/map-wp.conf + # Use cached or actual file if they exists, Otherwise pass request to WordPress location / { try_files $uri $uri/ /index.php$is_args$args; diff --git a/wo/cli/templates/redis.mustache b/wo/cli/templates/redis.mustache index 273a1c3..0a7004f 100644 --- a/wo/cli/templates/redis.mustache +++ b/wo/cli/templates/redis.mustache @@ -1,21 +1,7 @@ # Redis NGINX CONFIGURATION # DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE -set $skip_cache 0; -# POST requests and URL with a query string should always go to php -if ($request_method = POST) { - set $skip_cache 1; -} -if ($query_string != "") { - set $skip_cache 1; -} -# Don't cache URL containing the following segments -if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*\.php|index.php|/feed/|.*sitemap.*\.xml)") { - set $skip_cache 1; -} -# Don't use the cache for logged in users or recent commenter or customer with items in cart -if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in|[a-z0-9]+_items_in_cart") { - set $skip_cache 1; -} +# $skip_cache variable set in /etc/nginx/conf.d/map-wp.conf + # Use cached or actual file if they exists, Otherwise pass request to WordPress location / { try_files $uri $uri/ /index.php$is_args$args; diff --git a/wo/cli/templates/virtualconf-php7.mustache b/wo/cli/templates/virtualconf-php7.mustache index 43baa33..bc58b9c 100644 --- a/wo/cli/templates/virtualconf-php7.mustache +++ b/wo/cli/templates/virtualconf-php7.mustache @@ -39,7 +39,7 @@ server { {{/static}} {{^static}}include {{^hhvm}}{{#basic}}common/php73.conf;{{/basic}}{{#wpfc}}common/wpfc-php73.conf;{{/wpfc}} {{#wpsc}}common/wpsc-php73.conf;{{/wpsc}}{{#wpredis}}common/redis-php73.conf;{{/wpredis}} {{/hhvm}}{{#hhvm}}{{#basic}}common/php-hhvm.conf;{{/basic}}{{#wpfc}}common/wpfc-hhvm.conf;{{/wpfc}} {{#wpsc}}common/wpsc-hhvm.conf;{{/wpsc}}{{#wpredis}}common/redis-hhvm.conf;{{/wpredis}} {{/hhvm}} - {{#wpsubdir}}include common/wpsubdir-php73.conf;{{/wpsubdir}}{{/static}} + {{#wpsubdir}}include common/wpsubdir.conf;{{/wpsubdir}}{{/static}} {{#wp}}include common/wpcommon-php73.conf;{{/wp}} {{^proxy}}include common/locations-php73.conf;{{/proxy}} {{^vma}}{{^rc}}include {{webroot}}/conf/nginx/*.conf;{{/rc}}{{/vma}} diff --git a/wo/cli/templates/virtualconf.mustache b/wo/cli/templates/virtualconf.mustache index 3e41457..2fbd321 100644 --- a/wo/cli/templates/virtualconf.mustache +++ b/wo/cli/templates/virtualconf.mustache @@ -38,7 +38,7 @@ server { } {{/static}} - {{^static}}include {{^hhvm}}{{#basic}}common/php72.conf;{{/basic}}{{#wpfc}}common/wpfc-php72.conf;{{/wpfc}} {{#wpsc}}common/wpsc-php72.conf;{{/wpsc}}{{#wpredis}}common/redis-php72.conf;{{/wpredis}} {{/hhvm}}{{#hhvm}}{{#basic}}common/php-hhvm.conf;{{/basic}}{{#wpfc}}common/wpfc-hhvm.conf;{{/wpfc}} {{#wpsc}}common/wpsc-hhvm.conf;{{/wpsc}}{{#wpredis}}common/redis-hhvm.conf;{{/wpredis}} {{/hhvm}} {{#wpsubdir}}include common/wpsubdir-php72.conf;{{/wpsubdir}}{{/static}} + {{^static}}include {{^hhvm}}{{#basic}}common/php72.conf;{{/basic}}{{#wpfc}}common/wpfc-php72.conf;{{/wpfc}} {{#wpsc}}common/wpsc-php72.conf;{{/wpsc}}{{#wpredis}}common/redis-php72.conf;{{/wpredis}} {{/hhvm}}{{#hhvm}}{{#basic}}common/php-hhvm.conf;{{/basic}}{{#wpfc}}common/wpfc-hhvm.conf;{{/wpfc}} {{#wpsc}}common/wpsc-hhvm.conf;{{/wpsc}}{{#wpredis}}common/redis-hhvm.conf;{{/wpredis}} {{/hhvm}} {{#wpsubdir}}include common/wpsubdir.conf;{{/wpsubdir}}{{/static}} {{#wp}}include common/wpcommon-php72.conf;{{/wp}} {{^proxy}}include common/locations-php72.conf;{{/proxy}} {{^vma}}{{^rc}}include {{webroot}}/conf/nginx/*.conf;{{/rc}}{{/vma}} diff --git a/wo/cli/templates/webp.mustache b/wo/cli/templates/webp.mustache new file mode 100644 index 0000000..db3aac4 --- /dev/null +++ b/wo/cli/templates/webp.mustache @@ -0,0 +1,7 @@ +# WEBP NGINX CONFIGURATION +# DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE + +map $http_accept $webp_suffix { + default ""; + "~*webp" ".webp"; +} \ No newline at end of file diff --git a/wo/cli/templates/wpfc-hhvm.mustache b/wo/cli/templates/wpfc-hhvm.mustache index 6326d5d..d0b3f92 100644 --- a/wo/cli/templates/wpfc-hhvm.mustache +++ b/wo/cli/templates/wpfc-hhvm.mustache @@ -1,21 +1,7 @@ # WPFC NGINX CONFIGURATION # DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE -set $skip_cache 0; -# POST requests and URL with a query string should always go to php -if ($request_method = POST) { - set $skip_cache 1; -} -if ($query_string != "") { - set $skip_cache 1; -} -# Don't cache URL containing the following segments -if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*\.php|index.php|/feed/|.*sitemap.*\.xml)") { - set $skip_cache 1; -} -# Don't use the cache for logged in users or recent commenter or customer with items in cart -if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in|[a-z0-9]+_items_in_cart") { - set $skip_cache 1; -} +# $skip_cache variable set in /etc/nginx/conf.d/map-wp.conf + # Use cached or actual file if they exists, Otherwise pass request to WordPress location / { try_files $uri $uri/ /index.php$is_args$args; diff --git a/wo/cli/templates/wpfc-php7.mustache b/wo/cli/templates/wpfc-php7.mustache index 438aab2..aa7f087 100644 --- a/wo/cli/templates/wpfc-php7.mustache +++ b/wo/cli/templates/wpfc-php7.mustache @@ -1,7 +1,8 @@ # WPFC NGINX CONFIGURATION # DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE -# $skip_cache variable set in /etc/nginx/conf.d/map-wp-fastcgi-cache.conf +# $skip_cache variable set in /etc/nginx/conf.d/map-wp.conf +add_header X-fastcgi-cache $upstream_cache_status; # Use cached or actual file if they exists, Otherwise pass request to WordPress location / { try_files $uri $uri/ /index.php$is_args$args; diff --git a/wo/cli/templates/wpfc.mustache b/wo/cli/templates/wpfc.mustache index 6ad47d0..12258d8 100644 --- a/wo/cli/templates/wpfc.mustache +++ b/wo/cli/templates/wpfc.mustache @@ -1,7 +1,8 @@ # WPFC NGINX CONFIGURATION # DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE -# $skip_cache variable set in /etc/nginx/conf.d/map-wp-fastcgi-cache.conf +# $skip_cache variable set in /etc/nginx/conf.d/map-wp.conf +add_header X-fastcgi-cache $upstream_cache_status; # Use cached or actual file if they exists, Otherwise pass request to WordPress location / { try_files $uri $uri/ /index.php$is_args$args; diff --git a/wo/cli/templates/wpsc-hhvm.mustache b/wo/cli/templates/wpsc-hhvm.mustache index 8006d52..4040a4c 100644 --- a/wo/cli/templates/wpsc-hhvm.mustache +++ b/wo/cli/templates/wpsc-hhvm.mustache @@ -1,21 +1,7 @@ # WPSC NGINX CONFIGURATION # DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE -set $cache_uri $request_uri; -# POST requests and URL with a query string should always go to php -if ($request_method = POST) { - set $cache_uri 'null cache'; -} -if ($query_string != "") { - set $cache_uri 'null cache'; -} -# Don't cache URL containing the following segments -if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*\.php|index.php|/feed/|.*sitemap.*\.xml)") { - set $cache_uri 'null cache'; -} -# Don't use the cache for logged in users or recent commenter or customer with items in cart -if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in|[a-z0-9]+_items_in_cart") { - set $cache_uri 'null cache'; -} +# $skip_cache variable set in /etc/nginx/conf.d/map-wp.conf + # Use cached or actual file if they exists, Otherwise pass request to WordPress location / { # If we add index.php?$args its break WooCommerce like plugins diff --git a/wo/cli/templates/wpsc-php7.mustache b/wo/cli/templates/wpsc-php7.mustache index 3089a2d..9c5267e 100644 --- a/wo/cli/templates/wpsc-php7.mustache +++ b/wo/cli/templates/wpsc-php7.mustache @@ -1,5 +1,6 @@ # WPSC NGINX CONFIGURATION # DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE +# $cache_uri variable set in /etc/nginx/conf.d/map-wp.conf # Use cached or actual file if they exists, Otherwise pass request to WordPress location / { diff --git a/wo/cli/templates/wpsc.mustache b/wo/cli/templates/wpsc.mustache index 853399f..d1f795c 100644 --- a/wo/cli/templates/wpsc.mustache +++ b/wo/cli/templates/wpsc.mustache @@ -1,5 +1,6 @@ # WPSC NGINX CONFIGURATION # DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE +# $cache_uri variable set in /etc/nginx/conf.d/map-wp.conf # Use cached or actual file if they exists, Otherwise pass request to WordPress location / { From 6ecd23197471d655edf129db012a3824a6f19756 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Wed, 6 Mar 2019 15:38:43 +0100 Subject: [PATCH 45/56] add map-wp.mustache --- wo/cli/templates/{fastcgi-cache.mustache => map-wp.mustache} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename wo/cli/templates/{fastcgi-cache.mustache => map-wp.mustache} (100%) diff --git a/wo/cli/templates/fastcgi-cache.mustache b/wo/cli/templates/map-wp.mustache similarity index 100% rename from wo/cli/templates/fastcgi-cache.mustache rename to wo/cli/templates/map-wp.mustache From 1a4cdd5f188cff339479c7b039a7ebfbadc4ca60 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Wed, 6 Mar 2019 15:48:21 +0100 Subject: [PATCH 46/56] remove webp.conf from install script * update bash_completion * cleanup wo variables --- config/bash_completion.d/wo_auto.rc | 44 ++++++++++++++--------------- install | 8 ------ wo/core/variables.py | 12 +++++--- 3 files changed, 30 insertions(+), 34 deletions(-) diff --git a/config/bash_completion.d/wo_auto.rc b/config/bash_completion.d/wo_auto.rc index f406c04..03ca47c 100644 --- a/config/bash_completion.d/wo_auto.rc +++ b/config/bash_completion.d/wo_auto.rc @@ -29,7 +29,7 @@ _wo_complete() # IF YOU HAD ANOTHER CONTROLLER, YOU'D HANDLE THAT HERE "debug") COMPREPLY=( $(compgen \ - -W "$(command find /etc/nginx/sites-enabled/ -type l -printf "%P " 2> /dev/null) --nginx --php --php72 --fpm --fpm7 --mysql -i --interactive --all --import-slow-log --import-slow-log-interval= --nginx=off --php=off --php72=off --fpm=off --fpm7=off --mysql=off --all=off " \ + -W "$(command find /etc/nginx/sites-enabled/ -type l -printf "%P " 2> /dev/null) --nginx --php --php73 --fpm --fpm7 --mysql -i --interactive --all --import-slow-log --import-slow-log-interval= --nginx=off --php=off --php73=off --fpm=off --fpm7=off --mysql=off --all=off " \ -- $cur) ) ;; @@ -53,13 +53,13 @@ _wo_complete() "info") COMPREPLY=( $(compgen \ - -W "--mysql --php --php72 --nginx" \ + -W "--mysql --php --php73 --nginx" \ -- $cur) ) ;; "log") COMPREPLY=( $(compgen \ - -W "show reset gzip mail" \ + -W "show reset gzip" \ -- $cur) ) ;; @@ -74,17 +74,17 @@ _wo_complete() # HANDLE EVERYTHING AFTER THE THIRD LEVEL NAMESPACE "install" | "purge" | "remove" ) COMPREPLY=( $(compgen \ - -W "--web --admin --nginx --php --php72 --mysql --wpcli --phpmyadmin --adminer --utils --all --hhvm --redis --phpredisadmin" \ + -W "--web --admin --nginx --php --php73 --mysql --wpcli --phpmyadmin --adminer --utils --all --hhvm --redis --phpredisadmin" \ -- $cur) ) ;; "upgrade" ) COMPREPLY=( $(compgen \ - -W "--web --nginx --php --php72 --mysql --all --hhvm --php56 --no-prompt --wpcli" \ + -W "--web --nginx --php --php73 --mysql --all --hhvm --php56 --no-prompt --wpcli" \ -- $cur) ) ;; "start" | "stop" | "reload" | "restart" | "status") COMPREPLY=( $(compgen \ - -W "--nginx --php --php72 --mysql --memcache --redis" \ + -W "--nginx --php --php73 --mysql --memcache --redis" \ -- $cur) ) ;; "migrate") @@ -136,7 +136,7 @@ _wo_complete() ;; esac - if [ ${COMP_WORDS[1]} == "debug" ] && ([ "$prev" != "--start" ] && [ "$prev" != "--nginx" ] && [ "$prev" != "--php" ] && [ "$prev" != "--php72" ] && [ "$prev" != "--fpm" ] && [ "$prev" != "--fpm7" ] && [ "$prev" != "--mysql" ] && [ "$prev" != "-i" ] && [ "$prev" != "--interactive" ] && [ "$prev" != "--import-slow-log" ] && [ "$prev" != "--stop" ]); then + if [ ${COMP_WORDS[1]} == "debug" ] && ([ "$prev" != "--start" ] && [ "$prev" != "--nginx" ] && [ "$prev" != "--php" ] && [ "$prev" != "--php73" ] && [ "$prev" != "--fpm" ] && [ "$prev" != "--fpm7" ] && [ "$prev" != "--mysql" ] && [ "$prev" != "-i" ] && [ "$prev" != "--interactive" ] && [ "$prev" != "--import-slow-log" ] && [ "$prev" != "--stop" ]); then retlist="--all --wp --rewrite -i --all=off --wp=off --rewrite=off" ret="${retlist[@]/$prev}" COMPREPLY=( $(compgen \ @@ -159,13 +159,13 @@ _wo_complete() "create") COMPREPLY=( $(compgen \ - -W "--user --pass --email --html --php --php72 --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --hhvm --proxy= --wpredis --letsencrypt -le" \ + -W "--user --pass --email --html --php --php73 --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --hhvm --proxy= --wpredis --letsencrypt -le" \ -- $cur) ) ;; "update") COMPREPLY=( $(compgen \ - -W "--password --php --php72 --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --hhvm --hhvm=off --wpredis --letsencrypt --letsencrypt=off --letsencrypt=renew" \ + -W "--password --php --php73 --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --hhvm --hhvm=off --wpredis --letsencrypt --letsencrypt=off --letsencrypt=renew" \ -- $cur) ) ;; "delete") @@ -211,9 +211,9 @@ _wo_complete() "--wp") if [ ${COMP_WORDS[1]} != "debug" ]; then if [ ${COMP_WORDS[2]} == "create" ]; then - retlist="--wp --wpsc --wpfc --hhvm --user --email --pass --wpredis --letsencrypt --php72" + retlist="--wp --wpsc --wpfc --hhvm --user --email --pass --wpredis --letsencrypt --php73" elif [ ${COMP_WORDS[2]} == "update" ]; then - retlist="--wp --wpfc --wpsc --php72 --php72=off --hhvm --hhvm=off --wpredis --letsencrypt --letsencrypt=off --letsencrypt=renew" + retlist="--wp --wpfc --wpsc --php73 --php73=off --hhvm --hhvm=off --wpredis --letsencrypt --letsencrypt=off --letsencrypt=renew" else retlist="" fi @@ -230,9 +230,9 @@ _wo_complete() "--wpsubdir" | "--wpsubdomain") if [ ${COMP_WORDS[1]} != "debug" ]; then if [ ${COMP_WORDS[2]} == "create" ]; then - retlist="--wpsc --wpfc --hhvm --user --email --pass --wpredis --letsencrypt --php72" + retlist="--wpsc --wpfc --hhvm --user --email --pass --wpredis --letsencrypt --php73" elif [ ${COMP_WORDS[2]} == "update" ]; then - retlist="--wpfc --wpsc --php72 --php72=off --hhvm --hhvm=off --wpredis --letsencrypt --letsencrypt=off --letsencrypt=renew" + retlist="--wpfc --wpsc --php73 --php73=off --hhvm --hhvm=off --wpredis --letsencrypt --letsencrypt=off --letsencrypt=renew" else retlist="" fi @@ -248,7 +248,7 @@ _wo_complete() "--hhvm" | "--wpredis" | "--wpfc" | "--wpsc" | "--wpsubdir" | "--wpsubdomain" | "--user" | "--pass" | "--email" | "--wp") if [ ${COMP_WORDS[2]} == "create" ]; then - retlist="--user --pass --email --wp --wpsubdir --wpsubdomain --wpfc --wpsc --hhvm --experimenal --wpredis --php72 --letsencrypt " + retlist="--user --pass --email --wp --wpsubdir --wpsubdomain --wpfc --wpsc --hhvm --wpredis --php73 --letsencrypt " else retlist="" fi @@ -261,7 +261,7 @@ _wo_complete() "--hhvm" | "--wpredis" | "--wpfc") if [ ${COMP_WORDS[2]} == "update" ]; then - retlist="--password --php --php72 --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --hhvm --hhvm=off --experimenal --wpredis --letsencrypt --letsencrypt=off --letsencrypt=renew" + retlist="--password --php --php73 --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --hhvm --hhvm=off --wpredis --letsencrypt --letsencrypt=off --letsencrypt=renew" else retlist="" fi @@ -272,15 +272,15 @@ _wo_complete() -- $cur) ) ;; - "--web" | "--admin" | "--nginx" | "--php" | "--php72" | "--mysql" | "--wpcli" | "--phpmyadmin" | "--adminer" | "--utils" | "--memcache" | "--redis | --phpredisadmin") + "--web" | "--admin" | "--nginx" | "--php" | "--php73" | "--mysql" | "--wpcli" | "--phpmyadmin" | "--adminer" | "--utils" | "--memcache" | "--redis | --phpredisadmin") if [[ ${COMP_WORDS[2]} == "install" || ${COMP_WORDS[2]} == "purge" || ${COMP_WORDS[2]} == "remove" ]]; then - retlist="--web --admin --nginx --php --php72 --mysql--wpcli --phpmyadmin --adminer --utils --memcache --redis --phpredisadmin" + retlist="--web --admin --nginx --php --php73 --mysql--wpcli --phpmyadmin --adminer --utils --memcache --redis --phpredisadmin" elif [[ ${COMP_WORDS[2]} == "start" || ${COMP_WORDS[2]} == "reload" || ${COMP_WORDS[2]} == "restart" || ${COMP_WORDS[2]} == "stop" ]]; then - retlist="--nginx --php --php72 --mysql --memcache --redis" + retlist="--nginx --php --php73 --mysql --memcache --redis" elif [[ ${COMP_WORDS[1]} == "debug" ]]; then - retlist="--start --nginx --php --php72 --fpm --fpm7 --mysql -i --interactive -stop --import-slow-log --import-slow-log-interval= -" + retlist="--start --nginx --php --php73 --fpm --fpm7 --mysql -i --interactive -stop --import-slow-log --import-slow-log-interval= -" if [[ $prev == '--mysql' ]]; then - retlist="--start --nginx --php --php72 --fpm --fpm7 --mysql -i --interactive --stop --import-slow-log" + retlist="--start --nginx --php --php73 --fpm --fpm7 --mysql -i --interactive --stop --import-slow-log" fi elif [[ ${COMP_WORDS[1]} == "log" ]]; then if [ ${COMP_WORDS[2]} == "show" ]; then @@ -314,7 +314,7 @@ _wo_complete() elif [ ${COMP_WORDS[2]} == "delete" ]; then retlist="--db --files --force" elif [ ${COMP_WORDS[2]} == "update" ]; then - retlist="--password --php --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --hhvm --hhvm=off --wpredis --letsencrypt --letsencrypt=off --letsencrypt=renew" + retlist="--password --php --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --hhvm --hhvm=off --wpredis --letsencrypt --letsencrypt=off --letsencrypt=renew" else retlist="" fi @@ -363,7 +363,7 @@ _wo_complete() case "$mprev" in "--user" | "--email" | "--pass") if [ ${COMP_WORDS[2]} == "create" ]; then - retlist="--user --pass --email --html --php --php72 --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --hhvm --wpredis --letsencrypt" + retlist="--user --pass --email --html --php --php73 --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --hhvm --wpredis --letsencrypt" fi ret="${retlist[@]/$prev}" COMPREPLY=( $(compgen \ diff --git a/install b/install index c843fc6..4131b1e 100644 --- a/install +++ b/install @@ -148,14 +148,6 @@ wo_install_dep() sed -i 's/TLSv1 TLSv1.1 TLSv1.2;/TLSv1.2;/g' /etc/nginx/nginx.conf fi - ### - # Webp mapping - ### - [ ! -f /etc/nginx/conf.d/webp.conf ] && { - mkdir -p /etc/nginx/conf.d - echo -e 'map $http_accept $webp_suffix {\n default "";\n "~*webp" ".webp";\n}\n' > /etc/nginx/conf.d/webp.conf - } - # Let's Encrypt .well-known folder setup if [ ! -d /var/www/html/.well-known/acme-challenge ]; then mkdir -p /var/www/html/.well-known/acme-challenge diff --git a/wo/core/variables.py b/wo/core/variables.py index feab156..61d7e9d 100644 --- a/wo/core/variables.py +++ b/wo/core/variables.py @@ -107,11 +107,13 @@ class WOVariables(): 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"] + "php7.2-bcmath", "php7.2-mysql", "php7.2-opcache", + "php7.2-zip", "php7.2-xml", "php7.2-soap"] wo_php73 = ["php7.3-fpm", "php7.3-curl", "php7.3-gd", "php7.3-imap", "php7.3-readline", "php7.3-common", "php7.3-recode", "php7.3-cli", "php7.3-mbstring", - "php7.3-bcmath", "php7.3-mysql", "php7.3-opcache", "php7.3-zip", "php7.3-xml", "php7.3-soap"] + "php7.3-bcmath", "php7.3-mysql", "php7.3-opcache", + "php7.3-zip", "php7.3-xml", "php7.3-soap"] wo_php_extra = ["php-memcached", "php-imagick", "memcached", "graphviz", "php-xdebug", "php-msgpack", "php-redis"] elif wo_platform_distro == 'debian': @@ -120,13 +122,15 @@ class WOVariables(): wo_php = ["php7.2-fpm", "php7.2-curl", "php7.2-gd", "php7.2-imap", "php7.2-common", "php7.2-readline", "php-redis", "php7.2-mysql", "php7.2-cli", "php-imagick", - "php7.2-mbstring", "php7.2-recode", "php7.2-bcmath", "php7.2-opcache", "php7.2-zip", "php7.2-xml", + "php7.2-mbstring", "php7.2-recode", "php7.2-bcmath", + "php7.2-opcache", "php7.2-zip", "php7.2-xml", "php7.2-soap", "php-msgpack", "graphviz", "php-pear", "php-xdebug"] wo_php73 = ["php7.3-fpm", "php7.3-curl", "php7.3-gd", "php7.3-imap", "php7.3-common", "php7.3-readline", "php-redis", "php7.3-mysql", "php7.3-cli", "php-imagick", - "php7.3-mbstring", "php7.3-recode", "php7.3-bcmath", "php7.3-opcache", "php7.3-zip", "php7.3-xml", + "php7.3-mbstring", "php7.3-recode", "php7.3-bcmath", + "php7.3-opcache", "php7.3-zip", "php7.3-xml", "php7.3-soap", "php-msgpack", "graphviz", "php-pear", "php-xdebug"] wo_php_extra = [] From d8765a47264e672e4d28617f2512353445ef3f49 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Wed, 6 Mar 2019 15:55:39 +0100 Subject: [PATCH 47/56] update nginx upstreams --- wo/cli/templates/upstream.mustache | 41 +++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/wo/cli/templates/upstream.mustache b/wo/cli/templates/upstream.mustache index 00a1ba0..89cb5b1 100644 --- a/wo/cli/templates/upstream.mustache +++ b/wo/cli/templates/upstream.mustache @@ -1,27 +1,50 @@ # Common upstream settings + +# PHP 5.6 upstream upstream php { server 127.0.0.1:9000; } + upstream debug { # Debug Pool server 127.0.0.1:9001; } -upstream php72 { -server unix:/var/run/php/php72-fpm.sock; -} -upstream php73 { -server unix:/var/run/php/php73-fpm.sock; -} -{{#php7conf}} + +# PHP 7.0 upstream upstream php7 { server 127.0.0.1:9070; } -upstream debug7 { + +# PHP 7.2 upstream with load-balancing on two unix sockets +upstream php72 { +server unix:/var/run/php/php72-fpm.sock; +} + +# PHP 7.2 debug +upstream debug72 { # Debug Pool -server 127.0.0.1:9170; +server 127.0.0.1:9172; +} + +# PHP 7.3 upstream with load-balancing on two unix sockets +upstream php73 { +server unix:/var/run/php/php73-fpm.sock; +} + +{{#php7conf}} +# PHP 7.3 debug +upstream debug73 { +# Debug Pool +server 127.0.0.1:9173; } {{/php7conf}} +# Netdata Monitoring Upstream +upstream netdata { + server 127.0.0.1:19999; + keepalive 64; +} + {{#hhvmconf}} upstream hhvm { # HHVM Pool From 5d3368cd34652d41dabd48c407f50df590a931c7 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Wed, 6 Mar 2019 18:22:19 +0100 Subject: [PATCH 48/56] fix wordpress user_pass --- wo/cli/plugins/site_functions.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/wo/cli/plugins/site_functions.py b/wo/cli/plugins/site_functions.py index 68ff719..4eea310 100644 --- a/wo/cli/plugins/site_functions.py +++ b/wo/cli/plugins/site_functions.py @@ -301,24 +301,24 @@ def setupwordpress(self, data): "--dbhost=\'{3}\' " .format(data['wo_db_name'], wo_wp_prefix, data['wo_db_user'], data['wo_db_host']) - + "--dbpass= " + + "--dbpass=\'{0}\' " "--extra-php< Date: Wed, 6 Mar 2019 18:33:55 +0100 Subject: [PATCH 49/56] fix redis stack --- wo/cli/plugins/stack.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wo/cli/plugins/stack.py b/wo/cli/plugins/stack.py index ac2dbbb..56af34c 100644 --- a/wo/cli/plugins/stack.py +++ b/wo/cli/plugins/stack.py @@ -761,8 +761,8 @@ class WOStackController(CementBaseController): " keepalive 10;\n}\n") if os.path.isfile("/etc/nginx/nginx.conf") and (not - os.path.isfile("/etc/nginx/conf.d/redis-php72.conf")): - with open("/etc/nginx/conf.d/redis-php72.conf", "a") as redis_file: + os.path.isfile("/etc/nginx/conf.d/redis.conf")): + with open("/etc/nginx/conf.d/redis.conf", "a") as redis_file: redis_file.write("# Log format Settings\n" "log_format rt_cache_redis '$remote_addr $upstream_response_time $srcache_fetch_status [$time_local] '\n" "'$http_host \"$request\" $status $body_bytes_sent '\n" From 5eacbf858bdcc0c3146da83ca8507f23bf5552e9 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Wed, 6 Mar 2019 22:33:00 +0100 Subject: [PATCH 50/56] update travis * add more test for php7.3 stack --- .travis.yml | 67 ++++++++++++++++++----------------------------------- 1 file changed, 22 insertions(+), 45 deletions(-) diff --git a/.travis.yml b/.travis.yml index c2c50b1..5581386 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,73 +24,50 @@ script: - sudo bash install $TRAVIS_BRANCH - sudo wo --help - sudo wo stack install || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo stack install --web || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo stack install --web || sudo tail -n50 /var/log/wo/wordops.log - sudo wo stack install --admin || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site create html.net --html || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site create php.com --php || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create mysql.com --mysql || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create mysqlphp73.com --mysql --php73 || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create mysql-php73.com --mysql --php73 || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wp1.com --wp || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create wpphp73.com --wp --php73 || sudo tail -n50 /var/log/wo/wordops.log - - - sudo wo site create wpsc1.net --wp --wpsc || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wp-php73.com --wp --php73 || sudo tail -n50 /var/log/wo/wordops.log + + - sudo wo site create wpsc1.net --wpsc || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site create wpfc1.com --wpfc || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create wpfc2.net --wp --wpfc || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create wpfc3.org --wpfc --wp || sudo tail -n50 /var/log/wo/wordops.log + + - sudo wo site create wpsc-php73.net --wpsc --php73 || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wpfc-php73.net --wpfc --php73 || sudo tail -n50 /var/log/wo/wordops.log + + - sudo wo site create wpredis.net --wpredis || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wpredis-php73.net --wpredis --php73 || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wpsubdir1.com --wpsubdir || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wpsubdir-php73.com --wpsubdir --php73 || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site create wpsubdirwpsc1.com --wpsubdir --wpsc || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site create wpsubdirwpsc2.com --wpsubdir --wpfc || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create wpsubdirwpfc3.net --wpfc --wpsubdir || sudo tail -n50 /var/log/wo/wordops.log + + - sudo wo site create wpsubdirwpsc1-php73.com --wpsubdir --wpsc --php73 || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wpsubdirwpsc2-php73.com --wpsubdir --wpfc --php73|| sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wpsubdomain1.com --wpsubdomain || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site create wpsubdomain1-php73.com --wpsubdomain --php73 || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site create wpsubdomainwpsc.org --wpsubdomain --wpsc || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site create wpsubdomainwpfc.org --wpsubdomain --wpfc || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site create wpsubdomainwpfc2.in --wpfc --wpsubdomain || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create site1.localtest.me --php --mysql || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create site2.localtest.me --mysql --html || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create site3.localtest.me --php --html || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create site4.localtest.me --wp --wpsubdomain || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create site5.localtest.me --wp --wpsubdir --wpfc || sudo tail -n50 /var/log/wo/wordops.log - - yes | sudo wo site create site6.localtest.me --wpredis || sudo tail -n50 /var/log/wo/wordops.log - - yes | sudo wo site create site7.localtest.me --wpsubdomain --wpredis || sudo tail -n50 /var/log/wo/wordops.log - - yes | sudo wo site create site8.localtest.me --wpsubdir --wpredis || sudo tail -n50 /var/log/wo/wordops.log - - - - sudo wo debug --all || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo debug --all=off || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo debug site12.net || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo debug site12.net --all=off || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site create 1.com --html || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site create 2.com --php || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site create 3.com --mysql || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site update 1.com --wp || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site update 2.com --wpsubdir || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site update 3.com --wpsubdomain || sudo tail -n50 /var/log/wo/wordops.log - - - sudo wo site update site1.com --wp --wpfc || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site update site1.com --wp --wpsc || sudo tail -n50 /var/log/wo/wordops.log - - yes | sudo wo site update site1.com --wpredis || sudo tail -n50 /var/log/wo/wordops.log - - - sudo wo site update site5.com --wpsubdir --wpfc || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site update site5.com --wpsubdir --wpsc || sudo tail -n50 /var/log/wo/wordops.log - - - sudo wo site update site9.com --wpsubdomain --wpfc || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site update site9.com --wpsubdomain --wpsc || sudo tail -n50 /var/log/wo/wordops.log - - yes | sudo wo site update site.hhvm.pagespeed12.in --hhvm=off || sudo tail -n50 /var/log/wo/wordops.log - - yes | sudo wo site update site9.com --hhvm || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site info site.hhvm.pagespeed12.in || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site info site9.com || sudo tail -n50 /var/log/wo/wordops.log - - - sudo wo site create www.site-1.com --wp || sudo tail -n50 /var/log/wo/wordops.log|| sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site create www.subsite.site-1.com --wpfc || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site update www.subsite.site-1.com --wp || sudo tail -n50 /var/log/wo/wordops.log - - sudo wo site delete www.subsite.site-1.com --all --no-prompt || sudo tail -n50 /var/log/wo/wordops.log - - - sudo wo site delete site12.in --all --no-prompt || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site update 2.com --php73 || sudo tail -n50 /var/log/wo/wordops.log + - sudo wo site update 3.com --php73 || sudo tail -n50 /var/log/wo/wordops.log - sudo ls /var/www/ - sudo wp --allow-root --info From 42092d788503cf0ad7d05a1b64da86ba9c72657e Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Thu, 7 Mar 2019 12:36:32 +0100 Subject: [PATCH 51/56] remove --experimental --- install | 9 ++++----- wo/cli/plugins/site.py | 8 ++++---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/install b/install index 4131b1e..684ab65 100644 --- a/install +++ b/install @@ -27,7 +27,7 @@ TPUT_FAIL=$(tput setaf 1) wo_lib_echo () { TPUT_ECHO=$(tput setaf 4) - echo "${TPUT_ECHO}${*}${TPUT_RESET}" + echo "${*}${TPUT_RESET}" } wo_lib_echo_info() @@ -123,17 +123,17 @@ fi #### wo_install_dep() { - echo -ne ' Installing dependencies [..]\r' + echo -ne "${TPUT_ECHO}Installing dependencies ${TPUT_RESET}[..]\r" if { 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 pigz gnupg2 > /dev/null 2>&1 else apt-get -y install build-essential curl gzip dirmngr python3 python3-apt python3-setuptools python3-dev sqlite3 git tar software-properties-common pigz gnupg2 > /dev/null 2>&1 fi - }; then echo -ne ' Installing dependencies [OK]\r' + }; then echo -ne "${TPUT_ECHO}Installing dependencies ${TPUT_RESET}[OK]\r" echo -ne '\n' else - echo -e " Installing dependencies [FAIL]" + echo -e "${TPUT_FAIL}Installing dependencies ${TPUT_RESET}[FAIL]" echo -ne '\n' fi locale-gen en &>> /dev/null @@ -695,7 +695,6 @@ else fi else # 3 - Fresh WO setup - wo_lib_echo "Installing depedencies" | tee -ai $wo_install_log wo_install_dep | tee -ai $wo_install_log wo_lib_echo "Installing WordOps $wo_branch" | tee -ai $wo_install_log wo_install | tee -ai $wo_install_log diff --git a/wo/cli/plugins/site.py b/wo/cli/plugins/site.py index 417342d..69fcc1b 100644 --- a/wo/cli/plugins/site.py +++ b/wo/cli/plugins/site.py @@ -1180,7 +1180,7 @@ class WOSiteUpdateController(CementBaseController): if pargs.hhvm == "on" or pargs.letsencrypt == "on" or pargs.php73 == "on": if pargs.php73 == "on": - if (not pargs.experimental): + if pargs.experimental: Log.info( self, "Do you wish to enable PHP 7.3 now for {0}?".format(wo_domain)) @@ -1197,7 +1197,7 @@ class WOSiteUpdateController(CementBaseController): php73 = True if pargs.hhvm == "on": - if (not pargs.experimental): + if pargs.experimental: Log.info(self, "HHVM is experimental feature and it may not" " work with all plugins of your site.\nYou can " "disable it by passing --hhvm=off later.\nDo you wish" @@ -1218,7 +1218,7 @@ class WOSiteUpdateController(CementBaseController): if pargs.letsencrypt == "on": - if (not pargs.experimental): + if pargs.experimental: if oldsitetype in ['wpsubdomain']: Log.warn( @@ -1241,7 +1241,7 @@ class WOSiteUpdateController(CementBaseController): letsencrypt = True if pargs.wpredis and data['currcachetype'] != 'wpredis': - if (not pargs.experimental): + if pargs.experimental: Log.info(self, "Redis is experimental feature and it may not" " work with all plugins of your site.\nYou can " "disable it by changing cache type later.\nDo you wish" From 9b3e318121247ace7cb60f36702acb77c8c9270d Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Thu, 7 Mar 2019 13:15:15 +0100 Subject: [PATCH 52/56] set proper services names * rename memcache to memcached * remove outdated platform checks --- wo/cli/plugins/clean.py | 18 ++-- wo/cli/plugins/info.py | 25 ++--- wo/cli/plugins/log.py | 4 +- wo/cli/plugins/stack.py | 18 ++-- wo/cli/plugins/stack_migrate.py | 8 +- wo/cli/plugins/stack_services.py | 180 ++++++++++++------------------- wo/core/variables.py | 22 ++-- 7 files changed, 109 insertions(+), 166 deletions(-) diff --git a/wo/cli/plugins/clean.py b/wo/cli/plugins/clean.py index 8780e8e..b94e5f8 100644 --- a/wo/cli/plugins/clean.py +++ b/wo/cli/plugins/clean.py @@ -19,14 +19,14 @@ class WOCleanController(CementBaseController): label = 'clean' stacked_on = 'base' stacked_type = 'nested' - description = ('Clean NGINX FastCGI cache, Opcache, Memcache, Redis Cache') + description = ('Clean NGINX FastCGI cache, Opcache, Memcached, Redis Cache') arguments = [ (['--all'], dict(help='Clean all cache', action='store_true')), (['--fastcgi'], dict(help='Clean FastCGI cache', action='store_true')), - (['--memcache'], - dict(help='Clean MemCache', action='store_true')), + (['--memcached'], + dict(help='Clean MemCached', action='store_true')), (['--opcache'], dict(help='Clean OpCache', action='store_true')), (['--redis'], @@ -37,18 +37,18 @@ class WOCleanController(CementBaseController): @expose(hide=True) def default(self): if (not (self.app.pargs.all or self.app.pargs.fastcgi or - self.app.pargs.memcache or self.app.pargs.opcache or + self.app.pargs.memcached or self.app.pargs.opcache or self.app.pargs.redis)): self.clean_fastcgi() if self.app.pargs.all: - self.clean_memcache() + self.clean_memcached() self.clean_fastcgi() self.clean_opcache() self.clean_redis() if self.app.pargs.fastcgi: self.clean_fastcgi() - if self.app.pargs.memcache: - self.clean_memcache() + if self.app.pargs.memcached: + self.clean_memcached() if self.app.pargs.opcache: self.clean_opcache() if self.app.pargs.redis: @@ -68,9 +68,9 @@ class WOCleanController(CementBaseController): try: if(WOAptGet.is_installed(self, "memcached")): WOService.restart_service(self, "memcached") - Log.info(self, "Cleaning MemCache") + Log.info(self, "Cleaning MemCached") else: - Log.info(self, "Memcache not installed") + Log.info(self, "Memcached not installed") except Exception as e: Log.debug(self, "{0}".format(e)) Log.error(self, "Unable to restart Memcached", False) diff --git a/wo/cli/plugins/info.py b/wo/cli/plugins/info.py index 1576b04..16309a3 100644 --- a/wo/cli/plugins/info.py +++ b/wo/cli/plugins/info.py @@ -66,19 +66,17 @@ class WOInfoController(CementBaseController): @expose(hide=True) def info_php(self): """Display PHP information""" - version = os.popen("{0} -v 2>/dev/null | head -n1 | cut -d' ' -f2 |".format("php7.2" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php") + + version = os.popen("php7.2 -v 2>/dev/null | head -n1 | cut -d' ' -f2 |" " cut -d'+' -f1 | tr -d '\n'").read config = configparser.ConfigParser() - config.read('/etc/{0}/fpm/php.ini'.format("php/7.2" if (WOVariables.wo_platform_codename == - 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) + config.read('/etc/{0}/fpm/php.ini'.format("php/7.2")) 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/{0}/fpm/pool.d/www.conf'.format("php/7.2" if (WOVariables.wo_platform_codename == - 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) + config.read('/etc/{0}/fpm/pool.d/www.conf'.format("php/7.2")) www_listen = config['www']['listen'] www_ping_path = config['www']['ping.path'] www_pm_status_path = config['www']['pm.status_path'] @@ -96,8 +94,7 @@ class WOInfoController(CementBaseController): except Exception as e: www_xdebug = 'off' - config.read('/etc/{0}/fpm/pool.d/debug.conf'.format("php/7.2" if (WOVariables.wo_platform_codename == - 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) + config.read('/etc/{0}/fpm/pool.d/debug.conf'.format("php/7.2")) debug_listen = config['debug']['listen'] debug_ping_path = config['debug']['ping.path'] debug_pm_status_path = config['debug']['pm.status_path'] @@ -251,7 +248,7 @@ class WOInfoController(CementBaseController): self.app.pargs.php = True self.app.pargs.mysql = True if WOAptGet.is_installed(self, 'php7.3-fpm'): - self.app.pargs.php = True + self.app.pargs.php73 = True if self.app.pargs.nginx: if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self, 'nginx-common'): @@ -260,16 +257,10 @@ class WOInfoController(CementBaseController): Log.error(self, "Nginx is not installed") if self.app.pargs.php: - if (WOVariables.wo_platform_distro == 'debian' or WOVariables.wo_platform_codename == 'precise'): - if WOAptGet.is_installed(self, 'php7.2-fpm'): - self.info_php() - else: - Log.error(self, "PHP 7.2 is not installed") + if WOAptGet.is_installed(self, 'php7.2-fpm'): + self.info_php() else: - if WOAptGet.is_installed(self, 'php7.2-fpm'): - self.info_php() - else: - Log.error(self, "PHP 7.2 is not installed") + Log.error(self, "PHP 7.2 is not installed") if self.app.pargs.php73: if WOAptGet.is_installed(self, 'php7.3-fpm'): diff --git a/wo/cli/plugins/log.py b/wo/cli/plugins/log.py index f7ef3d8..14579e9 100644 --- a/wo/cli/plugins/log.py +++ b/wo/cli/plugins/log.py @@ -444,9 +444,9 @@ class WOLogMailController(CementBaseController): (['--nginx'], dict(help='Mail Nginx Error logs file', action='store_true')), (['--php'], - dict(help='Mail PHP Error logs file', action='store_true')), + dict(help='Mail PHP 7.2 Error logs file', action='store_true')), (['--fpm'], - dict(help='Mail PHP5-fpm slow logs file', + dict(help='Mail PHP 7.2-fpm slow logs file', action='store_true')), (['--mysql'], dict(help='Mail MySQL logs file', action='store_true')), diff --git a/wo/cli/plugins/stack.py b/wo/cli/plugins/stack.py index 56af34c..ea23221 100644 --- a/wo/cli/plugins/stack.py +++ b/wo/cli/plugins/stack.py @@ -1218,16 +1218,16 @@ class WOStackController(CementBaseController): WOVariables.wo_php_user, WOVariables.wo_php_user, recursive=True) - if any('/tmp/memcache.tar.gz' == x[1] + if any('/tmp/memcached.tar.gz' == x[1] for x in packages): - Log.debug(self, "Extracting memcache.tar.gz to location" - " {0}22222/htdocs/cache/memcache " + Log.debug(self, "Extracting memcached.tar.gz to location" + " {0}22222/htdocs/cache/memcached " .format(WOVariables.wo_webroot)) - WOExtract.extract(self, '/tmp/memcache.tar.gz', - '{0}22222/htdocs/cache/memcache' + WOExtract.extract(self, '/tmp/memcached.tar.gz', + '{0}22222/htdocs/cache/memcached' .format(WOVariables.wo_webroot)) Log.debug(self, "Setting Privileges to " - "{0}22222/htdocs/cache/memcache file" + "{0}22222/htdocs/cache/memcached file" .format(WOVariables.wo_webroot)) WOFileUtils.chown(self, '{0}22222' .format(WOVariables.wo_webroot), @@ -1527,7 +1527,7 @@ class WOStackController(CementBaseController): Log.debug(self, "Setting packages variable for utils") packages = packages + [["https://storage.googleapis.com/google-code-archive-downloads/" "v2/code.google.com/phpmemcacheadmin/" - "phpMemcachedAdmin-1.2.2-r262.tar.gz", '/tmp/memcache.tar.gz', + "phpMemcachedAdmin-1.2.2-r262.tar.gz", '/tmp/memcached.tar.gz', 'phpMemcachedAdmin'], ["https://raw.githubusercontent.com" "/rtCamp/eeadmin/master/cache/nginx/" @@ -1725,7 +1725,7 @@ class WOStackController(CementBaseController): .format(WOVariables.wo_webroot), '{0}22222/htdocs/cache/nginx/' 'clean.php'.format(WOVariables.wo_webroot), - '{0}22222/htdocs/cache/memcache' + '{0}22222/htdocs/cache/memcached' .format(WOVariables.wo_webroot), '/usr/bin/pt-query-advisor', '{0}22222/htdocs/db/anemometer' @@ -1862,7 +1862,7 @@ class WOStackController(CementBaseController): .format(WOVariables.wo_webroot), '{0}22222/htdocs/cache/nginx/' 'clean.php'.format(WOVariables.wo_webroot), - '{0}22222/htdocs/cache/memcache' + '{0}22222/htdocs/cache/memcached' .format(WOVariables.wo_webroot), '/usr/bin/pt-query-advisor', '{0}22222/htdocs/db/anemometer' diff --git a/wo/cli/plugins/stack_migrate.py b/wo/cli/plugins/stack_migrate.py index e835c68..64c612e 100644 --- a/wo/cli/plugins/stack_migrate.py +++ b/wo/cli/plugins/stack_migrate.py @@ -56,21 +56,21 @@ class WOStackMigrateController(CementBaseController): % e) Log.debug(self, "Pre-seeding MariaDB") - Log.debug(self, "echo \"mariadb-server-10.0 " + Log.debug(self, "echo \"mariadb-server-10.3 " "mysql-server/root_password " "password \" | " "debconf-set-selections") - WOShellExec.cmd_exec(self, "echo \"mariadb-server-10.0 " + WOShellExec.cmd_exec(self, "echo \"mariadb-server-10.3 " "mysql-server/root_password " "password {chars}\" | " "debconf-set-selections" .format(chars=chars), log=False) - Log.debug(self, "echo \"mariadb-server-10.0 " + Log.debug(self, "echo \"mariadb-server-10.3 " "mysql-server/root_password_again " "password \" | " "debconf-set-selections") - WOShellExec.cmd_exec(self, "echo \"mariadb-server-10.0 " + WOShellExec.cmd_exec(self, "echo \"mariadb-server-10.3 " "mysql-server/root_password_again " "password {chars}\" | " "debconf-set-selections" diff --git a/wo/cli/plugins/stack_services.py b/wo/cli/plugins/stack_services.py index bf9fbe6..8d16908 100644 --- a/wo/cli/plugins/stack_services.py +++ b/wo/cli/plugins/stack_services.py @@ -13,8 +13,8 @@ class WOStackStatusController(CementBaseController): stacked_type = 'embedded' description = 'Check the stack status' arguments = [ - (['--memcache'], - dict(help='start/stop/restart memcache', action='store_true')), + (['--memcached'], + dict(help='start/stop/restart memcached', action='store_true')), ] @expose(help="Start stack services") @@ -22,7 +22,7 @@ class WOStackStatusController(CementBaseController): """Start services""" services = [] if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php73 - or self.app.pargs.mysql or self.app.pargs.hhvm or self.app.pargs.memcache + or self.app.pargs.mysql or self.app.pargs.hhvm or self.app.pargs.memcached or self.app.pargs.redis): self.app.pargs.nginx = True self.app.pargs.php = True @@ -35,30 +35,20 @@ class WOStackStatusController(CementBaseController): Log.info(self, "Nginx is not installed") if self.app.pargs.php: - if (WOVariables.wo_platform_distro == 'debian' or WOVariables.wo_platform_codename == 'precise'): - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] - else: - Log.info(self, "PHP7.2-FPM is not installed") + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] - else: - Log.info(self, "PHP7.2-FPM is not installed") - - if WOAptGet.is_installed(self, 'php7.3-fpm'): - services = services + ['php7.3-fpm'] - else: - Log.info(self, "PHP7.3-FPM is not installed") + Log.info(self, "PHP7.2-FPM is not installed") + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] + else: + Log.info(self, "PHP7.3-FPM is not installed") if self.app.pargs.php73: - if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - if WOAptGet.is_installed(self, 'php7.3-fpm'): - services = services + ['php7.3-fpm'] - else: - Log.info(self, "PHP7.3-FPM is not installed") + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] else: - Log.info(self, "Your platform does not support PHP 7.3") + Log.info(self, "PHP7.3-FPM is not installed") if self.app.pargs.mysql: if ((WOVariables.wo_mysql_host is "localhost") or @@ -78,11 +68,11 @@ class WOStackStatusController(CementBaseController): services = services + ['hhvm'] else: Log.info(self, "HHVM is not installed") - if self.app.pargs.memcache: + if self.app.pargs.memcached: if WOAptGet.is_installed(self, 'memcached'): services = services + ['memcached'] else: - Log.info(self, "Memcache is not installed") + Log.info(self, "Memcached is not installed") if self.app.pargs.redis: if WOAptGet.is_installed(self, 'redis-server'): @@ -99,7 +89,7 @@ class WOStackStatusController(CementBaseController): """Stop services""" services = [] if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php73 - or self.app.pargs.mysql or self.app.pargs.hhvm or self.app.pargs.memcache + or self.app.pargs.mysql or self.app.pargs.hhvm or self.app.pargs.memcached or self.app.pargs.redis): self.app.pargs.nginx = True self.app.pargs.php = True @@ -112,30 +102,21 @@ class WOStackStatusController(CementBaseController): Log.info(self, "Nginx is not installed") if self.app.pargs.php: - if (WOVariables.wo_platform_distro == 'debian' or WOVariables.wo_platform_codename == 'precise'): - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] - else: - Log.info(self, "PHP7.2-FPM is not installed") + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] - else: - Log.info(self, "PHP7.2-FPM is not installed") + Log.info(self, "PHP7.2-FPM is not installed") - if WOAptGet.is_installed(self, 'php7.3-fpm'): - services = services + ['php7.3-fpm'] - else: - Log.info(self, "PHP7.3-FPM is not installed") + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] + else: + Log.info(self, "PHP7.3-FPM is not installed") if self.app.pargs.php73: - if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - if WOAptGet.is_installed(self, 'php7.3-fpm'): - services = services + ['php7.3-fpm'] - else: - Log.info(self, "PHP7.3-FPM is not installed") + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] else: - Log.info(self, "Your platform does not support PHP 7.3") + Log.info(self, "PHP7.3-FPM is not installed") if self.app.pargs.mysql: if ((WOVariables.wo_mysql_host is "localhost") or @@ -155,11 +136,11 @@ class WOStackStatusController(CementBaseController): services = services + ['hhvm'] else: Log.info(self, "HHVM is not installed") - if self.app.pargs.memcache: + if self.app.pargs.memcached: if WOAptGet.is_installed(self, 'memcached'): services = services + ['memcached'] else: - Log.info(self, "Memcache is not installed") + Log.info(self, "Memcached is not installed") if self.app.pargs.redis: if WOAptGet.is_installed(self, 'redis-server'): @@ -176,7 +157,7 @@ class WOStackStatusController(CementBaseController): """Restart services""" services = [] if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php73 - or self.app.pargs.mysql or self.app.pargs.hhvm or self.app.pargs.memcache + or self.app.pargs.mysql or self.app.pargs.hhvm or self.app.pargs.memcached or self.app.pargs.redis): self.app.pargs.nginx = True self.app.pargs.php = True @@ -189,30 +170,21 @@ class WOStackStatusController(CementBaseController): Log.info(self, "Nginx is not installed") if self.app.pargs.php: - if (WOVariables.wo_platform_distro == 'debian' or WOVariables.wo_platform_codename == 'precise'): - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] - else: - Log.info(self, "PHP7.2-FPM is not installed") + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] - else: - Log.info(self, "PHP7.2-FPM is not installed") + Log.info(self, "PHP7.2-FPM is not installed") - if WOAptGet.is_installed(self, 'php7.3-fpm'): - services = services + ['php7.3-fpm'] - else: - Log.info(self, "PHP7.3-FPM is not installed") + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] + else: + Log.info(self, "PHP7.3-FPM is not installed") if self.app.pargs.php73: - if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - if WOAptGet.is_installed(self, 'php7.3-fpm'): - services = services + ['php7.3-fpm'] - else: - Log.info(self, "PHP7.3-FPM is not installed") + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] else: - Log.info(self, "Your platform does not support PHP 7.3") + Log.info(self, "PHP7.3-FPM is not installed") if self.app.pargs.mysql: if ((WOVariables.wo_mysql_host is "localhost") or @@ -232,11 +204,11 @@ class WOStackStatusController(CementBaseController): services = services + ['hhvm'] else: Log.info(self, "HHVM is not installed") - if self.app.pargs.memcache: + if self.app.pargs.memcached: if WOAptGet.is_installed(self, 'memcached'): services = services + ['memcached'] else: - Log.info(self, "Memcache is not installed") + Log.info(self, "Memcached is not installed") if self.app.pargs.redis: if WOAptGet.is_installed(self, 'redis-server'): @@ -253,7 +225,7 @@ class WOStackStatusController(CementBaseController): """Status of services""" services = [] if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php73 - or self.app.pargs.mysql or self.app.pargs.hhvm or self.app.pargs.memcache + or self.app.pargs.mysql or self.app.pargs.hhvm or self.app.pargs.memcached or self.app.pargs.redis): self.app.pargs.nginx = True self.app.pargs.php = True @@ -267,30 +239,21 @@ class WOStackStatusController(CementBaseController): Log.info(self, "Nginx is not installed") if self.app.pargs.php: - if (WOVariables.wo_platform_distro == 'debian' or WOVariables.wo_platform_codename == 'precise'): - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] - else: - Log.info(self, "PHP7.2-FPM is not installed") + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] - else: - Log.info(self, "PHP7.2-FPM is not installed") + Log.info(self, "PHP7.2-FPM is not installed") - if WOAptGet.is_installed(self, 'php7.3-fpm'): - services = services + ['php7.3-fpm'] - else: - Log.info(self, "PHP7.3-FPM is not installed") + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] + else: + Log.info(self, "PHP7.3-FPM is not installed") if self.app.pargs.php73: - if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - if WOAptGet.is_installed(self, 'php7.3-fpm'): - services = services + ['php7.3-fpm'] - else: - Log.info(self, "PHP7.3-FPM is not installed") + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] else: - Log.info(self, "Your platform does not support PHP 7.3") + Log.info(self, "PHP7.3-FPM is not installed") if self.app.pargs.mysql: if ((WOVariables.wo_mysql_host is "localhost") or @@ -310,11 +273,11 @@ class WOStackStatusController(CementBaseController): services = services + ['hhvm'] else: Log.info(self, "HHVM is not installed") - if self.app.pargs.memcache: + if self.app.pargs.memcached: if WOAptGet.is_installed(self, 'memcached'): services = services + ['memcached'] else: - Log.info(self, "Memcache is not installed") + Log.info(self, "Memcached is not installed") if self.app.pargs.redis: if WOAptGet.is_installed(self, 'redis-server'): @@ -331,7 +294,7 @@ class WOStackStatusController(CementBaseController): """Reload service""" services = [] if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php73 - or self.app.pargs.mysql or self.app.pargs.hhvm or self.app.pargs.memcache + or self.app.pargs.mysql or self.app.pargs.hhvm or self.app.pargs.memcached or self.app.pargs.redis): self.app.pargs.nginx = True self.app.pargs.php = True @@ -344,30 +307,21 @@ class WOStackStatusController(CementBaseController): Log.info(self, "Nginx is not installed") if self.app.pargs.php: - if (WOVariables.wo_platform_distro == 'debian' or WOVariables.wo_platform_codename == 'precise'): - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] - else: - Log.info(self, "PHP7.2-FPM is not installed") + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] - else: - Log.info(self, "php7.2-fpm is not installed") + Log.info(self, "PHP7.2-FPM is not installed") - if WOAptGet.is_installed(self, 'php7.3-fpm'): - services = services + ['php7.3-fpm'] - else: - Log.info(self, "PHP7.3-FPM is not installed") + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] + else: + Log.info(self, "PHP7.3-FPM is not installed") if self.app.pargs.php73: - if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - if WOAptGet.is_installed(self, 'php7.3-fpm'): - services = services + ['php7.3-fpm'] - else: - Log.info(self, "PHP7.3-FPM is not installed") + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] else: - Log.info(self, "Your platform does not support PHP 7.3") + Log.info(self, "PHP7.3-FPM is not installed") if self.app.pargs.mysql: if ((WOVariables.wo_mysql_host is "localhost") or @@ -385,11 +339,11 @@ class WOStackStatusController(CementBaseController): if self.app.pargs.hhvm: Log.info(self, "HHVM does not support to reload") - if self.app.pargs.memcache: + if self.app.pargs.memcached: if WOAptGet.is_installed(self, 'memcached'): services = services + ['memcached'] else: - Log.info(self, "Memcache is not installed") + Log.info(self, "Memcached is not installed") if self.app.pargs.redis: if WOAptGet.is_installed(self, 'redis-server'): diff --git a/wo/core/variables.py b/wo/core/variables.py index 61d7e9d..cc70bf7 100644 --- a/wo/core/variables.py +++ b/wo/core/variables.py @@ -102,20 +102,19 @@ class WOVariables(): # PHP repo and packages if wo_platform_distro == 'ubuntu': - if (wo_platform_codename == 'trusty' or wo_platform_codename == 'xenial' or wo_platform_codename == 'bionic'): - wo_php_repo = "ppa:ondrej/php" - 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", + wo_php_repo = "ppa:ondrej/php" + 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_php73 = ["php7.3-fpm", "php7.3-curl", "php7.3-gd", "php7.3-imap", - "php7.3-readline", "php7.3-common", "php7.3-recode", - "php7.3-cli", "php7.3-mbstring", + wo_php73 = ["php7.3-fpm", "php7.3-curl", "php7.3-gd", "php7.3-imap", + "php7.3-readline", "php7.3-common", "php7.3-recode", + "php7.3-cli", "php7.3-mbstring", "php7.3-bcmath", "php7.3-mysql", "php7.3-opcache", "php7.3-zip", "php7.3-xml", "php7.3-soap"] - wo_php_extra = ["php-memcached", "php-imagick", "memcached", - "graphviz", "php-xdebug", "php-msgpack", "php-redis"] + wo_php_extra = ["php-memcached", "php-imagick", "memcached", + "graphviz", "php-xdebug", "php-msgpack", "php-redis"] elif wo_platform_distro == 'debian': wo_php_repo = ( "deb https://packages.sury.org/php/ {codename} main".format(codename=wo_platform_codename)) @@ -166,8 +165,7 @@ class WOVariables(): wo_redis_repo = ("deb https://packages.sury.org/php/ {codename} all" .format(codename=wo_platform_codename)) - if (wo_platform_codename == 'trusty' or wo_platform_codename == 'xenial' or wo_platform_codename == 'bionic' or wo_platform_distro == 'debian'): - wo_redis = ['redis-server', 'php-redis'] + wo_redis = ['redis-server', 'php-redis'] # Repo path wo_repo_file = "wo-repo.list" From 71a2461b757e4b204b19cc64138528a8bd20468f Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Thu, 7 Mar 2019 13:23:19 +0100 Subject: [PATCH 53/56] New install script presentation --- install | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/install b/install index 684ab65..aaf6f81 100644 --- a/install +++ b/install @@ -359,20 +359,25 @@ wo_update_wp_cli() # Now, finally, let's install WordOps wo_install() { - rm -rf /tmp/easyengine - rm -rf /tmp/wordops - - wo_lib_echo "Downloading WordOps straight from GitHub - fresh and brewed with love. Hold your horses..." - [ -z "$wo_branch" ] && { - wo_branch=master - } - - git clone -b "$wo_branch" https://github.com/WordOps/WordOps.git /tmp/wordops --quiet > /dev/null \ - || wo_lib_error "An error was encountered during the download, exit status" $? - - cd /tmp/wordops || exit 1 - wo_lib_echo "The moment you've all been waiting for, time to install WordOps!" - python3 setup.py install || wo_lib_error "An error was encountered during the installation, exit status " $? + if { + echo -ne "${TPUT_ECHO}Installing Wordops $wo_branch ${TPUT_RESET}[..]\r" + rm -rf /tmp/easyengine + rm -rf /tmp/wordops + + [ -z "$wo_branch" ] && { + wo_branch=master + } + + git clone -b "$wo_branch" https://github.com/WordOps/WordOps.git /tmp/wordops --quiet > /dev/null 2>&1 + + cd /tmp/wordops || exit 1 + python3 setup.py install > /dev/null 2>&1 + }; then echo -ne "${TPUT_ECHO}Installing Wordops $wo_branch ${TPUT_RESET}[OK]\r" + echo -ne '\n' + else + echo -e "${TPUT_FAIL}Installing Wordops $wo_branch ${TPUT_RESET}[FAIL]" + echo -ne '\n' + fi } wo_update_latest() @@ -604,7 +609,7 @@ wo_update_latest() fi fi - # Fix for SSL cert --all + # Fix for SSL cert --all crontab -l | grep -q '\-\-min_expiry_limit' if [[ $? -eq 0 ]]; then crontab -l > /var/spool/cron/cron-backup.txt #backup cron before editing @@ -696,7 +701,6 @@ else else # 3 - Fresh WO setup wo_install_dep | tee -ai $wo_install_log - wo_lib_echo "Installing WordOps $wo_branch" | tee -ai $wo_install_log wo_install | tee -ai $wo_install_log wo_lib_echo "Running post-install steps" | tee -ai $wo_install_log secure_wo_db | tee -ai $EE_INSTALL_LOG From b17ce2bc52b8e673231911cdab357c90a0304b13 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Thu, 7 Mar 2019 13:26:25 +0100 Subject: [PATCH 54/56] fix indentation --- wo/cli/plugins/stack_services.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wo/cli/plugins/stack_services.py b/wo/cli/plugins/stack_services.py index 8d16908..f4bc268 100644 --- a/wo/cli/plugins/stack_services.py +++ b/wo/cli/plugins/stack_services.py @@ -314,7 +314,7 @@ class WOStackStatusController(CementBaseController): if WOAptGet.is_installed(self, 'php7.3-fpm'): services = services + ['php7.3-fpm'] - else: + else: Log.info(self, "PHP7.3-FPM is not installed") if self.app.pargs.php73: From f9fc676920a582b5ccc1b4fdfe3bd924cb1a3ab4 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Thu, 7 Mar 2019 14:02:32 +0100 Subject: [PATCH 55/56] [skip travis] readme.md and license update --- LICENSE | 3 ++- README.md | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/LICENSE b/LICENSE index 9a71675..ddef593 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,7 @@ The MIT License (MIT) -Copyright (c) 2018 WordOps +Copyright (c) 2018-2019 WordOps +Copyright (C) 2011-2017 EE Development Group (https://github.com/ee/ee/contributors) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 835aa0a..436d1d8 100644 --- a/README.md +++ b/README.md @@ -16,10 +16,10 @@

Key Features • - RequirementsGetting StartedUsage • - Cheatsheet • + RoadMap • + ChangelogCreditsLicense

@@ -30,7 +30,8 @@ - Easy Migration from EasyEngine v3 (migration script development in progress) - Automated WordPress, Nginx, PHP, MySQL & Redis installation -- Optimized Nginx configuration with multiple cache backends support +- Up-to-date server stack with PHP 7.2 & 7.3, MariaDB 10.3 & Redis 5.0 +- Optimized Nginx configurations with multiple cache backends support - Let's Encrypt SSL certificates ## Requirements From 12bec03121eb2106d0ec2d3dec7b9c30970bc5e2 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Thu, 7 Mar 2019 14:49:27 +0100 Subject: [PATCH 56/56] update changelog --- CHANGELOG.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 841c6d5..da007a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,20 +8,30 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), #### Changed -- Updating Nginx fastcgi_cache template -- Updating Nginx configuration for WordPress 5.0 +- Updated Nginx fastcgi_cache templates +- Updated Nginx redis_cache templates +- Updated Nginx wp-super-cache templates +- Updated Nginx configuration for WordPress 5.0 - remove --experimental args - MariaDB version bumped to 10.3 +- Refactored Changelog +- Updated WO manual +- Updated WO bash_completion +- Refactored README.md #### Added - Add WebP image support with Nginx mapping - Add PHP 7.3 support +- WordPress $skip_cache variable mapping #### Fixed - Nginx variable $webp_suffix on fresh install - wo update command +- Fix php services management +- Fix WP-CLI install + ### v3.9.2 - November 30, 2018