Merge pull request #633 from WordOps/updating-configuration

Fix reported issues
This commit is contained in:
VirtuBox
2024-04-21 19:43:46 +02:00
committed by GitHub
7 changed files with 77 additions and 43 deletions

View File

@@ -757,7 +757,7 @@ def setupwp_plugin(self, plugin_name, plugin_option, plugin_data, data):
def setwebrootpermissions(self, webroot):
Log.debug(self, "Setting up permissions")
try:
WOFileUtils.findBrokenSymlink(self, '/var/www/')
WOFileUtils.findBrokenSymlink(self, f'{webroot}')
WOFileUtils.chown(self, webroot, WOVar.wo_php_user,
WOVar.wo_php_user, recursive=True)
except Exception as e:

View File

@@ -66,7 +66,7 @@ class WOSiteUpdateController(CementBaseController):
action='store', nargs='?')),
(['--subsiteof'],
dict(help="create a subsite of a multisite install",
action='store', nargs='?')),
action='store', nargs='?')),
(['-le', '--letsencrypt'],
dict(help="configure letsencrypt ssl for the site",
action='store' or 'store_const',
@@ -327,7 +327,7 @@ class WOSiteUpdateController(CementBaseController):
data["wpce"] = parent_site_info.cache_type == 'wpce'
data["wpredis"] = parent_site_info.cache_type == 'wpredis'
data["wpsubdir"] = parent_site_info.site_type == 'wpsubdir'
data["wo_php"] = ("php" + parent_site_info.php_version).replace(".", "")
data["wo_php"] = ("php" + parent_site_info.php_version).replace(".", "")
data['subsite'] = True
data['subsiteof_name'] = subsiteof_name
data['subsiteof_webroot'] = parent_site_info.site_path
@@ -722,15 +722,20 @@ class WOSiteUpdateController(CementBaseController):
'hsts.conf.disabled'
.format(wo_site_webroot))
# find all broken symlinks
sympath = "/var/www"
sympath = (f'{wo_site_webroot}/conf')
WOFileUtils.findBrokenSymlink(self, sympath)
elif (pargs.letsencrypt == "clean" or
pargs.letsencrypt == "purge"):
WOAcme.removeconf(self, wo_domain)
# find all broken symlinks
sympath = "/var/www"
WOFileUtils.findBrokenSymlink(self, sympath)
allsites = getAllsites(self)
for site in allsites:
if not site:
pass
sympath = "{0}/conf".format(site.site_path)
WOFileUtils.findBrokenSymlink(self, sympath)
if not WOService.reload_service(self, 'nginx'):
Log.error(self, "service nginx reload failed. "
"check issues with `nginx -t` command")

View File

@@ -22,6 +22,7 @@ from wo.core.template import WOTemplate
from wo.core.variables import WOVar
from wo.core.stackconf import WOConf
from wo.core.download import WODownload
from wo.core.checkfqdn import WOFqdn
def pre_pref(self, apt_packages):
@@ -404,7 +405,9 @@ def post_pref(self, apt_packages, packages, upgrade=False):
"/var/www/22222/cert/22222.key;\n"
"ssl_stapling off;\n")
server_ip = requests.get('http://v4.wordops.eu')
server_ip = WOFqdn.get_server_ip(self)
if server_ip is None:
server_ip = WOVar.wo_fqdn
if set(["nginx"]).issubset(set(apt_packages)):
print("WordOps backend configuration was successful\n"
@@ -418,11 +421,8 @@ def post_pref(self, apt_packages, packages, upgrade=False):
"Name: WordOps"] +
["HTTP Auth Password : {0}"
.format(passwd)])
self.msg = (self.msg + ["WordOps backend is available "
"on https://{0}:22222 "
"or https://{1}:22222"
.format(server_ip.text,
WOVar.wo_fqdn)])
self.msg = (self.msg + [f'WordOps backend is available on https://{server_ip}:22222]) '
'or https://{WOVar.wo_fqdn}:22222'])
data = dict(release=WOVar.wo_version)
WOTemplate.deploy(self, '/opt/cf-update.sh',

View File

@@ -1,5 +1,6 @@
# NGINX Tweaks - WordOps {{release}}
directio 4m;
# Enables the use of the O_DIRECT flag t can be useful for serving large files
directio 4m;
directio_alignment 512;
large_client_header_buffers 8 64k;