Merge pull request #633 from WordOps/updating-configuration
Fix reported issues
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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"
|
||||
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")
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# NGINX Tweaks - WordOps {{release}}
|
||||
# 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;
|
||||
|
||||
@@ -9,6 +9,7 @@ from wo.core.logging import Log
|
||||
from wo.core.shellexec import WOShellExec, CommandExecutionError
|
||||
from wo.core.variables import WOVar
|
||||
from wo.core.template import WOTemplate
|
||||
from wo.core.checkfqdn import WOFqdn
|
||||
|
||||
|
||||
class WOAcme:
|
||||
@@ -181,10 +182,10 @@ class WOAcme:
|
||||
|
||||
def check_dns(self, acme_domains):
|
||||
"""Check if a list of domains point to the server IP"""
|
||||
server_ip = requests.get('https://v4.wordops.eu/').text
|
||||
server_ip = WOFqdn.get_server_ip(self)
|
||||
for domain in acme_domains:
|
||||
domain_ip = requests.get('http://v4.wordops.eu/dns/{0}/'
|
||||
.format(domain)).text
|
||||
domain_ip = WOFqdn.get_domain_ip(self, domain)
|
||||
|
||||
if (not domain_ip == server_ip):
|
||||
Log.warn(
|
||||
self, "{0}".format(domain) +
|
||||
@@ -252,8 +253,7 @@ class WOAcme:
|
||||
for dir in acmedir:
|
||||
if os.path.exists('{0}'.format(dir)):
|
||||
WOFileUtils.rm(self, '{0}'.format(dir))
|
||||
# find all broken symlinks
|
||||
WOFileUtils.findBrokenSymlink(self, "/var/www")
|
||||
|
||||
else:
|
||||
if os.path.islink("{0}".format(sslconf)):
|
||||
WOFileUtils.remove_symlink(self, "{0}".format(sslconf))
|
||||
|
||||
@@ -4,7 +4,10 @@ from wo.core.shellexec import WOShellExec
|
||||
from wo.core.variables import WOVar
|
||||
|
||||
|
||||
def check_fqdn(self, wo_host):
|
||||
class WOFqdn:
|
||||
"""IP and FQDN tools for WordOps"""
|
||||
|
||||
def check_fqdn(self, wo_host):
|
||||
"""FQDN check with WordOps, for mail server hostname must be FQDN"""
|
||||
# wo_host=os.popen("hostname -f | tr -d '\n'").read()
|
||||
if '.' in wo_host:
|
||||
@@ -21,11 +24,11 @@ def check_fqdn(self, wo_host):
|
||||
|
||||
else:
|
||||
wo_host = input("Enter hostname [fqdn]:")
|
||||
check_fqdn(self, wo_host)
|
||||
WOFqdn.check_fqdn(self, wo_host)
|
||||
|
||||
|
||||
def check_fqdn_ip(self):
|
||||
def check_fqdn_ip(self):
|
||||
"""Check if server hostname resolved server IP"""
|
||||
try:
|
||||
x = requests.get('http://v4.wordops.eu')
|
||||
ip = (x.text).strip()
|
||||
|
||||
@@ -34,3 +37,28 @@ def check_fqdn_ip(self):
|
||||
ip_fqdn = (y.text).strip()
|
||||
|
||||
return bool(ip == ip_fqdn)
|
||||
except requests.exceptions.RequestException as e:
|
||||
print("Error occurred during request:", e)
|
||||
return False
|
||||
|
||||
def get_server_ip(self):
|
||||
"""Get the server externet IP"""
|
||||
try:
|
||||
x = requests.get('http://v4.wordops.eu')
|
||||
ip = (x.text).strip()
|
||||
|
||||
return ip
|
||||
except requests.exceptions.RequestException as e:
|
||||
print("Error occurred during request:", e)
|
||||
return None
|
||||
|
||||
def get_domain_ip(self, wo_domain):
|
||||
"""Get the server externet IP"""
|
||||
try:
|
||||
y = requests.get('http://v4.wordops.eu/dns/{0}/'.format(wo_domain))
|
||||
domain_ip = (y.text).strip()
|
||||
|
||||
return domain_ip
|
||||
except requests.exceptions.RequestException as e:
|
||||
print("Error occurred during request:", e)
|
||||
return None
|
||||
|
||||
@@ -17,11 +17,11 @@ class WOVar():
|
||||
# WordOps version
|
||||
wo_version = "3.19.1"
|
||||
# WordOps packages versions
|
||||
wo_wp_cli = "2.9.0"
|
||||
wo_wp_cli = "2.10.0"
|
||||
wo_adminer = "4.8.1"
|
||||
wo_phpmyadmin = "5.2.0"
|
||||
wo_extplorer = "2.1.15"
|
||||
wo_dashboard = "1.2"
|
||||
wo_dashboard = "1.3"
|
||||
|
||||
# Get WPCLI path
|
||||
wo_wpcli_path = '/usr/local/bin/wp'
|
||||
|
||||
Reference in New Issue
Block a user