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:
@@ -25,7 +25,7 @@ class WOStackMigrateController(CementBaseController):
|
||||
dict(help="Migrate/Upgrade database to MariaDB",
|
||||
action='store_true')),
|
||||
(['--nginx'],
|
||||
dict(help="Migrate Nginx TLS configuration to HTTP/3 QUIC",
|
||||
dict(help="Migrate OpenLiteSpeed configuration",
|
||||
action='store_true')),
|
||||
(['--force'],
|
||||
dict(help="Force Packages upgrade without any prompt",
|
||||
@@ -102,41 +102,34 @@ class WOStackMigrateController(CementBaseController):
|
||||
post_pref(self, WOVar.wo_mysql, [])
|
||||
|
||||
@expose(hide=True)
|
||||
def migrate_nginx(self):
|
||||
def migrate_ols(self):
|
||||
|
||||
# Add Nginx repo
|
||||
pre_pref(self, WOVar.wo_nginx)
|
||||
# Install Nginx
|
||||
# Add OLS repo
|
||||
pre_pref(self, WOVar.wo_ols)
|
||||
# Install/Upgrade OpenLiteSpeed
|
||||
Log.wait(self, "Updating apt-cache ")
|
||||
WOAptGet.update(self)
|
||||
Log.valide(self, "Updating apt-cache ")
|
||||
Log.wait(self, "Upgrading Nginx ")
|
||||
if WOAptGet.install(self, WOVar.wo_nginx):
|
||||
Log.valide(self, "Upgrading Nginx ")
|
||||
Log.wait(self, "Upgrading OpenLiteSpeed ")
|
||||
if WOAptGet.install(self, WOVar.wo_ols):
|
||||
Log.valide(self, "Upgrading OpenLiteSpeed ")
|
||||
else:
|
||||
Log.failed(self, "Upgrading Nginx ")
|
||||
Log.failed(self, "Upgrading OpenLiteSpeed ")
|
||||
# Update vhost SSL configs to enable QUIC
|
||||
allsites = getAllsites(self)
|
||||
for site in allsites:
|
||||
if not site:
|
||||
pass
|
||||
if os.path.exists(f'/var/www/{site.sitename}/conf/nginx/ssl.conf'):
|
||||
if not os.path.islink(f'/var/www/{site.sitename}/conf/nginx/ssl.conf'):
|
||||
data = dict(ssl_live_path=WOVar.wo_ssl_live,
|
||||
domain=site.sitename, quic=True)
|
||||
WOTemplate.deploy(
|
||||
self, f'/var/www/{site.sitename}/conf/nginx/ssl.conf',
|
||||
'ssl.mustache', data, overwrite=True)
|
||||
else:
|
||||
(_, wo_root_domain) = WODomain.getlevel(
|
||||
self, site.sitename)
|
||||
if (site.sitename != wo_root_domain and
|
||||
os.path.exists(f'/etc/letsencrypt/shared/{wo_root_domain}.conf')):
|
||||
data = dict(ssl_live_path=WOVar.wo_ssl_live,
|
||||
domain=wo_root_domain, quic=True)
|
||||
WOTemplate.deploy(
|
||||
self, f'/etc/letsencrypt/shared/{wo_root_domain}.conf',
|
||||
'ssl.mustache', data, overwrite=True)
|
||||
post_pref(self, WOVar.wo_nginx, [])
|
||||
vhost_conf = '{0}/{1}/vhconf.conf'.format(
|
||||
WOVar.wo_ols_vhost_dir, site.sitename)
|
||||
if os.path.exists(vhost_conf):
|
||||
# Enable QUIC in vhost SSL config
|
||||
if WOFileUtils.grepcheck(self, vhost_conf, 'enableQuic'):
|
||||
WOFileUtils.searchreplace(
|
||||
self, vhost_conf,
|
||||
'enableQuic 0',
|
||||
'enableQuic 1')
|
||||
post_pref(self, WOVar.wo_ols, [])
|
||||
|
||||
@expose(hide=True)
|
||||
def default(self):
|
||||
@@ -154,7 +147,7 @@ class WOStackMigrateController(CementBaseController):
|
||||
|
||||
Log.info(self, "If your database size is big, "
|
||||
"migration may take some time.")
|
||||
Log.info(self, "During migration non nginx-cached parts of "
|
||||
Log.info(self, "During migration non-cached parts of "
|
||||
"your site may remain down")
|
||||
if not pargs.force:
|
||||
start_upgrade = input("Do you want to continue:[y/N]")
|
||||
@@ -168,7 +161,7 @@ class WOStackMigrateController(CementBaseController):
|
||||
Log.error(self, "Your current MySQL is not alive or "
|
||||
"you allready installed MariaDB")
|
||||
if pargs.nginx:
|
||||
if os.path.exists('/usr/sbin/nginx'):
|
||||
self.migrate_nginx()
|
||||
if os.path.isfile('/usr/local/lsws/bin/openlitespeed'):
|
||||
self.migrate_ols()
|
||||
else:
|
||||
Log.error(self, "Unable to connect to MariaDB")
|
||||
Log.error(self, "OpenLiteSpeed is not installed")
|
||||
|
||||
Reference in New Issue
Block a user