diff --git a/wo/cli/plugins/site_functions.py b/wo/cli/plugins/site_functions.py index 0af68fe..32987e7 100644 --- a/wo/cli/plugins/site_functions.py +++ b/wo/cli/plugins/site_functions.py @@ -141,7 +141,7 @@ 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, 15))) + 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') @@ -804,8 +804,8 @@ def site_package_check(self, stype): not os.path.isfile("/etc/nginx/common/php73.conf")): data = dict() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/locations-php73.conf') - wo_nginx = open('/etc/nginx/common/locations-php73.conf', + 'file /etc/nginx/common/locations-wo.conf') + wo_nginx = open('/etc/nginx/common/locations-wo.conf', encoding='utf-8', mode='w') self.app.render((data), 'locations-php7.mustache', out=wo_nginx) diff --git a/wo/cli/plugins/stack.py b/wo/cli/plugins/stack.py index 41974b0..5e2d166 100644 --- a/wo/cli/plugins/stack.py +++ b/wo/cli/plugins/stack.py @@ -1394,6 +1394,9 @@ class WOStackController(CementBaseController): # set redis.conf parameter # set maxmemory 10% for ram below 512MB and 20% for others # set maxmemory-policy allkeys-lru + # enable systemd service + Log.debug(self, "Enabling redis systemd service") + WOShellExec.cmd_exec(self, "systemctl enable redis-server") if os.path.isfile("/etc/redis/redis.conf"): if WOVariables.wo_ram < 512: Log.debug(self, "Setting maxmemory variable to {0} in redis.conf" @@ -1404,6 +1407,7 @@ class WOStackController(CementBaseController): 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" @@ -1464,17 +1468,24 @@ class WOStackController(CementBaseController): # PHP 7.2 if self.app.pargs.php: Log.debug(self, "Removing apt_packages variable of PHP") - if not WOAptGet.is_installed(self, 'php7.2-fpm'): - apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra + if WOAptGet.is_installed(self, 'php7.2-fpm'): + if not WOAptGet.is_installed(self, 'php7.3-fpm'): + apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra + else: + apt_packages = apt_packages + WOVariables.wo_php + else: + Log.error(self, "PHP 7.2 not found") # PHP7.3 if self.app.pargs.php73: Log.debug(self, "Removing apt_packages variable of PHP 7.3") - if not WOAptGet.is_installed(self, 'php7.3-fpm'): + if WOAptGet.is_installed(self, 'php7.3-fpm'): if not (WOAptGet.is_installed(self, 'php7.2-fpm')): apt_packages = apt_packages + WOVariables.wo_php73 + WOVariables.wo_php_extra else: apt_packages = apt_packages + WOVariables.wo_php73 + else: + Log.error(self, "PHP 7.3 not found") # REDIS if self.app.pargs.redis: @@ -1548,15 +1559,6 @@ class WOStackController(CementBaseController): Log.info(self, "Successfully removed packages") - # 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): """Start purging of packages""" @@ -1601,21 +1603,25 @@ class WOStackController(CementBaseController): # PHP if self.app.pargs.php: Log.debug(self, "Purge apt_packages variable PHP") - if not WOAptGet.is_installed(self, 'php7.2-fpm'): - apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra + if WOAptGet.is_installed(self, 'php7.2-fpm'): + if not (WOAptGet.is_installed(self, 'php7.3-fpm')): + apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra + else: + apt_packages = apt_packages + WOVariables.wo_php else: Log.error(self, "Cannot Purge PHP 7.2. not found.") # PHP 7.3 if self.app.pargs.php73: Log.debug(self, "Removing apt_packages variable of PHP 7.3") - if not WOAptGet.is_installed(self, 'php7.3-fpm'): + if WOAptGet.is_installed(self, 'php7.3-fpm'): if not (WOAptGet.is_installed(self, 'php7.2-fpm')): apt_packages = apt_packages + WOVariables.wo_php73 + WOVariables.wo_php_extra else: apt_packages = apt_packages + WOVariables.wo_php73 else: Log.error(self, "Cannot Purge PHP 7.3. not found.") + # WP-CLI if self.app.pargs.wpcli: Log.debug(self, "Purge package variable WPCLI") diff --git a/wo/cli/plugins/stack_upgrade.py b/wo/cli/plugins/stack_upgrade.py index 6ac25aa..0e844aa 100644 --- a/wo/cli/plugins/stack_upgrade.py +++ b/wo/cli/plugins/stack_upgrade.py @@ -72,7 +72,7 @@ class WOStackUpgradeController(CementBaseController): WOAptGet.update(self) Log.info(self, "Installing packages, please wait ...") WOAptGet.install(self, WOVariables.wo_php + - WOVariables.wo_php_extra) + WOVariables.wo_php_extra) @expose(hide=True) def default(self): @@ -106,7 +106,10 @@ class WOStackUpgradeController(CementBaseController): if self.app.pargs.php: if WOAptGet.is_installed(self, 'php7.2-fpm'): - 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 + WOVariables.wo_php_extra + else: + apt_packages = apt_packages + WOVariables.wo_php else: Log.info(self, "PHP 7.2 is not installed")