v3.11.1 (#215)
- `--fail2ban` in wo stack upgrade - error with `wo maintenance` - php-igbinary missing for php74 (run `wo stack upgrade` to install it) - opcache reset with `wo clean`
This commit is contained in:
12
CHANGELOG.md
12
CHANGELOG.md
@@ -8,6 +8,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|||||||
|
|
||||||
### v3.9.x - [Unreleased]
|
### v3.9.x - [Unreleased]
|
||||||
|
|
||||||
|
### v3.11.1 - 2019-12-04
|
||||||
|
|
||||||
|
#### Added
|
||||||
|
|
||||||
|
- `--fail2ban` in wo stack upgrade
|
||||||
|
|
||||||
|
#### Fixed
|
||||||
|
|
||||||
|
- error with `wo maintenance`
|
||||||
|
- php-igbinary missing for php74 (run `wo stack upgrade` to install it)
|
||||||
|
- opcache reset with `wo clean`
|
||||||
|
|
||||||
### v3.11.0 - 2019-12-03
|
### v3.11.0 - 2019-12-03
|
||||||
|
|
||||||
#### Added
|
#### Added
|
||||||
|
|||||||
2
install
2
install
@@ -9,7 +9,7 @@
|
|||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
# wget -qO wo wops.cc && sudo bash wo
|
# wget -qO wo wops.cc && sudo bash wo
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
# Version 3.11.0 - 2019-12-03
|
# Version 3.11.1 - 2019-12-04
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
|
|
||||||
# CONTENTS
|
# CONTENTS
|
||||||
|
|||||||
2
setup.py
2
setup.py
@@ -27,7 +27,7 @@ if os.geteuid() == 0:
|
|||||||
os.makedirs('/var/lib/wo/tmp/')
|
os.makedirs('/var/lib/wo/tmp/')
|
||||||
|
|
||||||
setup(name='wordops',
|
setup(name='wordops',
|
||||||
version='3.11.0',
|
version='3.11.1',
|
||||||
description='An essential toolset that eases server administration',
|
description='An essential toolset that eases server administration',
|
||||||
long_description=LONG,
|
long_description=LONG,
|
||||||
long_description_content_type='text/markdown',
|
long_description_content_type='text/markdown',
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ if [ -z "$1" ]; then
|
|||||||
echo -e "${CGREEN}#############################################${CEND}"
|
echo -e "${CGREEN}#############################################${CEND}"
|
||||||
echo -e ' wo stack upgrade '
|
echo -e ' wo stack upgrade '
|
||||||
echo -e "${CGREEN}#############################################${CEND}"
|
echo -e "${CGREEN}#############################################${CEND}"
|
||||||
stack_upgrade='nginx php php72 php73 php74 mysql redis netdata dashboard phpmyadmin composer ngxblocker mysqltuner'
|
stack_upgrade='nginx php php72 php73 php74 mysql redis netdata dashboard phpmyadmin adminer fail2ban composer ngxblocker mysqltuner'
|
||||||
for stack in $stack_upgrade; do
|
for stack in $stack_upgrade; do
|
||||||
echo -ne " Upgrading $stack [..]\r"
|
echo -ne " Upgrading $stack [..]\r"
|
||||||
if {
|
if {
|
||||||
|
|||||||
@@ -74,18 +74,18 @@ class WOCleanController(CementBaseController):
|
|||||||
def clean_opcache(self):
|
def clean_opcache(self):
|
||||||
if (os.path.exists('/usr/sbin/nginx') and
|
if (os.path.exists('/usr/sbin/nginx') and
|
||||||
os.path.exists(
|
os.path.exists(
|
||||||
'/var/www/22222/htdocs/cache/opcache/opgui.php')):
|
'/var/www/22222/htdocs/cache/opcache/php72.php')):
|
||||||
try:
|
try:
|
||||||
Log.info(self, "Cleaning opcache")
|
Log.info(self, "Cleaning opcache")
|
||||||
opgui = requests.get(
|
opgui = requests.get(
|
||||||
"https://127.0.0.1:22222/cache/opcache/opgui.php?reset=1")
|
"http://127.0.0.1/cache/opcache/php72.php")
|
||||||
if opgui.status_code != '200':
|
if opgui.status_code != '200' or opgui.status_code != '302':
|
||||||
Log.warn(self, 'Cleaning opcache failed')
|
Log.warn(self, 'Cleaning opcache failed')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
Log.debug(self, "{0}".format(e))
|
Log.debug(self, "{0}".format(e))
|
||||||
Log.debug(self, "Unable hit url, "
|
Log.debug(self, "Unable hit url, "
|
||||||
" https://127.0.0.1:22222/cache/opcache/"
|
" http://127.0.0.1/cache/opcache/"
|
||||||
"opgui.php?reset=1,"
|
"php72.php,"
|
||||||
" please check you have admin tools installed")
|
" please check you have admin tools installed")
|
||||||
Log.debug(self, "please check you have admin tools installed,"
|
Log.debug(self, "please check you have admin tools installed,"
|
||||||
" or install them with `wo stack install --admin`")
|
" or install them with `wo stack install --admin`")
|
||||||
|
|||||||
@@ -184,10 +184,8 @@ class WOStackController(CementBaseController):
|
|||||||
if pargs.php72:
|
if pargs.php72:
|
||||||
Log.debug(self, "Setting apt_packages variable for PHP 7.2")
|
Log.debug(self, "Setting apt_packages variable for PHP 7.2")
|
||||||
if not (WOAptGet.is_installed(self, 'php7.2-fpm')):
|
if not (WOAptGet.is_installed(self, 'php7.2-fpm')):
|
||||||
apt_packages = apt_packages + WOVar.wo_php72
|
apt_packages = (apt_packages + WOVar.wo_php72 +
|
||||||
if not (WOAptGet.is_installed(self, 'php7.3-fpm') or
|
WOVar.wo_php_extra)
|
||||||
WOAptGet.is_installed(self, 'php7.4-fpm')):
|
|
||||||
apt_packages = apt_packages + WOVar.wo_php_extra
|
|
||||||
else:
|
else:
|
||||||
Log.debug(self, "PHP 7.2 already installed")
|
Log.debug(self, "PHP 7.2 already installed")
|
||||||
Log.info(self, "PHP 7.2 already installed")
|
Log.info(self, "PHP 7.2 already installed")
|
||||||
@@ -196,10 +194,8 @@ class WOStackController(CementBaseController):
|
|||||||
if pargs.php73:
|
if pargs.php73:
|
||||||
Log.debug(self, "Setting apt_packages variable for PHP 7.3")
|
Log.debug(self, "Setting apt_packages variable for PHP 7.3")
|
||||||
if not WOAptGet.is_installed(self, 'php7.3-fpm'):
|
if not WOAptGet.is_installed(self, 'php7.3-fpm'):
|
||||||
apt_packages = apt_packages + WOVar.wo_php73
|
apt_packages = (apt_packages + WOVar.wo_php73 +
|
||||||
if not (WOAptGet.is_installed(self, 'php7.2-fpm') or
|
WOVar.wo_php_extra)
|
||||||
WOAptGet.is_installed(self, 'php7.4-fpm')):
|
|
||||||
apt_packages = apt_packages + WOVar.wo_php_extra
|
|
||||||
else:
|
else:
|
||||||
Log.debug(self, "PHP 7.3 already installed")
|
Log.debug(self, "PHP 7.3 already installed")
|
||||||
Log.info(self, "PHP 7.3 already installed")
|
Log.info(self, "PHP 7.3 already installed")
|
||||||
@@ -208,10 +204,8 @@ class WOStackController(CementBaseController):
|
|||||||
if pargs.php74:
|
if pargs.php74:
|
||||||
Log.debug(self, "Setting apt_packages variable for PHP 7.4")
|
Log.debug(self, "Setting apt_packages variable for PHP 7.4")
|
||||||
if not WOAptGet.is_installed(self, 'php7.4-fpm'):
|
if not WOAptGet.is_installed(self, 'php7.4-fpm'):
|
||||||
apt_packages = apt_packages + WOVar.wo_php74
|
apt_packages = (apt_packages + WOVar.wo_php74 +
|
||||||
if not (WOAptGet.is_installed(self, 'php7.3-fpm') or
|
WOVar.wo_php_extra)
|
||||||
WOAptGet.is_installed(self, 'php7.2-fpm')):
|
|
||||||
apt_packages = apt_packages + WOVar.wo_php_extra
|
|
||||||
else:
|
else:
|
||||||
Log.debug(self, "PHP 7.4 already installed")
|
Log.debug(self, "PHP 7.4 already installed")
|
||||||
Log.info(self, "PHP 7.4 already installed")
|
Log.info(self, "PHP 7.4 already installed")
|
||||||
|
|||||||
@@ -97,12 +97,9 @@ def pre_pref(self, apt_packages):
|
|||||||
# add nginx repository
|
# add nginx repository
|
||||||
if set(WOVar.wo_nginx).issubset(set(apt_packages)):
|
if set(WOVar.wo_nginx).issubset(set(apt_packages)):
|
||||||
if (WOVar.wo_distro == 'ubuntu'):
|
if (WOVar.wo_distro == 'ubuntu'):
|
||||||
if not os.path.isfile(
|
Log.info(self, "Adding repository for NGINX, please wait...")
|
||||||
'wordops-ubuntu-nginx-wo-{0}.list'
|
WORepo.add(self, ppa=WOVar.wo_nginx_repo)
|
||||||
.format(WOVar.wo_platform_codename)):
|
Log.debug(self, 'Adding ppa for Nginx')
|
||||||
Log.info(self, "Adding repository for NGINX, please wait...")
|
|
||||||
WORepo.add(self, ppa=WOVar.wo_nginx_repo)
|
|
||||||
Log.debug(self, 'Adding ppa for Nginx')
|
|
||||||
else:
|
else:
|
||||||
if not WOFileUtils.grepcheck(
|
if not WOFileUtils.grepcheck(
|
||||||
self, '/etc/apt/sources.list/wo-repo.list',
|
self, '/etc/apt/sources.list/wo-repo.list',
|
||||||
@@ -117,11 +114,8 @@ def pre_pref(self, apt_packages):
|
|||||||
('php7.2-fpm' in apt_packages) or ('php7.4-fpm' in apt_packages)):
|
('php7.2-fpm' in apt_packages) or ('php7.4-fpm' in apt_packages)):
|
||||||
if (WOVar.wo_distro == 'ubuntu'):
|
if (WOVar.wo_distro == 'ubuntu'):
|
||||||
Log.debug(self, 'Adding ppa for PHP')
|
Log.debug(self, 'Adding ppa for PHP')
|
||||||
if not os.path.isfile(
|
Log.info(self, "Adding repository for PHP, please wait...")
|
||||||
'/etc/apt/sources.list.d/ondrej-ubuntu-php-{0}.list'
|
WORepo.add(self, ppa=WOVar.wo_php_repo)
|
||||||
.format(WOVar.wo_platform_codename)):
|
|
||||||
Log.info(self, "Adding repository for PHP, please wait...")
|
|
||||||
WORepo.add(self, ppa=WOVar.wo_php_repo)
|
|
||||||
else:
|
else:
|
||||||
# Add repository for php
|
# Add repository for php
|
||||||
if (WOVar.wo_platform_codename == 'buster'):
|
if (WOVar.wo_platform_codename == 'buster'):
|
||||||
@@ -144,13 +138,9 @@ def pre_pref(self, apt_packages):
|
|||||||
# add redis repository
|
# add redis repository
|
||||||
if set(WOVar.wo_redis).issubset(set(apt_packages)):
|
if set(WOVar.wo_redis).issubset(set(apt_packages)):
|
||||||
if WOVar.wo_distro == 'ubuntu':
|
if WOVar.wo_distro == 'ubuntu':
|
||||||
if not os.path.isfile(
|
Log.info(self, "Adding repository for Redis, please wait...")
|
||||||
'/etc/apt/sources.list.d/'
|
Log.debug(self, 'Adding ppa for redis')
|
||||||
'chris-lea-ubuntu-redis-server-{0}.list'
|
WORepo.add(self, ppa=WOVar.wo_redis_repo)
|
||||||
.format(WOVar.wo_platform_codename)):
|
|
||||||
Log.info(self, "Adding repository for Redis, please wait...")
|
|
||||||
Log.debug(self, 'Adding ppa for redis')
|
|
||||||
WORepo.add(self, ppa=WOVar.wo_redis_repo)
|
|
||||||
else:
|
else:
|
||||||
if not WOFileUtils.grepcheck(
|
if not WOFileUtils.grepcheck(
|
||||||
self, '/etc/apt/sources.list/wo-repo.list',
|
self, '/etc/apt/sources.list/wo-repo.list',
|
||||||
@@ -164,12 +154,8 @@ def pre_pref(self, apt_packages):
|
|||||||
if WOVar.wo_distro == 'ubuntu':
|
if WOVar.wo_distro == 'ubuntu':
|
||||||
if (WOVar.wo_platform_codename == 'bionic' or
|
if (WOVar.wo_platform_codename == 'bionic' or
|
||||||
WOVar.wo_platform_codename == 'xenial'):
|
WOVar.wo_platform_codename == 'xenial'):
|
||||||
if not os.path.exists(
|
Log.debug(self, 'Adding ppa for nano')
|
||||||
'/etc/apt/sources.list.d/'
|
WORepo.add(self, ppa=WOVar.wo_ubuntu_backports)
|
||||||
'jonathonf-ubuntu-backports-{0}.list'
|
|
||||||
.format(WOVar.wo_platform_codename)):
|
|
||||||
Log.debug(self, 'Adding ppa for nano')
|
|
||||||
WORepo.add(self, ppa=WOVar.wo_ubuntu_backports)
|
|
||||||
|
|
||||||
|
|
||||||
def post_pref(self, apt_packages, packages, upgrade=False):
|
def post_pref(self, apt_packages, packages, upgrade=False):
|
||||||
@@ -620,6 +606,16 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
encoding='utf-8', mode='w') as myfile:
|
encoding='utf-8', mode='w') as myfile:
|
||||||
myfile.write("<?php\nphpinfo();\n?>")
|
myfile.write("<?php\nphpinfo();\n?>")
|
||||||
|
|
||||||
|
# write opcache clean for php72
|
||||||
|
if not os.path.exists('{0}22222/htdocs/cache/opcache'
|
||||||
|
.format(ngxroot)):
|
||||||
|
os.makedirs('{0}22222/htdocs/cache/opcache'
|
||||||
|
.format(ngxroot))
|
||||||
|
WOFileUtils.textwrite(
|
||||||
|
self, '{0}22222/htdocs/cache/opcache/php72.php'
|
||||||
|
.format(ngxroot),
|
||||||
|
'<?php opcache_reset(); ?>')
|
||||||
|
|
||||||
WOFileUtils.chown(self, "{0}22222/htdocs"
|
WOFileUtils.chown(self, "{0}22222/htdocs"
|
||||||
.format(ngxroot),
|
.format(ngxroot),
|
||||||
'www-data',
|
'www-data',
|
||||||
@@ -757,6 +753,16 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
encoding='utf-8', mode='w') as myfile:
|
encoding='utf-8', mode='w') as myfile:
|
||||||
myfile.write("<?php\nphpinfo();\n?>")
|
myfile.write("<?php\nphpinfo();\n?>")
|
||||||
|
|
||||||
|
# write opcache clean for php73
|
||||||
|
if not os.path.exists('{0}22222/htdocs/cache/opcache'
|
||||||
|
.format(ngxroot)):
|
||||||
|
os.makedirs('{0}22222/htdocs/cache/opcache'
|
||||||
|
.format(ngxroot))
|
||||||
|
WOFileUtils.textwrite(
|
||||||
|
self, '{0}22222/htdocs/cache/opcache/php73.php'
|
||||||
|
.format(ngxroot),
|
||||||
|
'<?php opcache_reset(); ?>')
|
||||||
|
|
||||||
WOFileUtils.chown(self, "{0}22222/htdocs"
|
WOFileUtils.chown(self, "{0}22222/htdocs"
|
||||||
.format(ngxroot),
|
.format(ngxroot),
|
||||||
'www-data',
|
'www-data',
|
||||||
@@ -893,6 +899,16 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
self, "{0}22222/htdocs/php/info.php"
|
self, "{0}22222/htdocs/php/info.php"
|
||||||
.format(ngxroot), "<?php\nphpinfo();\n?>")
|
.format(ngxroot), "<?php\nphpinfo();\n?>")
|
||||||
|
|
||||||
|
# write opcache clean for php74
|
||||||
|
if not os.path.exists('{0}22222/htdocs/cache/opcache'
|
||||||
|
.format(ngxroot)):
|
||||||
|
os.makedirs('{0}22222/htdocs/cache/opcache'
|
||||||
|
.format(ngxroot))
|
||||||
|
WOFileUtils.textwrite(
|
||||||
|
self, '{0}22222/htdocs/cache/opcache/php74.php'
|
||||||
|
.format(ngxroot),
|
||||||
|
'<?php opcache_reset(); ?>')
|
||||||
|
|
||||||
WOFileUtils.chown(self, "{0}22222/htdocs"
|
WOFileUtils.chown(self, "{0}22222/htdocs"
|
||||||
.format(ngxroot),
|
.format(ngxroot),
|
||||||
'www-data',
|
'www-data',
|
||||||
@@ -997,35 +1013,34 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
WOGit.add(self, ["/etc/mysql"], msg="Adding MySQL into Git")
|
WOGit.add(self, ["/etc/mysql"], msg="Adding MySQL into Git")
|
||||||
|
|
||||||
# create fail2ban configuration files
|
# create fail2ban configuration files
|
||||||
if set(WOVar.wo_fail2ban).issubset(set(apt_packages)):
|
if "fail2ban" in apt_packages:
|
||||||
WOService.restart_service(self, 'fail2ban')
|
WOService.restart_service(self, 'fail2ban')
|
||||||
WOGit.add(self, ["/etc/fail2ban"],
|
WOGit.add(self, ["/etc/fail2ban"],
|
||||||
msg="Adding Fail2ban into Git")
|
msg="Adding Fail2ban into Git")
|
||||||
if not os.path.isfile("/etc/fail2ban/jail.d/custom.conf"):
|
Log.info(self, "Configuring Fail2Ban")
|
||||||
Log.info(self, "Configuring Fail2Ban")
|
data = dict(release=WOVar.wo_version)
|
||||||
data = dict(release=WOVar.wo_version)
|
WOTemplate.deploy(
|
||||||
WOTemplate.deploy(
|
self,
|
||||||
self,
|
'/etc/fail2ban/jail.d/custom.conf',
|
||||||
'/etc/fail2ban/jail.d/custom.conf',
|
'fail2ban.mustache',
|
||||||
'fail2ban.mustache',
|
data, overwrite=False)
|
||||||
data, overwrite=False)
|
WOTemplate.deploy(
|
||||||
WOTemplate.deploy(
|
self,
|
||||||
self,
|
'/etc/fail2ban/filter.d/wo-wordpress.conf',
|
||||||
'/etc/fail2ban/filter.d/wo-wordpress.conf',
|
'fail2ban-wp.mustache',
|
||||||
'fail2ban-wp.mustache',
|
data, overwrite=False)
|
||||||
data, overwrite=False)
|
WOTemplate.deploy(
|
||||||
WOTemplate.deploy(
|
self,
|
||||||
self,
|
'/etc/fail2ban/filter.d/nginx-forbidden.conf',
|
||||||
'/etc/fail2ban/filter.d/nginx-forbidden.conf',
|
'fail2ban-forbidden.mustache',
|
||||||
'fail2ban-forbidden.mustache',
|
data, overwrite=False)
|
||||||
data, overwrite=False)
|
|
||||||
|
|
||||||
if not WOService.reload_service(self, 'fail2ban'):
|
if not WOService.reload_service(self, 'fail2ban'):
|
||||||
WOGit.rollback(
|
WOGit.rollback(
|
||||||
self, ['/etc/fail2ban'], msg="Rollback f2b config")
|
self, ['/etc/fail2ban'], msg="Rollback f2b config")
|
||||||
else:
|
else:
|
||||||
WOGit.add(self, ["/etc/fail2ban"],
|
WOGit.add(self, ["/etc/fail2ban"],
|
||||||
msg="Adding Fail2ban into Git")
|
msg="Adding Fail2ban into Git")
|
||||||
|
|
||||||
# Proftpd configuration
|
# Proftpd configuration
|
||||||
if "proftpd-basic" in apt_packages:
|
if "proftpd-basic" in apt_packages:
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ class WOStackUpgradeController(CementBaseController):
|
|||||||
dict(help='Upgrade web stack', action='store_true')),
|
dict(help='Upgrade web stack', action='store_true')),
|
||||||
(['--admin'],
|
(['--admin'],
|
||||||
dict(help='Upgrade admin tools stack', action='store_true')),
|
dict(help='Upgrade admin tools stack', action='store_true')),
|
||||||
|
(['--security'],
|
||||||
|
dict(help='Upgrade security stack', action='store_true')),
|
||||||
(['--nginx'],
|
(['--nginx'],
|
||||||
dict(help='Upgrade Nginx stack', action='store_true')),
|
dict(help='Upgrade Nginx stack', action='store_true')),
|
||||||
(['--php'],
|
(['--php'],
|
||||||
@@ -44,6 +46,8 @@ class WOStackUpgradeController(CementBaseController):
|
|||||||
dict(help='Upgrade Redis', action='store_true')),
|
dict(help='Upgrade Redis', action='store_true')),
|
||||||
(['--netdata'],
|
(['--netdata'],
|
||||||
dict(help='Upgrade Netdata', action='store_true')),
|
dict(help='Upgrade Netdata', action='store_true')),
|
||||||
|
(['--fail2ban'],
|
||||||
|
dict(help='Upgrade Fail2Ban', action='store_true')),
|
||||||
(['--dashboard'],
|
(['--dashboard'],
|
||||||
dict(help='Upgrade WordOps Dashboard', action='store_true')),
|
dict(help='Upgrade WordOps Dashboard', action='store_true')),
|
||||||
(['--composer'],
|
(['--composer'],
|
||||||
@@ -71,18 +75,15 @@ class WOStackUpgradeController(CementBaseController):
|
|||||||
packages = []
|
packages = []
|
||||||
self.msg = []
|
self.msg = []
|
||||||
pargs = self.app.pargs
|
pargs = self.app.pargs
|
||||||
if ((not pargs.web) and (not pargs.nginx) and
|
if not (pargs.web or pargs.nginx or pargs.php or
|
||||||
(not pargs.php) and
|
pargs.php72 or pargs.php73 or pargs.php74 or pargs.mysql or
|
||||||
(not pargs.php72) and (not pargs.php73) and
|
pargs.ngxblocker or pargs.all or pargs.netdata or
|
||||||
(not pargs.php74) and
|
pargs.wpcli or pargs.composer or pargs.phpmyadmin or
|
||||||
(not pargs.mysql) and (not pargs.ngxblocker) and
|
pargs.adminer or pargs.dashboard or pargs.mysqltuner or
|
||||||
(not pargs.all) and (not pargs.wpcli) and
|
pargs.redis or pargs.fail2ban or pargs.security):
|
||||||
(not pargs.netdata) and (not pargs.composer) and
|
|
||||||
(not pargs.phpmyadmin) and (not pargs.adminer) and
|
|
||||||
(not pargs.dashboard) and (not pargs.mysqltuner) and
|
|
||||||
(not pargs.redis)):
|
|
||||||
pargs.web = True
|
pargs.web = True
|
||||||
pargs.admin = True
|
pargs.admin = True
|
||||||
|
pargs.security = True
|
||||||
|
|
||||||
if pargs.php:
|
if pargs.php:
|
||||||
pargs.php72 = True
|
pargs.php72 = True
|
||||||
@@ -90,8 +91,8 @@ class WOStackUpgradeController(CementBaseController):
|
|||||||
if pargs.all:
|
if pargs.all:
|
||||||
pargs.web = True
|
pargs.web = True
|
||||||
pargs.admin = True
|
pargs.admin = True
|
||||||
|
pargs.security = True
|
||||||
pargs.redis = True
|
pargs.redis = True
|
||||||
pargs.ngxblocker = True
|
|
||||||
|
|
||||||
if pargs.web:
|
if pargs.web:
|
||||||
pargs.nginx = True
|
pargs.nginx = True
|
||||||
@@ -110,6 +111,10 @@ class WOStackUpgradeController(CementBaseController):
|
|||||||
pargs.adminer = True
|
pargs.adminer = True
|
||||||
pargs.mysqltuner = True
|
pargs.mysqltuner = True
|
||||||
|
|
||||||
|
if pargs.security:
|
||||||
|
pargs.ngxblocker = True
|
||||||
|
pargs.fail2ban = True
|
||||||
|
|
||||||
# nginx
|
# nginx
|
||||||
if pargs.nginx:
|
if pargs.nginx:
|
||||||
if WOAptGet.is_installed(self, 'nginx-custom'):
|
if WOAptGet.is_installed(self, 'nginx-custom'):
|
||||||
@@ -149,6 +154,11 @@ class WOStackUpgradeController(CementBaseController):
|
|||||||
if WOAptGet.is_installed(self, 'redis-server'):
|
if WOAptGet.is_installed(self, 'redis-server'):
|
||||||
apt_packages = apt_packages + ['redis-server']
|
apt_packages = apt_packages + ['redis-server']
|
||||||
|
|
||||||
|
# fail2ban
|
||||||
|
if pargs.fail2ban:
|
||||||
|
if WOAptGet.is_installed(self, 'fail2ban'):
|
||||||
|
apt_packages = apt_packages + ['fail2ban']
|
||||||
|
|
||||||
# wp-cli
|
# wp-cli
|
||||||
if pargs.wpcli:
|
if pargs.wpcli:
|
||||||
if os.path.isfile('/usr/local/bin/wp'):
|
if os.path.isfile('/usr/local/bin/wp'):
|
||||||
@@ -267,26 +277,26 @@ class WOStackUpgradeController(CementBaseController):
|
|||||||
else:
|
else:
|
||||||
pre_stack(self)
|
pre_stack(self)
|
||||||
if (apt_packages):
|
if (apt_packages):
|
||||||
if (("php7.2-fpm" not in apt_packages) and
|
if not ("php7.2-fpm" in apt_packages or
|
||||||
("php7.3-fpm" not in apt_packages) and
|
"php7.3-fpm" in apt_packages or
|
||||||
("php7.4-fpm" not in apt_packages) and
|
"php7.4-fpm" in apt_packages or
|
||||||
("redis-server" not in apt_packages) and
|
"redis-server" in apt_packages or
|
||||||
("nginx-custom" not in apt_packages) and
|
"nginx-custom" in apt_packages or
|
||||||
("mariadb-server" not in apt_packages)):
|
"mariadb-server" in apt_packages):
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
Log.info(
|
Log.warn(
|
||||||
self, "Your sites may be down for few seconds if "
|
self, "Your sites may be down for few seconds if "
|
||||||
"you are upgrading Nginx, PHP-FPM, MariaDB or Redis")
|
"you are upgrading Nginx, PHP-FPM, MariaDB or Redis")
|
||||||
# Check prompt
|
# Check prompt
|
||||||
if ((not pargs.no_prompt) and (not pargs.force)):
|
if not (pargs.no_prompt or pargs.force):
|
||||||
start_upgrade = input("Do you want to continue:[y/N]")
|
start_upgrade = input("Do you want to continue:[y/N]")
|
||||||
if start_upgrade != "Y" and start_upgrade != "y":
|
if start_upgrade != "Y" and start_upgrade != "y":
|
||||||
Log.error(self, "Not starting package update")
|
Log.error(self, "Not starting package update")
|
||||||
Log.wait(self, "Updating APT packages")
|
Log.wait(self, "Updating APT cache")
|
||||||
# apt-get update
|
# apt-get update
|
||||||
WOAptGet.update(self)
|
WOAptGet.update(self)
|
||||||
Log.valide(self, "Updating APT packages")
|
Log.valide(self, "Updating APT cache")
|
||||||
|
|
||||||
# additional pre_pref
|
# additional pre_pref
|
||||||
if "nginx-custom" in apt_packages:
|
if "nginx-custom" in apt_packages:
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ server {
|
|||||||
server_name 127.0.0.1 localhost;
|
server_name 127.0.0.1 localhost;
|
||||||
access_log off;
|
access_log off;
|
||||||
log_not_found off;
|
log_not_found off;
|
||||||
root /var/www/html;
|
root /var/www/22222/htdocs;
|
||||||
|
allow 127.0.0.1;
|
||||||
|
deny all;
|
||||||
location ~ /(stub_status|nginx_status) {
|
location ~ /(stub_status|nginx_status) {
|
||||||
stub_status on;
|
stub_status on;
|
||||||
allow 127.0.0.1;
|
allow 127.0.0.1;
|
||||||
@@ -21,11 +23,33 @@ server {
|
|||||||
{{#phpconf}}
|
{{#phpconf}}
|
||||||
location ~ /(status|ping) {
|
location ~ /(status|ping) {
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
allow 127.0.0.1;
|
|
||||||
deny all;
|
|
||||||
fastcgi_pass phpstatus;
|
fastcgi_pass phpstatus;
|
||||||
access_log off;
|
access_log off;
|
||||||
log_not_found off;
|
log_not_found off;
|
||||||
}
|
}
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.php$is_args$args;
|
||||||
|
}
|
||||||
|
location /cache/opcache/php72.php {
|
||||||
|
try_files $uri =404;
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_pass php72;
|
||||||
|
access_log off;
|
||||||
|
log_not_found off;
|
||||||
|
}
|
||||||
|
location /cache/opcache/php73.php {
|
||||||
|
try_files $uri =404;
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_pass php73;
|
||||||
|
access_log off;
|
||||||
|
log_not_found off;
|
||||||
|
}
|
||||||
|
location /cache/opcache/php74.php {
|
||||||
|
try_files $uri =404;
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_pass php74;
|
||||||
|
access_log off;
|
||||||
|
log_not_found off;
|
||||||
|
}
|
||||||
{{/phpconf}}
|
{{/phpconf}}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,9 +48,21 @@ class WORepo():
|
|||||||
Log.debug(self, "{0}".format(e))
|
Log.debug(self, "{0}".format(e))
|
||||||
Log.error(self, "Unable to add repo")
|
Log.error(self, "Unable to add repo")
|
||||||
if ppa is not None:
|
if ppa is not None:
|
||||||
|
ppa_split = ppa.split(':')[1]
|
||||||
|
ppa_author = ppa_split.split('/')[0]
|
||||||
|
Log.debug(self, "ppa_author = {0}".format(ppa_author))
|
||||||
|
ppa_package = ppa_split.split('/')[1]
|
||||||
|
Log.debug(self, "ppa_package = {0}".format(ppa_package))
|
||||||
|
if os.path.exists(
|
||||||
|
'/etc/apt/sources.list.d/{0}-ubuntu-{1}-{2}.list'
|
||||||
|
.format(ppa_author,
|
||||||
|
ppa_package, WOVar.wo_platform_codename)):
|
||||||
|
Log.debug(self, "ppa already added")
|
||||||
|
return True
|
||||||
if WOShellExec.cmd_exec(
|
if WOShellExec.cmd_exec(
|
||||||
self, "LC_ALL=C.UTF-8 add-apt-repository -y '{ppa_name}'"
|
self, "LC_ALL=C.UTF-8 add-apt-repository -y '{ppa_name}'"
|
||||||
.format(ppa_name=ppa)):
|
.format(ppa_name=ppa)):
|
||||||
|
Log.debug(self, "Added PPA {0}".format(ppa))
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ class WOAptGet():
|
|||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
orig_out = sys.stdout
|
orig_out = sys.stdout
|
||||||
sys.stdout = open(self.app.config.get('log.logging', 'file'),
|
sys.stdout = open(self.app.config.get('log.colorlog', 'file'),
|
||||||
encoding='utf-8', mode='a')
|
encoding='utf-8', mode='a')
|
||||||
apt_get.autoclean("-y")
|
apt_get.autoclean("-y")
|
||||||
sys.stdout = orig_out
|
sys.stdout = orig_out
|
||||||
|
|||||||
@@ -38,13 +38,13 @@ class Log:
|
|||||||
Logs warning into log file
|
Logs warning into log file
|
||||||
"""
|
"""
|
||||||
print(Log.WARNING + msg + Log.ENDC)
|
print(Log.WARNING + msg + Log.ENDC)
|
||||||
self.app.log.warn(Log.BOLD + msg + Log.ENDC)
|
self.app.log.warning(Log.BOLD + msg + Log.ENDC)
|
||||||
|
|
||||||
def debug(self, msg):
|
def debug(self, msg):
|
||||||
"""
|
"""
|
||||||
Logs debug messages into log file
|
Logs debug messages into log file
|
||||||
"""
|
"""
|
||||||
self.app.log.debug(Log.HEADER + msg + Log.ENDC)
|
self.app.log.debug(Log.HEADER + msg + Log.ENDC, __name__)
|
||||||
|
|
||||||
def wait(self, msg, end='\r', log=True):
|
def wait(self, msg, end='\r', log=True):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ class LogWatcher(object):
|
|||||||
def __del__(self):
|
def __del__(self):
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
def loop(self, interval=0.1, async=False):
|
def loop(self, interval=0.1, req_async=False):
|
||||||
"""Start the loop.
|
"""Start the loop.
|
||||||
If async is True make one loop then return.
|
If async is True make one loop then return.
|
||||||
"""
|
"""
|
||||||
@@ -73,7 +73,7 @@ class LogWatcher(object):
|
|||||||
self.update_files()
|
self.update_files()
|
||||||
for fid, file in list(iter(self.files_map.items())):
|
for fid, file in list(iter(self.files_map.items())):
|
||||||
self.readfile(file)
|
self.readfile(file)
|
||||||
if async:
|
if req_async:
|
||||||
return
|
return
|
||||||
time.sleep(interval)
|
time.sleep(interval)
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class WOVar():
|
|||||||
"""Intialization of core variables"""
|
"""Intialization of core variables"""
|
||||||
|
|
||||||
# WordOps version
|
# WordOps version
|
||||||
wo_version = "3.11.0"
|
wo_version = "3.11.1"
|
||||||
# WordOps packages versions
|
# WordOps packages versions
|
||||||
wo_wp_cli = "2.4.0"
|
wo_wp_cli = "2.4.0"
|
||||||
wo_adminer = "4.7.5"
|
wo_adminer = "4.7.5"
|
||||||
@@ -150,7 +150,7 @@ class WOVar():
|
|||||||
for module in wo_module:
|
for module in wo_module:
|
||||||
wo_php74 = wo_php74 + ["php7.4-{0}".format(module)]
|
wo_php74 = wo_php74 + ["php7.4-{0}".format(module)]
|
||||||
|
|
||||||
wo_php_extra = ["php-memcached", "php-imagick",
|
wo_php_extra = ["php-memcached", "php-imagick", "php-igbinary",
|
||||||
"graphviz", "php-xdebug", "php-msgpack", "php-redis"]
|
"graphviz", "php-xdebug", "php-msgpack", "php-redis"]
|
||||||
|
|
||||||
wo_mysql = ["mariadb-server", "percona-toolkit"]
|
wo_mysql = ["mariadb-server", "percona-toolkit"]
|
||||||
|
|||||||
Reference in New Issue
Block a user