Add wo stack upgrade --dashboard

This commit is contained in:
VirtuBox
2019-08-16 14:53:39 +02:00
parent c86c4ecabc
commit 2e262af637
3 changed files with 38 additions and 4 deletions

View File

@@ -21,7 +21,6 @@ from wo.cli.plugins.stack_migrate import WOStackMigrateController
from wo.cli.plugins.stack_services import WOStackStatusController from wo.cli.plugins.stack_services import WOStackStatusController
from wo.cli.plugins.stack_upgrade import WOStackUpgradeController from wo.cli.plugins.stack_upgrade import WOStackUpgradeController
from wo.cli.plugins.stack_pref import pre_pref, post_pref from wo.cli.plugins.stack_pref import pre_pref, post_pref
from wo.core.addswap import WOSwap
from wo.core.apt_repo import WORepo from wo.core.apt_repo import WORepo
from wo.core.aptget import WOAptGet from wo.core.aptget import WOAptGet
from wo.core.cron import WOCron from wo.core.cron import WOCron

View File

@@ -29,6 +29,8 @@ class WOStackStatusController(CementBaseController):
pargs.nginx = True pargs.nginx = True
pargs.php = True pargs.php = True
pargs.mysql = True pargs.mysql = True
pargs.fail2ban = True
pargs.netdata = True
if pargs.nginx: if pargs.nginx:
if (WOAptGet.is_installed(self, 'nginx-custom')): if (WOAptGet.is_installed(self, 'nginx-custom')):
@@ -198,6 +200,7 @@ class WOStackStatusController(CementBaseController):
pargs.nginx = True pargs.nginx = True
pargs.php = True pargs.php = True
pargs.mysql = True pargs.mysql = True
pargs.netdata = True
if pargs.nginx: if pargs.nginx:
if (WOAptGet.is_installed(self, 'nginx-custom')): if (WOAptGet.is_installed(self, 'nginx-custom')):
@@ -281,6 +284,8 @@ class WOStackStatusController(CementBaseController):
pargs.nginx = True pargs.nginx = True
pargs.php = True pargs.php = True
pargs.mysql = True pargs.mysql = True
pargs.fail2ban = True
pargs.netdata = True
if pargs.nginx: if pargs.nginx:
if (WOAptGet.is_installed(self, 'nginx-custom')): if (WOAptGet.is_installed(self, 'nginx-custom')):
@@ -363,6 +368,7 @@ class WOStackStatusController(CementBaseController):
pargs.nginx = True pargs.nginx = True
pargs.php = True pargs.php = True
pargs.mysql = True pargs.mysql = True
pargs.fail2ban = True
if pargs.nginx: if pargs.nginx:
if (WOAptGet.is_installed(self, 'nginx-custom') or if (WOAptGet.is_installed(self, 'nginx-custom') or

View File

@@ -42,6 +42,8 @@ class WOStackUpgradeController(CementBaseController):
dict(help='Upgrade Redis', action='store_true')), dict(help='Upgrade Redis', action='store_true')),
(['--netdata'], (['--netdata'],
dict(help='Upgrade Netdata', action='store_true')), dict(help='Upgrade Netdata', action='store_true')),
(['--dashboard'],
dict(help='Upgrade WordOps Dashboard', action='store_true')),
(['--composer'], (['--composer'],
dict(help='Upgrade Composer', action='store_true')), dict(help='Upgrade Composer', action='store_true')),
(['--phpmyadmin'], (['--phpmyadmin'],
@@ -67,7 +69,7 @@ class WOStackUpgradeController(CementBaseController):
(not pargs.mysql) and (not pargs.mysql) and
(not pargs.all) and (not pargs.wpcli) and (not pargs.all) and (not pargs.wpcli) and
(not pargs.netdata) and (not pargs.composer) and (not pargs.netdata) and (not pargs.composer) and
(not pargs.phpmyadmin) and (not pargs.phpmyadmin) and (not pargs.dashboard) and
(not pargs.redis)): (not pargs.redis)):
pargs.web = True pargs.web = True
@@ -138,6 +140,21 @@ class WOStackUpgradeController(CementBaseController):
'kickstart-static64.sh', 'kickstart-static64.sh',
'/var/lib/wo/tmp/kickstart.sh', '/var/lib/wo/tmp/kickstart.sh',
'Netdata']] 'Netdata']]
if pargs.dashboard:
if os.path.isfile('/var/www/22222/htdocs/index.php'):
packages = packages + \
[["https://github.com/WordOps/wordops-dashboard/"
"releases/download/v{0}/wordops-dashboard.tar.gz"
.format(WOVariables.wo_dashboard),
"/var/lib/wo/tmp/wo-dashboard.tar.gz",
"WordOps Dashboard"],
["https://github.com/soerennb/"
"extplorer/archive/v{0}.tar.gz"
.format(WOVariables.wo_extplorer),
"/var/lib/wo/tmp/extplorer.tar.gz",
"eXtplorer"]]
if pargs.phpmyadmin: if pargs.phpmyadmin:
if os.path.isdir('/var/www/22222/htdocs/db/pma'): if os.path.isdir('/var/www/22222/htdocs/db/pma'):
packages = packages + \ packages = packages + \
@@ -184,10 +201,13 @@ class WOStackUpgradeController(CementBaseController):
if len(packages): if len(packages):
if pargs.wpcli: if pargs.wpcli:
WOFileUtils.remove(self, ['/usr/local/bin/wp']) WOFileUtils.rm(self, '/usr/local/bin/wp')
if pargs.netdata: if pargs.netdata:
WOFileUtils.remove(self, ['/var/lib/wo/tmp/kickstart.sh']) WOFileUtils.rm(self, '/var/lib/wo/tmp/kickstart.sh')
if pargs.dashboard:
WOFileUtils.rm(self, '/var/www/22222/htdocs/index.php')
Log.debug(self, "Downloading following: {0}".format(packages)) Log.debug(self, "Downloading following: {0}".format(packages))
WODownload.download(self, packages) WODownload.download(self, packages)
@@ -201,6 +221,15 @@ class WOStackUpgradeController(CementBaseController):
"kickstart.sh " "kickstart.sh "
"--dont-wait") "--dont-wait")
if pargs.dashboard:
Log.debug(self, "Extracting wo-dashboard.tar.gz "
"to location {0}22222/htdocs/"
.format(WOVariables.wo_webroot))
WOExtract.extract(self, '/var/lib/wo/tmp/'
'wo-dashboard.tar.gz',
'{0}22222/htdocs'
.format(WOVariables.wo_webroot))
if pargs.composer: if pargs.composer:
Log.info(self, "Upgrading Composer, please wait...") Log.info(self, "Upgrading Composer, please wait...")
WOShellExec.cmd_exec(self, "php -q /var/lib/wo" WOShellExec.cmd_exec(self, "php -q /var/lib/wo"