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,6 @@ 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.services import WOService
|
||||
from wo.core.sslutils import SSL
|
||||
from wo.core.variables import WOVar
|
||||
@@ -46,7 +45,7 @@ class WOSiteCreateController(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",
|
||||
@@ -85,9 +84,6 @@ class WOSiteCreateController(CementBaseController):
|
||||
(['--hsts'],
|
||||
dict(help="enable HSTS for site secured with letsencrypt",
|
||||
action='store_true')),
|
||||
(['--ngxblocker'],
|
||||
dict(help="enable HSTS for site secured with letsencrypt",
|
||||
action='store_true')),
|
||||
(['--user'],
|
||||
dict(help="provide user for WordPress site")),
|
||||
(['--email'],
|
||||
@@ -169,10 +165,10 @@ class WOSiteCreateController(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, "OpenLiteSpeed vhost configuration "
|
||||
"{0}/{1} already exists"
|
||||
.format(WOVar.wo_ols_vhost_dir, wo_domain))
|
||||
|
||||
if stype == 'proxy':
|
||||
data = dict(
|
||||
@@ -225,7 +221,7 @@ class WOSiteCreateController(CementBaseController):
|
||||
data['subsiteof_webroot'] = parent_site_info.site_path
|
||||
|
||||
if (pargs.php74 or pargs.php80 or pargs.php81 or
|
||||
pargs.php82 or pargs.php83 or pargs.php84):
|
||||
pargs.php82 or pargs.php83 or pargs.php84 or pargs.php85):
|
||||
data = dict(
|
||||
site_name=wo_domain, www_domain=wo_www_domain,
|
||||
static=False, basic=False,
|
||||
@@ -311,15 +307,13 @@ class WOSiteCreateController(CementBaseController):
|
||||
pre_run_checks(self)
|
||||
except SiteError as e:
|
||||
Log.debug(self, str(e))
|
||||
Log.error(self, "NGINX configuration check failed.")
|
||||
Log.error(self, "OpenLiteSpeed configuration check failed.")
|
||||
|
||||
try:
|
||||
try:
|
||||
# setup NGINX configuration, and webroot
|
||||
# setup OpenLiteSpeed configuration, and webroot
|
||||
setupdomain(self, data)
|
||||
|
||||
# Fix Nginx Hashbucket size error
|
||||
hashbucket(self)
|
||||
except SiteError as e:
|
||||
# call cleanup actions on failure
|
||||
Log.info(self, Log.FAIL +
|
||||
@@ -334,15 +328,15 @@ class WOSiteCreateController(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 OpenLiteSpeed config")
|
||||
Log.error(self, "Check the log for details: "
|
||||
"`tail /var/log/wo/wordops.log` "
|
||||
"and please try again")
|
||||
@@ -354,15 +348,15 @@ class WOSiteCreateController(CementBaseController):
|
||||
|
||||
elif 'alias' in data.keys() and data['alias']:
|
||||
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 OpenLiteSpeed config")
|
||||
Log.error(self, "Check the log for details: "
|
||||
"`tail /var/log/wo/wordops.log` "
|
||||
"and please try again")
|
||||
@@ -374,15 +368,15 @@ class WOSiteCreateController(CementBaseController):
|
||||
|
||||
elif 'subsite' in data.keys() and data['subsite']:
|
||||
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 OpenLiteSpeed config")
|
||||
Log.error(self, "Check the log for details: "
|
||||
"`tail /var/log/wo/wordops.log` "
|
||||
"and please try again")
|
||||
@@ -481,8 +475,8 @@ class WOSiteCreateController(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 OpenLiteSpeed 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...")
|
||||
@@ -494,13 +488,13 @@ class WOSiteCreateController(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 OpenLiteSpeed config.")
|
||||
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
|
||||
@@ -642,14 +636,14 @@ class WOSiteCreateController(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 OpenLiteSpeed config")
|
||||
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 vhost 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