Merge pull request #123 from WordOps/phpfpmpool

Phpfpmpool
This commit is contained in:
VirtuBox
2019-08-22 13:55:27 +02:00
committed by GitHub
8 changed files with 158 additions and 117 deletions

View File

@@ -31,36 +31,10 @@ script:
- sed -i 's/# "nose"/"nose"/g' setup.py
- sed -i 's/# "coverage"/"coverage"/g' setup.py
- sed -i 's/# "Sphinx >= 1.0"/"Sphinx >= 1.0"/g' setup.py
- sudo bash install --travis
- sudo wo --help && sudo wo stack install && sudo wo stack install --proftpd
- sudo wo site create html.net --html && sudo wo site create php.com --php && sudo wo site create mysql.com --mysql && sudo wo site create proxy.com --proxy=127.0.0.1:3000
- sudo wo site create wp1.com --wp && sudo wo site create wpsc1.net --wpsc && sudo wo site create wpfc1.com --wpfc
- sudo wo site create wpsc-php73.net --wpsc --php73 && sudo wo site create wpfc-php73.net --wpfc --php73
- sudo wo site create wprocket.net --wprocket && sudo wo site create wprocket-php73.net --wprocket --php73
- sudo wo site create wpce.net --wpce && sudo wo site create wpce-php73.net --wpce --php73
- sudo wo site create wpredis.net --wpredis && sudo wo site create wpredis-php73.net --wpredis --php73
- sudo wo site create wpsubdir1.com --wpsubdir && sudo wo site create wpsubdir-php73.com --wpsubdir --php73
- sudo bash install --travis -b "$TRAVIS_BRANCH"
- sudo bash tests/travis.sh
- sudo wo site create wpsubdirwpsc1.com --wpsubdir --wpsc && sudo wo site create wpsubdirwpsc2.com --wpsubdir --wpfc && sudo wo site create wpsubdirwpsc1-php73.com --wpsubdir --wpsc --php73 && sudo wo site create wpsubdirwpsc2-php73.com --wpsubdir --wpfc --php73
- sudo wo site create wpsubdomain1.com --wpsubdomain && sudo wo site create wpsubdomain1-php73.com --wpsubdomain --php73 && sudo wo site create wpsubdomainwpsc.org --wpsubdomain --wpsc && sudo wo site create wpsubdomainwpfc.org --wpsubdomain --wpfc && sudo wo site create wpsubdomainwpfc2.in --wpfc --wpsubdomain
- sudo wo site create 1.com --html && sudo wo site create 2.com --php && sudo wo site create 3.com --mysql
- sudo wo site update 1.com --wp && sudo wo site update 2.com --php73 && sudo wo site update 3.com --php73 && sudo wo site update 1.com --wpfc && sudo wo site update 1.com --wpsc && sudo wo site update 1.com --wpredis
- sudo wp --allow-root --info
- sudo wo info
- sudo cat /etc/nginx/nginx.conf
- sudo tree -L 2 /etc/nginx
- sudo tree -L 2 /var/www
- sudo cat /etc/mysql/my.cnf
- sudo wo stack upgrade --nginx --force
- sudo wo stack upgrade --php --force
- sudo wo stack upgrade --netdata --force
- sudo wo stack upgrade --phpmyadmin --force
- sudo wo stack upgrade --composer --force
- sudo wo stack upgrade --dashboard --force
- sudo wo update --travis
- sudo wo stack status
- sudo tar -I pigz -cf wordops.tar.gz /var/log/wo
- curl --progress-bar --upload-file wordops.tar.gz https://transfer.vtbox.net/$(basename "wordops.tar.gz") && echo "" | sudo tee -a $HOME/.transfer.log && echo ""
- echo "yes" | sudo wo stack purge --all --force
- sudo wo stack purge --all --force
- sudo bash install --purge

View File

@@ -8,9 +8,19 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### v3.9.x - [Unreleased]
### v3.9.8.3 - 2019-08-21
#### Changed
- Nginx package OpenSSL configuration improvements (TLS v1.3 now available on all operating systems supported by WordOps)
- remove user prompt for confirmation with `wo update`
- Nginx stack will not be upgraded with `wo update` anymore. This can be done at anytime with `wo upgrade --nginx`
- Databases name and user are now semi-randomly generated (0-8 letters from the domain + 8 random caracters)
#### Fixed
- `wo upgrade` output
- Database name or database user length
### v3.9.8.2 - 2019-08-20

109
install
View File

@@ -9,7 +9,7 @@
# -------------------------------------------------------------------------
# wget -qO wo wops.cc && sudo bash wo
# -------------------------------------------------------------------------
# Version 3.9.8.2 - 2019-08-20
# Version 3.9.8.3 - 2019-08-20
# -------------------------------------------------------------------------
# CONTENTS
@@ -114,7 +114,7 @@ else
fi
echo ""
wo_lib_echo "Welcome to WordOps install script v${wo_version_new}"
wo_lib_echo "Welcome to WordOps install/update script v${wo_version_new}"
echo ""
###
@@ -189,14 +189,18 @@ fi
###
# 2 - Setup the dependencies for installation
####
wo_dist_upgrade() {
[ -z "$wo_travis" ] && {
# update server packages
apt-get dist-upgrade --option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --option=Dpkg::options::=--force-unsafe-io --assume-yes --quiet
} >> "$wo_install_log" 2>&1
}
wo_install_dep() {
{
[ -z "$wo_travis" ] && {
# update server packages
apt-get dist-upgrade --option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --option=Dpkg::options::=--force-unsafe-io --assume-yes --quiet
}
if [ "$wo_linux_distro" == "Ubuntu" ]; then
# install dependencies
apt-get -option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --assume-yes install \
@@ -621,7 +625,7 @@ wo_backup_ee() {
}
wo_backup_wo() {
/bin/tar -I pigz -cf "$WO_BACKUP_FILE" /etc/nginx /usr/local/lib/python3.*/dist-packages/wo-*.egg /etc/wo /var/lib/wo /etc/letsencrypt >> /var/log/wo/install.log 2>&1
/bin/tar -I pigz -cf "$WO_BACKUP_FILE" /etc/nginx /etc/wo /var/lib/wo /etc/letsencrypt >> /var/log/wo/install.log 2>&1
}
wo_clean_ee() {
@@ -650,6 +654,10 @@ wo_tweak_kernel() {
sysctl -eq -p /etc/sysctl.d/60-wo-tweaks.conf
fi
}
wo_systemd_tweak() {
if [ ! -x /opt/wo-kernel.sh ]; then
{
# download and setup wo-kernel systemd service to apply kernel tweaks for netdata and redis on server startup
@@ -682,11 +690,6 @@ wo_ufw_setup() {
if [ -f /etc/ssh/sshd_config ]; then
CURRENT_SSH_PORT=$(grep "Port" /etc/ssh/sshd_config | awk -F " " '{print $2}')
fi
# install ufw if needed
if [ ! -d /etc/ufw ]; then
apt-get install ufw -y
fi
# define firewall rules
if ! grep -q "LOGLEVEL=low" /etc/ufw/ufw.conf; then
ufw logging low
@@ -760,54 +763,37 @@ else
# 1 - WO already installed
if [ -x /usr/local/bin/wo ]; then
if ! {
wo -v 2>&1 | grep "$wo_version_new"
wo -v 2>&1 | grep -q "$wo_version_new"
} || [ "$wo_force_install" = "y" ]; then
if [ -z "$wo_force_install" ]; then
echo -e "Update WordOps to $wo_version_new (y/n): " && read -r WO_ANSWER
wo_lib_echo "Installing wo dependencies " | tee -ai $wo_install_log
wo_install_dep | tee -ai $wo_install_log
wo_lib_echo "Backing-up WO install" | tee -ai $wo_install_log
wo_backup_wo | tee -ai $wo_install_log
secure_wo_db | tee -ai $wo_install_log
wo_lib_echo "Installing WordOps " | tee -ai $wo_install_log
wo_clean | tee -ai $wo_install_log
if [ "$wo_travis" = "y" ]; then
wo_install_travis | tee -ai $wo_install_log
else
WO_ANSWER="y"
fi
if [ "$WO_ANSWER" = "y" ] || [ "$WO_ANSWER" = "Y" ]; then
wo_lib_echo "Installing wo dependencies " | tee -ai $wo_install_log
wo_install_dep | tee -ai $wo_install_log
wo_lib_echo "Backing-up WO install" | tee -ai $wo_install_log
wo_backup_wo | tee -ai $wo_install_log
secure_wo_db | tee -ai $wo_install_log
wo_lib_echo "Installing WordOps " | tee -ai $wo_install_log
wo_clean | tee -ai $wo_install_log
if [ "$wo_travis" = "y" ]; then
wo_install_travis | tee -ai $wo_install_log
if [ -f "$HOME/.gitconfig" ]; then
wo_install >> $wo_install_log 2>&1
else
if [ -f "$HOME/.gitconfig" ]; then
wo_install >> $wo_install_log 2>&1
else
wo_install | tee -ai $wo_install_log
fi
wo_install | tee -ai $wo_install_log
fi
if [ -z "$wo_preserve_config" ]; then
if [ -n "$(command -v nginx)" ]; then
if [ ! -f /etc/apt/preferences.d/nginx-block ]; then
wo_lib_echo "Upgrading Nginx" | tee -ai $wo_install_log
wo_upgrade_nginx | tee -ai $wo_install_log
fi
fi
fi
wo_update_latest | tee -ai $wo_install_log
if [ ! -d /opt/acme/.sh ]; then
wo_lib_echo "Updating acme.sh" | tee -ai $wo_install_log
wo_install_acme_sh | tee -ai $wo_install_log
fi
if [ "$ufw" = "y" ]; then
wo_lib_echo "Configuring UFW" | tee -ai $wo_install_log
wo_ufw_setup | tee -ai $wo_install_log
fi
wo_lib_echo "Applying Kernel tweaks" | tee -ai $wo_install_log
wo_tweak_kernel | tee -ai $wo_install_log
wo_lib_echo "Running post-install steps " | tee -ai $wo_install_log
wo_update_wp_cli | tee -ai $wo_install_log
else
wo_lib_error "Not updating WordOps to $wo_version_new, exit status = " 1
fi
wo_update_latest | tee -ai $wo_install_log
if [ ! -d /opt/acme/.sh ]; then
wo_lib_echo "Updating acme.sh" | tee -ai $wo_install_log
wo_install_acme_sh | tee -ai $wo_install_log
fi
wo_lib_echo "Applying Kernel tweaks" | tee -ai $wo_install_log
wo_tweak_kernel | tee -ai $wo_install_log
if [ ! -f /opt/wo-kernel.sh ]; then
wo_lib_echo "Adding systemd service tweak" | tee -ai $wo_install_log
wo_systemd_tweak | tee -ai $wo_install_log
fi
wo_lib_echo "Running post-install steps " | tee -ai $wo_install_log
wo_update_wp_cli | tee -ai $wo_install_log
else
wo_lib_error "You already have WordOps $wo_version_new, exit status = " 1
fi
@@ -842,12 +828,12 @@ else
wo_update_latest | tee -ai $wo_install_log
wo_lib_echo "Installing acme.sh" | tee -ai $wo_install_log
wo_install_acme_sh | tee -ai $wo_install_log
if [ "$ufw" = "y" ]; then
wo_lib_echo "Configuring UFW" | tee -ai $wo_install_log
wo_ufw_setup | tee -ai $wo_install_log
fi
wo_lib_echo "Applying Kernel tweaks" | tee -ai $wo_install_log
wo_tweak_kernel | tee -ai $wo_install_log
if [ ! -f /opt/wo-kernel.sh ]; then
wo_lib_echo "Adding systemd service tweak" | tee -ai $wo_install_log
wo_systemd_tweak | tee -ai $wo_install_log
fi
wo_lib_echo "Running post-install steps " | tee -ai $wo_install_log
wo_git_init | tee -ai $wo_install_log
wo_update_wp_cli | tee -ai $wo_install_log
@@ -859,6 +845,7 @@ else
else
# 3 - Fresh WO setup
wo_lib_echo "Installing wo dependencies " | tee -ai $wo_install_log
wo_dist_upgrade | tee -ai $wo_install_log
wo_install_dep | tee -ai $wo_install_log
wo_lib_echo "Installing WordOps " | tee -ai $wo_install_log
if [ "$wo_travis" = "y" ]; then
@@ -872,6 +859,10 @@ else
fi
wo_lib_echo "Applying Kernel tweaks" | tee -ai $wo_install_log
wo_tweak_kernel | tee -ai $wo_install_log
if [ ! -f /opt/wo-kernel.sh ]; then
wo_lib_echo "Adding systemd service tweak" | tee -ai $wo_install_log
wo_systemd_tweak | tee -ai $wo_install_log
fi
wo_lib_echo "Installing acme.sh" | tee -ai $wo_install_log
wo_install_acme_sh | tee -ai $wo_install_log
wo_lib_echo "Running post-install steps " | tee -ai $wo_install_log

View File

@@ -57,7 +57,7 @@ if not os.path.isfile('/root/.gitconfig'):
shutil.copy2(os.path.expanduser("~")+'/.gitconfig', '/root/.gitconfig')
setup(name='wo',
version='3.9.8.2',
version='3.9.8.3',
description=long_description,
long_description=long_description,
classifiers=[],

52
tests/travis.sh Normal file
View File

@@ -0,0 +1,52 @@
#!/usr/bin/env bash
#
# WordOps travis testing script
#
#
exit_script() {
tar -I pigz -cf wordops.tar.gz /var/log/wo
curl --progress-bar --upload-file wordops.tar.gz https://transfer.vtbox.net/$(basename "wordops.tar.gz") && echo "" | sudo tee -a $HOME/.transfer.log && echo ""
exit 1
}
if ! {
wo --help && wo stack install && wo stack install --proftpd
}; then
exit_script
fi
if ! {
wo site create html.net --html && wo site create php.com --php && wo site create mysql.com --mysql && wo site create proxy.com --proxy=127.0.0.1:3000
wo site create wp1.com --wp && wo site create wpsc1.net --wpsc && wo site create wpfc1.com --wpfc
wo site create wpsc-php73.net --wpsc --php73 && wo site create wpfc-php73.net --wpfc --php73
wo site create wprocket.net --wprocket && wo site create wprocket-php73.net --wprocket --php73
wo site create wpce.net --wpce && wo site create wpce-php73.net --wpce --php73
wo site create wpredis.net --wpredis && wo site create wpredis-php73.net --wpredis --php73
wo site create wpsubdir1.com --wpsubdir && wo site create wpsubdir-php73.com --wpsubdir --php73
}; then
exit_script
fi
if ! {
wo site create wpsubdirwpsc1.com --wpsubdir --wpsc && wo site create wpsubdirwpsc2.com --wpsubdir --wpfc && wo site create wpsubdirwpsc1-php73.com --wpsubdir --wpsc --php73 && wo site create wpsubdirwpsc2-php73.com --wpsubdir --wpfc --php73
wo site create wpsubdomain1.com --wpsubdomain && wo site create wpsubdomain1-php73.com --wpsubdomain --php73 && wo site create wpsubdomainwpsc.org --wpsubdomain --wpsc && wo site create wpsubdomainwpfc.org --wpsubdomain --wpfc && wo site create wpsubdomainwpfc2.in --wpfc --wpsubdomain
wo site create 1.com --html && wo site create 2.com --php && wo site create 3.com --mysql
wo site update 1.com --wp && wo site update 2.com --php73 && wo site update 3.com --php73 && wo site update 1.com --wpfc && wo site update 1.com --wpsc && wo site update 1.com --wpredis
}; then
exit_script
fi
if ! {
wo stack upgrade --force
wo stack upgrade --php --force
wo stack upgrade --netdata --force
wo stack upgrade --phpmyadmin --force
wo stack upgrade --composer --force
wo stack upgrade --dashboard --force
}; then
exit_script
fi
wp --allow-root --info
cat /etc/nginx/nginx.conf
wo site info wp1.com
cat /etc/mysql/my.cnf

View File

@@ -139,10 +139,10 @@ def setupdomain(self, data):
def setupdatabase(self, data):
wo_domain_name = data['site_name']
wo_random = (''.join(random.sample(string.ascii_uppercase +
string.ascii_lowercase +
string.digits, 24)))
wo_replace_dot = wo_domain_name.replace('.', '_')
wo_random_pass = (''.join(random.sample(string.ascii_uppercase +
string.ascii_lowercase +
string.digits, 24)))
wo_replace_dot = wo_domain_name.replace('.', '')
prompt_dbname = self.app.config.get('mysql', 'db-name')
prompt_dbuser = self.app.config.get('mysql', 'db-user')
wo_mysql_grant_host = self.app.config.get('mysql', 'grant-host')
@@ -166,19 +166,17 @@ def setupdatabase(self, data):
.format(wo_replace_dot))
wo_db_password = getpass.getpass(prompt='Enter the MySQL database'
' password [{0}]: '
.format(wo_random))
.format(wo_random_pass))
except EOFError:
raise SiteError("Unable to input database credentials")
if not wo_db_username:
wo_db_username = wo_replace_dot
if not wo_db_password:
wo_db_password = wo_random
wo_db_password = wo_random_pass
if len(wo_db_username) > 16:
Log.debug(self, 'Autofix MySQL username (ERROR 1470 (HY000)),'
' please wait')
wo_db_username = (wo_db_name[0:6] + generate_random())
wo_db_username = (wo_db_name[0:8] + generate_random())
wo_db_name = (wo_db_name[0:8] + generate_random())
# create MySQL database
Log.info(self, "Setting up database\t\t", end='')
@@ -186,8 +184,8 @@ def setupdatabase(self, data):
try:
if WOMysql.check_db_exists(self, wo_db_name):
Log.debug(self, "Database already exists, Updating DB_NAME .. ")
wo_db_name = (wo_db_name[0:6] + generate_random())
wo_db_username = (wo_db_name[0:6] + generate_random())
wo_db_name = (wo_db_name[0:8] + generate_random())
wo_db_username = (wo_db_name[0:8] + generate_random())
except MySQLConnectionError:
raise SiteError("MySQL Connectivity problem occured")
@@ -239,9 +237,12 @@ def setupwordpress(self, data):
wo_wp_pass = self.app.config.get('wordpress', 'password')
wo_wp_email = self.app.config.get('wordpress', 'email')
# Random characters
wo_random_pass = (''.join(random.sample(string.ascii_uppercase +
string.ascii_lowercase +
string.digits, 24)))
wo_random = (''.join(random.sample(string.ascii_uppercase +
string.ascii_lowercase +
string.digits, 24)))
string.digits, 8)))
wo_wp_prefix = ''
# wo_wp_user = ''
# wo_wp_pass = ''
@@ -434,7 +435,7 @@ def setupwordpress(self, data):
except EOFError:
raise SiteError("input WordPress username failed")
if not wo_wp_pass:
wo_wp_pass = wo_random
wo_wp_pass = wo_random_pass
if not wo_wp_email:
wo_wp_email = WOVariables.wo_email
@@ -1116,13 +1117,20 @@ def detSitePar(opts):
return (sitetype, cachetype)
def generate_random():
def generate_random_pass():
wo_random10 = (''.join(random.sample(string.ascii_uppercase +
string.ascii_lowercase +
string.digits, 24)))
return wo_random10
def generate_random():
wo_random10 = (''.join(random.sample(string.ascii_uppercase +
string.ascii_lowercase +
string.digits, 8)))
return wo_random10
def deleteDB(self, dbname, dbuser, dbhost, exit=True):
try:
# Check if Database exists

View File

@@ -39,10 +39,7 @@ class WOUpdateController(CementBaseController):
pargs = self.app.pargs
filename = "woupdate" + time.strftime("%Y%m%d-%H%M%S")
if pargs.travis:
wo_branch = "updating-configuration"
install_args = "--travis --force "
elif pargs.beta:
if pargs.beta:
wo_branch = "beta"
install_args = ""
else:
@@ -59,14 +56,23 @@ class WOUpdateController(CementBaseController):
"/var/lib/wo/tmp/{0}".format(filename),
"update script"]])
try:
Log.info(self, "updating WordOps, please wait...")
os.system("/bin/bash /var/lib/wo/tmp/{0} "
"-b {1} {2}".format(filename,
wo_branch, install_args))
except OSError as e:
Log.debug(self, str(e))
Log.error(self, "WordOps update failed !")
if pargs.travis:
try:
Log.info(self, "updating WordOps, please wait...")
os.system("/bin/bash install --travis "
"-b $TRAVIS_BRANCH --force")
except OSError as e:
Log.debug(self, str(e))
Log.error(self, "WordOps update failed !")
else:
try:
Log.info(self, "updating WordOps, please wait...")
os.system("/bin/bash /var/lib/wo/tmp/{0} "
"-b {1} {2}".format(filename,
wo_branch, install_args))
except OSError as e:
Log.debug(self, str(e))
Log.error(self, "WordOps update failed !")
def load(app):

View File

@@ -10,7 +10,7 @@ class WOVariables():
"""Intialization of core variables"""
# WordOps version
wo_version = "3.9.8.2"
wo_version = "3.9.8.3"
# WordOps packages versions
wo_wp_cli = "2.2.0"
wo_adminer = "4.7.2"