feat: convert WordOps from Nginx to OpenLiteSpeed + LSPHP + LSCache
Complete conversion of the WordOps stack from Nginx + PHP-FPM to OpenLiteSpeed + LSPHP + LSCache. This is a full rewrite across all 7 phases of the codebase: - Foundation: OLS paths, variables, services, removed pynginxconfig dep - Templates: 11 new OLS mustache templates, removed nginx-specific ones - Stack: stack_pref, stack, stack_services, stack_upgrade, stack_migrate - Site: site_functions, site, site_create, site_update - Plugins: debug, info, log, clean rewritten for OLS - SSL/ACME: acme.sh deploy uses lswsctrl, OLS vhssl blocks - Other: secure, backup, clone, install script Additional features: - Debian 13 (trixie) support - PHP 8.5 support - WP Fort Knox mu-plugin integration (wo secure --lockdown/--unlock) - --nginx CLI flag preserved for backward compatibility Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -18,7 +18,6 @@ class WOStackStatusController(CementBaseController):
|
||||
def start(self):
|
||||
"""Start services"""
|
||||
services = []
|
||||
wo_system = "/lib/systemd/system/"
|
||||
pargs = self.app.pargs
|
||||
if all(value is None or value is False for value in vars(pargs).values()):
|
||||
pargs.nginx = True
|
||||
@@ -28,30 +27,23 @@ class WOStackStatusController(CementBaseController):
|
||||
pargs.netdata = True
|
||||
pargs.ufw = True
|
||||
|
||||
if pargs.php:
|
||||
if self.app.config.has_section('php'):
|
||||
config_php_ver = self.app.config.get(
|
||||
'php', 'version')
|
||||
current_php = config_php_ver.replace(".", "")
|
||||
setattr(self.app.pargs, 'php{0}'.format(current_php), True)
|
||||
|
||||
if pargs.nginx:
|
||||
if os.path.exists('{0}'.format(wo_system) + 'nginx.service'):
|
||||
services = services + ['nginx']
|
||||
if pargs.nginx or pargs.php:
|
||||
if os.path.isfile('/usr/local/lsws/bin/openlitespeed'):
|
||||
if 'lsws' not in services:
|
||||
services = services + ['lsws']
|
||||
else:
|
||||
Log.info(self, "Nginx is not installed")
|
||||
|
||||
if pargs.php:
|
||||
for parg_version, version in WOVar.wo_php_versions.items():
|
||||
if os.path.exists(f'{wo_system}' + f'php{version}-fpm.service'):
|
||||
services = services + [f'php{version}-fpm']
|
||||
if pargs.nginx:
|
||||
Log.info(self, "OpenLiteSpeed is not installed")
|
||||
if pargs.php:
|
||||
Log.info(self, "LSPHP is managed by OpenLiteSpeed")
|
||||
|
||||
for parg_version, version in WOVar.wo_php_versions.items():
|
||||
if (getattr(pargs, parg_version, False) and
|
||||
os.path.exists(f'{wo_system}' + f'php{version}-fpm.service')):
|
||||
services = services + [f'php{version}-fpm']
|
||||
else:
|
||||
Log.info(self, f"PHP{version}-FPM is not installed")
|
||||
if getattr(pargs, parg_version, False):
|
||||
if os.path.isfile('/usr/local/lsws/bin/openlitespeed'):
|
||||
if 'lsws' not in services:
|
||||
services = services + ['lsws']
|
||||
else:
|
||||
Log.info(self, "LSPHP is managed by OpenLiteSpeed")
|
||||
|
||||
if pargs.mysql:
|
||||
if ((WOVar.wo_mysql_host == "localhost") or
|
||||
@@ -65,14 +57,13 @@ class WOStackStatusController(CementBaseController):
|
||||
"Unable to check MySQL service status")
|
||||
|
||||
if pargs.redis:
|
||||
if os.path.exists('{0}'.format(wo_system) +
|
||||
'redis-server.service'):
|
||||
if os.path.exists('/lib/systemd/system/redis-server.service'):
|
||||
services = services + ['redis-server']
|
||||
else:
|
||||
Log.info(self, "Redis server is not installed")
|
||||
|
||||
if pargs.fail2ban:
|
||||
if os.path.exists('{0}'.format(wo_system) + 'fail2ban.service'):
|
||||
if os.path.exists('/lib/systemd/system/fail2ban.service'):
|
||||
services = services + ['fail2ban']
|
||||
else:
|
||||
Log.info(self, "fail2ban is not installed")
|
||||
@@ -86,7 +77,7 @@ class WOStackStatusController(CementBaseController):
|
||||
|
||||
# netdata
|
||||
if pargs.netdata:
|
||||
if os.path.exists('{0}'.format(wo_system) + 'netdata.service'):
|
||||
if os.path.exists('/lib/systemd/system/netdata.service'):
|
||||
services = services + ['netdata']
|
||||
else:
|
||||
Log.info(self, "Netdata is not installed")
|
||||
@@ -99,37 +90,29 @@ class WOStackStatusController(CementBaseController):
|
||||
def stop(self):
|
||||
"""Stop services"""
|
||||
services = []
|
||||
wo_system = "/lib/systemd/system/"
|
||||
pargs = self.app.pargs
|
||||
if all(value is None or value is False for value in vars(pargs).values()):
|
||||
pargs.nginx = True
|
||||
pargs.php = True
|
||||
pargs.mysql = True
|
||||
|
||||
if pargs.php:
|
||||
if self.app.config.has_section('php'):
|
||||
config_php_ver = self.app.config.get(
|
||||
'php', 'version')
|
||||
current_php = config_php_ver.replace(".", "")
|
||||
setattr(self.app.pargs, 'php{0}'.format(current_php), True)
|
||||
|
||||
if pargs.nginx:
|
||||
if os.path.exists('{0}'.format(wo_system) + 'nginx.service'):
|
||||
services = services + ['nginx']
|
||||
if pargs.nginx or pargs.php:
|
||||
if os.path.isfile('/usr/local/lsws/bin/openlitespeed'):
|
||||
if 'lsws' not in services:
|
||||
services = services + ['lsws']
|
||||
else:
|
||||
Log.info(self, "Nginx is not installed")
|
||||
|
||||
if pargs.php:
|
||||
for parg_version, version in WOVar.wo_php_versions.items():
|
||||
if os.path.exists(f'{wo_system}' + f'php{version}-fpm.service'):
|
||||
services = services + [f'php{version}-fpm']
|
||||
if pargs.nginx:
|
||||
Log.info(self, "OpenLiteSpeed is not installed")
|
||||
if pargs.php:
|
||||
Log.info(self, "LSPHP is managed by OpenLiteSpeed")
|
||||
|
||||
for parg_version, version in WOVar.wo_php_versions.items():
|
||||
if (getattr(pargs, parg_version, False) and
|
||||
os.path.exists(f'{wo_system}' + f'php{version}-fpm.service')):
|
||||
services = services + [f'php{version}-fpm']
|
||||
else:
|
||||
Log.info(self, f"PHP{version}-FPM is not installed")
|
||||
if getattr(pargs, parg_version, False):
|
||||
if os.path.isfile('/usr/local/lsws/bin/openlitespeed'):
|
||||
if 'lsws' not in services:
|
||||
services = services + ['lsws']
|
||||
else:
|
||||
Log.info(self, "LSPHP is managed by OpenLiteSpeed")
|
||||
|
||||
if pargs.mysql:
|
||||
if ((WOVar.wo_mysql_host == "localhost") or
|
||||
@@ -143,14 +126,13 @@ class WOStackStatusController(CementBaseController):
|
||||
"Unable to check MySQL service status")
|
||||
|
||||
if pargs.redis:
|
||||
if os.path.exists('{0}'.format(wo_system) +
|
||||
'redis-server.service'):
|
||||
if os.path.exists('/lib/systemd/system/redis-server.service'):
|
||||
services = services + ['redis-server']
|
||||
else:
|
||||
Log.info(self, "Redis server is not installed")
|
||||
|
||||
if pargs.fail2ban:
|
||||
if os.path.exists('{0}'.format(wo_system) + 'fail2ban.service'):
|
||||
if os.path.exists('/lib/systemd/system/fail2ban.service'):
|
||||
services = services + ['fail2ban']
|
||||
else:
|
||||
Log.info(self, "fail2ban is not installed")
|
||||
@@ -164,7 +146,7 @@ class WOStackStatusController(CementBaseController):
|
||||
|
||||
# netdata
|
||||
if pargs.netdata:
|
||||
if os.path.exists('{0}'.format(wo_system) + 'netdata.service'):
|
||||
if os.path.exists('/lib/systemd/system/netdata.service'):
|
||||
services = services + ['netdata']
|
||||
else:
|
||||
Log.info(self, "Netdata is not installed")
|
||||
@@ -177,7 +159,6 @@ class WOStackStatusController(CementBaseController):
|
||||
def restart(self):
|
||||
"""Restart services"""
|
||||
services = []
|
||||
wo_system = "/lib/systemd/system/"
|
||||
pargs = self.app.pargs
|
||||
if all(value is None or value is False for value in vars(pargs).values()):
|
||||
pargs.nginx = True
|
||||
@@ -185,30 +166,23 @@ class WOStackStatusController(CementBaseController):
|
||||
pargs.mysql = True
|
||||
pargs.netdata = True
|
||||
|
||||
if pargs.php:
|
||||
if self.app.config.has_section('php'):
|
||||
config_php_ver = self.app.config.get(
|
||||
'php', 'version')
|
||||
current_php = config_php_ver.replace(".", "")
|
||||
setattr(self.app.pargs, 'php{0}'.format(current_php), True)
|
||||
|
||||
if pargs.nginx:
|
||||
if os.path.exists('{0}'.format(wo_system) + 'nginx.service'):
|
||||
services = services + ['nginx']
|
||||
if pargs.nginx or pargs.php:
|
||||
if os.path.isfile('/usr/local/lsws/bin/openlitespeed'):
|
||||
if 'lsws' not in services:
|
||||
services = services + ['lsws']
|
||||
else:
|
||||
Log.info(self, "Nginx is not installed")
|
||||
|
||||
if pargs.php:
|
||||
for parg_version, version in WOVar.wo_php_versions.items():
|
||||
if os.path.exists(f'{wo_system}' + f'php{version}-fpm.service'):
|
||||
services = services + [f'php{version}-fpm']
|
||||
if pargs.nginx:
|
||||
Log.info(self, "OpenLiteSpeed is not installed")
|
||||
if pargs.php:
|
||||
Log.info(self, "LSPHP is managed by OpenLiteSpeed")
|
||||
|
||||
for parg_version, version in WOVar.wo_php_versions.items():
|
||||
if (getattr(pargs, parg_version, False) and
|
||||
os.path.exists(f'{wo_system}' + f'php{version}-fpm.service')):
|
||||
services = services + [f'php{version}-fpm']
|
||||
else:
|
||||
Log.info(self, f"PHP{version}-FPM is not installed")
|
||||
if getattr(pargs, parg_version, False):
|
||||
if os.path.isfile('/usr/local/lsws/bin/openlitespeed'):
|
||||
if 'lsws' not in services:
|
||||
services = services + ['lsws']
|
||||
else:
|
||||
Log.info(self, "LSPHP is managed by OpenLiteSpeed")
|
||||
|
||||
if pargs.mysql:
|
||||
if ((WOVar.wo_mysql_host == "localhost") or
|
||||
@@ -222,14 +196,13 @@ class WOStackStatusController(CementBaseController):
|
||||
"Unable to check MySQL service status")
|
||||
|
||||
if pargs.redis:
|
||||
if os.path.exists('{0}'.format(wo_system) +
|
||||
'redis-server.service'):
|
||||
if os.path.exists('/lib/systemd/system/redis-server.service'):
|
||||
services = services + ['redis-server']
|
||||
else:
|
||||
Log.info(self, "Redis server is not installed")
|
||||
|
||||
if pargs.fail2ban:
|
||||
if os.path.exists('{0}'.format(wo_system) + 'fail2ban.service'):
|
||||
if os.path.exists('/lib/systemd/system/fail2ban.service'):
|
||||
services = services + ['fail2ban']
|
||||
else:
|
||||
Log.info(self, "fail2ban is not installed")
|
||||
@@ -243,7 +216,7 @@ class WOStackStatusController(CementBaseController):
|
||||
|
||||
# netdata
|
||||
if pargs.netdata:
|
||||
if os.path.exists('{0}'.format(wo_system) + 'netdata.service'):
|
||||
if os.path.exists('/lib/systemd/system/netdata.service'):
|
||||
services = services + ['netdata']
|
||||
else:
|
||||
Log.info(self, "Netdata is not installed")
|
||||
@@ -256,7 +229,6 @@ class WOStackStatusController(CementBaseController):
|
||||
def status(self):
|
||||
"""Status of services"""
|
||||
services = []
|
||||
wo_system = "/lib/systemd/system/"
|
||||
pargs = self.app.pargs
|
||||
if all(value is None or value is False for value in vars(pargs).values()):
|
||||
pargs.nginx = True
|
||||
@@ -267,15 +239,17 @@ class WOStackStatusController(CementBaseController):
|
||||
pargs.ufw = True
|
||||
|
||||
if pargs.nginx:
|
||||
if os.path.exists('{0}'.format(wo_system) + 'nginx.service'):
|
||||
services = services + ['nginx']
|
||||
if os.path.isfile('/usr/local/lsws/bin/openlitespeed'):
|
||||
services = services + ['lsws']
|
||||
else:
|
||||
Log.info(self, "Nginx is not installed")
|
||||
Log.info(self, "OpenLiteSpeed is not installed")
|
||||
|
||||
if pargs.php:
|
||||
for parg_version, version in WOVar.wo_php_versions.items():
|
||||
if os.path.exists(f'{wo_system}' + f'php{version}-fpm.service'):
|
||||
services = services + [f'php{version}-fpm']
|
||||
if os.path.isfile('/usr/local/lsws/bin/openlitespeed'):
|
||||
if 'lsws' not in services:
|
||||
services = services + ['lsws']
|
||||
else:
|
||||
Log.info(self, "LSPHP is managed by OpenLiteSpeed")
|
||||
|
||||
if pargs.mysql:
|
||||
if ((WOVar.wo_mysql_host == "localhost") or
|
||||
@@ -289,14 +263,13 @@ class WOStackStatusController(CementBaseController):
|
||||
"Unable to check MySQL service status")
|
||||
|
||||
if pargs.redis:
|
||||
if os.path.exists('{0}'.format(wo_system) +
|
||||
'redis-server.service'):
|
||||
if os.path.exists('/lib/systemd/system/redis-server.service'):
|
||||
services = services + ['redis-server']
|
||||
else:
|
||||
Log.info(self, "Redis server is not installed")
|
||||
|
||||
if pargs.fail2ban:
|
||||
if os.path.exists('{0}'.format(wo_system) + 'fail2ban.service'):
|
||||
if os.path.exists('/lib/systemd/system/fail2ban.service'):
|
||||
services = services + ['fail2ban']
|
||||
else:
|
||||
Log.info(self, "fail2ban is not installed")
|
||||
@@ -310,7 +283,7 @@ class WOStackStatusController(CementBaseController):
|
||||
|
||||
# netdata
|
||||
if pargs.netdata:
|
||||
if os.path.exists('{0}'.format(wo_system) + 'netdata.service'):
|
||||
if os.path.exists('/lib/systemd/system/netdata.service'):
|
||||
services = services + ['netdata']
|
||||
else:
|
||||
Log.info(self, "Netdata is not installed")
|
||||
@@ -334,7 +307,6 @@ class WOStackStatusController(CementBaseController):
|
||||
def reload(self):
|
||||
"""Reload service"""
|
||||
services = []
|
||||
wo_system = "/lib/systemd/system/"
|
||||
pargs = self.app.pargs
|
||||
if all(value is None or value is False for value in vars(pargs).values()):
|
||||
pargs.nginx = True
|
||||
@@ -342,30 +314,23 @@ class WOStackStatusController(CementBaseController):
|
||||
pargs.mysql = True
|
||||
pargs.fail2ban = True
|
||||
|
||||
if pargs.php:
|
||||
if self.app.config.has_section('php'):
|
||||
config_php_ver = self.app.config.get(
|
||||
'php', 'version')
|
||||
current_php = config_php_ver.replace(".", "")
|
||||
setattr(self.app.pargs, 'php{0}'.format(current_php), True)
|
||||
|
||||
if pargs.nginx:
|
||||
if os.path.exists('{0}'.format(wo_system) + 'nginx.service'):
|
||||
services = services + ['nginx']
|
||||
if pargs.nginx or pargs.php:
|
||||
if os.path.isfile('/usr/local/lsws/bin/openlitespeed'):
|
||||
if 'lsws' not in services:
|
||||
services = services + ['lsws']
|
||||
else:
|
||||
Log.info(self, "Nginx is not installed")
|
||||
|
||||
if pargs.php:
|
||||
for parg_version, version in WOVar.wo_php_versions.items():
|
||||
if os.path.exists(f'{wo_system}' + f'php{version}-fpm.service'):
|
||||
services = services + [f'php{version}-fpm']
|
||||
if pargs.nginx:
|
||||
Log.info(self, "OpenLiteSpeed is not installed")
|
||||
if pargs.php:
|
||||
Log.info(self, "LSPHP is managed by OpenLiteSpeed")
|
||||
|
||||
for parg_version, version in WOVar.wo_php_versions.items():
|
||||
if (getattr(pargs, parg_version, False) and
|
||||
os.path.exists(f'{wo_system}' + f'php{version}-fpm.service')):
|
||||
services = services + [f'php{version}-fpm']
|
||||
else:
|
||||
Log.info(self, f"PHP{version}-FPM is not installed")
|
||||
if getattr(pargs, parg_version, False):
|
||||
if os.path.isfile('/usr/local/lsws/bin/openlitespeed'):
|
||||
if 'lsws' not in services:
|
||||
services = services + ['lsws']
|
||||
else:
|
||||
Log.info(self, "LSPHP is managed by OpenLiteSpeed")
|
||||
|
||||
if pargs.mysql:
|
||||
if ((WOVar.wo_mysql_host == "localhost") or
|
||||
@@ -379,14 +344,13 @@ class WOStackStatusController(CementBaseController):
|
||||
"Unable to check MySQL service status")
|
||||
|
||||
if pargs.redis:
|
||||
if os.path.exists('{0}'.format(wo_system) +
|
||||
'redis-server.service'):
|
||||
if os.path.exists('/lib/systemd/system/redis-server.service'):
|
||||
services = services + ['redis-server']
|
||||
else:
|
||||
Log.info(self, "Redis server is not installed")
|
||||
|
||||
if pargs.fail2ban:
|
||||
if os.path.exists('{0}'.format(wo_system) + 'fail2ban.service'):
|
||||
if os.path.exists('/lib/systemd/system/fail2ban.service'):
|
||||
services = services + ['fail2ban']
|
||||
else:
|
||||
Log.info(self, "fail2ban is not installed")
|
||||
@@ -400,7 +364,7 @@ class WOStackStatusController(CementBaseController):
|
||||
|
||||
# netdata
|
||||
if pargs.netdata:
|
||||
if os.path.exists('{0}'.format(wo_system) + 'netdata.service'):
|
||||
if os.path.exists('/lib/systemd/system/netdata.service'):
|
||||
services = services + ['netdata']
|
||||
else:
|
||||
Log.info(self, "Netdata is not installed")
|
||||
|
||||
Reference in New Issue
Block a user