From 363dffa10df6c4ca419d3b1ec56c9299fc232b4e Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Tue, 27 Oct 2020 14:30:17 +0100 Subject: [PATCH 1/8] Update Redis-cache plugin configuration --- wo/cli/plugins/site_functions.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wo/cli/plugins/site_functions.py b/wo/cli/plugins/site_functions.py index f4a5e93..516c9ed 100644 --- a/wo/cli/plugins/site_functions.py +++ b/wo/cli/plugins/site_functions.py @@ -380,14 +380,15 @@ def setupwordpress(self, data, vhostonly=False): # set all wp-config.php variables wp_conf_variables = [ - ['WP_CACHE_KEY_SALT', '{0}:'.format(wo_domain_name)], + ['WP_REDIS_PREFIX', '{0}:'.format(wo_domain_name)], ['WP_MEMORY_LIMIT', '128M'], ['WP_MAX_MEMORY_LIMIT', '256M'], ['CONCATENATE_SCRIPTS', 'false'], ['WP_POST_REVISIONS', '10'], ['MEDIA_TRASH', 'true'], ['EMPTY_TRASH_DAYS', '15'], - ['WP_AUTO_UPDATE_CORE', 'minor']] + ['WP_AUTO_UPDATE_CORE', 'minor'], + ['WP_REDIS_DISABLE_BANNERS', 'true']] Log.wait(self, "Configuring WordPress") for wp_conf in wp_conf_variables: wp_var = wp_conf[0] From c3a9343f4ad834a19229512be788d50aa4fd0406 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Tue, 27 Oct 2020 14:37:09 +0100 Subject: [PATCH 2/8] Update Github actions --- .github/workflows/main.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b183400..85f4dd4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,6 +1,16 @@ name: CI -on: [push, pull_request] +on: + push: + branches: + - updating-configuration + pull_request: + branches: + - master + release: + types: [published] + schedule: + - cron: '0 0 * * 0' jobs: build: @@ -19,9 +29,8 @@ jobs: sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php -y sudo rm -rf /etc/mysql /var/lib/mysql sudo apt-get purge --option=Dpkg::options::=--force-all --assume-yes graphviz* redis* php* mysql* - sudo apt-get install -qq git python3-setuptools python3-dev python3-apt python3-wheel python3-pip ccze tree + sudo apt-get install -qq git ccze tree sudo apt-get -qq autoremove --purge - sudo python3 setup.py sdist bdist_wheel sudo bash -c 'echo -e "[user]\n\tname = abc\n\temail = root@localhost.com" > $HOME/.gitconfig' - name: Install WordOps run: sudo timeout 1800 bash install --travis From 4bca86580e80e5d716c2c0b26c9d43c33c39085c Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Wed, 28 Oct 2020 11:11:01 +0100 Subject: [PATCH 3/8] Run dist-upgrade after MariaDB upgrade --- README.md | 3 ++- wo/cli/plugins/stack_migrate.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7ff41c8..77d3d5e 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@

build +CI MIT Commits GitHub release @@ -158,7 +159,7 @@ For any other questions about WordOps or if you need support, please use the [Co # Contributing -If you'd like to contribute, please fork the reposi7tory and make changes as you'd like. Pull requests are warmly welcome. +If you'd like to contribute, please fork the repository and make changes as you'd like. Pull requests are warmly welcome. There is no need to be a developer or a system administrator to contribute to WordOps project. You can still contribute by helping us to improve [WordOps documentation](https://github.com/WordOps/docs.wordops.net). ## Credits diff --git a/wo/cli/plugins/stack_migrate.py b/wo/cli/plugins/stack_migrate.py index bcfcb8c..35e1f52 100644 --- a/wo/cli/plugins/stack_migrate.py +++ b/wo/cli/plugins/stack_migrate.py @@ -53,6 +53,8 @@ class WOStackMigrateController(CementBaseController): WOAptGet.remove(self, ["mariadb-server"]) WOAptGet.auto_remove(self) WOAptGet.install(self, WOVar.wo_mysql) + WOAptGet.dist_upgrade(self) + WOAptGet.auto_remove(self) Log.valide(self, "Upgrading MariaDB ") WOFileUtils.mvfile( self, '/etc/mysql/my.cnf', '/etc/mysql/my.cnf.old') From 164f817d25c89fb0252752525030d2aa9b32450c Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Wed, 28 Oct 2020 11:45:30 +0100 Subject: [PATCH 4/8] Fix github actions --- tests/travis.sh | 2 +- wo/cli/plugins/stack_migrate.py | 9 ++++++++- wo/core/variables.py | 16 +++++----------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/tests/travis.sh b/tests/travis.sh index 1584965..04e8ac8 100644 --- a/tests/travis.sh +++ b/tests/travis.sh @@ -237,7 +237,7 @@ echo -e "${CGREEN}#############################################${CEND}" echo -ne " Upgrading mariadb [..]\r" if { - wo stack migrate --mariadb --force + wo stack migrate --mariadb --force --ci } >>/var/log/wo/test.log; then echo -ne " Upgrading mariadb [${CGREEN}OK${CEND}]\\r" echo -ne '\n' diff --git a/wo/cli/plugins/stack_migrate.py b/wo/cli/plugins/stack_migrate.py index 35e1f52..4136804 100644 --- a/wo/cli/plugins/stack_migrate.py +++ b/wo/cli/plugins/stack_migrate.py @@ -23,6 +23,10 @@ class WOStackMigrateController(CementBaseController): (['--force'], dict(help="Force Packages upgrade without any prompt", action='store_true')), + (['--ci'], + dict(help="Argument used for testing, " + "do not use it on your server", + action='store_true')), ] @expose(hide=True) @@ -53,7 +57,8 @@ class WOStackMigrateController(CementBaseController): WOAptGet.remove(self, ["mariadb-server"]) WOAptGet.auto_remove(self) WOAptGet.install(self, WOVar.wo_mysql) - WOAptGet.dist_upgrade(self) + if not self.app.args.ci: + WOAptGet.dist_upgrade(self) WOAptGet.auto_remove(self) Log.valide(self, "Upgrading MariaDB ") WOFileUtils.mvfile( @@ -70,6 +75,8 @@ class WOStackMigrateController(CementBaseController): if ((not pargs.mariadb)): self.app.args.print_help() if pargs.mariadb: + if WOVar.wo_distro == 'raspbian': + Log.error(self, "MariaDB upgrade is not available on Raspbian") if WOVar.wo_mysql_host != "localhost": Log.error( self, "Remote MySQL server in use, skipping local install") diff --git a/wo/core/variables.py b/wo/core/variables.py index 40ae6d9..b99a83c 100644 --- a/wo/core/variables.py +++ b/wo/core/variables.py @@ -158,25 +158,19 @@ class WOVar(): wo_php_extra = ["graphviz"] - wo_mysql = ["mariadb-server", "percona-toolkit"] + wo_mysql = [ + "mariadb-server", "percona-toolkit", + "mariadb-common", "python3-mysqldb"] if wo_distro == 'raspbian': - wo_mysql = wo_mysql + ["python3-mysqldb"] if wo_platform_codename == 'stretch': mariadb_ver = '10.1' else: mariadb_ver = '10.3' else: mariadb_ver = '10.5' - if wo_platform_codename == 'jessie': - wo_mysql = wo_mysql + ["python3-mysql.connector"] - else: - wo_mysql = wo_mysql + ["python3-mysqldb", "mariadb-backup"] + wo_mysql = wo_mysql + ["mariadb-backup"] - wo_mysql_client = ["mariadb-client"] - if wo_platform_codename == 'jessie': - wo_mysql_client = wo_mysql_client + ["python3-mysqldb"] - else: - wo_mysql_client = wo_mysql_client + ["python3-mysql.connector"] + wo_mysql_client = ["mariadb-client", "python3-mysqldb"] wo_fail2ban = ["fail2ban"] wo_clamav = ["clamav", "clamav-freshclam"] From 7d0b0cd50cebd7ab185589a94115eba2eac698b8 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Wed, 28 Oct 2020 12:25:09 +0100 Subject: [PATCH 5/8] Fix MariaDB upgrade on Github actions --- wo/cli/plugins/stack.py | 15 ++++++++++++++- wo/cli/plugins/stack_migrate.py | 9 ++++++--- wo/cli/plugins/stack_upgrade.py | 15 +++++++++++---- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/wo/cli/plugins/stack.py b/wo/cli/plugins/stack.py index 71e02d6..fd82f11 100644 --- a/wo/cli/plugins/stack.py +++ b/wo/cli/plugins/stack.py @@ -49,6 +49,8 @@ class WOStackController(CementBaseController): dict(help='Install PHP 7.4 stack', action='store_true')), (['--mysql'], dict(help='Install MySQL stack', action='store_true')), + (['--mariadb'], + dict(help='Install MySQL stack alias', action='store_true')), (['--mysqlclient'], dict(help='Install MySQL client for remote MySQL server', action='store_true')), @@ -120,7 +122,7 @@ class WOStackController(CementBaseController): pargs.dashboard or pargs.fail2ban or pargs.security or pargs.mysqlclient or pargs.mysqltuner or pargs.admin or pargs.adminer or - pargs.utils or pargs.redis or + pargs.utils or pargs.redis or pargs.mariadb or pargs.proftpd or pargs.extplorer or pargs.clamav or pargs.cheat or pargs.nanorc or pargs.ufw or pargs.ngxblocker or @@ -132,6 +134,9 @@ class WOStackController(CementBaseController): if pargs.php: pargs.php72 = True + if pargs.mariadb: + pargs.mysql = True + if pargs.all: pargs.web = True pargs.admin = True @@ -555,6 +560,7 @@ class WOStackController(CementBaseController): if ((not pargs.web) and (not pargs.admin) and (not pargs.nginx) and (not pargs.php) and (not pargs.mysql) and (not pargs.wpcli) and + (not pargs.mariadb) and (not pargs.phpmyadmin) and (not pargs.composer) and (not pargs.netdata) and (not pargs.dashboard) and (not pargs.fail2ban) and (not pargs.security) and @@ -572,6 +578,9 @@ class WOStackController(CementBaseController): if pargs.php: pargs.php72 = True + if pargs.mariadb: + pargs.mysql = True + if pargs.all: pargs.web = True pargs.admin = True @@ -868,6 +877,7 @@ class WOStackController(CementBaseController): if ((not pargs.web) and (not pargs.admin) and (not pargs.nginx) and (not pargs.php) and (not pargs.mysql) and (not pargs.wpcli) and + (not pargs.mariadb) and (not pargs.phpmyadmin) and (not pargs.composer) and (not pargs.netdata) and (not pargs.dashboard) and (not pargs.fail2ban) and (not pargs.security) and @@ -885,6 +895,9 @@ class WOStackController(CementBaseController): if pargs.php: pargs.php72 = True + if pargs.mariadb: + pargs.mysql = True + if pargs.all: pargs.web = True pargs.admin = True diff --git a/wo/cli/plugins/stack_migrate.py b/wo/cli/plugins/stack_migrate.py index 4136804..7fd8b6b 100644 --- a/wo/cli/plugins/stack_migrate.py +++ b/wo/cli/plugins/stack_migrate.py @@ -30,7 +30,7 @@ class WOStackMigrateController(CementBaseController): ] @expose(hide=True) - def migrate_mariadb(self): + def migrate_mariadb(self, ci=False): # Backup all database WOMysql.backupAll(self, fulldump=True) @@ -57,7 +57,7 @@ class WOStackMigrateController(CementBaseController): WOAptGet.remove(self, ["mariadb-server"]) WOAptGet.auto_remove(self) WOAptGet.install(self, WOVar.wo_mysql) - if not self.app.args.ci: + if not ci: WOAptGet.dist_upgrade(self) WOAptGet.auto_remove(self) Log.valide(self, "Upgrading MariaDB ") @@ -91,7 +91,10 @@ class WOStackMigrateController(CementBaseController): start_upgrade = input("Do you want to continue:[y/N]") if start_upgrade != "Y" and start_upgrade != "y": Log.error(self, "Not starting package update") - self.migrate_mariadb() + if not pargs.ci: + self.migrate_mariadb() + else: + self.migrate_mariadb(ci=True) else: Log.error(self, "Your current MySQL is not alive or " "you allready installed MariaDB") diff --git a/wo/cli/plugins/stack_upgrade.py b/wo/cli/plugins/stack_upgrade.py index e3f0082..f0071c8 100644 --- a/wo/cli/plugins/stack_upgrade.py +++ b/wo/cli/plugins/stack_upgrade.py @@ -41,6 +41,9 @@ class WOStackUpgradeController(CementBaseController): dict(help='Upgrade PHP 7.4 stack', action='store_true')), (['--mysql'], dict(help='Upgrade MySQL stack', action='store_true')), + (['--mariadb'], + dict(help='Upgrade MySQL stack alias', + action='store_true')), (['--wpcli'], dict(help='Upgrade WPCLI', action='store_true')), (['--redis'], @@ -79,14 +82,18 @@ class WOStackUpgradeController(CementBaseController): wo_phpmyadmin = WODownload.pma_release(self) if not (pargs.web or pargs.nginx or pargs.php or pargs.php72 or pargs.php73 or pargs.php74 or pargs.mysql or - pargs.ngxblocker or pargs.all or pargs.netdata or - pargs.wpcli or pargs.composer or pargs.phpmyadmin or - pargs.adminer or pargs.dashboard or pargs.mysqltuner or - pargs.redis or pargs.fail2ban or pargs.security): + pargs.mariadb or pargs.ngxblocker or pargs.all + or pargs.netdata or pargs.wpcli or pargs.composer or + pargs.phpmyadmin or pargs.adminer or pargs.dashboard or + pargs.mysqltuner or pargs.redis or + pargs.fail2ban or pargs.security): pargs.web = True pargs.admin = True pargs.security = True + if pargs.mariadb: + pargs.mysql = True + if pargs.php: pargs.php72 = True From a59187e1d7966154c9b817a4e4d2e331f5b90057 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Wed, 28 Oct 2020 12:26:11 +0100 Subject: [PATCH 6/8] Update main.yml --- .github/workflows/main.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 85f4dd4..3c96045 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,6 +4,7 @@ on: push: branches: - updating-configuration + - master pull_request: branches: - master @@ -25,12 +26,14 @@ jobs: - name: Prepare VM run: | unset LANG - sudo apt update -qq - sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php -y + echo "$HOME" && sudo echo "$HOME" + echo "$PWD" + sudo apt update -qq > /dev/null 2>&1 + sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php -y > /dev/null 2>&1 sudo rm -rf /etc/mysql /var/lib/mysql - sudo apt-get purge --option=Dpkg::options::=--force-all --assume-yes graphviz* redis* php* mysql* - sudo apt-get install -qq git ccze tree - sudo apt-get -qq autoremove --purge + sudo apt-get purge --option=Dpkg::options::=--force-all --assume-yes graphviz* redis* php* mysql* > /dev/null 2>&1 + sudo apt-get install -qq git ccze tree > /dev/null 2>&1 + sudo apt-get -qq autoremove --purge > /dev/null 2>&1 sudo bash -c 'echo -e "[user]\n\tname = abc\n\temail = root@localhost.com" > $HOME/.gitconfig' - name: Install WordOps run: sudo timeout 1800 bash install --travis From 5d8e2f0fc8e9c28902cb61ec71feb44b85ae7df0 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Wed, 28 Oct 2020 15:26:58 +0100 Subject: [PATCH 7/8] Improve venv install --- install | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/install b/install index b7e3bd3..474668f 100755 --- a/install +++ b/install @@ -468,10 +468,12 @@ wo_install() { else python3 -m pip install -I "git+git://github.com/WordOps/WordOps.git@$wo_branch#egg=wordops" fi - cp -rf /opt/wo/lib/python3."$python_ver"/site-packages/usr/* /usr/ - cp -rn /opt/wo/lib/python3."$python_ver"/site-packages/etc/* /etc/ - cp -f /opt/wo/lib/python3."$python_ver"/site-packages/etc/bash_completion.d/wo_auto.rc /etc/bash_completion.d/wo_auto.rc - rm -rf /usr/local/bin/wo /usr/local/lib/python3."$python_ver"/dist-packages/{etc,usr} + local python_venv + python_venv=$(python3 -c "import sys; print(sys.version_info[1])") + cp -rf /opt/wo/lib/python3."$python_venv"/site-packages/usr/* /usr/ + cp -rn /opt/wo/lib/python3."$python_venv"/site-packages/etc/* /etc/ + cp -f /opt/wo/lib/python3."$python_venv"/site-packages/etc/bash_completion.d/wo_auto.rc /etc/bash_completion.d/wo_auto.rc + rm -rf /usr/local/bin/wo /usr/local/lib/python3."$python_venv"/dist-packages/{etc,usr} ln -s /opt/wo/bin/wo /usr/local/bin/ deactivate if ! { /usr/local/bin/wo >/dev/null 2>&1; }; then From 4735696ef17464b54400aaff2cf7d9635604688c Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Thu, 29 Oct 2020 15:00:35 +0100 Subject: [PATCH 8/8] Fix install --- install | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/install b/install index 474668f..d696f5f 100755 --- a/install +++ b/install @@ -476,10 +476,9 @@ wo_install() { rm -rf /usr/local/bin/wo /usr/local/lib/python3."$python_venv"/dist-packages/{etc,usr} ln -s /opt/wo/bin/wo /usr/local/bin/ deactivate - if ! { /usr/local/bin/wo >/dev/null 2>&1; }; then + if [ ! -d /opt/wo/lib/python3."$python_ver"/site-packages/apt ];then python3 -m venv --system-site-packages /opt/wo fi - } # Clone Github repository if it doesn't exist