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