diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..53ae6b1 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,25 @@ +name: CI + +on: [push] + +jobs: + build: + + runs-on: ubuntu-18.04 + + steps: + - uses: actions/checkout@v1 + - 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 + 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 timeout 1800 bash install --travis + - name: Run tests + run: sudo timeout 1800 bash tests/travis.sh --actions 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/install b/install index d76dec6..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 @@ -70,6 +70,7 @@ while [ "$#" -gt 0 ]; do ;; --travis) wo_travis="y" + wo_force_install="y" ;; -s | --silent) wo_force_install="y" @@ -77,9 +78,6 @@ while [ "$#" -gt 0 ]; do --purge | --uninstall) wo_purge="y" ;; - -w | --wufw | --without-ufw) - ufw="n" - ;; -v | --version) wo_version="$2" shift @@ -496,6 +494,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 diff --git a/tests/travis.sh b/tests/travis.sh index 8104c4d..b28671e 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 "" 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'):