Add more info during stack install
This commit is contained in:
@@ -115,6 +115,7 @@ class WOStackController(CementBaseController):
|
||||
"""Start installation of packages"""
|
||||
self.msg = []
|
||||
empty_packages = []
|
||||
wo_webroot = "/var/www/"
|
||||
pargs = self.app.pargs
|
||||
try:
|
||||
# Default action for stack installation
|
||||
@@ -307,19 +308,21 @@ class WOStackController(CementBaseController):
|
||||
Log.info(self, "phpRedisAdmin already installed")
|
||||
|
||||
# Composer
|
||||
if pargs.composer:
|
||||
if not os.path.isfile('/usr/local/bin/composer'):
|
||||
Log.debug(self, "Setting packages variable for Composer ")
|
||||
packages = packages + [["https://getcomposer.org/"
|
||||
"installer",
|
||||
"/var/lib/wo/tmp/composer-install",
|
||||
"Composer"]]
|
||||
else:
|
||||
Log.debug(self, "Composer already installed")
|
||||
Log.info(self, "Composer already installed")
|
||||
if (pargs.composer and not
|
||||
os.path.isfile('/usr/local/bin/composer')):
|
||||
Log.debug(self, "Setting packages variable for Composer ")
|
||||
packages = packages + [["https://getcomposer.org/"
|
||||
"installer",
|
||||
"/var/lib/wo/tmp/composer-install",
|
||||
"Composer"]]
|
||||
else:
|
||||
Log.debug(self, "Composer already installed")
|
||||
Log.info(self, "Composer already installed")
|
||||
|
||||
# ADMINER
|
||||
if pargs.adminer:
|
||||
if (pargs.adminer and not
|
||||
os.path.isfile("{0}22222/htdocs/db/adminer/index.php"
|
||||
.format(wo_webroot))):
|
||||
Log.debug(self, "Setting packages variable for Adminer ")
|
||||
packages = packages + [["https://github.com/vrana/adminer/"
|
||||
"releases/download/v{0}"
|
||||
@@ -337,7 +340,8 @@ class WOStackController(CementBaseController):
|
||||
.format(WOVariables.wo_webroot),
|
||||
"Adminer theme"]]
|
||||
# mysqltuner
|
||||
if pargs.mysqltuner:
|
||||
if (pargs.mysqltuner and not
|
||||
os.path.isfile("/usr/bin/mysqltuner")):
|
||||
Log.debug(self, "Setting packages variable for MySQLTuner ")
|
||||
packages = packages + [["https://raw."
|
||||
"githubusercontent.com/"
|
||||
@@ -347,22 +351,23 @@ class WOStackController(CementBaseController):
|
||||
"MySQLTuner"]]
|
||||
|
||||
# Netdata
|
||||
if pargs.netdata:
|
||||
if (pargs.netdata and
|
||||
(not os.path.isdir('/opt/netdata') and not
|
||||
os.path.isdir("/etc/netdata"))):
|
||||
Log.debug(self, "Setting packages variable for Netdata")
|
||||
if not os.path.exists('/opt/netdata'):
|
||||
if WOVariables.wo_distro == 'raspbian':
|
||||
packages = packages + [['https://my-netdata.io/'
|
||||
'kickstart.sh',
|
||||
'/var/lib/wo/tmp/kickstart.sh',
|
||||
'Netdata']]
|
||||
else:
|
||||
packages = packages + [['https://my-netdata.io/'
|
||||
'kickstart-static64.sh',
|
||||
'/var/lib/wo/tmp/kickstart.sh',
|
||||
'Netdata']]
|
||||
if WOVariables.wo_distro == 'raspbian':
|
||||
packages = packages + [['https://my-netdata.io/'
|
||||
'kickstart.sh',
|
||||
'/var/lib/wo/tmp/kickstart.sh',
|
||||
'Netdata']]
|
||||
else:
|
||||
Log.debug(self, "Netdata already installed")
|
||||
Log.info(self, "Netdata already installed")
|
||||
packages = packages + [['https://my-netdata.io/'
|
||||
'kickstart-static64.sh',
|
||||
'/var/lib/wo/tmp/kickstart.sh',
|
||||
'Netdata']]
|
||||
else:
|
||||
Log.debug(self, "Netdata already installed")
|
||||
Log.info(self, "Netdata already installed")
|
||||
|
||||
# WordOps Dashboard
|
||||
if pargs.dashboard:
|
||||
@@ -506,8 +511,7 @@ class WOStackController(CementBaseController):
|
||||
pargs.proftpd = True
|
||||
pargs.utils = True
|
||||
pargs.redis = True
|
||||
packages = \
|
||||
packages + ['/var/www/22222/htdocs/*']
|
||||
packages = packages + ['/var/www/22222/htdocs/*']
|
||||
|
||||
if pargs.web:
|
||||
pargs.nginx = True
|
||||
@@ -693,8 +697,7 @@ class WOStackController(CementBaseController):
|
||||
pargs.proftpd = True
|
||||
pargs.utils = True
|
||||
pargs.redis = True
|
||||
packages = \
|
||||
packages + ['/var/www/22222/htdocs/*']
|
||||
packages = packages + ['/var/www/22222/htdocs/*']
|
||||
|
||||
if pargs.web:
|
||||
pargs.nginx = True
|
||||
|
||||
@@ -146,6 +146,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
||||
if (apt_packages):
|
||||
# Nginx configuration
|
||||
if set(WOVariables.wo_nginx).issubset(set(apt_packages)):
|
||||
Log.info(self, "Applying Nginx configuration templates")
|
||||
# Nginx main configuration
|
||||
ngxcnf = '/etc/nginx/conf.d'
|
||||
ngxcom = '/etc/nginx/common'
|
||||
@@ -501,6 +502,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
||||
WOService.restart_service(self, 'nginx')
|
||||
|
||||
if set(WOVariables.wo_php).issubset(set(apt_packages)):
|
||||
Log.info(self, "Configuring php7.2-fpm")
|
||||
ngxroot = '/var/www/'
|
||||
# Create log directories
|
||||
if not os.path.exists('/var/log/php/7.2/'):
|
||||
@@ -673,6 +675,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
||||
|
||||
# PHP7.3 configuration
|
||||
if set(WOVariables.wo_php73).issubset(set(apt_packages)):
|
||||
Log.info(self, "Configuring php7.3-fpm")
|
||||
ngxroot = '/var/www/'
|
||||
# Create log directories
|
||||
if not os.path.exists('/var/log/php/7.3/'):
|
||||
@@ -854,6 +857,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
||||
config_file.write(config)
|
||||
config_file.close()
|
||||
elif (not WOFileUtils.grep(self, "/etc/mysql/my.cnf", "WordOps")):
|
||||
Log.info(self, "Tuning MariaDB configuration")
|
||||
with open("/etc/mysql/my.cnf",
|
||||
"a") as mysql_file:
|
||||
mysql_file.write("\n# WordOps v3.9.8\n")
|
||||
@@ -963,6 +967,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
||||
# create fail2ban configuration files
|
||||
if set(WOVariables.wo_fail2ban).issubset(set(apt_packages)):
|
||||
if not os.path.isfile("/etc/fail2ban/jail.d/custom.conf"):
|
||||
Log.info(self, "Configuring Fail2Ban")
|
||||
data = dict()
|
||||
WOTemplate.render(self,
|
||||
'/etc/fail2ban/jail.d/custom.conf',
|
||||
@@ -986,6 +991,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
||||
# Proftpd configuration
|
||||
if set(["proftpd-basic"]).issubset(set(apt_packages)):
|
||||
if os.path.isfile("/etc/proftpd/proftpd.conf"):
|
||||
Log.info(self, "Configuring ProFTPd")
|
||||
Log.debug(self, "Setting up Proftpd configuration")
|
||||
WOFileUtils.searchreplace(self, "/etc/proftpd/"
|
||||
"proftpd.conf",
|
||||
@@ -1098,6 +1104,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
||||
WOShellExec.cmd_exec(self, "systemctl enable redis-server")
|
||||
if (os.path.isfile("/etc/redis/redis.conf") and
|
||||
not WOFileUtils.grep(self, "/etc/mysql/my.cnf", "WordOps")):
|
||||
Log.info(self, "Tuning Redis configuration")
|
||||
with open("/etc/redis/redis.conf",
|
||||
"a") as redis_file:
|
||||
redis_file.write("\n# WordOps v3.9.8\n")
|
||||
|
||||
@@ -76,6 +76,13 @@ class WOStackUpgradeController(CementBaseController):
|
||||
|
||||
if pargs.all:
|
||||
pargs.web = True
|
||||
pargs.netdata = True
|
||||
pargs.composer = True
|
||||
pargs.dashboard = True
|
||||
pargs.phpmyadmin = True
|
||||
pargs.redis = True
|
||||
pargs.wpcli = True
|
||||
pargs.php73 = True
|
||||
|
||||
if pargs.web:
|
||||
if WOAptGet.is_installed(self, 'nginx-custom'):
|
||||
|
||||
Reference in New Issue
Block a user