Refactor acme.sh and WOVariables
This commit is contained in:
@@ -15,6 +15,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|||||||
- [STACK] Nginx ultimate bad bots blocker with `wo stack install --ngxblocker`
|
- [STACK] Nginx ultimate bad bots blocker with `wo stack install --ngxblocker`
|
||||||
- [STACK] Added support for custom Nginx compiled from source
|
- [STACK] Added support for custom Nginx compiled from source
|
||||||
|
|
||||||
|
#### Changed
|
||||||
|
|
||||||
|
- [CORE] Query acme.sh database directly to check if a certificate exist
|
||||||
|
|
||||||
|
#### Fixed
|
||||||
|
|
||||||
|
- [SITE] Issues with root_domain variable with `wo site update`
|
||||||
|
|
||||||
### v3.9.9.1 - 2019-09-26
|
### v3.9.9.1 - 2019-09-26
|
||||||
|
|
||||||
#### Added
|
#### Added
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
# The following are only required in development, not production
|
|
||||||
nose
|
|
||||||
coverage
|
|
||||||
sphinx
|
|
||||||
pep8
|
|
||||||
autopep8
|
|
||||||
mock
|
|
||||||
pyinotify
|
|
||||||
|
|
||||||
# Required for optional extensions (only the ones supported on py3)
|
|
||||||
argcomplete
|
|
||||||
pystache
|
|
||||||
pyYaml
|
|
||||||
colorlog
|
|
||||||
configobj
|
|
||||||
tabulate
|
|
||||||
pylibmc
|
|
||||||
redis
|
|
||||||
jinja2
|
|
||||||
watchdog
|
|
||||||
pybars3
|
|
||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
from cement.core.controller import CementBaseController, expose
|
from cement.core.controller import CementBaseController, expose
|
||||||
|
|
||||||
from wo.core.variables import WOVariables
|
from wo.core.variables import WOVar
|
||||||
|
|
||||||
VERSION = WOVariables.wo_version
|
VERSION = WOVar.wo_version
|
||||||
|
|
||||||
BANNER = """
|
BANNER = """
|
||||||
WordOps v%s
|
WordOps v%s
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ from wo.core.logging import Log
|
|||||||
from wo.core.mysql import WOMysql
|
from wo.core.mysql import WOMysql
|
||||||
from wo.core.services import WOService
|
from wo.core.services import WOService
|
||||||
from wo.core.shellexec import WOShellExec
|
from wo.core.shellexec import WOShellExec
|
||||||
from wo.core.variables import WOVariables
|
from wo.core.variables import WOVar
|
||||||
|
|
||||||
|
|
||||||
def wo_debug_hook(app):
|
def wo_debug_hook(app):
|
||||||
@@ -146,7 +146,7 @@ class WODebugController(CementBaseController):
|
|||||||
Log.info(self, "Nginx debug for site already enabled")
|
Log.info(self, "Nginx debug for site already enabled")
|
||||||
|
|
||||||
self.msg = self.msg + ['{0}{1}/logs/error.log'
|
self.msg = self.msg + ['{0}{1}/logs/error.log'
|
||||||
.format(WOVariables.wo_webroot,
|
.format(WOVar.wo_webroot,
|
||||||
self.app.pargs.site_name)]
|
self.app.pargs.site_name)]
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@@ -446,14 +446,14 @@ class WODebugController(CementBaseController):
|
|||||||
"""Start/Stop WordPress debug"""
|
"""Start/Stop WordPress debug"""
|
||||||
if (self.app.pargs.wp == 'on' and self.app.pargs.site_name):
|
if (self.app.pargs.wp == 'on' and self.app.pargs.site_name):
|
||||||
wp_config = ("{0}/{1}/wp-config.php"
|
wp_config = ("{0}/{1}/wp-config.php"
|
||||||
.format(WOVariables.wo_webroot,
|
.format(WOVar.wo_webroot,
|
||||||
self.app.pargs.site_name))
|
self.app.pargs.site_name))
|
||||||
webroot = "{0}{1}".format(WOVariables.wo_webroot,
|
webroot = "{0}{1}".format(WOVar.wo_webroot,
|
||||||
self.app.pargs.site_name)
|
self.app.pargs.site_name)
|
||||||
# Check wp-config.php file into htdocs folder
|
# Check wp-config.php file into htdocs folder
|
||||||
if not os.path.isfile(wp_config):
|
if not os.path.isfile(wp_config):
|
||||||
wp_config = ("{0}/{1}/htdocs/wp-config.php"
|
wp_config = ("{0}/{1}/htdocs/wp-config.php"
|
||||||
.format(WOVariables.wo_webroot,
|
.format(WOVar.wo_webroot,
|
||||||
self.app.pargs.site_name))
|
self.app.pargs.site_name))
|
||||||
if os.path.isfile(wp_config):
|
if os.path.isfile(wp_config):
|
||||||
if not WOShellExec.cmd_exec(self, "grep \"\'WP_DEBUG\'\" {0} |"
|
if not WOShellExec.cmd_exec(self, "grep \"\'WP_DEBUG\'\" {0} |"
|
||||||
@@ -464,7 +464,7 @@ class WODebugController(CementBaseController):
|
|||||||
WOShellExec.cmd_exec(self, "chown {1}: {0}/htdocs/wp-"
|
WOShellExec.cmd_exec(self, "chown {1}: {0}/htdocs/wp-"
|
||||||
"content/debug.log"
|
"content/debug.log"
|
||||||
"".format(webroot,
|
"".format(webroot,
|
||||||
WOVariables.wo_php_user))
|
WOVar.wo_php_user))
|
||||||
WOShellExec.cmd_exec(self, "sed -i \"s/define(\'WP_DEBUG\'"
|
WOShellExec.cmd_exec(self, "sed -i \"s/define(\'WP_DEBUG\'"
|
||||||
".*/define(\'WP_DEBUG\', true);\\n"
|
".*/define(\'WP_DEBUG\', true);\\n"
|
||||||
"define(\'WP_DEBUG_DISPLAY\', false);"
|
"define(\'WP_DEBUG_DISPLAY\', false);"
|
||||||
@@ -478,11 +478,11 @@ class WODebugController(CementBaseController):
|
|||||||
WOShellExec.cmd_exec(self, "chown -R {1}: {0}/htdocs/"
|
WOShellExec.cmd_exec(self, "chown -R {1}: {0}/htdocs/"
|
||||||
"wp-content/plugins"
|
"wp-content/plugins"
|
||||||
.format(webroot,
|
.format(webroot,
|
||||||
WOVariables.wo_php_user))
|
WOVar.wo_php_user))
|
||||||
|
|
||||||
self.msg = self.msg + ['{0}{1}/htdocs/wp-content'
|
self.msg = self.msg + ['{0}{1}/htdocs/wp-content'
|
||||||
'/debug.log'
|
'/debug.log'
|
||||||
.format(WOVariables.wo_webroot,
|
.format(WOVar.wo_webroot,
|
||||||
self.app.pargs.site_name)]
|
self.app.pargs.site_name)]
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@@ -491,14 +491,14 @@ class WODebugController(CementBaseController):
|
|||||||
|
|
||||||
elif (self.app.pargs.wp == 'off' and self.app.pargs.site_name):
|
elif (self.app.pargs.wp == 'off' and self.app.pargs.site_name):
|
||||||
wp_config = ("{0}{1}/wp-config.php"
|
wp_config = ("{0}{1}/wp-config.php"
|
||||||
.format(WOVariables.wo_webroot,
|
.format(WOVar.wo_webroot,
|
||||||
self.app.pargs.site_name))
|
self.app.pargs.site_name))
|
||||||
webroot = "{0}{1}".format(WOVariables.wo_webroot,
|
webroot = "{0}{1}".format(WOVar.wo_webroot,
|
||||||
self.app.pargs.site_name)
|
self.app.pargs.site_name)
|
||||||
# Check wp-config.php file into htdocs folder
|
# Check wp-config.php file into htdocs folder
|
||||||
if not os.path.isfile(wp_config):
|
if not os.path.isfile(wp_config):
|
||||||
wp_config = ("{0}/{1}/htdocs/wp-config.php"
|
wp_config = ("{0}/{1}/htdocs/wp-config.php"
|
||||||
.format(WOVariables.wo_webroot,
|
.format(WOVar.wo_webroot,
|
||||||
self.app.pargs.site_name))
|
self.app.pargs.site_name))
|
||||||
if os.path.isfile(wp_config):
|
if os.path.isfile(wp_config):
|
||||||
if WOShellExec.cmd_exec(self, "grep \"\'WP_DEBUG\'\" {0} | "
|
if WOShellExec.cmd_exec(self, "grep \"\'WP_DEBUG\'\" {0} | "
|
||||||
@@ -565,11 +565,11 @@ class WODebugController(CementBaseController):
|
|||||||
Log.info(self, "Nginx rewrite logs for {0} already setup"
|
Log.info(self, "Nginx rewrite logs for {0} already setup"
|
||||||
.format(self.app.pargs.site_name))
|
.format(self.app.pargs.site_name))
|
||||||
|
|
||||||
if ('{0}{1}/logs/error.log'.format(WOVariables.wo_webroot,
|
if ('{0}{1}/logs/error.log'.format(WOVar.wo_webroot,
|
||||||
self.app.pargs.site_name)
|
self.app.pargs.site_name)
|
||||||
not in self.msg):
|
not in self.msg):
|
||||||
self.msg = self.msg + ['{0}{1}/logs/error.log'
|
self.msg = self.msg + ['{0}{1}/logs/error.log'
|
||||||
.format(WOVariables.wo_webroot,
|
.format(WOVar.wo_webroot,
|
||||||
self.app.pargs.site_name)]
|
self.app.pargs.site_name)]
|
||||||
|
|
||||||
# Stop Nginx rewrite for site
|
# Stop Nginx rewrite for site
|
||||||
@@ -608,7 +608,7 @@ class WODebugController(CementBaseController):
|
|||||||
self.debug_fpm73()
|
self.debug_fpm73()
|
||||||
if self.app.pargs.mysql:
|
if self.app.pargs.mysql:
|
||||||
# MySQL debug will not work for remote MySQL
|
# MySQL debug will not work for remote MySQL
|
||||||
if WOVariables.wo_mysql_host is "localhost":
|
if WOVar.wo_mysql_host is "localhost":
|
||||||
self.app.pargs.mysql = 'off'
|
self.app.pargs.mysql = 'off'
|
||||||
self.debug_mysql()
|
self.debug_mysql()
|
||||||
else:
|
else:
|
||||||
@@ -756,7 +756,7 @@ class WODebugController(CementBaseController):
|
|||||||
self.debug_fpm73()
|
self.debug_fpm73()
|
||||||
if self.app.pargs.mysql:
|
if self.app.pargs.mysql:
|
||||||
# MySQL debug will not work for remote MySQL
|
# MySQL debug will not work for remote MySQL
|
||||||
if WOVariables.wo_mysql_host == "localhost":
|
if WOVar.wo_mysql_host == "localhost":
|
||||||
self.debug_mysql()
|
self.debug_mysql()
|
||||||
else:
|
else:
|
||||||
Log.warn(self, "Remote MySQL found, WordOps does not support "
|
Log.warn(self, "Remote MySQL found, WordOps does not support "
|
||||||
@@ -796,22 +796,22 @@ class WODebugController(CementBaseController):
|
|||||||
def import_slow_log(self):
|
def import_slow_log(self):
|
||||||
"""Default function for import slow log"""
|
"""Default function for import slow log"""
|
||||||
if os.path.isdir("{0}22222/htdocs/db/anemometer"
|
if os.path.isdir("{0}22222/htdocs/db/anemometer"
|
||||||
.format(WOVariables.wo_webroot)):
|
.format(WOVar.wo_webroot)):
|
||||||
if os.path.isfile("/var/log/mysql/mysql-slow.log"):
|
if os.path.isfile("/var/log/mysql/mysql-slow.log"):
|
||||||
# Get Anemometer user name and password
|
# Get Anemometer user name and password
|
||||||
Log.info(self, "Importing MySQL slow log to Anemometer")
|
Log.info(self, "Importing MySQL slow log to Anemometer")
|
||||||
host = os.popen("grep -e \"\'host\'\" {0}22222/htdocs/"
|
host = os.popen("grep -e \"\'host\'\" {0}22222/htdocs/"
|
||||||
.format(WOVariables.wo_webroot) +
|
.format(WOVar.wo_webroot) +
|
||||||
"db/anemometer/conf/config.inc.php "
|
"db/anemometer/conf/config.inc.php "
|
||||||
"| head -1 | cut -d\\\' -f4 | "
|
"| head -1 | cut -d\\\' -f4 | "
|
||||||
"tr -d '\n'").read()
|
"tr -d '\n'").read()
|
||||||
user = os.popen("grep -e \"\'user\'\" {0}22222/htdocs/"
|
user = os.popen("grep -e \"\'user\'\" {0}22222/htdocs/"
|
||||||
.format(WOVariables.wo_webroot) +
|
.format(WOVar.wo_webroot) +
|
||||||
"db/anemometer/conf/config.inc.php "
|
"db/anemometer/conf/config.inc.php "
|
||||||
"| head -1 | cut -d\\\' -f4 | "
|
"| head -1 | cut -d\\\' -f4 | "
|
||||||
"tr -d '\n'").read()
|
"tr -d '\n'").read()
|
||||||
password = os.popen("grep -e \"\'password\'\" {0}22222/"
|
password = os.popen("grep -e \"\'password\'\" {0}22222/"
|
||||||
.format(WOVariables.wo_webroot) +
|
.format(WOVar.wo_webroot) +
|
||||||
"htdocs/db/anemometer/conf"
|
"htdocs/db/anemometer/conf"
|
||||||
"/config.inc.php "
|
"/config.inc.php "
|
||||||
"| head -1 | cut -d\\\' -f4 | "
|
"| head -1 | cut -d\\\' -f4 | "
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ from wo.core.logging import Log
|
|||||||
from wo.core.mysql import WOMysql
|
from wo.core.mysql import WOMysql
|
||||||
from wo.core.sendmail import WOSendMail
|
from wo.core.sendmail import WOSendMail
|
||||||
from wo.core.shellexec import WOShellExec
|
from wo.core.shellexec import WOShellExec
|
||||||
from wo.core.variables import WOVariables
|
from wo.core.variables import WOVar
|
||||||
|
|
||||||
|
|
||||||
def wo_log_hook(app):
|
def wo_log_hook(app):
|
||||||
@@ -99,7 +99,7 @@ class WOLogShowController(CementBaseController):
|
|||||||
'/var/log/php5/fpm.log']
|
'/var/log/php5/fpm.log']
|
||||||
if self.app.pargs.mysql:
|
if self.app.pargs.mysql:
|
||||||
# MySQL debug will not work for remote MySQL
|
# MySQL debug will not work for remote MySQL
|
||||||
if WOVariables.wo_mysql_host == "localhost":
|
if WOVar.wo_mysql_host == "localhost":
|
||||||
if os.path.isfile('/var/log/mysql/mysql-slow.log'):
|
if os.path.isfile('/var/log/mysql/mysql-slow.log'):
|
||||||
self.msg = self.msg + ['/var/log/mysql/mysql-slow.log']
|
self.msg = self.msg + ['/var/log/mysql/mysql-slow.log']
|
||||||
else:
|
else:
|
||||||
@@ -109,18 +109,18 @@ class WOLogShowController(CementBaseController):
|
|||||||
"remote MySQL servers or log files")
|
"remote MySQL servers or log files")
|
||||||
|
|
||||||
if self.app.pargs.site_name:
|
if self.app.pargs.site_name:
|
||||||
webroot = "{0}{1}".format(WOVariables.wo_webroot,
|
webroot = "{0}{1}".format(WOVar.wo_webroot,
|
||||||
self.app.pargs.site_name)
|
self.app.pargs.site_name)
|
||||||
|
|
||||||
if not os.path.isdir(webroot):
|
if not os.path.isdir(webroot):
|
||||||
Log.error(self, "Site not present, quitting")
|
Log.error(self, "Site not present, quitting")
|
||||||
if self.app.pargs.access:
|
if self.app.pargs.access:
|
||||||
self.msg = self.msg + ["{0}/{1}/logs/access.log"
|
self.msg = self.msg + ["{0}/{1}/logs/access.log"
|
||||||
.format(WOVariables.wo_webroot,
|
.format(WOVar.wo_webroot,
|
||||||
self.app.pargs.site_name)]
|
self.app.pargs.site_name)]
|
||||||
if self.app.pargs.nginx:
|
if self.app.pargs.nginx:
|
||||||
self.msg = self.msg + ["{0}/{1}/logs/error.log"
|
self.msg = self.msg + ["{0}/{1}/logs/error.log"
|
||||||
.format(WOVariables.wo_webroot,
|
.format(WOVar.wo_webroot,
|
||||||
self.app.pargs.site_name)]
|
self.app.pargs.site_name)]
|
||||||
if self.app.pargs.wp:
|
if self.app.pargs.wp:
|
||||||
if os.path.isdir('{0}/htdocs/wp-content'.format(webroot)):
|
if os.path.isdir('{0}/htdocs/wp-content'.format(webroot)):
|
||||||
@@ -134,7 +134,7 @@ class WOLogShowController(CementBaseController):
|
|||||||
WOShellExec.cmd_exec(self, "chown {1}: {0}/htdocs/"
|
WOShellExec.cmd_exec(self, "chown {1}: {0}/htdocs/"
|
||||||
"wp-content/debug.log"
|
"wp-content/debug.log"
|
||||||
"".format(webroot,
|
"".format(webroot,
|
||||||
WOVariables
|
WOVar
|
||||||
.wo_php_user)
|
.wo_php_user)
|
||||||
)
|
)
|
||||||
# create symbolic link for debug log
|
# create symbolic link for debug log
|
||||||
@@ -145,7 +145,7 @@ class WOLogShowController(CementBaseController):
|
|||||||
.format(webroot)])
|
.format(webroot)])
|
||||||
|
|
||||||
self.msg = self.msg + ["{0}/{1}/logs/debug.log"
|
self.msg = self.msg + ["{0}/{1}/logs/debug.log"
|
||||||
.format(WOVariables.wo_webroot,
|
.format(WOVar.wo_webroot,
|
||||||
self.app.pargs.site_name)]
|
self.app.pargs.site_name)]
|
||||||
else:
|
else:
|
||||||
Log.info(self, "Site is not WordPress site, skipping "
|
Log.info(self, "Site is not WordPress site, skipping "
|
||||||
@@ -238,7 +238,7 @@ class WOLogResetController(CementBaseController):
|
|||||||
'/var/log/php5/fpm.log']
|
'/var/log/php5/fpm.log']
|
||||||
if self.app.pargs.mysql:
|
if self.app.pargs.mysql:
|
||||||
# MySQL debug will not work for remote MySQL
|
# MySQL debug will not work for remote MySQL
|
||||||
if WOVariables.wo_mysql_host == "localhost":
|
if WOVar.wo_mysql_host == "localhost":
|
||||||
if os.path.isfile('/var/log/mysql/mysql-slow.log'):
|
if os.path.isfile('/var/log/mysql/mysql-slow.log'):
|
||||||
self.msg = self.msg + ['/var/log/mysql/mysql-slow.log']
|
self.msg = self.msg + ['/var/log/mysql/mysql-slow.log']
|
||||||
else:
|
else:
|
||||||
@@ -248,18 +248,18 @@ class WOLogResetController(CementBaseController):
|
|||||||
"remote MySQL servers or log files")
|
"remote MySQL servers or log files")
|
||||||
|
|
||||||
if self.app.pargs.site_name:
|
if self.app.pargs.site_name:
|
||||||
webroot = "{0}{1}".format(WOVariables.wo_webroot,
|
webroot = "{0}{1}".format(WOVar.wo_webroot,
|
||||||
self.app.pargs.site_name)
|
self.app.pargs.site_name)
|
||||||
|
|
||||||
if not os.path.isdir(webroot):
|
if not os.path.isdir(webroot):
|
||||||
Log.error(self, "Site not present, quitting")
|
Log.error(self, "Site not present, quitting")
|
||||||
if self.app.pargs.access:
|
if self.app.pargs.access:
|
||||||
self.msg = self.msg + ["{0}/{1}/logs/access.log"
|
self.msg = self.msg + ["{0}/{1}/logs/access.log"
|
||||||
.format(WOVariables.wo_webroot,
|
.format(WOVar.wo_webroot,
|
||||||
self.app.pargs.site_name)]
|
self.app.pargs.site_name)]
|
||||||
if self.app.pargs.nginx:
|
if self.app.pargs.nginx:
|
||||||
self.msg = self.msg + ["{0}/{1}/logs/error.log"
|
self.msg = self.msg + ["{0}/{1}/logs/error.log"
|
||||||
.format(WOVariables.wo_webroot,
|
.format(WOVar.wo_webroot,
|
||||||
self.app.pargs.site_name)]
|
self.app.pargs.site_name)]
|
||||||
if self.app.pargs.wp:
|
if self.app.pargs.wp:
|
||||||
if os.path.isdir('{0}/htdocs/wp-content'.format(webroot)):
|
if os.path.isdir('{0}/htdocs/wp-content'.format(webroot)):
|
||||||
@@ -273,7 +273,7 @@ class WOLogResetController(CementBaseController):
|
|||||||
WOShellExec.cmd_exec(self, "chown {1}: {0}/htdocs/"
|
WOShellExec.cmd_exec(self, "chown {1}: {0}/htdocs/"
|
||||||
"wp-content/debug.log"
|
"wp-content/debug.log"
|
||||||
"".format(webroot,
|
"".format(webroot,
|
||||||
WOVariables
|
WOVar
|
||||||
.wo_php_user)
|
.wo_php_user)
|
||||||
)
|
)
|
||||||
# create symbolic link for debug log
|
# create symbolic link for debug log
|
||||||
@@ -284,7 +284,7 @@ class WOLogResetController(CementBaseController):
|
|||||||
.format(webroot)])
|
.format(webroot)])
|
||||||
|
|
||||||
self.msg = self.msg + ["{0}/{1}/logs/debug.log"
|
self.msg = self.msg + ["{0}/{1}/logs/debug.log"
|
||||||
.format(WOVariables.wo_webroot,
|
.format(WOVar.wo_webroot,
|
||||||
self.app.pargs.site_name)]
|
self.app.pargs.site_name)]
|
||||||
else:
|
else:
|
||||||
Log.info(self, "Site is not WordPress site, skipping "
|
Log.info(self, "Site is not WordPress site, skipping "
|
||||||
@@ -366,7 +366,7 @@ class WOLogGzipController(CementBaseController):
|
|||||||
'/var/log/php5/fpm.log']
|
'/var/log/php5/fpm.log']
|
||||||
if self.app.pargs.mysql:
|
if self.app.pargs.mysql:
|
||||||
# MySQL debug will not work for remote MySQL
|
# MySQL debug will not work for remote MySQL
|
||||||
if WOVariables.wo_mysql_host == "localhost":
|
if WOVar.wo_mysql_host == "localhost":
|
||||||
if os.path.isfile('/var/log/mysql/mysql-slow.log'):
|
if os.path.isfile('/var/log/mysql/mysql-slow.log'):
|
||||||
self.msg = self.msg + ['/var/log/mysql/mysql-slow.log']
|
self.msg = self.msg + ['/var/log/mysql/mysql-slow.log']
|
||||||
else:
|
else:
|
||||||
@@ -377,18 +377,18 @@ class WOLogGzipController(CementBaseController):
|
|||||||
"remote MySQL servers or log files")
|
"remote MySQL servers or log files")
|
||||||
|
|
||||||
if self.app.pargs.site_name:
|
if self.app.pargs.site_name:
|
||||||
webroot = "{0}{1}".format(WOVariables.wo_webroot,
|
webroot = "{0}{1}".format(WOVar.wo_webroot,
|
||||||
self.app.pargs.site_name)
|
self.app.pargs.site_name)
|
||||||
|
|
||||||
if not os.path.isdir(webroot):
|
if not os.path.isdir(webroot):
|
||||||
Log.error(self, "Site not present, quitting")
|
Log.error(self, "Site not present, quitting")
|
||||||
if self.app.pargs.access:
|
if self.app.pargs.access:
|
||||||
self.msg = self.msg + ["{0}/{1}/logs/access.log"
|
self.msg = self.msg + ["{0}/{1}/logs/access.log"
|
||||||
.format(WOVariables.wo_webroot,
|
.format(WOVar.wo_webroot,
|
||||||
self.app.pargs.site_name)]
|
self.app.pargs.site_name)]
|
||||||
if self.app.pargs.nginx:
|
if self.app.pargs.nginx:
|
||||||
self.msg = self.msg + ["{0}/{1}/logs/error.log"
|
self.msg = self.msg + ["{0}/{1}/logs/error.log"
|
||||||
.format(WOVariables.wo_webroot,
|
.format(WOVar.wo_webroot,
|
||||||
self.app.pargs.site_name)]
|
self.app.pargs.site_name)]
|
||||||
if self.app.pargs.wp:
|
if self.app.pargs.wp:
|
||||||
if os.path.isdir('{0}/htdocs/wp-content'.format(webroot)):
|
if os.path.isdir('{0}/htdocs/wp-content'.format(webroot)):
|
||||||
@@ -402,7 +402,7 @@ class WOLogGzipController(CementBaseController):
|
|||||||
WOShellExec.cmd_exec(self, "chown {1}: {0}/htdocs/"
|
WOShellExec.cmd_exec(self, "chown {1}: {0}/htdocs/"
|
||||||
"wp-content/debug.log"
|
"wp-content/debug.log"
|
||||||
"".format(webroot,
|
"".format(webroot,
|
||||||
WOVariables
|
WOVar
|
||||||
.wo_php_user)
|
.wo_php_user)
|
||||||
)
|
)
|
||||||
# create symbolic link for debug log
|
# create symbolic link for debug log
|
||||||
@@ -413,7 +413,7 @@ class WOLogGzipController(CementBaseController):
|
|||||||
.format(webroot)])
|
.format(webroot)])
|
||||||
|
|
||||||
self.msg = self.msg + ["{0}/{1}/logs/debug.log"
|
self.msg = self.msg + ["{0}/{1}/logs/debug.log"
|
||||||
.format(WOVariables.wo_webroot,
|
.format(WOVar.wo_webroot,
|
||||||
self.app.pargs.site_name)]
|
self.app.pargs.site_name)]
|
||||||
else:
|
else:
|
||||||
Log.info(self, "Site is not WordPress site, skipping "
|
Log.info(self, "Site is not WordPress site, skipping "
|
||||||
@@ -504,7 +504,7 @@ class WOLogMailController(CementBaseController):
|
|||||||
'/var/log/php5/fpm.log']
|
'/var/log/php5/fpm.log']
|
||||||
if self.app.pargs.mysql:
|
if self.app.pargs.mysql:
|
||||||
# MySQL debug will not work for remote MySQL
|
# MySQL debug will not work for remote MySQL
|
||||||
if WOVariables.wo_mysql_host == "localhost":
|
if WOVar.wo_mysql_host == "localhost":
|
||||||
if os.path.isfile('/var/log/mysql/mysql-slow.log'):
|
if os.path.isfile('/var/log/mysql/mysql-slow.log'):
|
||||||
self.msg = self.msg + ['/var/log/mysql/mysql-slow.log']
|
self.msg = self.msg + ['/var/log/mysql/mysql-slow.log']
|
||||||
else:
|
else:
|
||||||
@@ -514,18 +514,18 @@ class WOLogMailController(CementBaseController):
|
|||||||
"remote MySQL servers or log files")
|
"remote MySQL servers or log files")
|
||||||
|
|
||||||
if self.app.pargs.site_name:
|
if self.app.pargs.site_name:
|
||||||
webroot = "{0}{1}".format(WOVariables.wo_webroot,
|
webroot = "{0}{1}".format(WOVar.wo_webroot,
|
||||||
self.app.pargs.site_name)
|
self.app.pargs.site_name)
|
||||||
|
|
||||||
if not os.path.isdir(webroot):
|
if not os.path.isdir(webroot):
|
||||||
Log.error(self, "Site not present, quitting")
|
Log.error(self, "Site not present, quitting")
|
||||||
if self.app.pargs.access:
|
if self.app.pargs.access:
|
||||||
self.msg = self.msg + ["{0}/{1}/logs/access.log"
|
self.msg = self.msg + ["{0}/{1}/logs/access.log"
|
||||||
.format(WOVariables.wo_webroot,
|
.format(WOVar.wo_webroot,
|
||||||
self.app.pargs.site_name)]
|
self.app.pargs.site_name)]
|
||||||
if self.app.pargs.nginx:
|
if self.app.pargs.nginx:
|
||||||
self.msg = self.msg + ["{0}/{1}/logs/error.log"
|
self.msg = self.msg + ["{0}/{1}/logs/error.log"
|
||||||
.format(WOVariables.wo_webroot,
|
.format(WOVar.wo_webroot,
|
||||||
self.app.pargs.site_name)]
|
self.app.pargs.site_name)]
|
||||||
if self.app.pargs.wp:
|
if self.app.pargs.wp:
|
||||||
if os.path.isdir('{0}/htdocs/wp-content'.format(webroot)):
|
if os.path.isdir('{0}/htdocs/wp-content'.format(webroot)):
|
||||||
@@ -539,7 +539,7 @@ class WOLogMailController(CementBaseController):
|
|||||||
WOShellExec.cmd_exec(self, "chown {1}: {0}/htdocs/"
|
WOShellExec.cmd_exec(self, "chown {1}: {0}/htdocs/"
|
||||||
"wp-content/debug.log"
|
"wp-content/debug.log"
|
||||||
"".format(webroot,
|
"".format(webroot,
|
||||||
WOVariables
|
WOVar
|
||||||
.wo_php_user)
|
.wo_php_user)
|
||||||
)
|
)
|
||||||
# create symbolic link for debug log
|
# create symbolic link for debug log
|
||||||
@@ -550,7 +550,7 @@ class WOLogMailController(CementBaseController):
|
|||||||
.format(webroot)])
|
.format(webroot)])
|
||||||
|
|
||||||
self.msg = self.msg + ["{0}/{1}/logs/debug.log"
|
self.msg = self.msg + ["{0}/{1}/logs/debug.log"
|
||||||
.format(WOVariables.wo_webroot,
|
.format(WOVar.wo_webroot,
|
||||||
self.app.pargs.site_name)]
|
self.app.pargs.site_name)]
|
||||||
else:
|
else:
|
||||||
Log.info(self, "Site is not WordPress site, skipping "
|
Log.info(self, "Site is not WordPress site, skipping "
|
||||||
@@ -563,7 +563,7 @@ class WOLogMailController(CementBaseController):
|
|||||||
for tomail in self.app.pargs.to:
|
for tomail in self.app.pargs.to:
|
||||||
Log.info(self, "Sending mail to {0}".format(tomail[0]))
|
Log.info(self, "Sending mail to {0}".format(tomail[0]))
|
||||||
WOSendMail("wordops", tomail[0], "{0} Log Files"
|
WOSendMail("wordops", tomail[0], "{0} Log Files"
|
||||||
.format(WOVariables.wo_fqdn),
|
.format(WOVar.wo_fqdn),
|
||||||
"Hi,\n The requested logfiles are attached."
|
"Hi,\n The requested logfiles are attached."
|
||||||
"\n\nBest regards,\nYour WordOps worker",
|
"\n\nBest regards,\nYour WordOps worker",
|
||||||
files=mail_list, port=25, isTls=False)
|
files=mail_list, port=25, isTls=False)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ from wo.core.random import RANDOM
|
|||||||
from wo.core.services import WOService
|
from wo.core.services import WOService
|
||||||
from wo.core.shellexec import WOShellExec
|
from wo.core.shellexec import WOShellExec
|
||||||
from wo.core.template import WOTemplate
|
from wo.core.template import WOTemplate
|
||||||
from wo.core.variables import WOVariables
|
from wo.core.variables import WOVar
|
||||||
|
|
||||||
|
|
||||||
def wo_secure_hook(app):
|
def wo_secure_hook(app):
|
||||||
@@ -73,10 +73,10 @@ class WOSecureController(CementBaseController):
|
|||||||
passwd = RANDOM.gen(self, length='24')
|
passwd = RANDOM.gen(self, length='24')
|
||||||
if not pargs.user_input:
|
if not pargs.user_input:
|
||||||
username = input("Provide HTTP authentication user "
|
username = input("Provide HTTP authentication user "
|
||||||
"name [{0}] :".format(WOVariables.wo_user))
|
"name [{0}] :".format(WOVar.wo_user))
|
||||||
pargs.user_input = username
|
pargs.user_input = username
|
||||||
if username == "":
|
if username == "":
|
||||||
pargs.user_input = WOVariables.wo_user
|
pargs.user_input = WOVar.wo_user
|
||||||
if not pargs.user_pass:
|
if not pargs.user_pass:
|
||||||
password = getpass.getpass("Provide HTTP authentication "
|
password = getpass.getpass("Provide HTTP authentication "
|
||||||
"password [{0}] :".format(passwd))
|
"password [{0}] :".format(passwd))
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ from wo.core.nginxhashbucket import hashbucket
|
|||||||
from wo.core.services import WOService
|
from wo.core.services import WOService
|
||||||
from wo.core.shellexec import WOShellExec
|
from wo.core.shellexec import WOShellExec
|
||||||
from wo.core.sslutils import SSL
|
from wo.core.sslutils import SSL
|
||||||
from wo.core.variables import WOVariables
|
from wo.core.variables import WOVar
|
||||||
|
|
||||||
|
|
||||||
def wo_site_hook(app):
|
def wo_site_hook(app):
|
||||||
@@ -56,8 +56,7 @@ class WOSiteController(CementBaseController):
|
|||||||
|
|
||||||
pargs.site_name = pargs.site_name.strip()
|
pargs.site_name = pargs.site_name.strip()
|
||||||
# validate domain name
|
# validate domain name
|
||||||
(wo_domain,
|
wo_domain = WODomain.validate(self, pargs.site_name)
|
||||||
wo_www_domain) = WODomain.validate(self, pargs.site_name)
|
|
||||||
|
|
||||||
# check if site exists
|
# check if site exists
|
||||||
if not check_domain_exists(self, wo_domain):
|
if not check_domain_exists(self, wo_domain):
|
||||||
@@ -94,8 +93,7 @@ class WOSiteController(CementBaseController):
|
|||||||
Log.debug(self, str(e))
|
Log.debug(self, str(e))
|
||||||
Log.error(self, 'could not input site name')
|
Log.error(self, 'could not input site name')
|
||||||
pargs.site_name = pargs.site_name.strip()
|
pargs.site_name = pargs.site_name.strip()
|
||||||
(wo_domain, wo_www_domain) = WODomain.validate(self,
|
wo_domain = WODomain.validate(self, pargs.site_name)
|
||||||
pargs.site_name)
|
|
||||||
# check if site exists
|
# check if site exists
|
||||||
if not check_domain_exists(self, wo_domain):
|
if not check_domain_exists(self, wo_domain):
|
||||||
Log.error(self, "site {0} does not exist".format(wo_domain))
|
Log.error(self, "site {0} does not exist".format(wo_domain))
|
||||||
@@ -135,8 +133,7 @@ class WOSiteController(CementBaseController):
|
|||||||
Log.debug(self, str(e))
|
Log.debug(self, str(e))
|
||||||
Log.error(self, 'could not input site name')
|
Log.error(self, 'could not input site name')
|
||||||
pargs.site_name = pargs.site_name.strip()
|
pargs.site_name = pargs.site_name.strip()
|
||||||
(wo_domain,
|
wo_domain = WODomain.validate(self, pargs.site_name)
|
||||||
wo_www_domain) = WODomain.validate(self, pargs.site_name)
|
|
||||||
(wo_domain_type, wo_root_domain) = WODomain.getlevel(
|
(wo_domain_type, wo_root_domain) = WODomain.getlevel(
|
||||||
self, wo_domain)
|
self, wo_domain)
|
||||||
wo_db_name = ''
|
wo_db_name = ''
|
||||||
@@ -189,8 +186,7 @@ class WOSiteController(CementBaseController):
|
|||||||
def log(self):
|
def log(self):
|
||||||
pargs = self.app.pargs
|
pargs = self.app.pargs
|
||||||
pargs.site_name = pargs.site_name.strip()
|
pargs.site_name = pargs.site_name.strip()
|
||||||
(wo_domain,
|
wo_domain = WODomain.validate(self, pargs.site_name)
|
||||||
wo_www_domain) = WODomain.validate(self, pargs.site_name)
|
|
||||||
wo_site_webroot = getSiteInfo(self, wo_domain).site_path
|
wo_site_webroot = getSiteInfo(self, wo_domain).site_path
|
||||||
|
|
||||||
if not check_domain_exists(self, wo_domain):
|
if not check_domain_exists(self, wo_domain):
|
||||||
@@ -212,8 +208,7 @@ class WOSiteController(CementBaseController):
|
|||||||
Log.error(self, 'could not input site name')
|
Log.error(self, 'could not input site name')
|
||||||
# TODO Write code for wo site edit command here
|
# TODO Write code for wo site edit command here
|
||||||
pargs.site_name = pargs.site_name.strip()
|
pargs.site_name = pargs.site_name.strip()
|
||||||
(wo_domain,
|
wo_domain = WODomain.validate(self, pargs.site_name)
|
||||||
wo_www_domain) = WODomain.validate(self, pargs.site_name)
|
|
||||||
|
|
||||||
if not check_domain_exists(self, wo_domain):
|
if not check_domain_exists(self, wo_domain):
|
||||||
Log.error(self, "site {0} does not exist".format(wo_domain))
|
Log.error(self, "site {0} does not exist".format(wo_domain))
|
||||||
@@ -244,8 +239,7 @@ class WOSiteController(CementBaseController):
|
|||||||
Log.error(self, 'Unable to read input, please try again')
|
Log.error(self, 'Unable to read input, please try again')
|
||||||
|
|
||||||
pargs.site_name = pargs.site_name.strip()
|
pargs.site_name = pargs.site_name.strip()
|
||||||
(wo_domain,
|
wo_domain = WODomain.validate(self, pargs.site_name)
|
||||||
wo_www_domain) = WODomain.validate(self, pargs.site_name)
|
|
||||||
|
|
||||||
if not check_domain_exists(self, wo_domain):
|
if not check_domain_exists(self, wo_domain):
|
||||||
Log.error(self, "site {0} does not exist".format(wo_domain))
|
Log.error(self, "site {0} does not exist".format(wo_domain))
|
||||||
@@ -285,13 +279,12 @@ class WOSiteEditController(CementBaseController):
|
|||||||
Log.error(self, 'Unable to read input, Please try again')
|
Log.error(self, 'Unable to read input, Please try again')
|
||||||
|
|
||||||
pargs.site_name = pargs.site_name.strip()
|
pargs.site_name = pargs.site_name.strip()
|
||||||
(wo_domain,
|
wo_domain = WODomain.validate(self, pargs.site_name)
|
||||||
wo_www_domain) = WODomain.validate(self, pargs.site_name)
|
|
||||||
|
|
||||||
if not check_domain_exists(self, wo_domain):
|
if not check_domain_exists(self, wo_domain):
|
||||||
Log.error(self, "site {0} does not exist".format(wo_domain))
|
Log.error(self, "site {0} does not exist".format(wo_domain))
|
||||||
|
|
||||||
wo_site_webroot = WOVariables.wo_webroot + wo_domain
|
wo_site_webroot = WOVar.wo_webroot + wo_domain
|
||||||
|
|
||||||
if os.path.isfile('/etc/nginx/sites-available/{0}'
|
if os.path.isfile('/etc/nginx/sites-available/{0}'
|
||||||
.format(wo_domain)):
|
.format(wo_domain)):
|
||||||
@@ -436,13 +429,12 @@ class WOSiteCreateController(CementBaseController):
|
|||||||
Log.error(self, "Unable to input site name, Please try again!")
|
Log.error(self, "Unable to input site name, Please try again!")
|
||||||
|
|
||||||
pargs.site_name = pargs.site_name.strip()
|
pargs.site_name = pargs.site_name.strip()
|
||||||
(wo_domain,
|
wo_domain = WODomain.validate(self, pargs.site_name)
|
||||||
wo_www_domain) = WODomain.validate(self, pargs.site_name)
|
|
||||||
if not wo_domain.strip():
|
if not wo_domain.strip():
|
||||||
Log.error(self, "Invalid domain name, "
|
Log.error(self, "Invalid domain name, "
|
||||||
"Provide valid domain name")
|
"Provide valid domain name")
|
||||||
|
|
||||||
wo_site_webroot = WOVariables.wo_webroot + wo_domain
|
wo_site_webroot = WOVar.wo_webroot + wo_domain
|
||||||
|
|
||||||
if check_domain_exists(self, wo_domain):
|
if check_domain_exists(self, wo_domain):
|
||||||
Log.error(self, "site {0} already exists".format(wo_domain))
|
Log.error(self, "site {0} already exists".format(wo_domain))
|
||||||
@@ -991,9 +983,8 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
Log.error(self, 'Unable to input site name, Please try again!')
|
Log.error(self, 'Unable to input site name, Please try again!')
|
||||||
|
|
||||||
pargs.site_name = pargs.site_name.strip()
|
pargs.site_name = pargs.site_name.strip()
|
||||||
(wo_domain,
|
wo_domain = WODomain.validate(self, pargs.site_name)
|
||||||
wo_www_domain) = WODomain.validate(self, pargs.site_name)
|
wo_site_webroot = WOVar.wo_webroot + wo_domain
|
||||||
wo_site_webroot = WOVariables.wo_webroot + wo_domain
|
|
||||||
check_site = getSiteInfo(self, wo_domain)
|
check_site = getSiteInfo(self, wo_domain)
|
||||||
|
|
||||||
if check_site is None:
|
if check_site is None:
|
||||||
@@ -1958,7 +1949,7 @@ class WOSiteDeleteController(CementBaseController):
|
|||||||
Log.error(self, 'could not input site name')
|
Log.error(self, 'could not input site name')
|
||||||
|
|
||||||
pargs.site_name = pargs.site_name.strip()
|
pargs.site_name = pargs.site_name.strip()
|
||||||
(wo_domain, wo_www_domain) = WODomain.validate(self, pargs.site_name)
|
wo_domain = WODomain.validate(self, pargs.site_name)
|
||||||
wo_db_name = ''
|
wo_db_name = ''
|
||||||
wo_prompt = ''
|
wo_prompt = ''
|
||||||
wo_nginx_prompt = ''
|
wo_nginx_prompt = ''
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ from wo.core.mysql import (MySQLConnectionError, StatementExcecutionError,
|
|||||||
from wo.core.services import WOService
|
from wo.core.services import WOService
|
||||||
from wo.core.shellexec import CommandExecutionError, WOShellExec
|
from wo.core.shellexec import CommandExecutionError, WOShellExec
|
||||||
from wo.core.sslutils import SSL
|
from wo.core.sslutils import SSL
|
||||||
from wo.core.variables import WOVariables
|
from wo.core.variables import WOVar
|
||||||
|
|
||||||
|
|
||||||
class SiteError(Exception):
|
class SiteError(Exception):
|
||||||
@@ -229,7 +229,7 @@ def setupdatabase(self, data):
|
|||||||
data['wo_db_name'] = wo_db_name
|
data['wo_db_name'] = wo_db_name
|
||||||
data['wo_db_user'] = wo_db_username
|
data['wo_db_user'] = wo_db_username
|
||||||
data['wo_db_pass'] = wo_db_password
|
data['wo_db_pass'] = wo_db_password
|
||||||
data['wo_db_host'] = WOVariables.wo_mysql_host
|
data['wo_db_host'] = WOVar.wo_mysql_host
|
||||||
data['wo_mysql_grant_host'] = wo_mysql_grant_host
|
data['wo_mysql_grant_host'] = wo_mysql_grant_host
|
||||||
return(data)
|
return(data)
|
||||||
|
|
||||||
@@ -295,7 +295,7 @@ def setupwordpress(self, data, vhostonly=False):
|
|||||||
if not data['multisite']:
|
if not data['multisite']:
|
||||||
Log.debug(self, "Generating wp-config for WordPress Single site")
|
Log.debug(self, "Generating wp-config for WordPress Single site")
|
||||||
Log.debug(self, "/bin/bash -c \"{0} --allow-root "
|
Log.debug(self, "/bin/bash -c \"{0} --allow-root "
|
||||||
.format(WOVariables.wo_wpcli_path) +
|
.format(WOVar.wo_wpcli_path) +
|
||||||
"config create " +
|
"config create " +
|
||||||
"--dbname=\'{0}\' --dbprefix=\'{1}\' --dbuser=\'{2}\' "
|
"--dbname=\'{0}\' --dbprefix=\'{1}\' --dbuser=\'{2}\' "
|
||||||
"--dbhost=\'{3}\' "
|
"--dbhost=\'{3}\' "
|
||||||
@@ -307,7 +307,7 @@ def setupwordpress(self, data, vhostonly=False):
|
|||||||
"\n\ndefine(\'WP_DEBUG\', false);"))
|
"\n\ndefine(\'WP_DEBUG\', false);"))
|
||||||
try:
|
try:
|
||||||
if WOShellExec.cmd_exec(self, "/bin/bash -c \"{0} --allow-root"
|
if WOShellExec.cmd_exec(self, "/bin/bash -c \"{0} --allow-root"
|
||||||
.format(WOVariables.wo_wpcli_path) +
|
.format(WOVar.wo_wpcli_path) +
|
||||||
" config create " +
|
" config create " +
|
||||||
"--dbname=\'{0}\' --dbprefix=\'{1}\' "
|
"--dbname=\'{0}\' --dbprefix=\'{1}\' "
|
||||||
"--dbuser=\'{2}\' --dbhost=\'{3}\' "
|
"--dbuser=\'{2}\' --dbhost=\'{3}\' "
|
||||||
@@ -330,7 +330,7 @@ def setupwordpress(self, data, vhostonly=False):
|
|||||||
else:
|
else:
|
||||||
Log.debug(self, "Generating wp-config for WordPress multisite")
|
Log.debug(self, "Generating wp-config for WordPress multisite")
|
||||||
Log.debug(self, "/bin/bash -c \"{0} --allow-root "
|
Log.debug(self, "/bin/bash -c \"{0} --allow-root "
|
||||||
.format(WOVariables.wo_wpcli_path) +
|
.format(WOVar.wo_wpcli_path) +
|
||||||
"config create " +
|
"config create " +
|
||||||
"--dbname=\'{0}\' --dbprefix=\'{1}\' --dbhost=\'{2}\' "
|
"--dbname=\'{0}\' --dbprefix=\'{1}\' --dbhost=\'{2}\' "
|
||||||
.format(data['wo_db_name'],
|
.format(data['wo_db_name'],
|
||||||
@@ -345,7 +345,7 @@ def setupwordpress(self, data, vhostonly=False):
|
|||||||
"\n\ndefine(\'WP_DEBUG\', false);"))
|
"\n\ndefine(\'WP_DEBUG\', false);"))
|
||||||
try:
|
try:
|
||||||
if WOShellExec.cmd_exec(self, "/bin/bash -c \"{0} --allow-root"
|
if WOShellExec.cmd_exec(self, "/bin/bash -c \"{0} --allow-root"
|
||||||
.format(WOVariables.wo_wpcli_path) +
|
.format(WOVar.wo_wpcli_path) +
|
||||||
" config create " +
|
" config create " +
|
||||||
"--dbname=\'{0}\' --dbprefix=\'{1}\' "
|
"--dbname=\'{0}\' --dbprefix=\'{1}\' "
|
||||||
"--dbhost=\'{2}\' "
|
"--dbhost=\'{2}\' "
|
||||||
@@ -370,36 +370,36 @@ def setupwordpress(self, data, vhostonly=False):
|
|||||||
try:
|
try:
|
||||||
|
|
||||||
WOShellExec.cmd_exec(self, "/bin/bash -c \"{0} --allow-root "
|
WOShellExec.cmd_exec(self, "/bin/bash -c \"{0} --allow-root "
|
||||||
.format(WOVariables.wo_wpcli_path) +
|
.format(WOVar.wo_wpcli_path) +
|
||||||
"config set WP_CACHE_KEY_SALT "
|
"config set WP_CACHE_KEY_SALT "
|
||||||
"\'{0}:\'\"".format(wo_domain_name))
|
"\'{0}:\'\"".format(wo_domain_name))
|
||||||
|
|
||||||
WOShellExec.cmd_exec(self, "/bin/bash -c \"{0} --allow-root "
|
WOShellExec.cmd_exec(self, "/bin/bash -c \"{0} --allow-root "
|
||||||
.format(WOVariables.wo_wpcli_path) +
|
.format(WOVar.wo_wpcli_path) +
|
||||||
"config set WP_MEMORY_LIMIT "
|
"config set WP_MEMORY_LIMIT "
|
||||||
"\'128M\'\"")
|
"\'128M\'\"")
|
||||||
WOShellExec.cmd_exec(self, "/bin/bash -c \"{0} --allow-root "
|
WOShellExec.cmd_exec(self, "/bin/bash -c \"{0} --allow-root "
|
||||||
.format(WOVariables.wo_wpcli_path) +
|
.format(WOVar.wo_wpcli_path) +
|
||||||
"config set WP_MAX_MEMORY_LIMIT "
|
"config set WP_MAX_MEMORY_LIMIT "
|
||||||
"\'256M\'\"")
|
"\'256M\'\"")
|
||||||
WOShellExec.cmd_exec(self, "/bin/bash -c \"{0} --allow-root "
|
WOShellExec.cmd_exec(self, "/bin/bash -c \"{0} --allow-root "
|
||||||
.format(WOVariables.wo_wpcli_path) +
|
.format(WOVar.wo_wpcli_path) +
|
||||||
"config set CONCATENATE_SCRIPTS "
|
"config set CONCATENATE_SCRIPTS "
|
||||||
"false --raw\"")
|
"false --raw\"")
|
||||||
WOShellExec.cmd_exec(self, "/bin/bash -c \"{0} --allow-root "
|
WOShellExec.cmd_exec(self, "/bin/bash -c \"{0} --allow-root "
|
||||||
.format(WOVariables.wo_wpcli_path) +
|
.format(WOVar.wo_wpcli_path) +
|
||||||
"config set WP_POST_REVISIONS "
|
"config set WP_POST_REVISIONS "
|
||||||
"\'10\'\"")
|
"\'10\'\"")
|
||||||
WOShellExec.cmd_exec(self, "/bin/bash -c \"{0} --allow-root "
|
WOShellExec.cmd_exec(self, "/bin/bash -c \"{0} --allow-root "
|
||||||
.format(WOVariables.wo_wpcli_path) +
|
.format(WOVar.wo_wpcli_path) +
|
||||||
"config set MEDIA_TRASH "
|
"config set MEDIA_TRASH "
|
||||||
"true --raw\"")
|
"true --raw\"")
|
||||||
WOShellExec.cmd_exec(self, "/bin/bash -c \"{0} --allow-root "
|
WOShellExec.cmd_exec(self, "/bin/bash -c \"{0} --allow-root "
|
||||||
.format(WOVariables.wo_wpcli_path) +
|
.format(WOVar.wo_wpcli_path) +
|
||||||
"config set EMPTY_TRASH_DAYS "
|
"config set EMPTY_TRASH_DAYS "
|
||||||
"\'15\'\"")
|
"\'15\'\"")
|
||||||
WOShellExec.cmd_exec(self, "/bin/bash -c \"{0} --allow-root "
|
WOShellExec.cmd_exec(self, "/bin/bash -c \"{0} --allow-root "
|
||||||
.format(WOVariables.wo_wpcli_path) +
|
.format(WOVar.wo_wpcli_path) +
|
||||||
"config set WP_AUTO_UPDATE_CORE "
|
"config set WP_AUTO_UPDATE_CORE "
|
||||||
"minor\"")
|
"minor\"")
|
||||||
|
|
||||||
@@ -426,7 +426,7 @@ def setupwordpress(self, data, vhostonly=False):
|
|||||||
raise SiteError("Unable to move wp-config.php")
|
raise SiteError("Unable to move wp-config.php")
|
||||||
|
|
||||||
if not wo_wp_user:
|
if not wo_wp_user:
|
||||||
wo_wp_user = WOVariables.wo_user
|
wo_wp_user = WOVar.wo_user
|
||||||
while not wo_wp_user:
|
while not wo_wp_user:
|
||||||
Log.warn(self, "Username can have only alphanumeric"
|
Log.warn(self, "Username can have only alphanumeric"
|
||||||
"characters, spaces, underscores, hyphens,"
|
"characters, spaces, underscores, hyphens,"
|
||||||
@@ -439,7 +439,7 @@ def setupwordpress(self, data, vhostonly=False):
|
|||||||
wo_wp_pass = wo_random_pass
|
wo_wp_pass = wo_random_pass
|
||||||
|
|
||||||
if not wo_wp_email:
|
if not wo_wp_email:
|
||||||
wo_wp_email = WOVariables.wo_email
|
wo_wp_email = WOVar.wo_email
|
||||||
while not wo_wp_email:
|
while not wo_wp_email:
|
||||||
try:
|
try:
|
||||||
wo_wp_email = input('Enter WordPress email: ')
|
wo_wp_email = input('Enter WordPress email: ')
|
||||||
@@ -460,14 +460,14 @@ def setupwordpress(self, data, vhostonly=False):
|
|||||||
if not data['multisite']:
|
if not data['multisite']:
|
||||||
Log.debug(self, "Creating tables for WordPress Single site")
|
Log.debug(self, "Creating tables for WordPress Single site")
|
||||||
Log.debug(self, "{0} --allow-root core install "
|
Log.debug(self, "{0} --allow-root core install "
|
||||||
.format(WOVariables.wo_wpcli_path) +
|
.format(WOVar.wo_wpcli_path) +
|
||||||
"--url=\'{0}\' --title=\'{0}\' --admin_name=\'{1}\' "
|
"--url=\'{0}\' --title=\'{0}\' --admin_name=\'{1}\' "
|
||||||
.format(data['www_domain'], wo_wp_user) +
|
.format(data['www_domain'], wo_wp_user) +
|
||||||
"--admin_password= --admin_email=\'{1}\'"
|
"--admin_password= --admin_email=\'{1}\'"
|
||||||
.format(wo_wp_pass, wo_wp_email))
|
.format(wo_wp_pass, wo_wp_email))
|
||||||
try:
|
try:
|
||||||
if WOShellExec.cmd_exec(self, "{0} --allow-root core "
|
if WOShellExec.cmd_exec(self, "{0} --allow-root core "
|
||||||
.format(WOVariables.wo_wpcli_path) +
|
.format(WOVar.wo_wpcli_path) +
|
||||||
"install --url=\'{0}\' --title=\'{0}\' "
|
"install --url=\'{0}\' --title=\'{0}\' "
|
||||||
"--admin_name=\'{1}\' "
|
"--admin_name=\'{1}\' "
|
||||||
.format(data['www_domain'], wo_wp_user) +
|
.format(data['www_domain'], wo_wp_user) +
|
||||||
@@ -484,7 +484,7 @@ def setupwordpress(self, data, vhostonly=False):
|
|||||||
else:
|
else:
|
||||||
Log.debug(self, "Creating tables for WordPress multisite")
|
Log.debug(self, "Creating tables for WordPress multisite")
|
||||||
Log.debug(self, "{0} --allow-root "
|
Log.debug(self, "{0} --allow-root "
|
||||||
.format(WOVariables.wo_wpcli_path) +
|
.format(WOVar.wo_wpcli_path) +
|
||||||
"core multisite-install "
|
"core multisite-install "
|
||||||
"--url=\'{0}\' --title=\'{0}\' --admin_name=\'{1}\' "
|
"--url=\'{0}\' --title=\'{0}\' --admin_name=\'{1}\' "
|
||||||
.format(data['www_domain'], wo_wp_user) +
|
.format(data['www_domain'], wo_wp_user) +
|
||||||
@@ -495,7 +495,7 @@ def setupwordpress(self, data, vhostonly=False):
|
|||||||
if not data['wpsubdir'] else ''))
|
if not data['wpsubdir'] else ''))
|
||||||
try:
|
try:
|
||||||
if WOShellExec.cmd_exec(self, "{0} --allow-root "
|
if WOShellExec.cmd_exec(self, "{0} --allow-root "
|
||||||
.format(WOVariables.wo_wpcli_path) +
|
.format(WOVar.wo_wpcli_path) +
|
||||||
"core multisite-install "
|
"core multisite-install "
|
||||||
"--url=\'{0}\' --title=\'{0}\' "
|
"--url=\'{0}\' --title=\'{0}\' "
|
||||||
"--admin_name=\'{1}\' "
|
"--admin_name=\'{1}\' "
|
||||||
@@ -517,7 +517,7 @@ def setupwordpress(self, data, vhostonly=False):
|
|||||||
Log.debug(self, "Updating WordPress permalink")
|
Log.debug(self, "Updating WordPress permalink")
|
||||||
try:
|
try:
|
||||||
WOShellExec.cmd_exec(self, " {0} --allow-root "
|
WOShellExec.cmd_exec(self, " {0} --allow-root "
|
||||||
.format(WOVariables.wo_wpcli_path) +
|
.format(WOVar.wo_wpcli_path) +
|
||||||
"rewrite structure "
|
"rewrite structure "
|
||||||
"/%postname%/")
|
"/%postname%/")
|
||||||
except CommandExecutionError as e:
|
except CommandExecutionError as e:
|
||||||
@@ -608,7 +608,7 @@ def setupwordpress(self, data, vhostonly=False):
|
|||||||
if vhostonly:
|
if vhostonly:
|
||||||
try:
|
try:
|
||||||
WOShellExec.cmd_exec(self, "/bin/bash -c \"{0} --allow-root "
|
WOShellExec.cmd_exec(self, "/bin/bash -c \"{0} --allow-root "
|
||||||
.format(WOVariables.wo_wpcli_path) +
|
.format(WOVar.wo_wpcli_path) +
|
||||||
"db clean --yes\"")
|
"db clean --yes\"")
|
||||||
WOFileUtils.rm(self, "{0}/htdocs".format(wo_site_webroot))
|
WOFileUtils.rm(self, "{0}/htdocs".format(wo_site_webroot))
|
||||||
WOFileUtils.mkdir(self, "{0}/htdocs".format(wo_site_webroot))
|
WOFileUtils.mkdir(self, "{0}/htdocs".format(wo_site_webroot))
|
||||||
@@ -653,7 +653,7 @@ def installwp_plugin(self, plugin_name, data):
|
|||||||
WOFileUtils.chdir(self, '{0}/htdocs/'.format(wo_site_webroot))
|
WOFileUtils.chdir(self, '{0}/htdocs/'.format(wo_site_webroot))
|
||||||
try:
|
try:
|
||||||
WOShellExec.cmd_exec(self, "{0} plugin "
|
WOShellExec.cmd_exec(self, "{0} plugin "
|
||||||
.format(WOVariables.wo_wpcli_path) +
|
.format(WOVar.wo_wpcli_path) +
|
||||||
"--allow-root install "
|
"--allow-root install "
|
||||||
"{0}".format(plugin_name))
|
"{0}".format(plugin_name))
|
||||||
except CommandExecutionError as e:
|
except CommandExecutionError as e:
|
||||||
@@ -662,7 +662,7 @@ def installwp_plugin(self, plugin_name, data):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
WOShellExec.cmd_exec(self, "{0} plugin "
|
WOShellExec.cmd_exec(self, "{0} plugin "
|
||||||
.format(WOVariables.wo_wpcli_path) +
|
.format(WOVar.wo_wpcli_path) +
|
||||||
"--allow-root activate "
|
"--allow-root activate "
|
||||||
"{0} {na}"
|
"{0} {na}"
|
||||||
.format(plugin_name,
|
.format(plugin_name,
|
||||||
@@ -689,12 +689,12 @@ def uninstallwp_plugin(self, plugin_name, data):
|
|||||||
.format(plugin_name))
|
.format(plugin_name))
|
||||||
try:
|
try:
|
||||||
WOShellExec.cmd_exec(self, "{0} plugin "
|
WOShellExec.cmd_exec(self, "{0} plugin "
|
||||||
.format(WOVariables.wo_wpcli_path) +
|
.format(WOVar.wo_wpcli_path) +
|
||||||
"--allow-root deactivate "
|
"--allow-root deactivate "
|
||||||
"{0}".format(plugin_name))
|
"{0}".format(plugin_name))
|
||||||
|
|
||||||
WOShellExec.cmd_exec(self, "{0} plugin "
|
WOShellExec.cmd_exec(self, "{0} plugin "
|
||||||
.format(WOVariables.wo_wpcli_path) +
|
.format(WOVar.wo_wpcli_path) +
|
||||||
"--allow-root uninstall "
|
"--allow-root uninstall "
|
||||||
"{0}".format(plugin_name))
|
"{0}".format(plugin_name))
|
||||||
except CommandExecutionError as e:
|
except CommandExecutionError as e:
|
||||||
@@ -716,7 +716,7 @@ def setupwp_plugin(self, plugin_name, plugin_option, plugin_data, data):
|
|||||||
if not data['multisite']:
|
if not data['multisite']:
|
||||||
try:
|
try:
|
||||||
WOShellExec.cmd_exec(self, "{0} "
|
WOShellExec.cmd_exec(self, "{0} "
|
||||||
.format(WOVariables.wo_wpcli_path) +
|
.format(WOVar.wo_wpcli_path) +
|
||||||
"--allow-root option update "
|
"--allow-root option update "
|
||||||
"{0} \'{1}\' --format=json"
|
"{0} \'{1}\' --format=json"
|
||||||
.format(plugin_option, plugin_data))
|
.format(plugin_option, plugin_data))
|
||||||
@@ -731,7 +731,7 @@ def setupwp_plugin(self, plugin_name, plugin_option, plugin_data, data):
|
|||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
WOShellExec.cmd_exec(self, "{0} "
|
WOShellExec.cmd_exec(self, "{0} "
|
||||||
.format(WOVariables.wo_wpcli_path) +
|
.format(WOVar.wo_wpcli_path) +
|
||||||
"--allow-root network meta update 1 "
|
"--allow-root network meta update 1 "
|
||||||
"{0} \'{1}\' --format=json"
|
"{0} \'{1}\' --format=json"
|
||||||
.format(plugin_option, plugin_data
|
.format(plugin_option, plugin_data
|
||||||
@@ -750,8 +750,8 @@ def setwebrootpermissions(self, webroot):
|
|||||||
Log.debug(self, "Setting up permissions")
|
Log.debug(self, "Setting up permissions")
|
||||||
try:
|
try:
|
||||||
WOFileUtils.findBrokenSymlink(self, '/var/www/')
|
WOFileUtils.findBrokenSymlink(self, '/var/www/')
|
||||||
WOFileUtils.chown(self, webroot, WOVariables.wo_php_user,
|
WOFileUtils.chown(self, webroot, WOVar.wo_php_user,
|
||||||
WOVariables.wo_php_user, recursive=True)
|
WOVar.wo_php_user, recursive=True)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
Log.debug(self, str(e))
|
Log.debug(self, str(e))
|
||||||
raise SiteError("problem occured while setting up webroot permissions")
|
raise SiteError("problem occured while setting up webroot permissions")
|
||||||
@@ -759,7 +759,7 @@ def setwebrootpermissions(self, webroot):
|
|||||||
|
|
||||||
def sitebackup(self, data):
|
def sitebackup(self, data):
|
||||||
wo_site_webroot = data['webroot']
|
wo_site_webroot = data['webroot']
|
||||||
backup_path = wo_site_webroot + '/backup/{0}'.format(WOVariables.wo_date)
|
backup_path = wo_site_webroot + '/backup/{0}'.format(WOVar.wo_date)
|
||||||
if not WOFileUtils.isexist(self, backup_path):
|
if not WOFileUtils.isexist(self, backup_path):
|
||||||
WOFileUtils.mkdir(self, backup_path)
|
WOFileUtils.mkdir(self, backup_path)
|
||||||
Log.info(self, "Backup location : {0}".format(backup_path))
|
Log.info(self, "Backup location : {0}".format(backup_path))
|
||||||
@@ -836,8 +836,8 @@ def site_package_check(self, stype):
|
|||||||
# do something
|
# do something
|
||||||
# do post nginx installation configuration
|
# do post nginx installation configuration
|
||||||
Log.info(self, "NGINX PLUS Detected ...")
|
Log.info(self, "NGINX PLUS Detected ...")
|
||||||
apt = ["nginx-plus"] + WOVariables.wo_nginx
|
apt = ["nginx-plus"] + WOVar.wo_nginx
|
||||||
# apt_packages = apt_packages + WOVariables.wo_nginx
|
# apt_packages = apt_packages + WOVar.wo_nginx
|
||||||
stack.post_pref(self, apt, packages)
|
stack.post_pref(self, apt, packages)
|
||||||
elif WOAptGet.is_installed(self, 'nginx'):
|
elif WOAptGet.is_installed(self, 'nginx'):
|
||||||
Log.info(self, "WordOps detected a previously"
|
Log.info(self, "WordOps detected a previously"
|
||||||
@@ -845,13 +845,13 @@ def site_package_check(self, stype):
|
|||||||
"It may or may not have required modules. "
|
"It may or may not have required modules. "
|
||||||
"\nIf you need help, please create an issue at "
|
"\nIf you need help, please create an issue at "
|
||||||
"https://github.com/WordOps/WordOps/issues/ \n")
|
"https://github.com/WordOps/WordOps/issues/ \n")
|
||||||
apt = ["nginx"] + WOVariables.wo_nginx
|
apt = ["nginx"] + WOVar.wo_nginx
|
||||||
# apt_packages = apt_packages + WOVariables.wo_nginx
|
# apt_packages = apt_packages + WOVar.wo_nginx
|
||||||
post_pref(self, apt, packages)
|
post_pref(self, apt, packages)
|
||||||
elif os.path.isfile('/usr/sbin/nginx'):
|
elif os.path.isfile('/usr/sbin/nginx'):
|
||||||
post_pref(self, WOVariables.wo_nginx, [])
|
post_pref(self, WOVar.wo_nginx, [])
|
||||||
else:
|
else:
|
||||||
apt_packages = apt_packages + WOVariables.wo_nginx
|
apt_packages = apt_packages + WOVar.wo_nginx
|
||||||
else:
|
else:
|
||||||
# Fix for Nginx white screen death
|
# Fix for Nginx white screen death
|
||||||
if not WOFileUtils.grep(self, '/etc/nginx/fastcgi_params',
|
if not WOFileUtils.grep(self, '/etc/nginx/fastcgi_params',
|
||||||
@@ -871,26 +871,26 @@ def site_package_check(self, stype):
|
|||||||
Log.debug(self, "Setting apt_packages variable for PHP 7.2")
|
Log.debug(self, "Setting apt_packages variable for PHP 7.2")
|
||||||
if not WOAptGet.is_installed(self, 'php7.2-fpm'):
|
if not WOAptGet.is_installed(self, 'php7.2-fpm'):
|
||||||
if not WOAptGet.is_installed(self, 'php7.3-fpm'):
|
if not WOAptGet.is_installed(self, 'php7.3-fpm'):
|
||||||
apt_packages = apt_packages + WOVariables.wo_php + \
|
apt_packages = apt_packages + WOVar.wo_php + \
|
||||||
WOVariables.wo_php_extra
|
WOVar.wo_php_extra
|
||||||
else:
|
else:
|
||||||
apt_packages = apt_packages + WOVariables.wo_php
|
apt_packages = apt_packages + WOVar.wo_php
|
||||||
|
|
||||||
if self.app.pargs.php73 and stype in ['mysql', 'wp',
|
if self.app.pargs.php73 and stype in ['mysql', 'wp',
|
||||||
'wpsubdir', 'wpsubdomain']:
|
'wpsubdir', 'wpsubdomain']:
|
||||||
Log.debug(self, "Setting apt_packages variable for PHP 7.3")
|
Log.debug(self, "Setting apt_packages variable for PHP 7.3")
|
||||||
if not WOAptGet.is_installed(self, 'php7.3-fpm'):
|
if not WOAptGet.is_installed(self, 'php7.3-fpm'):
|
||||||
if not WOAptGet.is_installed(self, 'php7.2-fpm'):
|
if not WOAptGet.is_installed(self, 'php7.2-fpm'):
|
||||||
apt_packages = apt_packages + WOVariables.wo_php + \
|
apt_packages = apt_packages + WOVar.wo_php + \
|
||||||
WOVariables.wo_php73 + WOVariables.wo_php_extra
|
WOVar.wo_php73 + WOVar.wo_php_extra
|
||||||
else:
|
else:
|
||||||
apt_packages = apt_packages + WOVariables.wo_php73
|
apt_packages = apt_packages + WOVar.wo_php73
|
||||||
|
|
||||||
if stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
|
if stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
|
||||||
Log.debug(self, "Setting apt_packages variable for MySQL")
|
Log.debug(self, "Setting apt_packages variable for MySQL")
|
||||||
if not WOShellExec.cmd_exec(self, "/usr/bin/mysqladmin ping"):
|
if not WOShellExec.cmd_exec(self, "/usr/bin/mysqladmin ping"):
|
||||||
if not WOVariables.wo_distro == 'raspbian':
|
if not WOVar.wo_distro == 'raspbian':
|
||||||
if (not WOVariables.wo_platform_codename == 'jessie'):
|
if (not WOVar.wo_platform_codename == 'jessie'):
|
||||||
wo_mysql = ["mariadb-server", "percona-toolkit",
|
wo_mysql = ["mariadb-server", "percona-toolkit",
|
||||||
"python3-mysqldb", "mariadb-backup"]
|
"python3-mysqldb", "mariadb-backup"]
|
||||||
else:
|
else:
|
||||||
@@ -907,7 +907,7 @@ def site_package_check(self, stype):
|
|||||||
packages = packages + [["https://github.com/wp-cli/wp-cli/"
|
packages = packages + [["https://github.com/wp-cli/wp-cli/"
|
||||||
"releases/download/v{0}/"
|
"releases/download/v{0}/"
|
||||||
"wp-cli-{0}.phar"
|
"wp-cli-{0}.phar"
|
||||||
.format(WOVariables.wo_wp_cli),
|
.format(WOVar.wo_wp_cli),
|
||||||
"/usr/local/bin/wp", "WP-CLI"]]
|
"/usr/local/bin/wp", "WP-CLI"]]
|
||||||
if self.app.pargs.wpredis:
|
if self.app.pargs.wpredis:
|
||||||
Log.debug(self, "Setting apt_packages variable for redis")
|
Log.debug(self, "Setting apt_packages variable for redis")
|
||||||
@@ -918,10 +918,10 @@ def site_package_check(self, stype):
|
|||||||
Log.debug(self, "Setting apt_packages variable for PHP 7.3")
|
Log.debug(self, "Setting apt_packages variable for PHP 7.3")
|
||||||
if not WOAptGet.is_installed(self, 'php7.3-fpm'):
|
if not WOAptGet.is_installed(self, 'php7.3-fpm'):
|
||||||
if not WOAptGet.is_installed(self, 'php7.2-fpm'):
|
if not WOAptGet.is_installed(self, 'php7.2-fpm'):
|
||||||
apt_packages = apt_packages + WOVariables.wo_php + \
|
apt_packages = apt_packages + WOVar.wo_php + \
|
||||||
WOVariables.wo_php73 + WOVariables.wo_php_extra
|
WOVar.wo_php73 + WOVar.wo_php_extra
|
||||||
else:
|
else:
|
||||||
apt_packages = apt_packages + WOVariables.wo_php73
|
apt_packages = apt_packages + WOVar.wo_php73
|
||||||
|
|
||||||
if self.app.pargs.ngxblocker:
|
if self.app.pargs.ngxblocker:
|
||||||
if not os.path.isdir('/etc/nginx/bots.d'):
|
if not os.path.isdir('/etc/nginx/bots.d'):
|
||||||
@@ -1293,9 +1293,9 @@ def removeAcmeConf(self, domain):
|
|||||||
Log.error(self, "Cert removal failed")
|
Log.error(self, "Cert removal failed")
|
||||||
|
|
||||||
WOFileUtils.rm(self, '{0}/{1}_ecc'
|
WOFileUtils.rm(self, '{0}/{1}_ecc'
|
||||||
.format(WOVariables.wo_ssl_archive, domain))
|
.format(WOVar.wo_ssl_archive, domain))
|
||||||
WOFileUtils.rm(self, '{0}/{1}'
|
WOFileUtils.rm(self, '{0}/{1}'
|
||||||
.format(WOVariables.wo_ssl_live, domain))
|
.format(WOVar.wo_ssl_live, domain))
|
||||||
WOFileUtils.rm(self, '{0}'.format(sslconf))
|
WOFileUtils.rm(self, '{0}'.format(sslconf))
|
||||||
WOFileUtils.rm(self, '{0}.disabled'.format(sslconf))
|
WOFileUtils.rm(self, '{0}.disabled'.format(sslconf))
|
||||||
WOFileUtils.rm(self, '{0}'.format(sslforce))
|
WOFileUtils.rm(self, '{0}'.format(sslforce))
|
||||||
@@ -1502,7 +1502,7 @@ def archivedCertificateHandle(self, domain):
|
|||||||
self, "You already have an existing certificate "
|
self, "You already have an existing certificate "
|
||||||
"for the domain requested.\n"
|
"for the domain requested.\n"
|
||||||
"(ref: {0}/"
|
"(ref: {0}/"
|
||||||
"{1}_ecc/{1}.conf)".format(WOVariables.wo_ssl_archive, domain) +
|
"{1}_ecc/{1}.conf)".format(WOVar.wo_ssl_archive, domain) +
|
||||||
"\nPlease select an option from below?"
|
"\nPlease select an option from below?"
|
||||||
"\n\t1: Reinstall existing certificate"
|
"\n\t1: Reinstall existing certificate"
|
||||||
"\n\t2: Issue a new certificate to replace "
|
"\n\t2: Issue a new certificate to replace "
|
||||||
@@ -1511,10 +1511,10 @@ def archivedCertificateHandle(self, domain):
|
|||||||
check_prompt = input(
|
check_prompt = input(
|
||||||
"\nType the appropriate number [1-2] or any other key to cancel: ")
|
"\nType the appropriate number [1-2] or any other key to cancel: ")
|
||||||
if not os.path.isfile("{0}/{1}/fullchain.pem"
|
if not os.path.isfile("{0}/{1}/fullchain.pem"
|
||||||
.format(WOVariables.wo_ssl_live, domain)):
|
.format(WOVar.wo_ssl_live, domain)):
|
||||||
Log.error(
|
Log.error(
|
||||||
self, "{0}/{1}/fullchain.pem file is missing."
|
self, "{0}/{1}/fullchain.pem file is missing."
|
||||||
.format(WOVariables.wo_ssl_live, domain))
|
.format(WOVar.wo_ssl_live, domain))
|
||||||
|
|
||||||
if check_prompt == "1":
|
if check_prompt == "1":
|
||||||
Log.info(self, "Reinstalling SSL cert with acme.sh")
|
Log.info(self, "Reinstalling SSL cert with acme.sh")
|
||||||
@@ -1539,7 +1539,7 @@ def archivedCertificateHandle(self, domain):
|
|||||||
"ssl_certificate_key {0}/{1}/key.pem;\n"
|
"ssl_certificate_key {0}/{1}/key.pem;\n"
|
||||||
"ssl_trusted_certificate {0}/{1}/ca.pem;\n"
|
"ssl_trusted_certificate {0}/{1}/ca.pem;\n"
|
||||||
"ssl_stapling_verify on;\n"
|
"ssl_stapling_verify on;\n"
|
||||||
.format(WOVariables.wo_ssl_live, domain))
|
.format(WOVar.wo_ssl_live, domain))
|
||||||
sslconf.close()
|
sslconf.close()
|
||||||
|
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
@@ -1573,7 +1573,7 @@ def archivedCertificateHandle(self, domain):
|
|||||||
"{0}/{1}/ca.pem;\n"
|
"{0}/{1}/ca.pem;\n"
|
||||||
"--reloadcmd "
|
"--reloadcmd "
|
||||||
"\"nginx -t && service nginx restart\" "
|
"\"nginx -t && service nginx restart\" "
|
||||||
.format(WOVariables.wo_ssl_live, domain))
|
.format(WOVar.wo_ssl_live, domain))
|
||||||
|
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
Log.debug(self, str(e))
|
Log.debug(self, str(e))
|
||||||
@@ -1595,8 +1595,8 @@ def archivedCertificateHandle(self, domain):
|
|||||||
|
|
||||||
|
|
||||||
def setuprocketchat(self):
|
def setuprocketchat(self):
|
||||||
if ((not WOVariables.wo_platform_codename == 'bionic') and
|
if ((not WOVar.wo_platform_codename == 'bionic') and
|
||||||
(not WOVariables.wo_platform_codename == 'xenial')):
|
(not WOVar.wo_platform_codename == 'xenial')):
|
||||||
Log.info(self, "Rocket.chat is only available on Ubuntu 16.04 "
|
Log.info(self, "Rocket.chat is only available on Ubuntu 16.04 "
|
||||||
"& 18.04 LTS")
|
"& 18.04 LTS")
|
||||||
return False
|
return False
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ from wo.core.logging import Log
|
|||||||
from wo.core.mysql import WOMysql
|
from wo.core.mysql import WOMysql
|
||||||
from wo.core.services import WOService
|
from wo.core.services import WOService
|
||||||
from wo.core.shellexec import WOShellExec
|
from wo.core.shellexec import WOShellExec
|
||||||
from wo.core.variables import WOVariables
|
from wo.core.variables import WOVar
|
||||||
|
|
||||||
|
|
||||||
def wo_stack_hook(app):
|
def wo_stack_hook(app):
|
||||||
@@ -163,18 +163,18 @@ class WOStackController(CementBaseController):
|
|||||||
if not (WOAptGet.is_installed(self, 'nginx-plus') or
|
if not (WOAptGet.is_installed(self, 'nginx-plus') or
|
||||||
WOAptGet.is_installed(self, 'nginx')):
|
WOAptGet.is_installed(self, 'nginx')):
|
||||||
if not os.path.isfile('/usr/sbin/nginx'):
|
if not os.path.isfile('/usr/sbin/nginx'):
|
||||||
apt_packages = apt_packages + WOVariables.wo_nginx
|
apt_packages = apt_packages + WOVar.wo_nginx
|
||||||
else:
|
else:
|
||||||
if WOAptGet.is_installed(self, 'nginx-plus'):
|
if WOAptGet.is_installed(self, 'nginx-plus'):
|
||||||
Log.info(self, "NGINX PLUS Detected ...")
|
Log.info(self, "NGINX PLUS Detected ...")
|
||||||
apt = ["nginx-plus"] + WOVariables.wo_nginx
|
apt = ["nginx-plus"] + WOVar.wo_nginx
|
||||||
self.post_pref(apt, empty_packages)
|
self.post_pref(apt, empty_packages)
|
||||||
elif WOAptGet.is_installed(self, 'nginx'):
|
elif WOAptGet.is_installed(self, 'nginx'):
|
||||||
Log.info(self, "WordOps detected an already "
|
Log.info(self, "WordOps detected an already "
|
||||||
"installed nginx package."
|
"installed nginx package."
|
||||||
"It may or may not have "
|
"It may or may not have "
|
||||||
"required modules.\n")
|
"required modules.\n")
|
||||||
apt = ["nginx"] + WOVariables.wo_nginx
|
apt = ["nginx"] + WOVar.wo_nginx
|
||||||
self.post_pref(apt, empty_packages)
|
self.post_pref(apt, empty_packages)
|
||||||
else:
|
else:
|
||||||
Log.debug(self, "Nginx already installed")
|
Log.debug(self, "Nginx already installed")
|
||||||
@@ -182,7 +182,7 @@ class WOStackController(CementBaseController):
|
|||||||
# Redis
|
# Redis
|
||||||
if pargs.redis:
|
if pargs.redis:
|
||||||
if not WOAptGet.is_installed(self, 'redis-server'):
|
if not WOAptGet.is_installed(self, 'redis-server'):
|
||||||
apt_packages = apt_packages + WOVariables.wo_redis
|
apt_packages = apt_packages + WOVar.wo_redis
|
||||||
|
|
||||||
else:
|
else:
|
||||||
Log.info(self, "Redis already installed")
|
Log.info(self, "Redis already installed")
|
||||||
@@ -191,8 +191,8 @@ class WOStackController(CementBaseController):
|
|||||||
if pargs.php:
|
if pargs.php:
|
||||||
Log.debug(self, "Setting apt_packages variable for PHP 7.2")
|
Log.debug(self, "Setting apt_packages variable for PHP 7.2")
|
||||||
if not (WOAptGet.is_installed(self, 'php7.2-fpm')):
|
if not (WOAptGet.is_installed(self, 'php7.2-fpm')):
|
||||||
apt_packages = (apt_packages + WOVariables.wo_php +
|
apt_packages = (apt_packages + WOVar.wo_php +
|
||||||
WOVariables.wo_php_extra)
|
WOVar.wo_php_extra)
|
||||||
else:
|
else:
|
||||||
Log.debug(self, "PHP 7.2 already installed")
|
Log.debug(self, "PHP 7.2 already installed")
|
||||||
Log.info(self, "PHP 7.2 already installed")
|
Log.info(self, "PHP 7.2 already installed")
|
||||||
@@ -201,9 +201,9 @@ class WOStackController(CementBaseController):
|
|||||||
if pargs.php73:
|
if pargs.php73:
|
||||||
Log.debug(self, "Setting apt_packages variable for PHP 7.3")
|
Log.debug(self, "Setting apt_packages variable for PHP 7.3")
|
||||||
if not WOAptGet.is_installed(self, 'php7.3-fpm'):
|
if not WOAptGet.is_installed(self, 'php7.3-fpm'):
|
||||||
apt_packages = (apt_packages + WOVariables.wo_php +
|
apt_packages = (apt_packages + WOVar.wo_php +
|
||||||
WOVariables.wo_php73 +
|
WOVar.wo_php73 +
|
||||||
WOVariables.wo_php_extra)
|
WOVar.wo_php_extra)
|
||||||
else:
|
else:
|
||||||
Log.debug(self, "PHP 7.3 already installed")
|
Log.debug(self, "PHP 7.3 already installed")
|
||||||
Log.info(self, "PHP 7.3 already installed")
|
Log.info(self, "PHP 7.3 already installed")
|
||||||
@@ -213,7 +213,7 @@ class WOStackController(CementBaseController):
|
|||||||
pargs.mysqltuner = True
|
pargs.mysqltuner = True
|
||||||
Log.debug(self, "Setting apt_packages variable for MySQL")
|
Log.debug(self, "Setting apt_packages variable for MySQL")
|
||||||
if not WOShellExec.cmd_exec(self, "mysqladmin ping"):
|
if not WOShellExec.cmd_exec(self, "mysqladmin ping"):
|
||||||
apt_packages = apt_packages + WOVariables.wo_mysql
|
apt_packages = apt_packages + WOVar.wo_mysql
|
||||||
else:
|
else:
|
||||||
Log.debug(self, "MySQL already installed and alive")
|
Log.debug(self, "MySQL already installed and alive")
|
||||||
Log.info(self, "MySQL already installed and alive")
|
Log.info(self, "MySQL already installed and alive")
|
||||||
@@ -223,7 +223,7 @@ class WOStackController(CementBaseController):
|
|||||||
Log.debug(self, "Setting apt_packages variable "
|
Log.debug(self, "Setting apt_packages variable "
|
||||||
"for MySQL Client")
|
"for MySQL Client")
|
||||||
if not WOShellExec.cmd_exec(self, "mysqladmin ping"):
|
if not WOShellExec.cmd_exec(self, "mysqladmin ping"):
|
||||||
apt_packages = apt_packages + WOVariables.wo_mysql_client
|
apt_packages = apt_packages + WOVar.wo_mysql_client
|
||||||
else:
|
else:
|
||||||
Log.debug(self, "MySQL already installed and alive")
|
Log.debug(self, "MySQL already installed and alive")
|
||||||
Log.info(self, "MySQL already installed and alive")
|
Log.info(self, "MySQL already installed and alive")
|
||||||
@@ -236,7 +236,7 @@ class WOStackController(CementBaseController):
|
|||||||
packages = packages + [["https://github.com/wp-cli/wp-cli/"
|
packages = packages + [["https://github.com/wp-cli/wp-cli/"
|
||||||
"releases/download/v{0}/"
|
"releases/download/v{0}/"
|
||||||
"wp-cli-{0}.phar"
|
"wp-cli-{0}.phar"
|
||||||
"".format(WOVariables.wo_wp_cli),
|
"".format(WOVar.wo_wp_cli),
|
||||||
"/usr/local/bin/wp",
|
"/usr/local/bin/wp",
|
||||||
"WP-CLI"]]
|
"WP-CLI"]]
|
||||||
else:
|
else:
|
||||||
@@ -247,7 +247,7 @@ class WOStackController(CementBaseController):
|
|||||||
if pargs.fail2ban:
|
if pargs.fail2ban:
|
||||||
Log.debug(self, "Setting apt_packages variable for Fail2ban")
|
Log.debug(self, "Setting apt_packages variable for Fail2ban")
|
||||||
if not WOAptGet.is_installed(self, 'fail2ban'):
|
if not WOAptGet.is_installed(self, 'fail2ban'):
|
||||||
apt_packages = apt_packages + WOVariables.wo_fail2ban
|
apt_packages = apt_packages + WOVar.wo_fail2ban
|
||||||
else:
|
else:
|
||||||
Log.debug(self, "Fail2ban already installed")
|
Log.debug(self, "Fail2ban already installed")
|
||||||
Log.info(self, "Fail2ban already installed")
|
Log.info(self, "Fail2ban already installed")
|
||||||
@@ -256,7 +256,7 @@ class WOStackController(CementBaseController):
|
|||||||
if pargs.clamav:
|
if pargs.clamav:
|
||||||
Log.debug(self, "Setting apt_packages variable for ClamAV")
|
Log.debug(self, "Setting apt_packages variable for ClamAV")
|
||||||
if not WOAptGet.is_installed(self, 'clamav'):
|
if not WOAptGet.is_installed(self, 'clamav'):
|
||||||
apt_packages = apt_packages + WOVariables.wo_clamav
|
apt_packages = apt_packages + WOVar.wo_clamav
|
||||||
else:
|
else:
|
||||||
Log.debug(self, "ClamAV already installed")
|
Log.debug(self, "ClamAV already installed")
|
||||||
Log.info(self, "ClamAV already installed")
|
Log.info(self, "ClamAV already installed")
|
||||||
@@ -346,17 +346,17 @@ class WOStackController(CementBaseController):
|
|||||||
packages = packages + [["https://github.com/vrana/adminer/"
|
packages = packages + [["https://github.com/vrana/adminer/"
|
||||||
"releases/download/v{0}"
|
"releases/download/v{0}"
|
||||||
"/adminer-{0}.php"
|
"/adminer-{0}.php"
|
||||||
.format(WOVariables.wo_adminer),
|
.format(WOVar.wo_adminer),
|
||||||
"{0}22222/"
|
"{0}22222/"
|
||||||
"htdocs/db/adminer/index.php"
|
"htdocs/db/adminer/index.php"
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVar.wo_webroot),
|
||||||
"Adminer"],
|
"Adminer"],
|
||||||
["https://raw.githubusercontent.com"
|
["https://raw.githubusercontent.com"
|
||||||
"/vrana/adminer/master/designs/"
|
"/vrana/adminer/master/designs/"
|
||||||
"pepa-linha/adminer.css",
|
"pepa-linha/adminer.css",
|
||||||
"{0}22222/"
|
"{0}22222/"
|
||||||
"htdocs/db/adminer/adminer.css"
|
"htdocs/db/adminer/adminer.css"
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVar.wo_webroot),
|
||||||
"Adminer theme"]]
|
"Adminer theme"]]
|
||||||
else:
|
else:
|
||||||
Log.debug(self, "Adminer already installed")
|
Log.debug(self, "Adminer already installed")
|
||||||
@@ -383,7 +383,7 @@ class WOStackController(CementBaseController):
|
|||||||
os.path.isdir("/etc/netdata")):
|
os.path.isdir("/etc/netdata")):
|
||||||
Log.debug(
|
Log.debug(
|
||||||
self, "Setting packages variable for Netdata")
|
self, "Setting packages variable for Netdata")
|
||||||
if WOVariables.wo_distro == 'raspbian':
|
if WOVar.wo_distro == 'raspbian':
|
||||||
packages = packages + [['https://my-netdata.io/'
|
packages = packages + [['https://my-netdata.io/'
|
||||||
'kickstart.sh',
|
'kickstart.sh',
|
||||||
'/var/lib/wo/tmp/kickstart.sh',
|
'/var/lib/wo/tmp/kickstart.sh',
|
||||||
@@ -407,7 +407,7 @@ class WOStackController(CementBaseController):
|
|||||||
"/wordops-dashboard/"
|
"/wordops-dashboard/"
|
||||||
"releases/download/v{0}/"
|
"releases/download/v{0}/"
|
||||||
"wordops-dashboard.tar.gz"
|
"wordops-dashboard.tar.gz"
|
||||||
.format(WOVariables.wo_dashboard),
|
.format(WOVar.wo_dashboard),
|
||||||
"/var/lib/wo/tmp/wo-dashboard.tar.gz",
|
"/var/lib/wo/tmp/wo-dashboard.tar.gz",
|
||||||
"WordOps Dashboard"]]
|
"WordOps Dashboard"]]
|
||||||
else:
|
else:
|
||||||
@@ -421,7 +421,7 @@ class WOStackController(CementBaseController):
|
|||||||
packages = packages + \
|
packages = packages + \
|
||||||
[["https://github.com/soerennb/"
|
[["https://github.com/soerennb/"
|
||||||
"extplorer/archive/v{0}.tar.gz"
|
"extplorer/archive/v{0}.tar.gz"
|
||||||
.format(WOVariables.wo_extplorer),
|
.format(WOVar.wo_extplorer),
|
||||||
"/var/lib/wo/tmp/extplorer.tar.gz",
|
"/var/lib/wo/tmp/extplorer.tar.gz",
|
||||||
"eXtplorer"]]
|
"eXtplorer"]]
|
||||||
else:
|
else:
|
||||||
@@ -449,25 +449,25 @@ class WOStackController(CementBaseController):
|
|||||||
"clean.php",
|
"clean.php",
|
||||||
"{0}22222/htdocs/cache/"
|
"{0}22222/htdocs/cache/"
|
||||||
"nginx/clean.php"
|
"nginx/clean.php"
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVar.wo_webroot),
|
||||||
"clean.php"],
|
"clean.php"],
|
||||||
["https://raw.github.com/rlerdorf/"
|
["https://raw.github.com/rlerdorf/"
|
||||||
"opcache-status/master/opcache.php",
|
"opcache-status/master/opcache.php",
|
||||||
"{0}22222/htdocs/cache/"
|
"{0}22222/htdocs/cache/"
|
||||||
"opcache/opcache.php"
|
"opcache/opcache.php"
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVar.wo_webroot),
|
||||||
"opcache.php"],
|
"opcache.php"],
|
||||||
["https://raw.github.com/amnuts/"
|
["https://raw.github.com/amnuts/"
|
||||||
"opcache-gui/master/index.php",
|
"opcache-gui/master/index.php",
|
||||||
"{0}22222/htdocs/"
|
"{0}22222/htdocs/"
|
||||||
"cache/opcache/opgui.php"
|
"cache/opcache/opgui.php"
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVar.wo_webroot),
|
||||||
"Opgui"],
|
"Opgui"],
|
||||||
["https://raw.githubusercontent.com/"
|
["https://raw.githubusercontent.com/"
|
||||||
"mlazarov/ocp/master/ocp.php",
|
"mlazarov/ocp/master/ocp.php",
|
||||||
"{0}22222/htdocs/cache/"
|
"{0}22222/htdocs/cache/"
|
||||||
"opcache/ocp.php"
|
"opcache/ocp.php"
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVar.wo_webroot),
|
||||||
"OCP.php"],
|
"OCP.php"],
|
||||||
["https://github.com/jokkedk/webgrind/"
|
["https://github.com/jokkedk/webgrind/"
|
||||||
"archive/master.tar.gz",
|
"archive/master.tar.gz",
|
||||||
@@ -575,27 +575,27 @@ class WOStackController(CementBaseController):
|
|||||||
if pargs.nginx:
|
if pargs.nginx:
|
||||||
if WOAptGet.is_installed(self, 'nginx-custom'):
|
if WOAptGet.is_installed(self, 'nginx-custom'):
|
||||||
Log.debug(self, "Removing apt_packages variable of Nginx")
|
Log.debug(self, "Removing apt_packages variable of Nginx")
|
||||||
apt_packages = apt_packages + WOVariables.wo_nginx
|
apt_packages = apt_packages + WOVar.wo_nginx
|
||||||
|
|
||||||
# PHP 7.2
|
# PHP 7.2
|
||||||
if pargs.php:
|
if pargs.php:
|
||||||
Log.debug(self, "Removing apt_packages variable of PHP")
|
Log.debug(self, "Removing apt_packages variable of PHP")
|
||||||
if WOAptGet.is_installed(self, 'php7.2-fpm'):
|
if WOAptGet.is_installed(self, 'php7.2-fpm'):
|
||||||
if not WOAptGet.is_installed(self, 'php7.3-fpm'):
|
if not WOAptGet.is_installed(self, 'php7.3-fpm'):
|
||||||
apt_packages = apt_packages + WOVariables.wo_php + \
|
apt_packages = apt_packages + WOVar.wo_php + \
|
||||||
WOVariables.wo_php_extra
|
WOVar.wo_php_extra
|
||||||
else:
|
else:
|
||||||
apt_packages = apt_packages + WOVariables.wo_php
|
apt_packages = apt_packages + WOVar.wo_php
|
||||||
|
|
||||||
# PHP7.3
|
# PHP7.3
|
||||||
if pargs.php73:
|
if pargs.php73:
|
||||||
Log.debug(self, "Removing apt_packages variable of PHP 7.3")
|
Log.debug(self, "Removing apt_packages variable of PHP 7.3")
|
||||||
if WOAptGet.is_installed(self, 'php7.3-fpm'):
|
if WOAptGet.is_installed(self, 'php7.3-fpm'):
|
||||||
if not (WOAptGet.is_installed(self, 'php7.2-fpm')):
|
if not (WOAptGet.is_installed(self, 'php7.2-fpm')):
|
||||||
apt_packages = apt_packages + WOVariables.wo_php73 + \
|
apt_packages = apt_packages + WOVar.wo_php73 + \
|
||||||
WOVariables.wo_php_extra
|
WOVar.wo_php_extra
|
||||||
else:
|
else:
|
||||||
apt_packages = apt_packages + WOVariables.wo_php73
|
apt_packages = apt_packages + WOVar.wo_php73
|
||||||
|
|
||||||
# REDIS
|
# REDIS
|
||||||
if pargs.redis:
|
if pargs.redis:
|
||||||
@@ -616,19 +616,19 @@ class WOStackController(CementBaseController):
|
|||||||
Log.debug(self, "Removing apt_packages variable "
|
Log.debug(self, "Removing apt_packages variable "
|
||||||
"for MySQL Client")
|
"for MySQL Client")
|
||||||
if WOShellExec.cmd_exec(self, "mysqladmin ping"):
|
if WOShellExec.cmd_exec(self, "mysqladmin ping"):
|
||||||
apt_packages = apt_packages + WOVariables.wo_mysql_client
|
apt_packages = apt_packages + WOVar.wo_mysql_client
|
||||||
|
|
||||||
# fail2ban
|
# fail2ban
|
||||||
if pargs.fail2ban:
|
if pargs.fail2ban:
|
||||||
if WOAptGet.is_installed(self, 'fail2ban'):
|
if WOAptGet.is_installed(self, 'fail2ban'):
|
||||||
Log.debug(self, "Remove apt_packages variable of Fail2ban")
|
Log.debug(self, "Remove apt_packages variable of Fail2ban")
|
||||||
apt_packages = apt_packages + WOVariables.wo_fail2ban
|
apt_packages = apt_packages + WOVar.wo_fail2ban
|
||||||
|
|
||||||
# ClamAV
|
# ClamAV
|
||||||
if pargs.clamav:
|
if pargs.clamav:
|
||||||
Log.debug(self, "Setting apt_packages variable for ClamAV")
|
Log.debug(self, "Setting apt_packages variable for ClamAV")
|
||||||
if WOAptGet.is_installed(self, 'clamav'):
|
if WOAptGet.is_installed(self, 'clamav'):
|
||||||
apt_packages = apt_packages + WOVariables.wo_clamav
|
apt_packages = apt_packages + WOVar.wo_clamav
|
||||||
|
|
||||||
# sendmail
|
# sendmail
|
||||||
if pargs.sendmail:
|
if pargs.sendmail:
|
||||||
@@ -657,10 +657,10 @@ class WOStackController(CementBaseController):
|
|||||||
# PHPMYADMIN
|
# PHPMYADMIN
|
||||||
if pargs.phpmyadmin:
|
if pargs.phpmyadmin:
|
||||||
if os.path.isdir('{0}22222/htdocs/db/pma'
|
if os.path.isdir('{0}22222/htdocs/db/pma'
|
||||||
.format(WOVariables.wo_webroot)):
|
.format(WOVar.wo_webroot)):
|
||||||
Log.debug(self, "Removing package of phpMyAdmin ")
|
Log.debug(self, "Removing package of phpMyAdmin ")
|
||||||
packages = packages + ['{0}22222/htdocs/db/pma'
|
packages = packages + ['{0}22222/htdocs/db/pma'
|
||||||
.format(WOVariables.wo_webroot)]
|
.format(WOVar.wo_webroot)]
|
||||||
# Composer
|
# Composer
|
||||||
if pargs.composer:
|
if pargs.composer:
|
||||||
Log.debug(self, "Removing package of Composer ")
|
Log.debug(self, "Removing package of Composer ")
|
||||||
@@ -677,28 +677,28 @@ class WOStackController(CementBaseController):
|
|||||||
if pargs.phpredisadmin:
|
if pargs.phpredisadmin:
|
||||||
Log.debug(self, "Removing package variable of phpRedisAdmin ")
|
Log.debug(self, "Removing package variable of phpRedisAdmin ")
|
||||||
if os.path.isdir('{0}22222/htdocs/cache/redis'
|
if os.path.isdir('{0}22222/htdocs/cache/redis'
|
||||||
.format(WOVariables.wo_webroot)):
|
.format(WOVar.wo_webroot)):
|
||||||
packages = packages + ['{0}22222/htdocs/'
|
packages = packages + ['{0}22222/htdocs/'
|
||||||
'cache/redis'
|
'cache/redis'
|
||||||
.format(WOVariables.wo_webroot)]
|
.format(WOVar.wo_webroot)]
|
||||||
# ADMINER
|
# ADMINER
|
||||||
if pargs.adminer:
|
if pargs.adminer:
|
||||||
if os.path.isdir('{0}22222/htdocs/db/adminer'
|
if os.path.isdir('{0}22222/htdocs/db/adminer'
|
||||||
.format(WOVariables.wo_webroot)):
|
.format(WOVar.wo_webroot)):
|
||||||
Log.debug(self, "Removing package variable of Adminer ")
|
Log.debug(self, "Removing package variable of Adminer ")
|
||||||
packages = packages + ['{0}22222/htdocs/db/adminer'
|
packages = packages + ['{0}22222/htdocs/db/adminer'
|
||||||
.format(WOVariables.wo_webroot)]
|
.format(WOVar.wo_webroot)]
|
||||||
if pargs.utils:
|
if pargs.utils:
|
||||||
Log.debug(self, "Removing package variable of utils ")
|
Log.debug(self, "Removing package variable of utils ")
|
||||||
packages = packages + ['{0}22222/htdocs/php/webgrind/'
|
packages = packages + ['{0}22222/htdocs/php/webgrind/'
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVar.wo_webroot),
|
||||||
'{0}22222/htdocs/cache/opcache'
|
'{0}22222/htdocs/cache/opcache'
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVar.wo_webroot),
|
||||||
'{0}22222/htdocs/cache/nginx/'
|
'{0}22222/htdocs/cache/nginx/'
|
||||||
'clean.php'.format(WOVariables.wo_webroot),
|
'clean.php'.format(WOVar.wo_webroot),
|
||||||
'/usr/bin/pt-query-advisor',
|
'/usr/bin/pt-query-advisor',
|
||||||
'{0}22222/htdocs/db/anemometer'
|
'{0}22222/htdocs/db/anemometer'
|
||||||
.format(WOVariables.wo_webroot)]
|
.format(WOVar.wo_webroot)]
|
||||||
|
|
||||||
if pargs.netdata:
|
if pargs.netdata:
|
||||||
Log.debug(self, "Removing Netdata")
|
Log.debug(self, "Removing Netdata")
|
||||||
@@ -708,16 +708,16 @@ class WOStackController(CementBaseController):
|
|||||||
|
|
||||||
if pargs.dashboard:
|
if pargs.dashboard:
|
||||||
if (os.path.isfile('{0}22222/htdocs/index.php'
|
if (os.path.isfile('{0}22222/htdocs/index.php'
|
||||||
.format(WOVariables.wo_webroot)) or
|
.format(WOVar.wo_webroot)) or
|
||||||
os.path.isfile('{0}22222/htdocs/index.html'
|
os.path.isfile('{0}22222/htdocs/index.html'
|
||||||
.format(WOVariables.wo_webroot))):
|
.format(WOVar.wo_webroot))):
|
||||||
Log.debug(self, "Removing Wo-Dashboard")
|
Log.debug(self, "Removing Wo-Dashboard")
|
||||||
packages = packages + ['{0}22222/htdocs/assets'
|
packages = packages + ['{0}22222/htdocs/assets'
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVar.wo_webroot),
|
||||||
'{0}22222/htdocs/index.php'
|
'{0}22222/htdocs/index.php'
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVar.wo_webroot),
|
||||||
'{0}22222/htdocs/index.html'
|
'{0}22222/htdocs/index.html'
|
||||||
.format(WOVariables.wo_webroot)]
|
.format(WOVar.wo_webroot)]
|
||||||
|
|
||||||
if (packages) or (apt_packages):
|
if (packages) or (apt_packages):
|
||||||
if (not pargs.force):
|
if (not pargs.force):
|
||||||
@@ -739,7 +739,7 @@ class WOStackController(CementBaseController):
|
|||||||
# Netdata uninstaller
|
# Netdata uninstaller
|
||||||
if (set(['/var/lib/wo/tmp/'
|
if (set(['/var/lib/wo/tmp/'
|
||||||
'kickstart.sh']).issubset(set(packages))):
|
'kickstart.sh']).issubset(set(packages))):
|
||||||
if WOVariables.wo_distro == 'Raspbian':
|
if WOVar.wo_distro == 'Raspbian':
|
||||||
WOShellExec.cmd_exec(self, "bash /usr/"
|
WOShellExec.cmd_exec(self, "bash /usr/"
|
||||||
"libexec/netdata/"
|
"libexec/netdata/"
|
||||||
"netdata-uninstaller.sh -y -f")
|
"netdata-uninstaller.sh -y -f")
|
||||||
@@ -818,7 +818,7 @@ class WOStackController(CementBaseController):
|
|||||||
if pargs.nginx:
|
if pargs.nginx:
|
||||||
if WOAptGet.is_installed(self, 'nginx-custom'):
|
if WOAptGet.is_installed(self, 'nginx-custom'):
|
||||||
Log.debug(self, "Add Nginx to apt_packages list")
|
Log.debug(self, "Add Nginx to apt_packages list")
|
||||||
apt_packages = apt_packages + WOVariables.wo_nginx
|
apt_packages = apt_packages + WOVar.wo_nginx
|
||||||
else:
|
else:
|
||||||
Log.info(self, "Nginx is not installed")
|
Log.info(self, "Nginx is not installed")
|
||||||
|
|
||||||
@@ -827,20 +827,20 @@ class WOStackController(CementBaseController):
|
|||||||
Log.debug(self, "Add PHP to apt_packages list")
|
Log.debug(self, "Add PHP to apt_packages list")
|
||||||
if WOAptGet.is_installed(self, 'php7.2-fpm'):
|
if WOAptGet.is_installed(self, 'php7.2-fpm'):
|
||||||
if not (WOAptGet.is_installed(self, 'php7.3-fpm')):
|
if not (WOAptGet.is_installed(self, 'php7.3-fpm')):
|
||||||
apt_packages = apt_packages + WOVariables.wo_php + \
|
apt_packages = apt_packages + WOVar.wo_php + \
|
||||||
WOVariables.wo_php_extra
|
WOVar.wo_php_extra
|
||||||
else:
|
else:
|
||||||
apt_packages = apt_packages + WOVariables.wo_php
|
apt_packages = apt_packages + WOVar.wo_php
|
||||||
|
|
||||||
# PHP 7.3
|
# PHP 7.3
|
||||||
if pargs.php73:
|
if pargs.php73:
|
||||||
Log.debug(self, "Removing apt_packages variable of PHP 7.3")
|
Log.debug(self, "Removing apt_packages variable of PHP 7.3")
|
||||||
if WOAptGet.is_installed(self, 'php7.3-fpm'):
|
if WOAptGet.is_installed(self, 'php7.3-fpm'):
|
||||||
if not (WOAptGet.is_installed(self, 'php7.2-fpm')):
|
if not (WOAptGet.is_installed(self, 'php7.2-fpm')):
|
||||||
apt_packages = apt_packages + WOVariables.wo_php73 + \
|
apt_packages = apt_packages + WOVar.wo_php73 + \
|
||||||
WOVariables.wo_php_extra
|
WOVar.wo_php_extra
|
||||||
else:
|
else:
|
||||||
apt_packages = apt_packages + WOVariables.wo_php73
|
apt_packages = apt_packages + WOVar.wo_php73
|
||||||
|
|
||||||
# REDIS
|
# REDIS
|
||||||
if pargs.redis:
|
if pargs.redis:
|
||||||
@@ -865,19 +865,19 @@ class WOStackController(CementBaseController):
|
|||||||
if pargs.mysqlclient:
|
if pargs.mysqlclient:
|
||||||
if WOShellExec.cmd_exec(self, "mysqladmin ping"):
|
if WOShellExec.cmd_exec(self, "mysqladmin ping"):
|
||||||
Log.debug(self, "Add MySQL client to apt_packages list")
|
Log.debug(self, "Add MySQL client to apt_packages list")
|
||||||
apt_packages = apt_packages + WOVariables.wo_mysql_client
|
apt_packages = apt_packages + WOVar.wo_mysql_client
|
||||||
|
|
||||||
# fail2ban
|
# fail2ban
|
||||||
if pargs.fail2ban:
|
if pargs.fail2ban:
|
||||||
if WOAptGet.is_installed(self, 'fail2ban'):
|
if WOAptGet.is_installed(self, 'fail2ban'):
|
||||||
Log.debug(self, "Add Fail2ban to apt_packages list")
|
Log.debug(self, "Add Fail2ban to apt_packages list")
|
||||||
apt_packages = apt_packages + WOVariables.wo_fail2ban
|
apt_packages = apt_packages + WOVar.wo_fail2ban
|
||||||
|
|
||||||
# ClamAV
|
# ClamAV
|
||||||
if pargs.clamav:
|
if pargs.clamav:
|
||||||
if WOAptGet.is_installed(self, 'clamav'):
|
if WOAptGet.is_installed(self, 'clamav'):
|
||||||
Log.debug(self, "Add ClamAV to apt_packages list")
|
Log.debug(self, "Add ClamAV to apt_packages list")
|
||||||
apt_packages = apt_packages + WOVariables.wo_clamav
|
apt_packages = apt_packages + WOVar.wo_clamav
|
||||||
|
|
||||||
# UFW
|
# UFW
|
||||||
if pargs.ufw:
|
if pargs.ufw:
|
||||||
@@ -906,10 +906,10 @@ class WOStackController(CementBaseController):
|
|||||||
# PHPMYADMIN
|
# PHPMYADMIN
|
||||||
if pargs.phpmyadmin:
|
if pargs.phpmyadmin:
|
||||||
if os.path.isdir('{0}22222/htdocs/db/pma'
|
if os.path.isdir('{0}22222/htdocs/db/pma'
|
||||||
.format(WOVariables.wo_webroot)):
|
.format(WOVar.wo_webroot)):
|
||||||
Log.debug(self, "Removing package of phpMyAdmin ")
|
Log.debug(self, "Removing package of phpMyAdmin ")
|
||||||
packages = packages + ['{0}22222/htdocs/db/pma'
|
packages = packages + ['{0}22222/htdocs/db/pma'
|
||||||
.format(WOVariables.wo_webroot)]
|
.format(WOVar.wo_webroot)]
|
||||||
|
|
||||||
# Composer
|
# Composer
|
||||||
if pargs.composer:
|
if pargs.composer:
|
||||||
@@ -927,29 +927,29 @@ class WOStackController(CementBaseController):
|
|||||||
if pargs.phpredisadmin:
|
if pargs.phpredisadmin:
|
||||||
Log.debug(self, "Removing package variable of phpRedisAdmin ")
|
Log.debug(self, "Removing package variable of phpRedisAdmin ")
|
||||||
if os.path.isdir('{0}22222/htdocs/cache/redis'
|
if os.path.isdir('{0}22222/htdocs/cache/redis'
|
||||||
.format(WOVariables.wo_webroot)):
|
.format(WOVar.wo_webroot)):
|
||||||
packages = packages + ['{0}22222/htdocs/'
|
packages = packages + ['{0}22222/htdocs/'
|
||||||
'cache/redis'
|
'cache/redis'
|
||||||
.format(WOVariables.wo_webroot)]
|
.format(WOVar.wo_webroot)]
|
||||||
# ADMINER
|
# ADMINER
|
||||||
if pargs.adminer:
|
if pargs.adminer:
|
||||||
if os.path.isdir('{0}22222/htdocs/db/adminer'
|
if os.path.isdir('{0}22222/htdocs/db/adminer'
|
||||||
.format(WOVariables.wo_webroot)):
|
.format(WOVar.wo_webroot)):
|
||||||
Log.debug(self, "Removing package variable of Adminer ")
|
Log.debug(self, "Removing package variable of Adminer ")
|
||||||
packages = packages + ['{0}22222/htdocs/db/adminer'
|
packages = packages + ['{0}22222/htdocs/db/adminer'
|
||||||
.format(WOVariables.wo_webroot)]
|
.format(WOVar.wo_webroot)]
|
||||||
# utils
|
# utils
|
||||||
if pargs.utils:
|
if pargs.utils:
|
||||||
Log.debug(self, "Purge package variable utils")
|
Log.debug(self, "Purge package variable utils")
|
||||||
packages = packages + ['{0}22222/htdocs/php/webgrind/'
|
packages = packages + ['{0}22222/htdocs/php/webgrind/'
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVar.wo_webroot),
|
||||||
'{0}22222/htdocs/cache/opcache'
|
'{0}22222/htdocs/cache/opcache'
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVar.wo_webroot),
|
||||||
'{0}22222/htdocs/cache/nginx/'
|
'{0}22222/htdocs/cache/nginx/'
|
||||||
'clean.php'.format(WOVariables.wo_webroot),
|
'clean.php'.format(WOVar.wo_webroot),
|
||||||
'/usr/bin/pt-query-advisor',
|
'/usr/bin/pt-query-advisor',
|
||||||
'{0}22222/htdocs/db/anemometer'
|
'{0}22222/htdocs/db/anemometer'
|
||||||
.format(WOVariables.wo_webroot)
|
.format(WOVar.wo_webroot)
|
||||||
]
|
]
|
||||||
|
|
||||||
if pargs.netdata:
|
if pargs.netdata:
|
||||||
@@ -961,9 +961,9 @@ class WOStackController(CementBaseController):
|
|||||||
if pargs.dashboard:
|
if pargs.dashboard:
|
||||||
Log.debug(self, "Removing Wo-Dashboard")
|
Log.debug(self, "Removing Wo-Dashboard")
|
||||||
packages = packages + ['{0}22222/htdocs/assets/'
|
packages = packages + ['{0}22222/htdocs/assets/'
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVar.wo_webroot),
|
||||||
'{0}22222/htdocs/index.php'
|
'{0}22222/htdocs/index.php'
|
||||||
.format(WOVariables.wo_webroot)]
|
.format(WOVar.wo_webroot)]
|
||||||
|
|
||||||
if (packages) or (apt_packages):
|
if (packages) or (apt_packages):
|
||||||
if (not pargs.force):
|
if (not pargs.force):
|
||||||
@@ -991,7 +991,7 @@ class WOStackController(CementBaseController):
|
|||||||
# Netdata uninstaller
|
# Netdata uninstaller
|
||||||
if (set(['/var/lib/wo/tmp/'
|
if (set(['/var/lib/wo/tmp/'
|
||||||
'kickstart.sh']).issubset(set(packages))):
|
'kickstart.sh']).issubset(set(packages))):
|
||||||
if WOVariables.wo_distro == 'Raspbian':
|
if WOVar.wo_distro == 'Raspbian':
|
||||||
WOShellExec.cmd_exec(self, "bash /usr/"
|
WOShellExec.cmd_exec(self, "bash /usr/"
|
||||||
"libexec/netdata/netdata-"
|
"libexec/netdata/netdata-"
|
||||||
"uninstaller.sh -y -f",
|
"uninstaller.sh -y -f",
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ from wo.core.aptget import WOAptGet
|
|||||||
from wo.core.logging import Log
|
from wo.core.logging import Log
|
||||||
from wo.core.mysql import WOMysql
|
from wo.core.mysql import WOMysql
|
||||||
from wo.core.shellexec import WOShellExec
|
from wo.core.shellexec import WOShellExec
|
||||||
from wo.core.variables import WOVariables
|
from wo.core.variables import WOVar
|
||||||
|
|
||||||
|
|
||||||
class WOStackMigrateController(CementBaseController):
|
class WOStackMigrateController(CementBaseController):
|
||||||
@@ -29,8 +29,8 @@ class WOStackMigrateController(CementBaseController):
|
|||||||
# Backup all database
|
# Backup all database
|
||||||
WOMysql.backupAll(self)
|
WOMysql.backupAll(self)
|
||||||
|
|
||||||
if not WOVariables.wo_distro == 'raspbian':
|
if not WOVar.wo_distro == 'raspbian':
|
||||||
if (not WOVariables.wo_platform_codename == 'jessie'):
|
if (not WOVar.wo_platform_codename == 'jessie'):
|
||||||
wo_mysql = ["mariadb-server", "percona-toolkit",
|
wo_mysql = ["mariadb-server", "percona-toolkit",
|
||||||
"python3-mysqldb", "mariadb-backup"]
|
"python3-mysqldb", "mariadb-backup"]
|
||||||
else:
|
else:
|
||||||
@@ -49,9 +49,9 @@ class WOStackMigrateController(CementBaseController):
|
|||||||
'MariaDB.pref', 'w') as mysql_pref_file:
|
'MariaDB.pref', 'w') as mysql_pref_file:
|
||||||
mysql_pref_file.write(mysql_pref)
|
mysql_pref_file.write(mysql_pref)
|
||||||
|
|
||||||
WORepo.add(self, repo_url=WOVariables.wo_mysql_repo)
|
WORepo.add(self, repo_url=WOVar.wo_mysql_repo)
|
||||||
Log.debug(self, 'Adding key for {0}'
|
Log.debug(self, 'Adding key for {0}'
|
||||||
.format(WOVariables.wo_mysql_repo))
|
.format(WOVar.wo_mysql_repo))
|
||||||
WORepo.add_key(self, '0xcbcb082a1bb943db',
|
WORepo.add_key(self, '0xcbcb082a1bb943db',
|
||||||
keyserver="keyserver.ubuntu.com")
|
keyserver="keyserver.ubuntu.com")
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ class WOStackMigrateController(CementBaseController):
|
|||||||
if ((not self.app.pargs.mariadb)):
|
if ((not self.app.pargs.mariadb)):
|
||||||
self.app.args.print_help()
|
self.app.args.print_help()
|
||||||
if self.app.pargs.mariadb:
|
if self.app.pargs.mariadb:
|
||||||
if WOVariables.wo_mysql_host != "localhost":
|
if WOVar.wo_mysql_host != "localhost":
|
||||||
Log.error(
|
Log.error(
|
||||||
self, "Remote MySQL server in use, skipping local install")
|
self, "Remote MySQL server in use, skipping local install")
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ from wo.core.services import WOService
|
|||||||
from wo.core.shellexec import CommandExecutionError, WOShellExec
|
from wo.core.shellexec import CommandExecutionError, WOShellExec
|
||||||
from wo.core.sslutils import SSL
|
from wo.core.sslutils import SSL
|
||||||
from wo.core.template import WOTemplate
|
from wo.core.template import WOTemplate
|
||||||
from wo.core.variables import WOVariables
|
from wo.core.variables import WOVar
|
||||||
from wo.core.nginxhashbucket import hashbucket
|
from wo.core.nginxhashbucket import hashbucket
|
||||||
|
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ def pre_pref(self, apt_packages):
|
|||||||
|
|
||||||
if ("mariadb-server" in apt_packages or "mariadb-client" in apt_packages):
|
if ("mariadb-server" in apt_packages or "mariadb-client" in apt_packages):
|
||||||
# add mariadb repository excepted on raspbian and ubuntu 19.04
|
# add mariadb repository excepted on raspbian and ubuntu 19.04
|
||||||
if (not WOVariables.wo_distro == 'raspbian'):
|
if (not WOVar.wo_distro == 'raspbian'):
|
||||||
Log.info(self, "Adding repository for MySQL, please wait...")
|
Log.info(self, "Adding repository for MySQL, please wait...")
|
||||||
mysql_pref = ("Package: *\nPin: origin "
|
mysql_pref = ("Package: *\nPin: origin "
|
||||||
"sfo1.mirrors.digitalocean.com"
|
"sfo1.mirrors.digitalocean.com"
|
||||||
@@ -40,7 +40,7 @@ def pre_pref(self, apt_packages):
|
|||||||
with open('/etc/apt/preferences.d/'
|
with open('/etc/apt/preferences.d/'
|
||||||
'MariaDB.pref', 'w') as mysql_pref_file:
|
'MariaDB.pref', 'w') as mysql_pref_file:
|
||||||
mysql_pref_file.write(mysql_pref)
|
mysql_pref_file.write(mysql_pref)
|
||||||
WORepo.add(self, repo_url=WOVariables.wo_mysql_repo)
|
WORepo.add(self, repo_url=WOVar.wo_mysql_repo)
|
||||||
WORepo.add_key(self, '0xcbcb082a1bb943db',
|
WORepo.add_key(self, '0xcbcb082a1bb943db',
|
||||||
keyserver='keys.gnupg.net')
|
keyserver='keys.gnupg.net')
|
||||||
WORepo.add_key(self, '0xF1656F24C74CD1D8',
|
WORepo.add_key(self, '0xF1656F24C74CD1D8',
|
||||||
@@ -50,8 +50,8 @@ def pre_pref(self, apt_packages):
|
|||||||
chars = ''.join(random.sample(string.ascii_letters, 24))
|
chars = ''.join(random.sample(string.ascii_letters, 24))
|
||||||
|
|
||||||
# configure MySQL non-interactive install
|
# configure MySQL non-interactive install
|
||||||
if ((WOVariables.wo_distro == 'raspbian') and
|
if ((WOVar.wo_distro == 'raspbian') and
|
||||||
(WOVariables.wo_platform_codename == 'stretch')):
|
(WOVar.wo_platform_codename == 'stretch')):
|
||||||
mariadb_ver = '10.1'
|
mariadb_ver = '10.1'
|
||||||
else:
|
else:
|
||||||
mariadb_ver = '10.3'
|
mariadb_ver = '10.3'
|
||||||
@@ -106,26 +106,26 @@ def pre_pref(self, apt_packages):
|
|||||||
WOFileUtils.chmod(self, "/etc/mysql/conf.d/my.cnf", 0o600)
|
WOFileUtils.chmod(self, "/etc/mysql/conf.d/my.cnf", 0o600)
|
||||||
|
|
||||||
# add nginx repository
|
# add nginx repository
|
||||||
if set(WOVariables.wo_nginx).issubset(set(apt_packages)):
|
if set(WOVar.wo_nginx).issubset(set(apt_packages)):
|
||||||
Log.info(self, "Adding repository for NGINX, please wait...")
|
Log.info(self, "Adding repository for NGINX, please wait...")
|
||||||
if (WOVariables.wo_distro == 'ubuntu'):
|
if (WOVar.wo_distro == 'ubuntu'):
|
||||||
WORepo.add(self, ppa=WOVariables.wo_nginx_repo)
|
WORepo.add(self, ppa=WOVar.wo_nginx_repo)
|
||||||
Log.debug(self, 'Adding ppa for Nginx')
|
Log.debug(self, 'Adding ppa for Nginx')
|
||||||
else:
|
else:
|
||||||
WORepo.add(self, repo_url=WOVariables.wo_nginx_repo)
|
WORepo.add(self, repo_url=WOVar.wo_nginx_repo)
|
||||||
Log.debug(self, 'Adding repository for Nginx')
|
Log.debug(self, 'Adding repository for Nginx')
|
||||||
WORepo.add_key(self, WOVariables.wo_nginx_key)
|
WORepo.add_key(self, WOVar.wo_nginx_key)
|
||||||
|
|
||||||
# add php repository
|
# add php repository
|
||||||
if (set(WOVariables.wo_php73).issubset(set(apt_packages)) or
|
if (set(WOVar.wo_php73).issubset(set(apt_packages)) or
|
||||||
set(WOVariables.wo_php).issubset(set(apt_packages))):
|
set(WOVar.wo_php).issubset(set(apt_packages))):
|
||||||
Log.info(self, "Adding repository for PHP, please wait...")
|
Log.info(self, "Adding repository for PHP, please wait...")
|
||||||
if (WOVariables.wo_distro == 'ubuntu'):
|
if (WOVar.wo_distro == 'ubuntu'):
|
||||||
Log.debug(self, 'Adding ppa for PHP')
|
Log.debug(self, 'Adding ppa for PHP')
|
||||||
WORepo.add(self, ppa=WOVariables.wo_php_repo)
|
WORepo.add(self, ppa=WOVar.wo_php_repo)
|
||||||
else:
|
else:
|
||||||
# Add repository for php
|
# Add repository for php
|
||||||
if (WOVariables.wo_platform_codename == 'buster'):
|
if (WOVar.wo_platform_codename == 'buster'):
|
||||||
php_pref = ("Package: *\nPin: origin "
|
php_pref = ("Package: *\nPin: origin "
|
||||||
"packages.sury.org"
|
"packages.sury.org"
|
||||||
"\nPin-Priority: 1000\n")
|
"\nPin-Priority: 1000\n")
|
||||||
@@ -133,22 +133,22 @@ def pre_pref(self, apt_packages):
|
|||||||
'PHP.pref', 'w') as php_pref_file:
|
'PHP.pref', 'w') as php_pref_file:
|
||||||
php_pref_file.write(php_pref)
|
php_pref_file.write(php_pref)
|
||||||
Log.debug(self, 'Adding repo_url of php for debian')
|
Log.debug(self, 'Adding repo_url of php for debian')
|
||||||
WORepo.add(self, repo_url=WOVariables.wo_php_repo)
|
WORepo.add(self, repo_url=WOVar.wo_php_repo)
|
||||||
Log.debug(self, 'Adding deb.sury GPG key')
|
Log.debug(self, 'Adding deb.sury GPG key')
|
||||||
WORepo.add_key(self, WOVariables.wo_php_key)
|
WORepo.add_key(self, WOVar.wo_php_key)
|
||||||
# add redis repository
|
# add redis repository
|
||||||
if set(WOVariables.wo_redis).issubset(set(apt_packages)):
|
if set(WOVar.wo_redis).issubset(set(apt_packages)):
|
||||||
Log.info(self, "Adding repository for Redis, please wait...")
|
Log.info(self, "Adding repository for Redis, please wait...")
|
||||||
if WOVariables.wo_distro == 'ubuntu':
|
if WOVar.wo_distro == 'ubuntu':
|
||||||
Log.debug(self, 'Adding ppa for redis')
|
Log.debug(self, 'Adding ppa for redis')
|
||||||
WORepo.add(self, ppa=WOVariables.wo_redis_repo)
|
WORepo.add(self, ppa=WOVar.wo_redis_repo)
|
||||||
|
|
||||||
|
|
||||||
def post_pref(self, apt_packages, packages, upgrade=False):
|
def post_pref(self, apt_packages, packages, upgrade=False):
|
||||||
"""Post activity after installation of packages"""
|
"""Post activity after installation of packages"""
|
||||||
if (apt_packages):
|
if (apt_packages):
|
||||||
# Nginx configuration
|
# Nginx configuration
|
||||||
if set(WOVariables.wo_nginx).issubset(set(apt_packages)):
|
if set(WOVar.wo_nginx).issubset(set(apt_packages)):
|
||||||
Log.info(self, "Applying Nginx configuration templates")
|
Log.info(self, "Applying Nginx configuration templates")
|
||||||
# Nginx main configuration
|
# Nginx main configuration
|
||||||
ngxcnf = '/etc/nginx/conf.d'
|
ngxcnf = '/etc/nginx/conf.d'
|
||||||
@@ -306,7 +306,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
with open("/etc/nginx/common/release",
|
with open("/etc/nginx/common/release",
|
||||||
"w") as release_file:
|
"w") as release_file:
|
||||||
release_file.write("v{0}"
|
release_file.write("v{0}"
|
||||||
.format(WOVariables.wo_version))
|
.format(WOVar.wo_version))
|
||||||
release_file.close()
|
release_file.close()
|
||||||
|
|
||||||
# Following files should not be overwrited
|
# Following files should not be overwrited
|
||||||
@@ -459,7 +459,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
"on https://{0}:22222 "
|
"on https://{0}:22222 "
|
||||||
"or https://{1}:22222"
|
"or https://{1}:22222"
|
||||||
.format(server_ip.text,
|
.format(server_ip.text,
|
||||||
WOVariables.wo_fqdn)])
|
WOVar.wo_fqdn)])
|
||||||
|
|
||||||
if not os.path.isfile("/opt/cf-update.sh"):
|
if not os.path.isfile("/opt/cf-update.sh"):
|
||||||
data = dict()
|
data = dict()
|
||||||
@@ -493,7 +493,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
"Use the command nginx -t to identify "
|
"Use the command nginx -t to identify "
|
||||||
"the cause of this issue", False)
|
"the cause of this issue", False)
|
||||||
|
|
||||||
if set(WOVariables.wo_php).issubset(set(apt_packages)):
|
if set(WOVar.wo_php).issubset(set(apt_packages)):
|
||||||
WOGit.add(self, ["/etc/php"], msg="Adding PHP into Git")
|
WOGit.add(self, ["/etc/php"], msg="Adding PHP into Git")
|
||||||
Log.info(self, "Configuring php7.2-fpm")
|
Log.info(self, "Configuring php7.2-fpm")
|
||||||
ngxroot = '/var/www/'
|
ngxroot = '/var/www/'
|
||||||
@@ -517,7 +517,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
config['PHP']['max_execution_time'] = '300'
|
config['PHP']['max_execution_time'] = '300'
|
||||||
config['PHP']['max_input_time'] = '300'
|
config['PHP']['max_input_time'] = '300'
|
||||||
config['PHP']['max_input_vars'] = '20000'
|
config['PHP']['max_input_vars'] = '20000'
|
||||||
config['Date']['date.timezone'] = WOVariables.wo_timezone
|
config['Date']['date.timezone'] = WOVar.wo_timezone
|
||||||
config['opcache']['opcache.enable'] = '1'
|
config['opcache']['opcache.enable'] = '1'
|
||||||
config['opcache']['opcache.interned_strings_buffer'] = '8'
|
config['opcache']['opcache.interned_strings_buffer'] = '8'
|
||||||
config['opcache']['opcache.max_accelerated_files'] = '10000'
|
config['opcache']['opcache.max_accelerated_files'] = '10000'
|
||||||
@@ -627,7 +627,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
WOService.restart_service(self, 'php7.2-fpm')
|
WOService.restart_service(self, 'php7.2-fpm')
|
||||||
|
|
||||||
# PHP7.3 configuration
|
# PHP7.3 configuration
|
||||||
if set(WOVariables.wo_php73).issubset(set(apt_packages)):
|
if set(WOVar.wo_php73).issubset(set(apt_packages)):
|
||||||
WOGit.add(self, ["/etc/php"], msg="Adding PHP into Git")
|
WOGit.add(self, ["/etc/php"], msg="Adding PHP into Git")
|
||||||
Log.info(self, "Configuring php7.3-fpm")
|
Log.info(self, "Configuring php7.3-fpm")
|
||||||
ngxroot = '/var/www/'
|
ngxroot = '/var/www/'
|
||||||
@@ -651,7 +651,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
config['PHP']['max_execution_time'] = '300'
|
config['PHP']['max_execution_time'] = '300'
|
||||||
config['PHP']['max_input_time'] = '300'
|
config['PHP']['max_input_time'] = '300'
|
||||||
config['PHP']['max_input_vars'] = '20000'
|
config['PHP']['max_input_vars'] = '20000'
|
||||||
config['Date']['date.timezone'] = WOVariables.wo_timezone
|
config['Date']['date.timezone'] = WOVar.wo_timezone
|
||||||
config['opcache']['opcache.enable'] = '1'
|
config['opcache']['opcache.enable'] = '1'
|
||||||
config['opcache']['opcache.interned_strings_buffer'] = '8'
|
config['opcache']['opcache.interned_strings_buffer'] = '8'
|
||||||
config['opcache']['opcache.max_accelerated_files'] = '10000'
|
config['opcache']['opcache.max_accelerated_files'] = '10000'
|
||||||
@@ -815,7 +815,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
WOGit.add(self, ["/etc/mysql"], msg="Adding MySQL into Git")
|
WOGit.add(self, ["/etc/mysql"], msg="Adding MySQL into Git")
|
||||||
|
|
||||||
# create fail2ban configuration files
|
# create fail2ban configuration files
|
||||||
if set(WOVariables.wo_fail2ban).issubset(set(apt_packages)):
|
if set(WOVar.wo_fail2ban).issubset(set(apt_packages)):
|
||||||
WOGit.add(self, ["/etc/fail2ban"],
|
WOGit.add(self, ["/etc/fail2ban"],
|
||||||
msg="Adding Fail2ban into Git")
|
msg="Adding Fail2ban into Git")
|
||||||
if not os.path.isfile("/etc/fail2ban/jail.d/custom.conf"):
|
if not os.path.isfile("/etc/fail2ban/jail.d/custom.conf"):
|
||||||
@@ -1004,7 +1004,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
WOService.restart_service(self, 'redis-server')
|
WOService.restart_service(self, 'redis-server')
|
||||||
|
|
||||||
# ClamAV configuration
|
# ClamAV configuration
|
||||||
if set(WOVariables.wo_clamav).issubset(set(apt_packages)):
|
if set(WOVar.wo_clamav).issubset(set(apt_packages)):
|
||||||
Log.debug(self, "Setting up freshclam cronjob")
|
Log.debug(self, "Setting up freshclam cronjob")
|
||||||
if not os.path.isfile("/opt/freshclam.sh"):
|
if not os.path.isfile("/opt/freshclam.sh"):
|
||||||
data = dict()
|
data = dict()
|
||||||
@@ -1032,26 +1032,26 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
Log.debug(self, 'Extracting file /var/lib/wo/tmp/pma.tar.gz to '
|
Log.debug(self, 'Extracting file /var/lib/wo/tmp/pma.tar.gz to '
|
||||||
'location /var/lib/wo/tmp/')
|
'location /var/lib/wo/tmp/')
|
||||||
if not os.path.exists('{0}22222/htdocs/db'
|
if not os.path.exists('{0}22222/htdocs/db'
|
||||||
.format(WOVariables.wo_webroot)):
|
.format(WOVar.wo_webroot)):
|
||||||
Log.debug(self, "Creating new directory "
|
Log.debug(self, "Creating new directory "
|
||||||
"{0}22222/htdocs/db"
|
"{0}22222/htdocs/db"
|
||||||
.format(WOVariables.wo_webroot))
|
.format(WOVar.wo_webroot))
|
||||||
os.makedirs('{0}22222/htdocs/db'
|
os.makedirs('{0}22222/htdocs/db'
|
||||||
.format(WOVariables.wo_webroot))
|
.format(WOVar.wo_webroot))
|
||||||
if not os.path.exists('{0}22222/htdocs/db/pma/'
|
if not os.path.exists('{0}22222/htdocs/db/pma/'
|
||||||
.format(WOVariables.wo_webroot)):
|
.format(WOVar.wo_webroot)):
|
||||||
shutil.move('/var/lib/wo/tmp/phpmyadmin-STABLE/',
|
shutil.move('/var/lib/wo/tmp/phpmyadmin-STABLE/',
|
||||||
'{0}22222/htdocs/db/pma/'
|
'{0}22222/htdocs/db/pma/'
|
||||||
.format(WOVariables.wo_webroot))
|
.format(WOVar.wo_webroot))
|
||||||
shutil.copyfile('{0}22222/htdocs/db/pma'
|
shutil.copyfile('{0}22222/htdocs/db/pma'
|
||||||
'/config.sample.inc.php'
|
'/config.sample.inc.php'
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVar.wo_webroot),
|
||||||
'{0}22222/htdocs/db/pma/config.inc.php'
|
'{0}22222/htdocs/db/pma/config.inc.php'
|
||||||
.format(WOVariables.wo_webroot))
|
.format(WOVar.wo_webroot))
|
||||||
Log.debug(self, 'Setting Blowfish Secret Key '
|
Log.debug(self, 'Setting Blowfish Secret Key '
|
||||||
'FOR COOKIE AUTH to '
|
'FOR COOKIE AUTH to '
|
||||||
'{0}22222/htdocs/db/pma/config.inc.php file '
|
'{0}22222/htdocs/db/pma/config.inc.php file '
|
||||||
.format(WOVariables.wo_webroot))
|
.format(WOVar.wo_webroot))
|
||||||
blowfish_key = ''.join([random.choice
|
blowfish_key = ''.join([random.choice
|
||||||
(string.ascii_letters +
|
(string.ascii_letters +
|
||||||
string.digits)
|
string.digits)
|
||||||
@@ -1059,7 +1059,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
WOFileUtils.searchreplace(self,
|
WOFileUtils.searchreplace(self,
|
||||||
'{0}22222/htdocs/db/pma'
|
'{0}22222/htdocs/db/pma'
|
||||||
'/config.inc.php'
|
'/config.inc.php'
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVar.wo_webroot),
|
||||||
"$cfg[\'blowfish_secret\']"
|
"$cfg[\'blowfish_secret\']"
|
||||||
" = \'\';",
|
" = \'\';",
|
||||||
"$cfg[\'blowfish_secret\']"
|
"$cfg[\'blowfish_secret\']"
|
||||||
@@ -1067,21 +1067,21 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
.format(blowfish_key))
|
.format(blowfish_key))
|
||||||
Log.debug(self, 'Setting HOST Server For Mysql to '
|
Log.debug(self, 'Setting HOST Server For Mysql to '
|
||||||
'{0}22222/htdocs/db/pma/config.inc.php file '
|
'{0}22222/htdocs/db/pma/config.inc.php file '
|
||||||
.format(WOVariables.wo_webroot))
|
.format(WOVar.wo_webroot))
|
||||||
WOFileUtils.searchreplace(self,
|
WOFileUtils.searchreplace(self,
|
||||||
'{0}22222/htdocs/db/pma'
|
'{0}22222/htdocs/db/pma'
|
||||||
'/config.inc.php'
|
'/config.inc.php'
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVar.wo_webroot),
|
||||||
"$cfg[\'Servers\'][$i][\'host\']"
|
"$cfg[\'Servers\'][$i][\'host\']"
|
||||||
" = \'localhost\';", "$cfg"
|
" = \'localhost\';", "$cfg"
|
||||||
"[\'Servers\'][$i][\'host\'] "
|
"[\'Servers\'][$i][\'host\'] "
|
||||||
"= \'{0}\';"
|
"= \'{0}\';"
|
||||||
.format(WOVariables.wo_mysql_host))
|
.format(WOVar.wo_mysql_host))
|
||||||
Log.debug(self, 'Setting Privileges of webroot permission to '
|
Log.debug(self, 'Setting Privileges of webroot permission to '
|
||||||
'{0}22222/htdocs/db/pma file '
|
'{0}22222/htdocs/db/pma file '
|
||||||
.format(WOVariables.wo_webroot))
|
.format(WOVar.wo_webroot))
|
||||||
WOFileUtils.chown(self, '{0}22222/htdocs'
|
WOFileUtils.chown(self, '{0}22222/htdocs'
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVar.wo_webroot),
|
||||||
'www-data',
|
'www-data',
|
||||||
'www-data',
|
'www-data',
|
||||||
recursive=True)
|
recursive=True)
|
||||||
@@ -1107,19 +1107,19 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
"/var/www/22222/htdocs/db/pma/")
|
"/var/www/22222/htdocs/db/pma/")
|
||||||
WOFileUtils.chown(
|
WOFileUtils.chown(
|
||||||
self, '{0}22222/htdocs/db/pma'
|
self, '{0}22222/htdocs/db/pma'
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVar.wo_webroot),
|
||||||
'www-data',
|
'www-data',
|
||||||
'www-data',
|
'www-data',
|
||||||
recursive=True)
|
recursive=True)
|
||||||
Log.valide(self, "Updating phpMyAdmin")
|
Log.valide(self, "Updating phpMyAdmin")
|
||||||
if not os.path.exists('{0}22222/htdocs/cache/'
|
if not os.path.exists('{0}22222/htdocs/cache/'
|
||||||
'redis/phpRedisAdmin'
|
'redis/phpRedisAdmin'
|
||||||
.format(WOVariables.wo_webroot)):
|
.format(WOVar.wo_webroot)):
|
||||||
Log.debug(self, "Creating new directory "
|
Log.debug(self, "Creating new directory "
|
||||||
"{0}22222/htdocs/cache/redis"
|
"{0}22222/htdocs/cache/redis"
|
||||||
.format(WOVariables.wo_webroot))
|
.format(WOVar.wo_webroot))
|
||||||
os.makedirs('{0}22222/htdocs/cache/redis/phpRedisAdmin'
|
os.makedirs('{0}22222/htdocs/cache/redis/phpRedisAdmin'
|
||||||
.format(WOVariables.wo_webroot))
|
.format(WOVar.wo_webroot))
|
||||||
if not os.path.isfile('/var/www/22222/htdocs/cache/redis/'
|
if not os.path.isfile('/var/www/22222/htdocs/cache/redis/'
|
||||||
'phpRedisAdmin/composer.lock'):
|
'phpRedisAdmin/composer.lock'):
|
||||||
WOShellExec.cmd_exec(
|
WOShellExec.cmd_exec(
|
||||||
@@ -1128,7 +1128,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
"erik-dubbelboer/php-redis-admin "
|
"erik-dubbelboer/php-redis-admin "
|
||||||
"/var/www/22222/htdocs/cache/redis/phpRedisAdmin")
|
"/var/www/22222/htdocs/cache/redis/phpRedisAdmin")
|
||||||
WOFileUtils.chown(self, '{0}22222/htdocs'
|
WOFileUtils.chown(self, '{0}22222/htdocs'
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVar.wo_webroot),
|
||||||
'www-data',
|
'www-data',
|
||||||
'www-data',
|
'www-data',
|
||||||
recursive=True)
|
recursive=True)
|
||||||
@@ -1194,25 +1194,25 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
for x in packages):
|
for x in packages):
|
||||||
Log.debug(self, "Extracting wo-dashboard.tar.gz "
|
Log.debug(self, "Extracting wo-dashboard.tar.gz "
|
||||||
"to location {0}22222/htdocs/"
|
"to location {0}22222/htdocs/"
|
||||||
.format(WOVariables.wo_webroot))
|
.format(WOVar.wo_webroot))
|
||||||
WOExtract.extract(self, '/var/lib/wo/tmp/'
|
WOExtract.extract(self, '/var/lib/wo/tmp/'
|
||||||
'wo-dashboard.tar.gz',
|
'wo-dashboard.tar.gz',
|
||||||
'{0}22222/htdocs'
|
'{0}22222/htdocs'
|
||||||
.format(WOVariables.wo_webroot))
|
.format(WOVar.wo_webroot))
|
||||||
wo_wan = os.popen("/sbin/ip -4 route get 8.8.8.8 | "
|
wo_wan = os.popen("/sbin/ip -4 route get 8.8.8.8 | "
|
||||||
"grep -oP \"dev [^[:space:]]+ \" "
|
"grep -oP \"dev [^[:space:]]+ \" "
|
||||||
"| cut -d ' ' -f 2").read()
|
"| cut -d ' ' -f 2").read()
|
||||||
if (wo_wan != 'eth0' and wo_wan != ''):
|
if (wo_wan != 'eth0' and wo_wan != ''):
|
||||||
WOFileUtils.searchreplace(self,
|
WOFileUtils.searchreplace(self,
|
||||||
"{0}22222/htdocs/index.html"
|
"{0}22222/htdocs/index.html"
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVar.wo_webroot),
|
||||||
"eth0",
|
"eth0",
|
||||||
"{0}".format(wo_wan))
|
"{0}".format(wo_wan))
|
||||||
Log.debug(self, "Setting Privileges to "
|
Log.debug(self, "Setting Privileges to "
|
||||||
"{0}22222/htdocs"
|
"{0}22222/htdocs"
|
||||||
.format(WOVariables.wo_webroot))
|
.format(WOVar.wo_webroot))
|
||||||
WOFileUtils.chown(self, '{0}22222/htdocs'
|
WOFileUtils.chown(self, '{0}22222/htdocs'
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVar.wo_webroot),
|
||||||
'www-data',
|
'www-data',
|
||||||
'www-data',
|
'www-data',
|
||||||
recursive=True)
|
recursive=True)
|
||||||
@@ -1222,18 +1222,18 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
for x in packages):
|
for x in packages):
|
||||||
Log.debug(self, "Extracting extplorer.tar.gz "
|
Log.debug(self, "Extracting extplorer.tar.gz "
|
||||||
"to location {0}22222/htdocs/files"
|
"to location {0}22222/htdocs/files"
|
||||||
.format(WOVariables.wo_webroot))
|
.format(WOVar.wo_webroot))
|
||||||
WOExtract.extract(self, '/var/lib/wo/tmp/extplorer.tar.gz',
|
WOExtract.extract(self, '/var/lib/wo/tmp/extplorer.tar.gz',
|
||||||
'/var/lib/wo/tmp/')
|
'/var/lib/wo/tmp/')
|
||||||
shutil.move('/var/lib/wo/tmp/extplorer-{0}'
|
shutil.move('/var/lib/wo/tmp/extplorer-{0}'
|
||||||
.format(WOVariables.wo_extplorer),
|
.format(WOVar.wo_extplorer),
|
||||||
'{0}22222/htdocs/files'
|
'{0}22222/htdocs/files'
|
||||||
.format(WOVariables.wo_webroot))
|
.format(WOVar.wo_webroot))
|
||||||
Log.debug(self, "Setting Privileges to "
|
Log.debug(self, "Setting Privileges to "
|
||||||
"{0}22222/htdocs/files"
|
"{0}22222/htdocs/files"
|
||||||
.format(WOVariables.wo_webroot))
|
.format(WOVar.wo_webroot))
|
||||||
WOFileUtils.chown(self, '{0}22222/htdocs'
|
WOFileUtils.chown(self, '{0}22222/htdocs'
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVar.wo_webroot),
|
||||||
'www-data',
|
'www-data',
|
||||||
'www-data',
|
'www-data',
|
||||||
recursive=True)
|
recursive=True)
|
||||||
@@ -1247,41 +1247,41 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
self, '/var/lib/wo/tmp/webgrind.tar.gz',
|
self, '/var/lib/wo/tmp/webgrind.tar.gz',
|
||||||
'/var/lib/wo/tmp/')
|
'/var/lib/wo/tmp/')
|
||||||
if not os.path.exists('{0}22222/htdocs/php'
|
if not os.path.exists('{0}22222/htdocs/php'
|
||||||
.format(WOVariables.wo_webroot)):
|
.format(WOVar.wo_webroot)):
|
||||||
Log.debug(self, "Creating directroy "
|
Log.debug(self, "Creating directroy "
|
||||||
"{0}22222/htdocs/php"
|
"{0}22222/htdocs/php"
|
||||||
.format(WOVariables.wo_webroot))
|
.format(WOVar.wo_webroot))
|
||||||
os.makedirs('{0}22222/htdocs/php'
|
os.makedirs('{0}22222/htdocs/php'
|
||||||
.format(WOVariables.wo_webroot))
|
.format(WOVar.wo_webroot))
|
||||||
if not os.path.exists('{0}22222/htdocs/php/webgrind'
|
if not os.path.exists('{0}22222/htdocs/php/webgrind'
|
||||||
.format(WOVariables.wo_webroot)):
|
.format(WOVar.wo_webroot)):
|
||||||
shutil.move('/var/lib/wo/tmp/webgrind-master/',
|
shutil.move('/var/lib/wo/tmp/webgrind-master/',
|
||||||
'{0}22222/htdocs/php/webgrind'
|
'{0}22222/htdocs/php/webgrind'
|
||||||
.format(WOVariables.wo_webroot))
|
.format(WOVar.wo_webroot))
|
||||||
|
|
||||||
WOFileUtils.searchreplace(
|
WOFileUtils.searchreplace(
|
||||||
self, "{0}22222/htdocs/php/webgrind/"
|
self, "{0}22222/htdocs/php/webgrind/"
|
||||||
"config.php"
|
"config.php"
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVar.wo_webroot),
|
||||||
"/usr/local/bin/dot", "/usr/bin/dot")
|
"/usr/local/bin/dot", "/usr/bin/dot")
|
||||||
WOFileUtils.searchreplace(
|
WOFileUtils.searchreplace(
|
||||||
self, "{0}22222/htdocs/php/webgrind/"
|
self, "{0}22222/htdocs/php/webgrind/"
|
||||||
"config.php"
|
"config.php"
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVar.wo_webroot),
|
||||||
"Europe/Copenhagen",
|
"Europe/Copenhagen",
|
||||||
WOVariables.wo_timezone)
|
WOVar.wo_timezone)
|
||||||
|
|
||||||
WOFileUtils.searchreplace(
|
WOFileUtils.searchreplace(
|
||||||
self, "{0}22222/htdocs/php/webgrind/"
|
self, "{0}22222/htdocs/php/webgrind/"
|
||||||
"config.php"
|
"config.php"
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVar.wo_webroot),
|
||||||
"90", "100")
|
"90", "100")
|
||||||
|
|
||||||
Log.debug(self, "Setting Privileges of webroot permission to "
|
Log.debug(self, "Setting Privileges of webroot permission to "
|
||||||
"{0}22222/htdocs/php/webgrind/ file "
|
"{0}22222/htdocs/php/webgrind/ file "
|
||||||
.format(WOVariables.wo_webroot))
|
.format(WOVar.wo_webroot))
|
||||||
WOFileUtils.chown(self, '{0}22222/htdocs'
|
WOFileUtils.chown(self, '{0}22222/htdocs'
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVar.wo_webroot),
|
||||||
'www-data',
|
'www-data',
|
||||||
'www-data',
|
'www-data',
|
||||||
recursive=True)
|
recursive=True)
|
||||||
@@ -1294,20 +1294,20 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
self, '/var/lib/wo/tmp/anemometer.tar.gz',
|
self, '/var/lib/wo/tmp/anemometer.tar.gz',
|
||||||
'/var/lib/wo/tmp/')
|
'/var/lib/wo/tmp/')
|
||||||
if not os.path.exists('{0}22222/htdocs/db/'
|
if not os.path.exists('{0}22222/htdocs/db/'
|
||||||
.format(WOVariables.wo_webroot)):
|
.format(WOVar.wo_webroot)):
|
||||||
Log.debug(self, "Creating directory")
|
Log.debug(self, "Creating directory")
|
||||||
os.makedirs('{0}22222/htdocs/db/'
|
os.makedirs('{0}22222/htdocs/db/'
|
||||||
.format(WOVariables.wo_webroot))
|
.format(WOVar.wo_webroot))
|
||||||
if not os.path.exists('{0}22222/htdocs/db/anemometer'
|
if not os.path.exists('{0}22222/htdocs/db/anemometer'
|
||||||
.format(WOVariables.wo_webroot)):
|
.format(WOVar.wo_webroot)):
|
||||||
shutil.move('/var/lib/wo/tmp/Anemometer-master',
|
shutil.move('/var/lib/wo/tmp/Anemometer-master',
|
||||||
'{0}22222/htdocs/db/anemometer'
|
'{0}22222/htdocs/db/anemometer'
|
||||||
.format(WOVariables.wo_webroot))
|
.format(WOVar.wo_webroot))
|
||||||
chars = ''.join(random.sample(string.ascii_letters, 8))
|
chars = ''.join(random.sample(string.ascii_letters, 8))
|
||||||
try:
|
try:
|
||||||
WOShellExec.cmd_exec(self, 'mysql < {0}22222/htdocs/db'
|
WOShellExec.cmd_exec(self, 'mysql < {0}22222/htdocs/db'
|
||||||
'/anemometer/install.sql'
|
'/anemometer/install.sql'
|
||||||
.format(WOVariables.wo_webroot))
|
.format(WOVar.wo_webroot))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
Log.debug(self, "{0}".format(e))
|
Log.debug(self, "{0}".format(e))
|
||||||
Log.error(self, "failed to configure Anemometer",
|
Log.error(self, "failed to configure Anemometer",
|
||||||
@@ -1334,11 +1334,11 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
|
|
||||||
# Custom Anemometer configuration
|
# Custom Anemometer configuration
|
||||||
Log.debug(self, "configration Anemometer")
|
Log.debug(self, "configration Anemometer")
|
||||||
data = dict(host=WOVariables.wo_mysql_host, port='3306',
|
data = dict(host=WOVar.wo_mysql_host, port='3306',
|
||||||
user='anemometer', password=chars)
|
user='anemometer', password=chars)
|
||||||
WOTemplate.deploy(self, '{0}22222/htdocs/db/anemometer'
|
WOTemplate.deploy(self, '{0}22222/htdocs/db/anemometer'
|
||||||
'/conf/config.inc.php'
|
'/conf/config.inc.php'
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVar.wo_webroot),
|
||||||
'anemometer.mustache', data)
|
'anemometer.mustache', data)
|
||||||
|
|
||||||
# pt-query-advisor
|
# pt-query-advisor
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ from cement.core.controller import CementBaseController, expose
|
|||||||
from wo.core.aptget import WOAptGet
|
from wo.core.aptget import WOAptGet
|
||||||
from wo.core.logging import Log
|
from wo.core.logging import Log
|
||||||
from wo.core.services import WOService
|
from wo.core.services import WOService
|
||||||
from wo.core.variables import WOVariables
|
from wo.core.variables import WOVar
|
||||||
|
|
||||||
|
|
||||||
class WOStackStatusController(CementBaseController):
|
class WOStackStatusController(CementBaseController):
|
||||||
@@ -57,8 +57,8 @@ class WOStackStatusController(CementBaseController):
|
|||||||
Log.info(self, "PHP7.3-FPM is not installed")
|
Log.info(self, "PHP7.3-FPM is not installed")
|
||||||
|
|
||||||
if pargs.mysql:
|
if pargs.mysql:
|
||||||
if ((WOVariables.wo_mysql_host == "localhost") or
|
if ((WOVar.wo_mysql_host == "localhost") or
|
||||||
(WOVariables.wo_mysql_host == "127.0.0.1")):
|
(WOVar.wo_mysql_host == "127.0.0.1")):
|
||||||
if (WOAptGet.is_installed(self, 'mysql-server') or
|
if (WOAptGet.is_installed(self, 'mysql-server') or
|
||||||
WOAptGet.is_installed(self, 'percona-server-server-5.6') or
|
WOAptGet.is_installed(self, 'percona-server-server-5.6') or
|
||||||
WOAptGet.is_installed(self, 'mariadb-server')):
|
WOAptGet.is_installed(self, 'mariadb-server')):
|
||||||
@@ -144,8 +144,8 @@ class WOStackStatusController(CementBaseController):
|
|||||||
|
|
||||||
# mysql
|
# mysql
|
||||||
if pargs.mysql:
|
if pargs.mysql:
|
||||||
if ((WOVariables.wo_mysql_host == "localhost") or
|
if ((WOVar.wo_mysql_host == "localhost") or
|
||||||
(WOVariables.wo_mysql_host == "127.0.0.1")):
|
(WOVar.wo_mysql_host == "127.0.0.1")):
|
||||||
if (WOAptGet.is_installed(self, 'mysql-server') or
|
if (WOAptGet.is_installed(self, 'mysql-server') or
|
||||||
WOAptGet.is_installed(self, 'percona-server-server-5.6') or
|
WOAptGet.is_installed(self, 'percona-server-server-5.6') or
|
||||||
WOAptGet.is_installed(self, 'mariadb-server')):
|
WOAptGet.is_installed(self, 'mariadb-server')):
|
||||||
@@ -230,8 +230,8 @@ class WOStackStatusController(CementBaseController):
|
|||||||
Log.info(self, "PHP7.3-FPM is not installed")
|
Log.info(self, "PHP7.3-FPM is not installed")
|
||||||
|
|
||||||
if pargs.mysql:
|
if pargs.mysql:
|
||||||
if ((WOVariables.wo_mysql_host == "localhost") or
|
if ((WOVar.wo_mysql_host == "localhost") or
|
||||||
(WOVariables.wo_mysql_host == "127.0.0.1")):
|
(WOVar.wo_mysql_host == "127.0.0.1")):
|
||||||
if ((WOAptGet.is_installed(self, 'mysql-server') or
|
if ((WOAptGet.is_installed(self, 'mysql-server') or
|
||||||
WOAptGet.is_installed(self,
|
WOAptGet.is_installed(self,
|
||||||
'percona-server-server-5.6') or
|
'percona-server-server-5.6') or
|
||||||
@@ -316,8 +316,8 @@ class WOStackStatusController(CementBaseController):
|
|||||||
Log.info(self, "PHP7.3-FPM is not installed")
|
Log.info(self, "PHP7.3-FPM is not installed")
|
||||||
|
|
||||||
if pargs.mysql:
|
if pargs.mysql:
|
||||||
if ((WOVariables.wo_mysql_host == "localhost") or
|
if ((WOVar.wo_mysql_host == "localhost") or
|
||||||
(WOVariables.wo_mysql_host == "127.0.0.1")):
|
(WOVar.wo_mysql_host == "127.0.0.1")):
|
||||||
if (WOAptGet.is_installed(self, 'mysql-server') or
|
if (WOAptGet.is_installed(self, 'mysql-server') or
|
||||||
WOAptGet.is_installed(self, 'percona-server-server-5.6') or
|
WOAptGet.is_installed(self, 'percona-server-server-5.6') or
|
||||||
WOAptGet.is_installed(self, 'mariadb-server')):
|
WOAptGet.is_installed(self, 'mariadb-server')):
|
||||||
@@ -401,8 +401,8 @@ class WOStackStatusController(CementBaseController):
|
|||||||
Log.info(self, "PHP7.3-FPM is not installed")
|
Log.info(self, "PHP7.3-FPM is not installed")
|
||||||
|
|
||||||
if pargs.mysql:
|
if pargs.mysql:
|
||||||
if ((WOVariables.wo_mysql_host == "localhost") or
|
if ((WOVar.wo_mysql_host == "localhost") or
|
||||||
(WOVariables.wo_mysql_host == "127.0.0.1")):
|
(WOVar.wo_mysql_host == "127.0.0.1")):
|
||||||
if (WOAptGet.is_installed(self, 'mysql-server') or
|
if (WOAptGet.is_installed(self, 'mysql-server') or
|
||||||
WOAptGet.is_installed(self, 'percona-server-server-5.6') or
|
WOAptGet.is_installed(self, 'percona-server-server-5.6') or
|
||||||
WOAptGet.is_installed(self, 'mariadb-server')):
|
WOAptGet.is_installed(self, 'mariadb-server')):
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ from wo.core.fileutils import WOFileUtils
|
|||||||
from wo.core.logging import Log
|
from wo.core.logging import Log
|
||||||
from wo.core.services import WOService
|
from wo.core.services import WOService
|
||||||
from wo.core.shellexec import WOShellExec
|
from wo.core.shellexec import WOShellExec
|
||||||
from wo.core.variables import WOVariables
|
from wo.core.variables import WOVar
|
||||||
|
|
||||||
|
|
||||||
class WOStackUpgradeController(CementBaseController):
|
class WOStackUpgradeController(CementBaseController):
|
||||||
@@ -92,31 +92,31 @@ class WOStackUpgradeController(CementBaseController):
|
|||||||
|
|
||||||
if pargs.nginx:
|
if pargs.nginx:
|
||||||
if WOAptGet.is_installed(self, 'nginx-custom'):
|
if WOAptGet.is_installed(self, 'nginx-custom'):
|
||||||
apt_packages = apt_packages + WOVariables.wo_nginx
|
apt_packages = apt_packages + WOVar.wo_nginx
|
||||||
else:
|
else:
|
||||||
if os.path.isfile(self, '/usr/sbin/nginx'):
|
if os.path.isfile(self, '/usr/sbin/nginx'):
|
||||||
Log.info(self, "Updating Nginx templates")
|
Log.info(self, "Updating Nginx templates")
|
||||||
post_pref(self, WOVariables.wo_nginx, [])
|
post_pref(self, WOVar.wo_nginx, [])
|
||||||
else:
|
else:
|
||||||
Log.info(self, "Nginx Stable is not already installed")
|
Log.info(self, "Nginx Stable is not already installed")
|
||||||
|
|
||||||
if pargs.php:
|
if pargs.php:
|
||||||
if WOAptGet.is_installed(self, 'php7.2-fpm'):
|
if WOAptGet.is_installed(self, 'php7.2-fpm'):
|
||||||
if not WOAptGet.is_installed(self, 'php7.3-fpm'):
|
if not WOAptGet.is_installed(self, 'php7.3-fpm'):
|
||||||
apt_packages = apt_packages + WOVariables.wo_php + \
|
apt_packages = apt_packages + WOVar.wo_php + \
|
||||||
WOVariables.wo_php_extra
|
WOVar.wo_php_extra
|
||||||
else:
|
else:
|
||||||
apt_packages = apt_packages + WOVariables.wo_php
|
apt_packages = apt_packages + WOVar.wo_php
|
||||||
else:
|
else:
|
||||||
Log.info(self, "PHP 7.2 is not installed")
|
Log.info(self, "PHP 7.2 is not installed")
|
||||||
|
|
||||||
if pargs.php73:
|
if pargs.php73:
|
||||||
if WOAptGet.is_installed(self, 'php7.3-fpm'):
|
if WOAptGet.is_installed(self, 'php7.3-fpm'):
|
||||||
if not WOAptGet.is_installed(self, 'php7.2-fpm'):
|
if not WOAptGet.is_installed(self, 'php7.2-fpm'):
|
||||||
apt_packages = apt_packages + WOVariables.wo_php73 + \
|
apt_packages = apt_packages + WOVar.wo_php73 + \
|
||||||
WOVariables.wo_php_extra
|
WOVar.wo_php_extra
|
||||||
else:
|
else:
|
||||||
apt_packages = apt_packages + WOVariables.wo_php73
|
apt_packages = apt_packages + WOVar.wo_php73
|
||||||
else:
|
else:
|
||||||
Log.info(self, "PHP 7.3 is not installed")
|
Log.info(self, "PHP 7.3 is not installed")
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ class WOStackUpgradeController(CementBaseController):
|
|||||||
packages = packages + [["https://github.com/wp-cli/wp-cli/"
|
packages = packages + [["https://github.com/wp-cli/wp-cli/"
|
||||||
"releases/download/v{0}/"
|
"releases/download/v{0}/"
|
||||||
"wp-cli-{0}.phar"
|
"wp-cli-{0}.phar"
|
||||||
"".format(WOVariables.wo_wp_cli),
|
"".format(WOVar.wo_wp_cli),
|
||||||
"/usr/local/bin/wp",
|
"/usr/local/bin/wp",
|
||||||
"WP-CLI"]]
|
"WP-CLI"]]
|
||||||
else:
|
else:
|
||||||
@@ -157,7 +157,7 @@ class WOStackUpgradeController(CementBaseController):
|
|||||||
packages = packages + \
|
packages = packages + \
|
||||||
[["https://github.com/WordOps/wordops-dashboard/"
|
[["https://github.com/WordOps/wordops-dashboard/"
|
||||||
"releases/download/v{0}/wordops-dashboard.tar.gz"
|
"releases/download/v{0}/wordops-dashboard.tar.gz"
|
||||||
.format(WOVariables.wo_dashboard),
|
.format(WOVar.wo_dashboard),
|
||||||
"/var/lib/wo/tmp/wo-dashboard.tar.gz",
|
"/var/lib/wo/tmp/wo-dashboard.tar.gz",
|
||||||
"WordOps Dashboard"]]
|
"WordOps Dashboard"]]
|
||||||
|
|
||||||
@@ -168,7 +168,7 @@ class WOStackUpgradeController(CementBaseController):
|
|||||||
"/phpMyAdmin/{0}/"
|
"/phpMyAdmin/{0}/"
|
||||||
"phpMyAdmin-{0}-"
|
"phpMyAdmin-{0}-"
|
||||||
"all-languages"
|
"all-languages"
|
||||||
".tar.gz".format(WOVariables.wo_phpmyadmin),
|
".tar.gz".format(WOVar.wo_phpmyadmin),
|
||||||
"/var/lib/wo/tmp/pma.tar.gz",
|
"/var/lib/wo/tmp/pma.tar.gz",
|
||||||
"PHPMyAdmin"]]
|
"PHPMyAdmin"]]
|
||||||
else:
|
else:
|
||||||
@@ -209,7 +209,7 @@ class WOStackUpgradeController(CementBaseController):
|
|||||||
|
|
||||||
# additional pre_pref
|
# additional pre_pref
|
||||||
if ["nginx-custom"] in apt_packages:
|
if ["nginx-custom"] in apt_packages:
|
||||||
pre_pref(self, WOVariables.wo_nginx)
|
pre_pref(self, WOVar.wo_nginx)
|
||||||
if ["php7.2-fpm"] in apt_packages:
|
if ["php7.2-fpm"] in apt_packages:
|
||||||
WOAptGet.remove(self, ['php7.2-fpm'],
|
WOAptGet.remove(self, ['php7.2-fpm'],
|
||||||
auto=False, purge=True)
|
auto=False, purge=True)
|
||||||
@@ -219,8 +219,8 @@ class WOStackUpgradeController(CementBaseController):
|
|||||||
# check if nginx upgrade is blocked
|
# check if nginx upgrade is blocked
|
||||||
if os.path.isfile(
|
if os.path.isfile(
|
||||||
'/etc/apt/preferences.d/nginx-block'):
|
'/etc/apt/preferences.d/nginx-block'):
|
||||||
apt_packages.remove(WOVariables.wo_nginx)
|
apt_packages.remove(WOVar.wo_nginx)
|
||||||
post_pref(self, WOVariables.wo_nginx, [], True)
|
post_pref(self, WOVar.wo_nginx, [], True)
|
||||||
# upgrade packages
|
# upgrade packages
|
||||||
WOAptGet.install(self, apt_packages)
|
WOAptGet.install(self, apt_packages)
|
||||||
Log.valide(self, "Upgrading APT Packages")
|
Log.valide(self, "Upgrading APT Packages")
|
||||||
@@ -269,7 +269,7 @@ class WOStackUpgradeController(CementBaseController):
|
|||||||
"/wordops-dashboard/"
|
"/wordops-dashboard/"
|
||||||
"releases/download/v{0}/"
|
"releases/download/v{0}/"
|
||||||
"wordops-dashboard.tar.gz"
|
"wordops-dashboard.tar.gz"
|
||||||
.format(WOVariables.wo_dashboard),
|
.format(WOVar.wo_dashboard),
|
||||||
"/var/lib/wo/tmp/wo-dashboard.tar.gz",
|
"/var/lib/wo/tmp/wo-dashboard.tar.gz",
|
||||||
"WordOps Dashboard"]])
|
"WordOps Dashboard"]])
|
||||||
|
|
||||||
@@ -290,20 +290,20 @@ class WOStackUpgradeController(CementBaseController):
|
|||||||
'/var/lib/wo/tmp/')
|
'/var/lib/wo/tmp/')
|
||||||
shutil.copyfile(('{0}22222/htdocs/db/pma'
|
shutil.copyfile(('{0}22222/htdocs/db/pma'
|
||||||
'/config.inc.php'
|
'/config.inc.php'
|
||||||
.format(WOVariables.wo_webroot)),
|
.format(WOVar.wo_webroot)),
|
||||||
('/var/lib/wo/tmp/phpMyAdmin-{0}'
|
('/var/lib/wo/tmp/phpMyAdmin-{0}'
|
||||||
'-all-languages/config.inc.php'
|
'-all-languages/config.inc.php'
|
||||||
.format(WOVariables.wo_phpmyadmin))
|
.format(WOVar.wo_phpmyadmin))
|
||||||
)
|
)
|
||||||
WOFileUtils.rm(self, '{0}22222/htdocs/db/pma'
|
WOFileUtils.rm(self, '{0}22222/htdocs/db/pma'
|
||||||
.format(WOVariables.wo_webroot))
|
.format(WOVar.wo_webroot))
|
||||||
shutil.move('/var/lib/wo/tmp/phpMyAdmin-{0}'
|
shutil.move('/var/lib/wo/tmp/phpMyAdmin-{0}'
|
||||||
'-all-languages/'
|
'-all-languages/'
|
||||||
.format(WOVariables.wo_phpmyadmin),
|
.format(WOVar.wo_phpmyadmin),
|
||||||
'{0}22222/htdocs/db/pma/'
|
'{0}22222/htdocs/db/pma/'
|
||||||
.format(WOVariables.wo_webroot))
|
.format(WOVar.wo_webroot))
|
||||||
WOFileUtils.chown(self, "{0}22222/htdocs"
|
WOFileUtils.chown(self, "{0}22222/htdocs"
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVar.wo_webroot),
|
||||||
'www-data',
|
'www-data',
|
||||||
'www-data', recursive=True)
|
'www-data', recursive=True)
|
||||||
Log.valide(self, "Upgrading phpMyAdmin")
|
Log.valide(self, "Upgrading phpMyAdmin")
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ from wo.core.fileutils import WOFileUtils
|
|||||||
from wo.core.git import WOGit
|
from wo.core.git import WOGit
|
||||||
from wo.core.logging import Log
|
from wo.core.logging import Log
|
||||||
from wo.core.shellexec import WOShellExec
|
from wo.core.shellexec import WOShellExec
|
||||||
from wo.core.variables import WOVariables
|
from wo.core.variables import WOVar
|
||||||
|
|
||||||
|
|
||||||
class WOAcme:
|
class WOAcme:
|
||||||
@@ -77,7 +77,7 @@ class WOAcme:
|
|||||||
"--fullchain-file {0}/{1}/fullchain.pem "
|
"--fullchain-file {0}/{1}/fullchain.pem "
|
||||||
"--ca-file {0}/{1}/ca.pem --reloadcmd \"nginx -t && "
|
"--ca-file {0}/{1}/ca.pem --reloadcmd \"nginx -t && "
|
||||||
"service nginx restart\" "
|
"service nginx restart\" "
|
||||||
.format(WOVariables.wo_ssl_live,
|
.format(WOVar.wo_ssl_live,
|
||||||
wo_domain_name, WOAcme.wo_acme_exec)):
|
wo_domain_name, WOAcme.wo_acme_exec)):
|
||||||
Log.valide(self, "Deploying SSL cert")
|
Log.valide(self, "Deploying SSL cert")
|
||||||
else:
|
else:
|
||||||
@@ -97,7 +97,7 @@ class WOAcme:
|
|||||||
"ssl_certificate_key {0}/{1}/key.pem;\n"
|
"ssl_certificate_key {0}/{1}/key.pem;\n"
|
||||||
"ssl_trusted_certificate {0}/{1}/ca.pem;\n"
|
"ssl_trusted_certificate {0}/{1}/ca.pem;\n"
|
||||||
"ssl_stapling_verify on;\n"
|
"ssl_stapling_verify on;\n"
|
||||||
.format(WOVariables.wo_ssl_live, wo_domain_name))
|
.format(WOVar.wo_ssl_live, wo_domain_name))
|
||||||
sslconf.close()
|
sslconf.close()
|
||||||
|
|
||||||
if not WOFileUtils.grep(self, '/var/www/22222/conf/nginx/ssl.conf',
|
if not WOFileUtils.grep(self, '/var/www/22222/conf/nginx/ssl.conf',
|
||||||
@@ -109,7 +109,7 @@ class WOAcme:
|
|||||||
"ssl_certificate_key {0}/{1}/key.pem;\n"
|
"ssl_certificate_key {0}/{1}/key.pem;\n"
|
||||||
"ssl_trusted_certificate {0}/{1}/ca.pem;\n"
|
"ssl_trusted_certificate {0}/{1}/ca.pem;\n"
|
||||||
"ssl_stapling_verify on;\n"
|
"ssl_stapling_verify on;\n"
|
||||||
.format(WOVariables.wo_ssl_live, wo_domain_name))
|
.format(WOVar.wo_ssl_live, wo_domain_name))
|
||||||
sslconf.close()
|
sslconf.close()
|
||||||
|
|
||||||
WOGit.add(self, ["/etc/letsencrypt"],
|
WOGit.add(self, ["/etc/letsencrypt"],
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import os
|
|||||||
|
|
||||||
from wo.core.logging import Log
|
from wo.core.logging import Log
|
||||||
from wo.core.shellexec import WOShellExec
|
from wo.core.shellexec import WOShellExec
|
||||||
from wo.core.variables import WOVariables
|
from wo.core.variables import WOVar
|
||||||
|
|
||||||
|
|
||||||
class WORepo():
|
class WORepo():
|
||||||
@@ -25,7 +25,7 @@ class WORepo():
|
|||||||
|
|
||||||
if repo_url is not None:
|
if repo_url is not None:
|
||||||
repo_file_path = ("/etc/apt/sources.list.d/" +
|
repo_file_path = ("/etc/apt/sources.list.d/" +
|
||||||
WOVariables().wo_repo_file)
|
WOVar().wo_repo_file)
|
||||||
try:
|
try:
|
||||||
if not os.path.isfile(repo_file_path):
|
if not os.path.isfile(repo_file_path):
|
||||||
with open(repo_file_path,
|
with open(repo_file_path,
|
||||||
@@ -65,7 +65,7 @@ class WORepo():
|
|||||||
.format(ppa_name=ppa))
|
.format(ppa_name=ppa))
|
||||||
elif repo_url:
|
elif repo_url:
|
||||||
repo_file_path = ("/etc/apt/sources.list.d/" +
|
repo_file_path = ("/etc/apt/sources.list.d/" +
|
||||||
WOVariables().wo_repo_file)
|
WOVar().wo_repo_file)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
repofile = open(repo_file_path, "w+")
|
repofile = open(repo_file_path, "w+")
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
import requests
|
import requests
|
||||||
|
|
||||||
from wo.core.shellexec import WOShellExec
|
from wo.core.shellexec import WOShellExec
|
||||||
from wo.core.variables import WOVariables
|
from wo.core.variables import WOVar
|
||||||
|
|
||||||
|
|
||||||
def check_fqdn(self, wo_host):
|
def check_fqdn(self, wo_host):
|
||||||
"""FQDN check with WordOps, for mail server hostname must be FQDN"""
|
"""FQDN check with WordOps, for mail server hostname must be FQDN"""
|
||||||
# wo_host=os.popen("hostname -f | tr -d '\n'").read()
|
# wo_host=os.popen("hostname -f | tr -d '\n'").read()
|
||||||
if '.' in wo_host:
|
if '.' in wo_host:
|
||||||
WOVariables.wo_fqdn = wo_host
|
WOVar.wo_fqdn = wo_host
|
||||||
with open('/etc/hostname', encoding='utf-8', mode='w') as hostfile:
|
with open('/etc/hostname', encoding='utf-8', mode='w') as hostfile:
|
||||||
hostfile.write(wo_host)
|
hostfile.write(wo_host)
|
||||||
|
|
||||||
WOShellExec.cmd_exec(self, "sed -i \"1i\\127.0.0.1 {0}\" /etc/hosts"
|
WOShellExec.cmd_exec(self, "sed -i \"1i\\127.0.0.1 {0}\" /etc/hosts"
|
||||||
.format(wo_host))
|
.format(wo_host))
|
||||||
if WOVariables.wo_distro == 'debian':
|
if WOVar.wo_distro == 'debian':
|
||||||
WOShellExec.cmd_exec(self, "/etc/init.d/hostname.sh start")
|
WOShellExec.cmd_exec(self, "/etc/init.d/hostname.sh start")
|
||||||
else:
|
else:
|
||||||
WOShellExec.cmd_exec(self, "service hostname restart")
|
WOShellExec.cmd_exec(self, "service hostname restart")
|
||||||
@@ -29,7 +29,7 @@ def check_fqdn_ip(self):
|
|||||||
x = requests.get('http://v4.wordops.eu')
|
x = requests.get('http://v4.wordops.eu')
|
||||||
ip = (x.text).strip()
|
ip = (x.text).strip()
|
||||||
|
|
||||||
wo_fqdn = WOVariables.wo_fqdn
|
wo_fqdn = WOVar.wo_fqdn
|
||||||
y = requests.get('http://v4.wordops.eu/dns/{0}/'.format(wo_fqdn))
|
y = requests.get('http://v4.wordops.eu/dns/{0}/'.format(wo_fqdn))
|
||||||
ip_fqdn = (y.text).strip()
|
ip_fqdn = (y.text).strip()
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ from sqlalchemy import create_engine
|
|||||||
from sqlalchemy.ext.declarative import declarative_base
|
from sqlalchemy.ext.declarative import declarative_base
|
||||||
from sqlalchemy.orm import scoped_session, sessionmaker
|
from sqlalchemy.orm import scoped_session, sessionmaker
|
||||||
|
|
||||||
from wo.core.variables import WOVariables
|
from wo.core.variables import WOVar
|
||||||
|
|
||||||
# db_path = self.app.config.get('site', 'db_path')
|
# db_path = self.app.config.get('site', 'db_path')
|
||||||
engine = create_engine(WOVariables.wo_db_uri, convert_unicode=True)
|
engine = create_engine(WOVar.wo_db_uri, convert_unicode=True)
|
||||||
db_session = scoped_session(sessionmaker(autocommit=False,
|
db_session = scoped_session(sessionmaker(autocommit=False,
|
||||||
autoflush=False,
|
autoflush=False,
|
||||||
bind=engine))
|
bind=engine))
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class WODomain():
|
|||||||
else:
|
else:
|
||||||
final_domain = domain_name
|
final_domain = domain_name
|
||||||
|
|
||||||
return (final_domain, domain_name)
|
return final_domain
|
||||||
|
|
||||||
def getlevel(self, domain):
|
def getlevel(self, domain):
|
||||||
"""
|
"""
|
||||||
@@ -49,3 +49,4 @@ class WODomain():
|
|||||||
root_domain = ('.'.join(domain_name[1:]))
|
root_domain = ('.'.join(domain_name[1:]))
|
||||||
suffix_file.close()
|
suffix_file.close()
|
||||||
return (domain_type, root_domain)
|
return (domain_type, root_domain)
|
||||||
|
return ('other', domain)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import pymysql
|
|||||||
from pymysql import DatabaseError, Error, connections
|
from pymysql import DatabaseError, Error, connections
|
||||||
|
|
||||||
from wo.core.logging import Log
|
from wo.core.logging import Log
|
||||||
from wo.core.variables import WOVariables
|
from wo.core.variables import WOVar
|
||||||
|
|
||||||
|
|
||||||
class MySQLConnectionError(Exception):
|
class MySQLConnectionError(Exception):
|
||||||
@@ -115,7 +115,7 @@ class WOMysql():
|
|||||||
stderr=subprocess.PIPE, shell=True)
|
stderr=subprocess.PIPE, shell=True)
|
||||||
p2 = subprocess.Popen("/usr/bin/pigz -c > "
|
p2 = subprocess.Popen("/usr/bin/pigz -c > "
|
||||||
"/var/wo-mysqlbackup/{0}{1}.sql.gz"
|
"/var/wo-mysqlbackup/{0}{1}.sql.gz"
|
||||||
.format(dbs, WOVariables.wo_date),
|
.format(dbs, WOVar.wo_date),
|
||||||
stdin=p1.stdout,
|
stdin=p1.stdout,
|
||||||
shell=True)
|
shell=True)
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import re
|
|||||||
from wo.core.fileutils import WOFileUtils
|
from wo.core.fileutils import WOFileUtils
|
||||||
from wo.core.logging import Log
|
from wo.core.logging import Log
|
||||||
from wo.core.shellexec import WOShellExec
|
from wo.core.shellexec import WOShellExec
|
||||||
from wo.core.variables import WOVariables
|
from wo.core.variables import WOVar
|
||||||
|
|
||||||
|
|
||||||
class SSL:
|
class SSL:
|
||||||
@@ -63,11 +63,11 @@ class SSL:
|
|||||||
self, '{0}/htdocs/'.format(wo_site_webroot))
|
self, '{0}/htdocs/'.format(wo_site_webroot))
|
||||||
if WOShellExec.cmd_exec(
|
if WOShellExec.cmd_exec(
|
||||||
self, "{0} --allow-root core is-installed"
|
self, "{0} --allow-root core is-installed"
|
||||||
.format(WOVariables.wo_wp_cli)):
|
.format(WOVar.wo_wp_cli)):
|
||||||
wo_siteurl = (
|
wo_siteurl = (
|
||||||
WOShellExec.cmd_exec_stdout(
|
WOShellExec.cmd_exec_stdout(
|
||||||
self, "{0} option get siteurl "
|
self, "{0} option get siteurl "
|
||||||
.format(WOVariables.wo_wpcli_path) +
|
.format(WOVar.wo_wpcli_path) +
|
||||||
"--allow-root --quiet"))
|
"--allow-root --quiet"))
|
||||||
test_url = re.split(":", wo_siteurl)
|
test_url = re.split(":", wo_siteurl)
|
||||||
if not (test_url[0] == 'https'):
|
if not (test_url[0] == 'https'):
|
||||||
@@ -76,11 +76,11 @@ class SSL:
|
|||||||
WOShellExec.cmd_exec(
|
WOShellExec.cmd_exec(
|
||||||
self, "{0} option update siteurl "
|
self, "{0} option update siteurl "
|
||||||
"\'https://{1}\' --allow-root".format(
|
"\'https://{1}\' --allow-root".format(
|
||||||
WOVariables.wo_wpcli_path, domain))
|
WOVar.wo_wpcli_path, domain))
|
||||||
WOShellExec.cmd_exec(
|
WOShellExec.cmd_exec(
|
||||||
self, "{0} option update home "
|
self, "{0} option update home "
|
||||||
"\'https://{1}\' --allow-root".format(
|
"\'https://{1}\' --allow-root".format(
|
||||||
WOVariables.wo_wpcli_path, domain))
|
WOVar.wo_wpcli_path, domain))
|
||||||
WOShellExec.cmd_exec(
|
WOShellExec.cmd_exec(
|
||||||
self, "{0} search-replace \'http://{0}\'"
|
self, "{0} search-replace \'http://{0}\'"
|
||||||
"\'https://{0}\' --skip-columns=guid "
|
"\'https://{0}\' --skip-columns=guid "
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ Render Templates
|
|||||||
|
|
||||||
|
|
||||||
class WOTemplate():
|
class WOTemplate():
|
||||||
|
"""WordOps template utilities"""
|
||||||
|
|
||||||
def deploy(self, fileconf, template, data, overwrite=True):
|
def deploy(self, fileconf, template, data, overwrite=True):
|
||||||
"""Deploy template with render()"""
|
"""Deploy template with render()"""
|
||||||
data = dict(data)
|
data = dict(data)
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
"""WordOps core variable module"""
|
"""WordOps core variable module"""
|
||||||
import configparser
|
import configparser
|
||||||
import datetime
|
|
||||||
import os
|
import os
|
||||||
import socket
|
from datetime import datetime
|
||||||
|
from re import match
|
||||||
|
from socket import getfqdn
|
||||||
|
|
||||||
import distro
|
from distro import linux_distribution
|
||||||
|
from sh import git
|
||||||
|
|
||||||
|
|
||||||
class WOVariables():
|
class WOVar():
|
||||||
"""Intialization of core variables"""
|
"""Intialization of core variables"""
|
||||||
|
|
||||||
# WordOps version
|
# WordOps version
|
||||||
@@ -23,14 +25,14 @@ class WOVariables():
|
|||||||
wo_wpcli_path = '/usr/local/bin/wp'
|
wo_wpcli_path = '/usr/local/bin/wp'
|
||||||
|
|
||||||
# Current date and time of System
|
# Current date and time of System
|
||||||
wo_date = datetime.datetime.now().strftime('%d%b%Y-%H-%M-%S')
|
wo_date = datetime.now().strftime('%d%b%Y-%H-%M-%S')
|
||||||
|
|
||||||
# WordOps core variables
|
# WordOps core variables
|
||||||
wo_distro = distro.linux_distribution(
|
wo_distro = linux_distribution(
|
||||||
full_distribution_name=False)[0].lower()
|
full_distribution_name=False)[0].lower()
|
||||||
wo_platform_version = distro.linux_distribution(
|
wo_platform_version = linux_distribution(
|
||||||
full_distribution_name=False)[1].lower()
|
full_distribution_name=False)[1].lower()
|
||||||
wo_platform_codename = distro.linux_distribution(
|
wo_platform_codename = linux_distribution(
|
||||||
full_distribution_name=False)[2].lower()
|
full_distribution_name=False)[2].lower()
|
||||||
|
|
||||||
# Get timezone of system
|
# Get timezone of system
|
||||||
@@ -43,7 +45,7 @@ class WOVariables():
|
|||||||
wo_timezone = "Europe/Amsterdam"
|
wo_timezone = "Europe/Amsterdam"
|
||||||
|
|
||||||
# Get FQDN of system
|
# Get FQDN of system
|
||||||
wo_fqdn = socket.getfqdn()
|
wo_fqdn = getfqdn()
|
||||||
|
|
||||||
# WordOps default webroot path
|
# WordOps default webroot path
|
||||||
wo_webroot = '/var/www/'
|
wo_webroot = '/var/www/'
|
||||||
@@ -64,11 +66,25 @@ class WOVariables():
|
|||||||
wo_user = config['user']['name']
|
wo_user = config['user']['name']
|
||||||
wo_email = config['user']['email']
|
wo_email = config['user']['email']
|
||||||
except Exception:
|
except Exception:
|
||||||
|
print("WordOps (wo) require an username & and an email "
|
||||||
|
"address to configure Git (used to save server configurations)")
|
||||||
|
print("Your informations will ONLY be stored locally")
|
||||||
|
|
||||||
wo_user = input("Enter your name: ")
|
wo_user = input("Enter your name: ")
|
||||||
|
while wo_user == "":
|
||||||
|
print("Unfortunately, this can't be left blank")
|
||||||
|
wo_user = input("Enter your name: ")
|
||||||
|
|
||||||
wo_email = input("Enter your email: ")
|
wo_email = input("Enter your email: ")
|
||||||
os.system("git config --global user.name {0}".format(wo_user))
|
|
||||||
os.system(
|
while not match(r"^[A-Za-z0-9\.\+_-]+@[A-Za-z0-9\._-]+\.[a-zA-Z]*$",
|
||||||
"git config --global user.email {0}".format(wo_email))
|
wo_email):
|
||||||
|
print("Whoops, seems like you made a typo - "
|
||||||
|
"the e-mailaddress is invalid...")
|
||||||
|
wo_email = input("Enter your email: ")
|
||||||
|
|
||||||
|
git.config("--global", "user.name", "{0}".format(wo_user))
|
||||||
|
git.config("--global", "user.email", "{0}".format(wo_email))
|
||||||
|
|
||||||
# MySQL hostname
|
# MySQL hostname
|
||||||
wo_mysql_host = ""
|
wo_mysql_host = ""
|
||||||
|
|||||||
Reference in New Issue
Block a user