From 009b5e1af67c3501fa21d044081ebe82088e3370 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Sun, 25 Oct 2020 23:11:24 +0100 Subject: [PATCH 1/5] Delete acme conf when domain is deleted --- wo/cli/plugins/site.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wo/cli/plugins/site.py b/wo/cli/plugins/site.py index 5f5c7e9..34033e5 100644 --- a/wo/cli/plugins/site.py +++ b/wo/cli/plugins/site.py @@ -17,6 +17,7 @@ from wo.core.services import WOService from wo.core.shellexec import WOShellExec, CommandExecutionError from wo.core.sslutils import SSL from wo.core.variables import WOVar +from wo.core.acme import WOAcme def wo_site_hook(app): @@ -432,6 +433,7 @@ class WOSiteDeleteController(CementBaseController): # TODO Delete nginx conf removeNginxConf(self, wo_domain) deleteSiteInfo(self, wo_domain) + WOAcme.removeconf(self, wo_domain) Log.info(self, "Deleted site {0}".format(wo_domain)) # else: # Log.error(self, " site {0} does @@ -442,6 +444,7 @@ class WOSiteDeleteController(CementBaseController): # TODO Delete nginx conf removeNginxConf(self, wo_domain) deleteSiteInfo(self, wo_domain) + WOAcme.removeconf(self, wo_domain) Log.info(self, "Deleted site {0}".format(wo_domain)) From 295b8420cfec70b0b2b4c72b56e1b25da73e2e53 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Mon, 26 Oct 2020 14:21:04 +0100 Subject: [PATCH 2/5] Fix virtualenv configuration --- CHANGELOG.md | 4 +++ install | 67 ++++++++++++++++++++++++++++++++---------- wo/cli/plugins/site.py | 5 +++- 3 files changed, 60 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c5f7b6a..94cc0ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### v3.9.x - [Unreleased] +#### Fixed + +- Python virtualenv configuration + #### v3.13.0 - 2020-10-25 #### Added diff --git a/install b/install index c5b8714..22b0352 100755 --- a/install +++ b/install @@ -209,13 +209,15 @@ wo_install_dep() { # install dependencies apt-get -option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --assume-yes install \ build-essential curl gzip python3-pip python3-apt python3-venv gcc python3-dev sqlite3 git tar software-properties-common pigz \ - gnupg2 cron ccze rsync apt-transport-https tree haveged ufw unattended-upgrades tzdata ntp zstd idn >/dev/null 2>&1 + gnupg2 cron ccze rsync apt-transport-https tree haveged ufw unattended-upgrades tzdata ntp zstd idn \ + python3-distutils-extra libapt-pkg-dev >/dev/null 2>&1 curl -sL https://download.opensuse.org/repositories/home:/virtubox:/WordOps/xUbuntu_18.04/Release.key | apt-key add - else # install dependencies apt-get -option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --assume-yes install \ build-essential curl gzip dirmngr sudo python3-pip python3-apt python3-venv gcc python3-dev ca-certificates sqlite3 git tar \ - software-properties-common pigz apt-transport-https gnupg2 cron ccze rsync tree haveged ufw unattended-upgrades tzdata ntp zstd idn >/dev/null 2>&1 + software-properties-common pigz apt-transport-https gnupg2 cron ccze rsync tree haveged ufw unattended-upgrades tzdata ntp zstd idn \ + python3-distutils-extra libapt-pkg-dev >/dev/null 2>&1 # add php repository gpg key [ -d /etc/apt/trusted.gpg.d ] && { wget -qO /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg; } # add nginx repository gpg key @@ -427,22 +429,41 @@ wo_install_acme_sh() { wo_install() { local python_ver python_ver=$(python3 -c "import sys; print(sys.version_info[1])") + local wo_distro_codename + wo_distro_codename=$(lsb_release -sc) + local wo_linux_distro + wo_linux_distro=$(lsb_release -is) if [ -d /usr/local/lib/python3."$python_ver"/dist-packages ]; then cd /usr/local/lib/python3."$python_ver"/dist-packages || exit 1 fi python3 -m pip uninstall -yq wo wordops ee - if [ -d /opt/wo ]; then - cd /opt/wo || exit 1 - source bin/activate + if [ -d /opt/wo/lib/python3."$python_ver"/site-packages/apt ]; then + source /opt/wo/bin/activate + python3 -m pip install -U pip setuptools wheel else - mkdir -p /opt/wo - cd /opt || exit 1 - python3 -m venv --system-site-packages wo - source wo/bin/activate + rm -rf /opt/wo + python3 -m venv /opt/wo + source /opt/wo/bin/activate + python3 -m pip install -U pip setuptools wheel + if [ "$wo_linux_distro" = "Debian" ] || [ "$wo_linux_distro" = "Raspbian" ]; then + if [ "$wo_distro_codename" = "strech" ]; then + python3 -m pip install git+https://salsa.debian.org/apt-team/python-apt.git@1.4.y#egg=python-apt + else + python3 -m pip install git+https://salsa.debian.org/apt-team/python-apt.git@1.8.4.y#egg=python-apt + fi + else + if [ "$wo_distro_codename" = "focal" ]; then + python3 -m pip install git+https://salsa.debian.org/apt-team/python-apt.git@2.0.0#egg=python-apt + elif [ "$wo_distro_codename" = "bionic" ]; then + python3 -m pip install git+https://salsa.debian.org/apt-team/python-apt.git@1.6.y#egg=python-apt + else + python3 -m pip install git+https://salsa.debian.org/apt-team/python-apt.git@1.1.y-xenial#egg=python-apt + fi + fi fi - python3 -m pip install -U pip setuptools wheel + if [ "$wo_branch" = "master" ]; then - python3 -m pip install -I wordops + python3 -m pip install -U wordops else python3 -m pip install -I "git+git://github.com/WordOps/WordOps.git@$wo_branch#egg=wordops" fi @@ -462,14 +483,30 @@ wo_travis_install() { rm -rf dist fi if [ -f ./setup.py ]; then - if [ -d /opt/wo ]; then + if [ -d /opt/wo/lib/python3."$python_ver"/site-packages/apt ]; then source /opt/wo/bin/activate + python3 -m pip install -U pip setuptools wheel else - mkdir -p /opt/wo - python3 -m venv --system-site-packages /opt/wo + rm -rf /opt/wo + python3 -m venv /opt/wo source /opt/wo/bin/activate + python3 -m pip install -U pip setuptools wheel + if [ "$wo_linux_distro" = "Debian" ] || [ "$wo_linux_distro" = "Raspbian" ]; then + if [ "$wo_distro_codename" = "strech" ]; then + python3 -m pip install git+https://salsa.debian.org/apt-team/python-apt.git@1.4.y#egg=python-apt + else + python3 -m pip install git+https://salsa.debian.org/apt-team/python-apt.git@1.8.4.y#egg=python-apt + fi + else + if [ "$wo_distro_codename" = "focal" ]; then + python3 -m pip install git+https://salsa.debian.org/apt-team/python-apt.git@2.0.0#egg=python-apt + elif [ "$wo_distro_codename" = "bionic" ]; then + python3 -m pip install git+https://salsa.debian.org/apt-team/python-apt.git@1.6.y#egg=python-apt + else + python3 -m pip install git+https://salsa.debian.org/apt-team/python-apt.git@1.1.y-xenial#egg=python-apt + fi + fi fi - python3 -m pip install -U pip setuptools wheel python3 -m pip install -U . else python3 -m pip install -U "git+git://github.com/WordOps/WordOps.git@$wo_branch#egg=wordops" diff --git a/wo/cli/plugins/site.py b/wo/cli/plugins/site.py index 34033e5..fec615c 100644 --- a/wo/cli/plugins/site.py +++ b/wo/cli/plugins/site.py @@ -444,7 +444,10 @@ class WOSiteDeleteController(CementBaseController): # TODO Delete nginx conf removeNginxConf(self, wo_domain) deleteSiteInfo(self, wo_domain) - WOAcme.removeconf(self, wo_domain) + # To improve + if not WOFileUtils.grepcheck( + self, '/var/www/22222/conf/nginx/ssl.conf', wo_domain): + WOAcme.removeconf(self, wo_domain) Log.info(self, "Deleted site {0}".format(wo_domain)) From 54905adf36b887c76dfa58115a16878dca06a669 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Mon, 26 Oct 2020 14:54:47 +0100 Subject: [PATCH 3/5] Fix python-apt install on Debian 9 --- CHANGELOG.md | 1 + install | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94cc0ca..6ec2d4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), #### Fixed - Python virtualenv configuration +- Removing ssl certificate when deleting a site #### v3.13.0 - 2020-10-25 diff --git a/install b/install index 22b0352..a30dd58 100755 --- a/install +++ b/install @@ -446,7 +446,7 @@ wo_install() { source /opt/wo/bin/activate python3 -m pip install -U pip setuptools wheel if [ "$wo_linux_distro" = "Debian" ] || [ "$wo_linux_distro" = "Raspbian" ]; then - if [ "$wo_distro_codename" = "strech" ]; then + if [ "$wo_distro_codename" = "stretch" ]; then python3 -m pip install git+https://salsa.debian.org/apt-team/python-apt.git@1.4.y#egg=python-apt else python3 -m pip install git+https://salsa.debian.org/apt-team/python-apt.git@1.8.4.y#egg=python-apt From dbb58192ec0886ada090ce5f42306401de7951db Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Mon, 26 Oct 2020 15:15:19 +0100 Subject: [PATCH 4/5] Ready for release --- CHANGELOG.md | 2 ++ install | 2 +- setup.py | 2 +- wo/core/variables.py | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ec2d4a..107d91a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### v3.9.x - [Unreleased] +#### v3.13.1 - 2020-10-26 + #### Fixed - Python virtualenv configuration diff --git a/install b/install index a30dd58..1eb89d8 100755 --- a/install +++ b/install @@ -9,7 +9,7 @@ # ------------------------------------------------------------------------- # wget -qO wo wops.cc && sudo -E bash wo # ------------------------------------------------------------------------- -# Version 3.13.0 - 2020-10-25 +# Version 3.13.1 - 2020-10-26 # ------------------------------------------------------------------------- # CONTENTS diff --git a/setup.py b/setup.py index d437072..05d08f0 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,7 @@ if os.geteuid() == 0: os.makedirs('/var/lib/wo/tmp/') setup(name='wordops', - version='3.13.0', + version='3.13.1', description='An essential toolset that eases server administration', long_description=LONG, long_description_content_type='text/markdown', diff --git a/wo/core/variables.py b/wo/core/variables.py index 6af68de..bc46051 100644 --- a/wo/core/variables.py +++ b/wo/core/variables.py @@ -14,7 +14,7 @@ class WOVar(): """Intialization of core variables""" # WordOps version - wo_version = "3.13.0" + wo_version = "3.13.1" # WordOps packages versions wo_wp_cli = "2.4.0" wo_adminer = "4.7.5" From 81218a07a46453f6a2279d1af6f667dc0965c807 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Mon, 26 Oct 2020 16:38:23 +0100 Subject: [PATCH 5/5] Fix travis --- install | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/install b/install index 1eb89d8..f7ce8df 100755 --- a/install +++ b/install @@ -479,6 +479,10 @@ wo_install() { wo_travis_install() { local python_ver python_ver=$(python3 -c "import sys; print(sys.version_info[1])") + local wo_distro_codename + wo_distro_codename=$(lsb_release -sc) + local wo_linux_distro + wo_linux_distro=$(lsb_release -is) if [ -d ./dist ]; then rm -rf dist fi @@ -492,7 +496,7 @@ wo_travis_install() { source /opt/wo/bin/activate python3 -m pip install -U pip setuptools wheel if [ "$wo_linux_distro" = "Debian" ] || [ "$wo_linux_distro" = "Raspbian" ]; then - if [ "$wo_distro_codename" = "strech" ]; then + if [ "$wo_distro_codename" = "stretch" ]; then python3 -m pip install git+https://salsa.debian.org/apt-team/python-apt.git@1.4.y#egg=python-apt else python3 -m pip install git+https://salsa.debian.org/apt-team/python-apt.git@1.8.4.y#egg=python-apt