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:
@@ -12,7 +12,7 @@ from wo.core.acme import WOAcme
|
||||
from wo.core.domainvalidate import WODomain
|
||||
from wo.core.git import WOGit
|
||||
from wo.core.logging import Log
|
||||
from wo.core.nginxhashbucket import hashbucket
|
||||
from wo.core.fileutils import WOFileUtils
|
||||
from wo.core.services import WOService
|
||||
from wo.core.sslutils import SSL
|
||||
from wo.core.variables import WOVar
|
||||
@@ -54,7 +54,7 @@ class WOSiteCloneController(CementBaseController):
|
||||
action='store_true')),
|
||||
(['--wpfc'],
|
||||
dict(help="create WordPress single/multi site with "
|
||||
"Nginx fastcgi_cache",
|
||||
"LSCache",
|
||||
action='store_true')),
|
||||
(['--wpsc'],
|
||||
dict(help="create WordPress single/multi site with wpsc cache",
|
||||
@@ -153,10 +153,10 @@ class WOSiteCloneController(CementBaseController):
|
||||
|
||||
if check_domain_exists(self, wo_domain):
|
||||
Log.error(self, "site {0} already exists".format(wo_domain))
|
||||
elif os.path.isfile('/etc/nginx/sites-available/{0}'
|
||||
.format(wo_domain)):
|
||||
Log.error(self, "Nginx configuration /etc/nginx/sites-available/"
|
||||
"{0} already exists".format(wo_domain))
|
||||
elif os.path.isdir('{0}/{1}'
|
||||
.format(WOVar.wo_ols_vhost_dir, wo_domain)):
|
||||
Log.error(self, "OLS vhost configuration already exists "
|
||||
"for {0}".format(wo_domain))
|
||||
|
||||
if stype == 'proxy':
|
||||
data = dict(
|
||||
@@ -262,15 +262,14 @@ class WOSiteCloneController(CementBaseController):
|
||||
pre_run_checks(self)
|
||||
except SiteError as e:
|
||||
Log.debug(self, str(e))
|
||||
Log.error(self, "NGINX configuration check failed.")
|
||||
Log.error(self, "OLS configuration check failed.")
|
||||
|
||||
try:
|
||||
try:
|
||||
# setup NGINX configuration, and webroot
|
||||
# setup OLS configuration, and webroot
|
||||
setupdomain(self, data)
|
||||
|
||||
# Fix Nginx Hashbucket size error
|
||||
hashbucket(self)
|
||||
pass
|
||||
except SiteError as e:
|
||||
# call cleanup actions on failure
|
||||
Log.info(self, Log.FAIL +
|
||||
@@ -285,15 +284,15 @@ class WOSiteCloneController(CementBaseController):
|
||||
|
||||
if 'proxy' in data.keys() and data['proxy']:
|
||||
addNewSite(self, wo_domain, stype, cache, wo_site_webroot)
|
||||
# Service Nginx Reload
|
||||
if not WOService.reload_service(self, 'nginx'):
|
||||
# Service OLS Reload
|
||||
if not WOService.reload_service(self, 'lsws'):
|
||||
Log.info(self, Log.FAIL +
|
||||
"There was a serious error encountered...")
|
||||
Log.info(self, Log.FAIL + "Cleaning up afterwards...")
|
||||
doCleanupAction(self, domain=wo_domain)
|
||||
deleteSiteInfo(self, wo_domain)
|
||||
Log.error(self, "service nginx reload failed. "
|
||||
"check issues with `nginx -t` command")
|
||||
Log.error(self, "service lsws reload failed. "
|
||||
"check issues with `{0} -t` command".format(WOVar.wo_ols_bin))
|
||||
Log.error(self, "Check the log for details: "
|
||||
"`tail /var/log/wo/wordops.log` "
|
||||
"and please try again")
|
||||
@@ -397,8 +396,8 @@ class WOSiteCloneController(CementBaseController):
|
||||
"`tail /var/log/wo/wordops.log` "
|
||||
"and please try again")
|
||||
|
||||
# Service Nginx Reload call cleanup if failed to reload nginx
|
||||
if not WOService.reload_service(self, 'nginx'):
|
||||
# Service OLS Reload call cleanup if failed to reload lsws
|
||||
if not WOService.reload_service(self, 'lsws'):
|
||||
Log.info(self, Log.FAIL +
|
||||
"There was a serious error encountered...")
|
||||
Log.info(self, Log.FAIL + "Cleaning up afterwards...")
|
||||
@@ -410,13 +409,13 @@ class WOSiteCloneController(CementBaseController):
|
||||
dbuser=data['wo_db_user'],
|
||||
dbhost=data['wo_mysql_grant_host'])
|
||||
deleteSiteInfo(self, wo_domain)
|
||||
Log.info(self, Log.FAIL + "service nginx reload failed."
|
||||
" check issues with `nginx -t` command.")
|
||||
Log.info(self, Log.FAIL + "service lsws reload failed."
|
||||
" check issues with `{0} -t` command.".format(WOVar.wo_ols_bin))
|
||||
Log.error(self, "Check the log for details: "
|
||||
"`tail /var/log/wo/wordops.log` "
|
||||
"and please try again")
|
||||
|
||||
WOGit.add(self, ["/etc/nginx"],
|
||||
WOGit.add(self, [WOVar.wo_ols_conf_dir],
|
||||
msg="{0} created with {1} {2}"
|
||||
.format(wo_www_domain, stype, cache))
|
||||
# Setup Permissions for webroot
|
||||
@@ -558,14 +557,14 @@ class WOSiteCloneController(CementBaseController):
|
||||
|
||||
SSL.httpsredirect(self, wo_domain, acme_domains, True)
|
||||
SSL.siteurlhttps(self, wo_domain)
|
||||
if not WOService.reload_service(self, 'nginx'):
|
||||
Log.error(self, "service nginx reload failed. "
|
||||
"check issues with `nginx -t` command")
|
||||
if not WOService.reload_service(self, 'lsws'):
|
||||
Log.error(self, "service lsws reload failed. "
|
||||
"check issues with `{0} -t` command".format(WOVar.wo_ols_bin))
|
||||
Log.info(self, "Congratulations! Successfully Configured "
|
||||
"SSL on https://{0}".format(wo_domain))
|
||||
|
||||
# Add nginx conf folder into GIT
|
||||
WOGit.add(self, ["{0}/conf/nginx".format(wo_site_webroot)],
|
||||
# Add OLS conf folder into GIT
|
||||
WOGit.add(self, ["{0}/{1}".format(WOVar.wo_ols_vhost_dir, wo_domain)],
|
||||
msg="Adding letsencrypts config of site: {0}"
|
||||
.format(wo_domain))
|
||||
updateSiteInfo(self, wo_domain, ssl=letsencrypt)
|
||||
|
||||
Reference in New Issue
Block a user