Fix wo info and add tweaks to wo stack upgrade

This commit is contained in:
VirtuBox
2019-10-30 04:23:20 +01:00
parent 5cb8ab6268
commit f2d4bcb353
12 changed files with 98 additions and 69 deletions

View File

@@ -79,20 +79,22 @@ class WOInfoController(CementBaseController):
max_execution_time = config['PHP']['max_execution_time']
config.read('/etc/{0}/fpm/pool.d/www.conf'.format("php/7.2"))
www_listen = config['www-php72']['listen']
www_ping_path = config['www-php72']['ping.path']
www_pm_status_path = config['www-php72']['pm.status_path']
www_pm = config['www-php72']['pm']
www_pm_max_requests = config['www-php72']['pm.max_requests']
www_pm_max_children = config['www-php72']['pm.max_children']
www_pm_start_servers = config['www-php72']['pm.start_servers']
www_pm_min_spare_servers = config['www-php72']['pm.min_spare_servers']
www_pm_max_spare_servers = config['www-php72']['pm.max_spare_servers']
www_request_terminate_time = (config['www-php72']
wo_sec = (config.sections())[0]
www_listen = config[[wo_sec]]['listen']
www_ping_path = config[[wo_sec]]['ping.path']
www_pm_status_path = config[[wo_sec]]['pm.status_path']
www_pm = config[[wo_sec]]['pm']
www_pm_max_requests = config[[wo_sec]]['pm.max_requests']
www_pm_max_children = config[[wo_sec]]['pm.max_children']
www_pm_start_servers = config[[wo_sec]]['pm.start_servers']
www_pm_min_spare_servers = config[[wo_sec]]['pm.min_spare_servers']
www_pm_max_spare_servers = config[[wo_sec]]['pm.max_spare_servers']
www_request_terminate_time = (config[[wo_sec]]
['request_terminate_timeout'])
try:
www_xdebug = (config['www-php72']['php_admin_flag[xdebug.profiler_enable'
'_trigger]'])
www_xdebug = (
config[[wo_sec]]['php_admin_flag[xdebug.profiler_enable'
'_trigger]'])
except Exception as e:
Log.debug(self, "{0}".format(e))
www_xdebug = 'off'
@@ -156,19 +158,20 @@ class WOInfoController(CementBaseController):
max_execution_time = config['PHP']['max_execution_time']
config.read('/etc/php/7.3/fpm/pool.d/www.conf')
www_listen = config['www-php73']['listen']
www_ping_path = config['www-php73']['ping.path']
www_pm_status_path = config['www-php73']['pm.status_path']
www_pm = config['www-php73']['pm']
www_pm_max_requests = config['www-php73']['pm.max_requests']
www_pm_max_children = config['www-php73']['pm.max_children']
www_pm_start_servers = config['www-php73']['pm.start_servers']
www_pm_min_spare_servers = config['www-php73']['pm.min_spare_servers']
www_pm_max_spare_servers = config['www-php73']['pm.max_spare_servers']
www_request_terminate_time = (config['www-php73']
wo_sec = (config.sections())[0]
www_listen = config[wo_sec]['listen']
www_ping_path = config[wo_sec]['ping.path']
www_pm_status_path = config[wo_sec]['pm.status_path']
www_pm = config[wo_sec]['pm']
www_pm_max_requests = config[wo_sec]['pm.max_requests']
www_pm_max_children = config[wo_sec]['pm.max_children']
www_pm_start_servers = config[wo_sec]['pm.start_servers']
www_pm_min_spare_servers = config[wo_sec]['pm.min_spare_servers']
www_pm_max_spare_servers = config[wo_sec]['pm.max_spare_servers']
www_request_terminate_time = (config[wo_sec]
['request_terminate_timeout'])
try:
www_xdebug = (config['www-php73']
www_xdebug = (config[wo_sec]
['php_admin_flag[xdebug.profiler_enable'
'_trigger]'])
except Exception as e:
@@ -266,7 +269,8 @@ class WOInfoController(CementBaseController):
if self.app.pargs.nginx:
if (WOAptGet.is_installed(self, 'nginx-custom') or
WOAptGet.is_installed(self, 'nginx-wo')):
WOAptGet.is_installed(self, 'nginx-wo') or
(os.path.exists('/usr/bin/nginx'))):
self.info_nginx()
else:
Log.error(self, "Nginx is not installed")

View File

@@ -78,7 +78,7 @@ class WOSiteController(CementBaseController):
Log.error(self, "service nginx reload failed. "
"check issues with `nginx -t` command")
else:
Log.error(self, "nginx configuration file does not exist")
Log.error(self, 'nginx configuration file does not exist')
@expose(help="Disable site example.com")
def disable(self):
@@ -106,7 +106,7 @@ class WOSiteController(CementBaseController):
if not os.path.isfile('/etc/nginx/sites-enabled/{0}'
.format(wo_domain)):
Log.debug(self, "Site {0} already disabled".format(wo_domain))
Log.info(self, "[" + Log.FAIL + "Failed" + Log.OKBLUE+"]")
Log.info(self, "[" + Log.FAIL + "Failed" + Log.OKBLUE + "]")
else:
WOFileUtils.remove_symlink(self,
'/etc/nginx/sites-enabled/{0}'
@@ -176,7 +176,7 @@ class WOSiteController(CementBaseController):
dbname=wo_db_name, dbuser=wo_db_user,
php_version=php_version,
dbpass=wo_db_pass,
ssl=ssl, sslprovider=sslprovider, sslexpiry=sslexpiry,
ssl=ssl, sslprovider=sslprovider, sslexpiry=sslexpiry,
type=sitetype + " " + cachetype + " ({0})"
.format("enabled" if siteinfo.is_enabled else
"disabled"))
@@ -452,7 +452,7 @@ class WOSiteCreateController(CementBaseController):
if stype == 'proxy':
data = dict(site_name=wo_domain, www_domain=wo_www_domain,
static=True, basic=False, php73=False, wp=False,
static=True, basic=False, php73=False, wp=False,
wpfc=False, wpsc=False, wprocket=False, wpce=False,
multisite=False,
wpsubdir=False, webroot=wo_site_webroot)
@@ -463,7 +463,7 @@ class WOSiteCreateController(CementBaseController):
if pargs.php73:
data = dict(site_name=wo_domain, www_domain=wo_www_domain,
static=False, basic=False, php73=True, wp=False,
static=False, basic=False, php73=True, wp=False,
wpfc=False, wpsc=False, wprocket=False, wpce=False,
multisite=False,
wpsubdir=False, webroot=wo_site_webroot)
@@ -471,7 +471,7 @@ class WOSiteCreateController(CementBaseController):
if stype in ['html', 'php']:
data = dict(site_name=wo_domain, www_domain=wo_www_domain,
static=True, basic=False, php73=False, wp=False,
static=True, basic=False, php73=False, wp=False,
wpfc=False, wpsc=False, wprocket=False, wpce=False,
multisite=False,
wpsubdir=False, webroot=wo_site_webroot)
@@ -483,7 +483,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, wprocket=False, wpce=False,
multisite=False,
wpsubdir=False, webroot=wo_site_webroot,
@@ -509,8 +509,7 @@ class WOSiteCreateController(CementBaseController):
elif data:
data['php73'] = False
if ((not pargs.wpfc) and
(not pargs.wpsc) and
if ((not pargs.wpfc) and (not pargs.wpsc) and
(not pargs.wprocket) and
(not pargs.wpce) and
(not pargs.wpredis)):
@@ -1131,7 +1130,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, wprocket=False, wpce=False,
multisite=False, wpsubdir=False, webroot=wo_site_webroot,
currsitetype=oldsitetype, currcachetype=oldcachetype)
@@ -1140,7 +1139,7 @@ class WOSiteUpdateController(CementBaseController):
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, wprocket=False, wpce=False,
multisite=False, wpsubdir=False, webroot=wo_site_webroot,
wo_db_name='', wo_db_user='', wo_db_pass='',
@@ -1294,6 +1293,11 @@ class WOSiteUpdateController(CementBaseController):
letsencrypt = False
acme_subdomain = False
acme_wildcard = False
else:
data['letsencrypt'] = False
letsencrypt = False
acme_subdomain = False
acme_wildcard = False
if not (acme_subdomain is True):
if letsencrypt is check_ssl:

View File

@@ -539,6 +539,7 @@ class WOStackController(CementBaseController):
Log.info(self, "Successfully installed packages")
else:
return self.msg
return 0
@expose(help="Remove packages")
def remove(self):

View File

@@ -814,14 +814,14 @@ def post_pref(self, apt_packages, packages, upgrade=False):
"/etc/mysql/my.cnf.default-pkg")
wo_ram = psutil.virtual_memory().total / (1024 * 1024)
# set InnoDB variable depending on the RAM available
wo_ram_innodb = int(wo_ram*0.3)
wo_ram_log_buffer = int(wo_ram_innodb*0.25)
wo_ram_log_size = int(wo_ram_log_buffer*0.5)
wo_ram_innodb = int(wo_ram * 0.3)
wo_ram_log_buffer = int(wo_ram_innodb * 0.25)
wo_ram_log_size = int(wo_ram_log_buffer * 0.5)
if (wo_ram < 2000):
wo_innodb_instance = int(1)
tmp_table_size = int(32)
elif (wo_ram > 2000) and (wo_ram < 64000):
wo_innodb_instance = int(wo_ram/1000)
wo_innodb_instance = int(wo_ram / 1000)
tmp_table_size = int(128)
elif (wo_ram > 64000):
wo_innodb_instance = int(64)
@@ -1015,24 +1015,26 @@ def post_pref(self, apt_packages, packages, upgrade=False):
if wo_ram < 1024:
Log.debug(self, "Setting maxmemory variable to "
"{0} in redis.conf"
.format(int(wo_ram*1024*1024*0.1)))
WOFileUtils.searchreplace(self,
"/etc/redis/redis.conf",
"# maxmemory <bytes>",
"maxmemory {0}"
.format
(int(wo_ram*1024*1024*0.1)))
.format(int(wo_ram * 1024 * 1024 * 0.1)))
WOFileUtils.searchreplace
(self,
"/etc/redis/redis.conf",
"# maxmemory <bytes>",
"maxmemory {0}"
.format
(int(wo_ram * 1024 * 1024 * 0.1)))
else:
Log.debug(self, "Setting maxmemory variable to {0} "
"in redis.conf"
.format(int(wo_ram*1024*1024*0.2)))
WOFileUtils.searchreplace(self,
"/etc/redis/redis.conf",
"# maxmemory <bytes>",
"maxmemory {0}"
.format
(int(wo_ram*1024*1024*0.2)))
.format(int(wo_ram * 1024 * 1024 * 0.2)))
WOFileUtils.searchreplace(
self,
"/etc/redis/redis.conf",
"# maxmemory <bytes>",
"maxmemory {0}"
.format
(int(wo_ram * 1024 * 1024 * 0.2)))
Log.debug(
self, "Setting maxmemory-policy variable to "

View File

@@ -3,7 +3,7 @@ import shutil
from cement.core.controller import CementBaseController, expose
from wo.cli.plugins.stack_pref import post_pref, pre_pref
from wo.cli.plugins.stack_pref import post_pref, pre_pref, pre_stack
from wo.core.aptget import WOAptGet
from wo.core.download import WODownload
from wo.core.extract import WOExtract
@@ -178,6 +178,7 @@ class WOStackUpgradeController(CementBaseController):
if ((not (apt_packages)) and (not(packages))):
self.app.args.print_help()
else:
pre_stack(self)
if (apt_packages):
if (("php7.2-fpm" not in apt_packages) and
("php7.3-fpm" not in apt_packages) and