Simplify stack upgrade
This commit is contained in:
@@ -1114,7 +1114,7 @@ def post_pref(self, apt_packages, packages):
|
|||||||
WOService.reload_service(self, 'proftpd')
|
WOService.reload_service(self, 'proftpd')
|
||||||
|
|
||||||
# Redis configuration
|
# Redis configuration
|
||||||
if set(["redis-server"]).issubset(set(apt_packages)):
|
if set(WOVariables.wo_redis).issubset(set(apt_packages)):
|
||||||
# set redis.conf parameter
|
# set redis.conf parameter
|
||||||
# set maxmemory 10% for ram below 512MB and 20% for others
|
# set maxmemory 10% for ram below 512MB and 20% for others
|
||||||
# set maxmemory-policy allkeys-lru
|
# set maxmemory-policy allkeys-lru
|
||||||
|
|||||||
@@ -149,12 +149,7 @@ class WOStackUpgradeController(CementBaseController):
|
|||||||
"releases/download/v{0}/wordops-dashboard.tar.gz"
|
"releases/download/v{0}/wordops-dashboard.tar.gz"
|
||||||
.format(WOVariables.wo_dashboard),
|
.format(WOVariables.wo_dashboard),
|
||||||
"/var/lib/wo/tmp/wo-dashboard.tar.gz",
|
"/var/lib/wo/tmp/wo-dashboard.tar.gz",
|
||||||
"WordOps Dashboard"],
|
"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'):
|
||||||
@@ -177,95 +172,94 @@ class WOStackUpgradeController(CementBaseController):
|
|||||||
else:
|
else:
|
||||||
Log.error(self, "Composer isn't installed")
|
Log.error(self, "Composer isn't installed")
|
||||||
|
|
||||||
if len(packages) or len(apt_packages):
|
if len(apt_packages):
|
||||||
if len(apt_packages):
|
Log.info(self, "Your site may be down for few seconds if "
|
||||||
Log.info(self, "Your site may be down for few seconds if "
|
"you are upgrading Nginx, PHP-FPM, MariaDB or Redis")
|
||||||
"you are upgrading Nginx, PHP-FPM, MariaDB or Redis")
|
# Check prompt
|
||||||
# Check prompt
|
if ((not pargs.no_prompt) and (not pargs.force)):
|
||||||
if ((not pargs.no_prompt) and (not pargs.force)):
|
start_upgrade = input("Do you want to continue:[y/N]")
|
||||||
start_upgrade = input("Do you want to continue:[y/N]")
|
if start_upgrade != "Y" and start_upgrade != "y":
|
||||||
if start_upgrade != "Y" and start_upgrade != "y":
|
Log.error(self, "Not starting package update")
|
||||||
Log.error(self, "Not starting package update")
|
Log.info(self, "Updating APT packages, please wait...")
|
||||||
Log.info(self, "Updating APT packages, please wait...")
|
# apt-get update
|
||||||
# apt-get update
|
WOAptGet.update(self)
|
||||||
WOAptGet.update(self)
|
if set(WOVariables.wo_php).issubset(set(apt_packages)):
|
||||||
if set(WOVariables.wo_php).issubset(set(apt_packages)):
|
WOAptGet.remove(self, ['php7.2-fpm'],
|
||||||
WOAptGet.remove(self, ['php7.2-fpm'],
|
auto=False, purge=True)
|
||||||
auto=False, purge=True)
|
if set(WOVariables.wo_php73).issubset(set(apt_packages)):
|
||||||
if set(WOVariables.wo_php73).issubset(set(apt_packages)):
|
WOAptGet.remove(self, ['php7.3-fpm'],
|
||||||
WOAptGet.remove(self, ['php7.3-fpm'],
|
auto=False, purge=True)
|
||||||
auto=False, purge=True)
|
# Update packages
|
||||||
# Update packages
|
WOAptGet.install(self, apt_packages)
|
||||||
WOAptGet.install(self, apt_packages)
|
post_pref(self, apt_packages, empty_packages)
|
||||||
post_pref(self, apt_packages, empty_packages)
|
# Post Actions after package updates
|
||||||
# Post Actions after package updates
|
|
||||||
|
|
||||||
if len(packages):
|
if len(packages):
|
||||||
if pargs.wpcli:
|
if pargs.wpcli:
|
||||||
WOFileUtils.rm(self, '/usr/local/bin/wp')
|
WOFileUtils.rm(self, '/usr/local/bin/wp')
|
||||||
|
|
||||||
if pargs.netdata:
|
if pargs.netdata:
|
||||||
WOFileUtils.rm(self, '/var/lib/wo/tmp/kickstart.sh')
|
WOFileUtils.rm(self, '/var/lib/wo/tmp/kickstart.sh')
|
||||||
|
|
||||||
if pargs.dashboard:
|
if pargs.dashboard:
|
||||||
WOFileUtils.rm(self, '/var/www/22222/htdocs/index.php')
|
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)
|
||||||
|
|
||||||
if pargs.wpcli:
|
if pargs.wpcli:
|
||||||
WOFileUtils.chmod(self, "/usr/local/bin/wp", 0o775)
|
WOFileUtils.chmod(self, "/usr/local/bin/wp", 0o775)
|
||||||
|
|
||||||
if pargs.netdata:
|
if pargs.netdata:
|
||||||
Log.info(self, "Upgrading Netdata, please wait...")
|
Log.info(self, "Upgrading Netdata, please wait...")
|
||||||
WOShellExec.cmd_exec(self, "/bin/bash /var/lib/wo/tmp/"
|
WOShellExec.cmd_exec(self, "/bin/bash /var/lib/wo/tmp/"
|
||||||
"kickstart.sh "
|
"kickstart.sh "
|
||||||
"--dont-wait")
|
"--dont-wait")
|
||||||
|
|
||||||
if pargs.dashboard:
|
if pargs.dashboard:
|
||||||
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(WOVariables.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(WOVariables.wo_webroot))
|
||||||
WOFileUtils.chown(self, "{0}22222/htdocs"
|
WOFileUtils.chown(self, "{0}22222/htdocs"
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVariables.wo_webroot),
|
||||||
WOVariables.wo_php_user,
|
WOVariables.wo_php_user,
|
||||||
WOVariables.wo_php_user, recursive=True)
|
WOVariables.wo_php_user, recursive=True)
|
||||||
|
|
||||||
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"
|
||||||
"/tmp/composer-install "
|
"/tmp/composer-install "
|
||||||
"--install-dir=/var/lib/wo/tmp/")
|
"--install-dir=/var/lib/wo/tmp/")
|
||||||
shutil.copyfile('/var/lib/wo/tmp/composer.phar',
|
shutil.copyfile('/var/lib/wo/tmp/composer.phar',
|
||||||
'/usr/local/bin/composer')
|
'/usr/local/bin/composer')
|
||||||
WOFileUtils.chmod(self, "/usr/local/bin/composer", 0o775)
|
WOFileUtils.chmod(self, "/usr/local/bin/composer", 0o775)
|
||||||
|
|
||||||
if pargs.phpmyadmin:
|
if pargs.phpmyadmin:
|
||||||
Log.info(self, "Upgrading phpMyAdmin, please wait...")
|
Log.info(self, "Upgrading phpMyAdmin, please wait...")
|
||||||
WOExtract.extract(self, '/var/lib/wo/tmp/pma.tar.gz',
|
WOExtract.extract(self, '/var/lib/wo/tmp/pma.tar.gz',
|
||||||
'/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(WOVariables.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(WOVariables.wo_phpmyadmin))
|
||||||
)
|
)
|
||||||
WOFileUtils.rm(self, '{0}22222/htdocs/db/pma'
|
WOFileUtils.rm(self, '{0}22222/htdocs/db/pma'
|
||||||
.format(WOVariables.wo_webroot))
|
.format(WOVariables.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(WOVariables.wo_phpmyadmin),
|
||||||
'{0}22222/htdocs/db/pma/'
|
'{0}22222/htdocs/db/pma/'
|
||||||
.format(WOVariables.wo_webroot))
|
.format(WOVariables.wo_webroot))
|
||||||
WOFileUtils.chown(self, "{0}22222/htdocs"
|
WOFileUtils.chown(self, "{0}22222/htdocs"
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVariables.wo_webroot),
|
||||||
WOVariables.wo_php_user,
|
WOVariables.wo_php_user,
|
||||||
WOVariables.wo_php_user, recursive=True)
|
WOVariables.wo_php_user, recursive=True)
|
||||||
|
|
||||||
Log.info(self, "Successfully updated packages")
|
Log.info(self, "Successfully updated packages")
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user