From a5f362ad4ac4139972fbbc4df4acf0e30eca88bd Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Fri, 27 Sep 2019 13:57:24 +0200 Subject: [PATCH 1/8] Update main.yml --- .github/workflows/main.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..af0845c --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,23 @@ +name: CI + +on: [push] + +jobs: + build: + + runs-on: ubuntu-18.04 + + steps: + - uses: actions/checkout@v1 + - name: Prepare VM + run: | + unset LANG + sudo apt-get -qq purge graphviz* redis* + sudo apt-get install -qq git python3-setuptools python3-dev python3-apt ccze tree + sudo apt-get -qq autoremove --purge + sudo mkdir -p /etc/mysql/conf.d + echo -e '[client]\nuser = root\npassword = root\n' | sudo tee /etc/mysql/conf.d/my.cnf + - name: Install WordOps + run: sudo bash install --travis + - name: Run tests + run: sudo bash tests/travis.sh From 5fbb0f58e6ea92d1b2a352312c998ee434334dbc Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Fri, 27 Sep 2019 14:15:00 +0200 Subject: [PATCH 2/8] Add support for custom nginx --- CHANGELOG.md | 1 + wo/cli/plugins/site_functions.py | 12 ++++++++++++ wo/cli/plugins/stack.py | 6 +++--- wo/cli/plugins/stack_upgrade.py | 6 +++++- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a578966..18bca5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - [STACK] Nginx server_names_hash_bucket_size automated fix - [STACK] Nginx configuration rollback in case of failure after `wo stack upgrade --nginx - [STACK] Nginx ultimate bad bots blocker with `wo stack install --ngxblocker` +- [STACK] Added support for custom Nginx compiled from source ### v3.9.9.1 - 2019-09-26 diff --git a/wo/cli/plugins/site_functions.py b/wo/cli/plugins/site_functions.py index cd4c19e..f4d11c2 100644 --- a/wo/cli/plugins/site_functions.py +++ b/wo/cli/plugins/site_functions.py @@ -847,6 +847,8 @@ def site_package_check(self, stype): apt = ["nginx"] + WOVariables.wo_nginx # apt_packages = apt_packages + WOVariables.wo_nginx post_pref(self, apt, packages) + elif os.file.isfile('/usr/sbin/nginx'): + post_pref(self, WOVariables.wo_nginx, []) else: apt_packages = apt_packages + WOVariables.wo_nginx else: @@ -920,6 +922,16 @@ def site_package_check(self, stype): else: apt_packages = apt_packages + WOVariables.wo_php73 + if self.app.pargs.ngxblocker: + if not os.path.isdir('/etc/nginx/bots.d'): + Log.debug(self, "Setting packages variable for ngxblocker") + packages = packages + \ + [["https://raw.githubusercontent.com/" + "mitchellkrogza/nginx-ultimate-bad-bot-blocker" + "/master/install-ngxblocker", + "/usr/local/sbin/install-ngxblocker", + "ngxblocker"]] + return(stack.install(apt_packages=apt_packages, packages=packages, disp_msg=False)) diff --git a/wo/cli/plugins/stack.py b/wo/cli/plugins/stack.py index d11191e..b690777 100644 --- a/wo/cli/plugins/stack.py +++ b/wo/cli/plugins/stack.py @@ -159,11 +159,11 @@ class WOStackController(CementBaseController): # Nginx if pargs.nginx: Log.debug(self, "Setting apt_packages variable for Nginx") - if not (WOAptGet.is_installed(self, 'nginx-custom')): if not (WOAptGet.is_installed(self, 'nginx-plus') or WOAptGet.is_installed(self, 'nginx')): - apt_packages = apt_packages + WOVariables.wo_nginx + if not os.path.isfile('/usr/sbin/nginx'): + apt_packages = apt_packages + WOVariables.wo_nginx else: if WOAptGet.is_installed(self, 'nginx-plus'): Log.info(self, "NGINX PLUS Detected ...") @@ -177,7 +177,7 @@ class WOStackController(CementBaseController): apt = ["nginx"] + WOVariables.wo_nginx self.post_pref(apt, empty_packages) else: - Log.debug(self, "Nginx Stable already installed") + Log.debug(self, "Nginx already installed") # Redis if pargs.redis: diff --git a/wo/cli/plugins/stack_upgrade.py b/wo/cli/plugins/stack_upgrade.py index fe4eeca..b8f2a61 100644 --- a/wo/cli/plugins/stack_upgrade.py +++ b/wo/cli/plugins/stack_upgrade.py @@ -94,7 +94,11 @@ class WOStackUpgradeController(CementBaseController): if WOAptGet.is_installed(self, 'nginx-custom'): apt_packages = apt_packages + WOVariables.wo_nginx else: - Log.info(self, "Nginx Stable is not already installed") + if os.path.isfile(self, '/usr/sbin/nginx'): + Log.info(self, "Updating Nginx templates") + post_pref(self, WOVariables.wo_nginx, []) + else: + Log.info(self, "Nginx Stable is not already installed") if pargs.php: if WOAptGet.is_installed(self, 'php7.2-fpm'): From dae94046eb6552da0f2d5f4272a3f4675d89eb19 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Fri, 27 Sep 2019 14:17:18 +0200 Subject: [PATCH 3/8] Update main.yml --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index af0845c..fa1d721 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,4 +20,4 @@ jobs: - name: Install WordOps run: sudo bash install --travis - name: Run tests - run: sudo bash tests/travis.sh + run: sudo bash tests/travis.sh --actions From 59f903bcecd844725e3b4d93ce5088be32cb1cb1 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Fri, 27 Sep 2019 14:19:35 +0200 Subject: [PATCH 4/8] Update travis.sh --- tests/travis.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/travis.sh b/tests/travis.sh index 882ebe9..6a0b7a1 100644 --- a/tests/travis.sh +++ b/tests/travis.sh @@ -9,9 +9,11 @@ CRED="${CSI}1;31m" CGREEN="${CSI}1;32m" CEND="${CSI}0m" -apt-get -qq purge mysql* graphviz* redis* -apt-get install -qq git python3-setuptools python3-dev python3-apt ccze tree -sudo apt-get -qq autoremove --purge +if [ -z "$1" ]; then + apt-get -qq purge mysql* graphviz* redis* + apt-get install -qq git python3-setuptools python3-dev python3-apt ccze tree + sudo apt-get -qq autoremove --purge +fi exit_script() { curl --progress-bar --upload-file /var/log/wo/wordops.log https://transfer.vtbox.net/"$(basename wordops.log)" && echo "" From fbec92c710f5b84798cee71e6b5bcf8174b023de Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Fri, 27 Sep 2019 14:25:31 +0200 Subject: [PATCH 5/8] Update install --- install | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/install b/install index a380e30..35692c4 100755 --- a/install +++ b/install @@ -70,6 +70,7 @@ while [ "$#" -gt 0 ]; do ;; --travis) wo_travis="y" + wo_force_install="y" ;; -s | --silent) wo_force_install="y" @@ -495,6 +496,10 @@ wo_install() { # Clone Github repository if it doesn't exist wo_install_travis() { + if [ "$wo_force_install" = "y" ]; then + [ ! -f "$HOME/.gitconfig" ] && { bash -c 'echo -e "[user]\n\tname = $USER\n\temail = root@$HOSTNAME.local" > $HOME/.gitconfig'; } + fi + if [ -f "$HOME/.gitconfig" ]; then # install and redirect log to not print python package install python3 setup.py install From 26952ddb9fd63b014e7504ad736daa7fc40f1044 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Fri, 27 Sep 2019 14:33:23 +0200 Subject: [PATCH 6/8] Update main.yml --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fa1d721..fca1962 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,6 +18,6 @@ jobs: sudo mkdir -p /etc/mysql/conf.d echo -e '[client]\nuser = root\npassword = root\n' | sudo tee /etc/mysql/conf.d/my.cnf - name: Install WordOps - run: sudo bash install --travis + run: sudo timeout 1800 bash install --travis - name: Run tests - run: sudo bash tests/travis.sh --actions + run: sudo timeout 1800 bash tests/travis.sh --actions From 26ed1faf2902ec4cdcf4ecd6f5f9217b09e16bf4 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Fri, 27 Sep 2019 14:43:37 +0200 Subject: [PATCH 7/8] Fix GitHub actions --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fca1962..53ae6b1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,6 +12,8 @@ jobs: - name: Prepare VM run: | unset LANG + sudo apt update -qq + sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php -y sudo apt-get -qq purge graphviz* redis* sudo apt-get install -qq git python3-setuptools python3-dev python3-apt ccze tree sudo apt-get -qq autoremove --purge From ceecc89bbf7615f7b92d2022797315a4843462a1 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Fri, 27 Sep 2019 14:46:00 +0200 Subject: [PATCH 8/8] Update install --- install | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/install b/install index 80ca70a..bb9d970 100755 --- a/install +++ b/install @@ -9,7 +9,7 @@ # ------------------------------------------------------------------------- # wget -qO wo wops.cc && sudo bash wo # ------------------------------------------------------------------------- -# Version 3.9.9.1 - 2019-09-26 +# Version 3.9.9.1 - 2019-09-27 # ------------------------------------------------------------------------- # CONTENTS @@ -78,9 +78,6 @@ while [ "$#" -gt 0 ]; do --purge | --uninstall) wo_purge="y" ;; - -w | --wufw | --without-ufw) - ufw="n" - ;; -v | --version) wo_version="$2" shift