diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b183400..3c96045 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,6 +1,17 @@ name: CI -on: [push, pull_request] +on: + push: + branches: + - updating-configuration + - master + pull_request: + branches: + - master + release: + types: [published] + schedule: + - cron: '0 0 * * 0' jobs: build: @@ -15,13 +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 python3-setuptools python3-dev python3-apt python3-wheel python3-pip ccze tree - sudo apt-get -qq autoremove --purge - sudo python3 setup.py sdist bdist_wheel + 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 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/install b/install index b7e3bd3..d696f5f 100755 --- a/install +++ b/install @@ -468,16 +468,17 @@ 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 + 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 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/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] 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 bcfcb8c..7fd8b6b 100644 --- a/wo/cli/plugins/stack_migrate.py +++ b/wo/cli/plugins/stack_migrate.py @@ -23,10 +23,14 @@ 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) - def migrate_mariadb(self): + def migrate_mariadb(self, ci=False): # Backup all database WOMysql.backupAll(self, fulldump=True) @@ -53,6 +57,9 @@ class WOStackMigrateController(CementBaseController): WOAptGet.remove(self, ["mariadb-server"]) WOAptGet.auto_remove(self) WOAptGet.install(self, WOVar.wo_mysql) + if not ci: + 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') @@ -68,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") @@ -82,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 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"]