Updating configuration (#197)
#### Added - [ACME] Display warning about sudo usage when issuing certificate with DNS API validation (require `sudo -E`) #### Changed - [ACME] Resolve domain IP over HTTPS with Cloudflare DNS Resolver - [CORE] Cement Framework updated to v2.10.2 - [SITE] database name = 0 to 16 characters from the site name + 4 randomly generated character - [SITE] database user = 0 to 12 characters from the site name + 4 randomy generated character - [STACK] Improve sysctl tweak deployment #### Fixed - [SITE] https redirection missing on subdomains sites - Issues with digitalocean mariadb repository - Cement Framework output handler issues - [CLEAN] check if Nginx is installed before purging fastcgi or opcache
This commit is contained in:
21
CHANGELOG.md
21
CHANGELOG.md
@@ -8,6 +8,27 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|||||||
|
|
||||||
### v3.9.x - [Unreleased]
|
### v3.9.x - [Unreleased]
|
||||||
|
|
||||||
|
### v3.10.3 - 2019-11-11
|
||||||
|
|
||||||
|
#### Added
|
||||||
|
|
||||||
|
- [ACME] Display warning about sudo usage when issuing certificate with DNS API validation (require `sudo -E`)
|
||||||
|
|
||||||
|
#### Changed
|
||||||
|
|
||||||
|
- [ACME] Resolve domain IP over HTTPS with Cloudflare DNS Resolver
|
||||||
|
- [CORE] Cement Framework updated to v2.10.2
|
||||||
|
- [SITE] database name = 0 to 16 characters from the site name + 4 randomly generated character
|
||||||
|
- [SITE] database user = 0 to 12 characters from the site name + 4 randomy generated character
|
||||||
|
- [STACK] Improve sysctl tweak deployment
|
||||||
|
|
||||||
|
#### Fixed
|
||||||
|
|
||||||
|
- [SITE] https redirection missing on subdomains sites
|
||||||
|
- Issues with digitalocean mariadb repository
|
||||||
|
- Cement Framework output handler issues
|
||||||
|
- [CLEAN] check if Nginx is installed before purging fastcgi or opcache
|
||||||
|
|
||||||
### v3.10.2 - 2019-11-06
|
### v3.10.2 - 2019-11-06
|
||||||
|
|
||||||
#### Added
|
#### Added
|
||||||
|
|||||||
14
install
14
install
@@ -9,7 +9,7 @@
|
|||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
# wget -qO wo wops.cc && sudo bash wo
|
# wget -qO wo wops.cc && sudo bash wo
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
# Version 3.10.2 - 2019-11-06
|
# Version 3.10.3 - 2019-11-11
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
|
|
||||||
# CONTENTS
|
# CONTENTS
|
||||||
@@ -207,13 +207,13 @@ wo_install_dep() {
|
|||||||
if [ "$wo_linux_distro" == "Ubuntu" ]; then
|
if [ "$wo_linux_distro" == "Ubuntu" ]; then
|
||||||
# install dependencies
|
# install dependencies
|
||||||
apt-get -option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --assume-yes install \
|
apt-get -option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --assume-yes install \
|
||||||
build-essential curl gzip python3-pip python3-wheel python3-apt python3-setuptools python3-dev sqlite3 git tar software-properties-common pigz \
|
build-essential curl gzip python3-pip python3-apt python3-dev sqlite3 git tar software-properties-common pigz \
|
||||||
gnupg2 cron ccze rsync apt-transport-https tree haveged ufw unattended-upgrades tzdata ntp >/dev/null 2>&1
|
gnupg2 cron ccze rsync apt-transport-https tree haveged ufw unattended-upgrades tzdata ntp >/dev/null 2>&1
|
||||||
curl -sL https://download.opensuse.org/repositories/home:/virtubox:/WordOps/xUbuntu_18.04/Release.key | apt-key add -
|
curl -sL https://download.opensuse.org/repositories/home:/virtubox:/WordOps/xUbuntu_18.04/Release.key | apt-key add -
|
||||||
else
|
else
|
||||||
# install dependencies
|
# install dependencies
|
||||||
apt-get -option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --assume-yes install \
|
apt-get -option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --assume-yes install \
|
||||||
build-essential curl gzip dirmngr sudo python3-pip python3-wheel python3-apt python3-setuptools python3-dev ca-certificates sqlite3 git tar \
|
build-essential curl gzip dirmngr sudo python3-pip python3-apt 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 >/dev/null 2>&1
|
software-properties-common pigz apt-transport-https gnupg2 cron ccze rsync tree haveged ufw unattended-upgrades tzdata ntp >/dev/null 2>&1
|
||||||
# add php repository gpg key
|
# 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; }
|
[ -d /etc/apt/trusted.gpg.d ] && { wget -qO /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg; }
|
||||||
@@ -631,7 +631,13 @@ wo_init() {
|
|||||||
|
|
||||||
if [ -z "$wo_travis" ]; then
|
if [ -z "$wo_travis" ]; then
|
||||||
# import easyengine opensusebuildservice gpg key to avoid issues with packages update
|
# import easyengine opensusebuildservice gpg key to avoid issues with packages update
|
||||||
apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv-keys 3050ac3cd2ae6f03 > /dev/null 2>&1
|
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3050ac3cd2ae6f03 > /dev/null 2>&1
|
||||||
|
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xF1656F24C74CD1D8 > /dev/null 2>&1
|
||||||
|
# fix digitalocean mariadb repository issue
|
||||||
|
sed -i 's/sfo1.mirrors.digitalocean.com\/mariadb/mariadb.mirrors.ovh.net\/MariaDB/' /etc/apt/sources.list.d/*.list > /dev/null 2>&1
|
||||||
|
if [ -f /etc/apt/preferences.d/MariaDB.pref ]; then
|
||||||
|
sed -i 's/sfo1.mirrors.digitalocean.com/mariadb.mirrors.ovh.net/' /etc/apt/preferences.d/MariaDB.pref > /dev/null 2>&1
|
||||||
|
fi
|
||||||
if ! {
|
if ! {
|
||||||
apt-get update --allow-releaseinfo-change -qq >/dev/null 2>&1
|
apt-get update --allow-releaseinfo-change -qq >/dev/null 2>&1
|
||||||
}; then
|
}; then
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cement==2.8.2
|
cement==2.10.12
|
||||||
pystache>=0.5.4
|
pystache>=0.5.4
|
||||||
pynginxconfig>=0.3.4
|
pynginxconfig>=0.3.4
|
||||||
PyMySQL>=0.9.3
|
PyMySQL>=0.9.3
|
||||||
|
|||||||
4
setup.py
4
setup.py
@@ -27,7 +27,7 @@ if os.geteuid() == 0:
|
|||||||
os.makedirs('/var/lib/wo/tmp/')
|
os.makedirs('/var/lib/wo/tmp/')
|
||||||
|
|
||||||
setup(name='wordops',
|
setup(name='wordops',
|
||||||
version='3.10.2',
|
version='3.10.3',
|
||||||
description='An essential toolset that eases server administration',
|
description='An essential toolset that eases server administration',
|
||||||
long_description=LONG,
|
long_description=LONG,
|
||||||
long_description_content_type='text/markdown',
|
long_description_content_type='text/markdown',
|
||||||
@@ -55,7 +55,7 @@ setup(name='wordops',
|
|||||||
# Required to build documentation
|
# Required to build documentation
|
||||||
# "Sphinx >= 1.0",
|
# "Sphinx >= 1.0",
|
||||||
# Required to function
|
# Required to function
|
||||||
'cement == 2.8.2',
|
'cement == 2.10.12',
|
||||||
'pystache >= 0.5.4',
|
'pystache >= 0.5.4',
|
||||||
'pynginxconfig >= 0.3.4',
|
'pynginxconfig >= 0.3.4',
|
||||||
'PyMySQL >= 0.9.3',
|
'PyMySQL >= 0.9.3',
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
from wo.utils import test
|
|
||||||
from wo.cli.main import get_test_app
|
|
||||||
|
|
||||||
|
|
||||||
class CliTestCaseStack(test.WOTestCase):
|
|
||||||
|
|
||||||
def test_wo_cli(self):
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_install_nginx(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'install', '--nginx'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_install_php(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'install', '--php'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_install_php73(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'install', '--php73'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_install_mysql(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'install', '--mysql'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_install_wpcli(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'install', '--wpcli'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_install_phpmyadmin(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'install', '--phpmyadmin'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_install_adminer(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'install', '--adminer'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_install_utils(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'install', '--utils'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
41
tests/cli/13_test_stack_install.py
Normal file
41
tests/cli/13_test_stack_install.py
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
from wo.utils import test
|
||||||
|
from wo.cli.main import WOTestApp
|
||||||
|
|
||||||
|
|
||||||
|
class CliTestCaseStack(test.WOTestCase):
|
||||||
|
|
||||||
|
def test_wo_cli(self):
|
||||||
|
with WOTestApp as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_install_nginx(self):
|
||||||
|
with WOTestApp(argv=['stack', 'install', '--nginx']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_install_php(self):
|
||||||
|
with WOTestApp(argv=['stack', 'install', '--php']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_install_php73(self):
|
||||||
|
with WOTestApp(argv=['stack', 'install', '--php73']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_install_mysql(self):
|
||||||
|
with WOTestApp(argv=['stack', 'install', '--mysql']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_install_wpcli(self):
|
||||||
|
with WOTestApp(argv=['stack', 'install', '--wpcli']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_install_phpmyadmin(self):
|
||||||
|
with WOTestApp(argv=['stack', 'install', '--phpmyadmin']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_install_adminer(self):
|
||||||
|
with WOTestApp(argv=['stack', 'install', '--adminer']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_install_utils(self):
|
||||||
|
with WOTestApp(argv=['stack', 'install', '--utils']) as app:
|
||||||
|
app.run()
|
||||||
25
tests/cli/14_test_stack_services_stop.py
Normal file
25
tests/cli/14_test_stack_services_stop.py
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
from wo.utils import test
|
||||||
|
from wo.cli.main import WOTestApp
|
||||||
|
|
||||||
|
|
||||||
|
class CliTestCaseStackStop(test.WOTestCase):
|
||||||
|
|
||||||
|
def test_wo_cli(self):
|
||||||
|
with WOTestApp as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_services_stop_nginx(self):
|
||||||
|
with WOTestApp(argv=['stack', 'stop', '--nginx']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_services_stop_php_fpm(self):
|
||||||
|
with WOTestApp(argv=['stack', 'stop', '--php']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_services_stop_mysql(self):
|
||||||
|
with WOTestApp(argv=['stack', 'stop', '--mysql']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_services_stop_all(self):
|
||||||
|
with WOTestApp(argv=['stack', 'stop']) as app:
|
||||||
|
app.run()
|
||||||
25
tests/cli/15_test_stack_services_start.py
Normal file
25
tests/cli/15_test_stack_services_start.py
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
from wo.utils import test
|
||||||
|
from wo.cli.main import WOTestApp
|
||||||
|
|
||||||
|
|
||||||
|
class CliTestCaseStackStart(test.WOTestCase):
|
||||||
|
|
||||||
|
def test_wo_cli(self):
|
||||||
|
with WOTestApp as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_services_start_nginx(self):
|
||||||
|
with WOTestApp(argv=['stack', 'start', '--nginx']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_services_start_php_fpm(self):
|
||||||
|
with WOTestApp(argv=['stack', 'start', '--php']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_services_start_mysql(self):
|
||||||
|
with WOTestApp(argv=['stack', 'start', '--mysql']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_services_start_all(self):
|
||||||
|
with WOTestApp(argv=['stack', 'start']) as app:
|
||||||
|
app.run()
|
||||||
25
tests/cli/16_test_stack_services_restart.py
Normal file
25
tests/cli/16_test_stack_services_restart.py
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
from wo.utils import test
|
||||||
|
from wo.cli.main import WOTestApp
|
||||||
|
|
||||||
|
|
||||||
|
class CliTestCaseStackRestart(test.WOTestCase):
|
||||||
|
|
||||||
|
def test_wo_cli(self):
|
||||||
|
with WOTestApp as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_services_restart_nginx(self):
|
||||||
|
with WOTestApp(argv=['stack', 'restart', '--nginx']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_services_restart_php_fpm(self):
|
||||||
|
with WOTestApp(argv=['stack', 'restart', '--php']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_services_restart_mysql(self):
|
||||||
|
with WOTestApp(argv=['stack', 'restart', '--mysql']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_services_restart_all(self):
|
||||||
|
with WOTestApp(argv=['stack', 'restart']) as app:
|
||||||
|
app.run()
|
||||||
25
tests/cli/17_test_stack_services_status.py
Normal file
25
tests/cli/17_test_stack_services_status.py
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
from wo.utils import test
|
||||||
|
from wo.cli.main import WOTestApp
|
||||||
|
|
||||||
|
|
||||||
|
class CliTestCaseStackStatus(test.WOTestCase):
|
||||||
|
|
||||||
|
def test_wo_cli(self):
|
||||||
|
with WOTestApp as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_services_status_nginx(self):
|
||||||
|
with WOTestApp(argv=['stack', 'status', '--nginx']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_services_status_php_fpm(self):
|
||||||
|
with WOTestApp(argv=['stack', 'status', '--php']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_services_status_mysql(self):
|
||||||
|
with WOTestApp(argv=['stack', 'status', '--mysql']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_services_status_all(self):
|
||||||
|
with WOTestApp(argv=['stack', 'status']) as app:
|
||||||
|
app.run()
|
||||||
50
tests/cli/18_test_site_create.py
Normal file
50
tests/cli/18_test_site_create.py
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
from wo.utils import test
|
||||||
|
from wo.cli.main import WOTestApp
|
||||||
|
|
||||||
|
|
||||||
|
class CliTestCaseSiteCreate(test.WOTestCase):
|
||||||
|
|
||||||
|
def test_wo_cli(self):
|
||||||
|
with WOTestApp as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_site_create_html(self):
|
||||||
|
with WOTestApp(argv=['site', 'create', 'example1.com',
|
||||||
|
'--html']) as app:
|
||||||
|
app.config.set('wo', '', True)
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_site_create_php(self):
|
||||||
|
with WOTestApp(argv=['site', 'create', 'example2.com',
|
||||||
|
'--php']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_site_create_mysql(self):
|
||||||
|
with WOTestApp(argv=['site', 'create', 'example3.com',
|
||||||
|
'--mysql']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_site_create_wp(self):
|
||||||
|
with WOTestApp(argv=['site', 'create', 'example4.com',
|
||||||
|
'--wp']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_site_create_wpsubdir(self):
|
||||||
|
with WOTestApp(argv=['site', 'create', 'example5.com',
|
||||||
|
'--wpsubdir']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_site_create_wpsubdomain(self):
|
||||||
|
with WOTestApp(argv=['site', 'create', 'example6.com',
|
||||||
|
'--wpsubdomain']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_site_create_wpfc(self):
|
||||||
|
with WOTestApp(argv=['site', 'create', 'example8.com',
|
||||||
|
'--wpfc']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_site_create_wpsc(self):
|
||||||
|
with WOTestApp(argv=['site', 'create', 'example9.com',
|
||||||
|
'--wpsc']) as app:
|
||||||
|
app.run()
|
||||||
13
tests/cli/19_test_site_disable.py
Normal file
13
tests/cli/19_test_site_disable.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
from wo.utils import test
|
||||||
|
from wo.cli.main import WOTestApp
|
||||||
|
|
||||||
|
|
||||||
|
class CliTestCaseSiteDisable(test.WOTestCase):
|
||||||
|
|
||||||
|
def test_wo_cli(self):
|
||||||
|
with WOTestApp as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_site_disable(self):
|
||||||
|
with WOTestApp(argv=['site', 'disable', 'example2.com']) as app:
|
||||||
|
app.run()
|
||||||
13
tests/cli/20_test_site_enable.py
Normal file
13
tests/cli/20_test_site_enable.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
from wo.utils import test
|
||||||
|
from wo.cli.main import WOTestApp
|
||||||
|
|
||||||
|
|
||||||
|
class CliTestCaseSiteEnable(test.WOTestCase):
|
||||||
|
|
||||||
|
def test_wo_cli(self):
|
||||||
|
with WOTestApp as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_site_enable(self):
|
||||||
|
with WOTestApp(argv=['site', 'enable', 'example2.com']) as app:
|
||||||
|
app.run()
|
||||||
13
tests/cli/21_test_site_info.py
Normal file
13
tests/cli/21_test_site_info.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
from wo.utils import test
|
||||||
|
from wo.cli.main import WOTestApp
|
||||||
|
|
||||||
|
|
||||||
|
class CliTestCaseSiteInfo(test.WOTestCase):
|
||||||
|
|
||||||
|
def test_wo_cli(self):
|
||||||
|
with WOTestApp as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_site_info(self):
|
||||||
|
with WOTestApp(argv=['site', 'info', 'example1.com']) as app:
|
||||||
|
app.run()
|
||||||
17
tests/cli/22_test_site_list.py
Normal file
17
tests/cli/22_test_site_list.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
from wo.utils import test
|
||||||
|
from wo.cli.main import WOTestApp
|
||||||
|
|
||||||
|
|
||||||
|
class CliTestCaseSiteList(test.WOTestCase):
|
||||||
|
|
||||||
|
def test_wo_cli(self):
|
||||||
|
with WOTestApp as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_site_list_enable(self):
|
||||||
|
with WOTestApp(argv=['site', 'list', '--enabled']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_site_list_disable(self):
|
||||||
|
with WOTestApp(argv=['site', 'list', '--disabled']) as app:
|
||||||
|
app.run()
|
||||||
13
tests/cli/23_test_site_show.py
Normal file
13
tests/cli/23_test_site_show.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
from wo.utils import test
|
||||||
|
from wo.cli.main import WOTestApp
|
||||||
|
|
||||||
|
|
||||||
|
class CliTestCaseSiteShow(test.WOTestCase):
|
||||||
|
|
||||||
|
def test_wo_cli(self):
|
||||||
|
with WOTestApp as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_show_edit(self):
|
||||||
|
with WOTestApp(argv=['site', 'show', 'example1.com']) as app:
|
||||||
|
app.run()
|
||||||
49
tests/cli/24_test_site_update.py
Normal file
49
tests/cli/24_test_site_update.py
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
from wo.utils import test
|
||||||
|
from wo.cli.main import WOTestApp
|
||||||
|
|
||||||
|
|
||||||
|
class CliTestCaseSiteUpdate(test.WOTestCase):
|
||||||
|
|
||||||
|
def test_wo_cli(self):
|
||||||
|
with WOTestApp as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_site_update_html(self):
|
||||||
|
with WOTestApp(argv=['site', 'update', 'example2.com',
|
||||||
|
'--html']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_site_update_php(self):
|
||||||
|
with WOTestApp(argv=['site', 'update', 'example1.com',
|
||||||
|
'--php']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_site_update_mysql(self):
|
||||||
|
with WOTestApp(argv=['site', 'update', 'example1.com',
|
||||||
|
'--html']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_site_update_wp(self):
|
||||||
|
with WOTestApp(argv=['site', 'update', 'example5.com',
|
||||||
|
'--wp']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_site_update_wpsubdir(self):
|
||||||
|
with WOTestApp(argv=['site', 'update', 'example4.com',
|
||||||
|
'--wpsubdir']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_site_update_wpsubdomain(self):
|
||||||
|
with WOTestApp(argv=['site', 'update', 'example7.com',
|
||||||
|
'--wpsubdomain']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_site_update_wpfc(self):
|
||||||
|
with WOTestApp(argv=['site', 'update', 'example9.com',
|
||||||
|
'--wpfc']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_site_update_wpsc(self):
|
||||||
|
with WOTestApp(argv=['site', 'update', 'example6.com',
|
||||||
|
'--wpsc']) as app:
|
||||||
|
app.run()
|
||||||
29
tests/cli/25_test_clean.py
Normal file
29
tests/cli/25_test_clean.py
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
from wo.utils import test
|
||||||
|
from wo.cli.main import WOTestApp
|
||||||
|
|
||||||
|
|
||||||
|
class CliTestCaseClean(test.WOTestCase):
|
||||||
|
|
||||||
|
def test_wo_cli(self):
|
||||||
|
with WOTestApp as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_clean(self):
|
||||||
|
with WOTestApp(argv=['clean']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_clean_fastcgi(self):
|
||||||
|
with WOTestApp(argv=['clean', '--fastcgi']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_clean_all(self):
|
||||||
|
with WOTestApp(argv=['clean', '--all']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_clean_opcache(self):
|
||||||
|
with WOTestApp(argv=['clean', '--opcache']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_clean_redis(self):
|
||||||
|
with WOTestApp(argv=['clean', '--redis']) as app:
|
||||||
|
app.run()
|
||||||
66
tests/cli/26_test_debug.py
Normal file
66
tests/cli/26_test_debug.py
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
from wo.utils import test
|
||||||
|
from wo.cli.main import WOTestApp
|
||||||
|
|
||||||
|
|
||||||
|
class CliTestCaseDebug(test.WOTestCase):
|
||||||
|
|
||||||
|
def test_wo_cli(self):
|
||||||
|
with WOTestApp as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_debug_stop(self):
|
||||||
|
with WOTestApp(argv=['debug', '--stop']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_debug_start(self):
|
||||||
|
with WOTestApp(argv=['debug', '--start']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_debug_php(self):
|
||||||
|
with WOTestApp(argv=['debug', '--php']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_debug_nginx(self):
|
||||||
|
with WOTestApp(argv=['debug', '--nginx']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_debug_rewrite(self):
|
||||||
|
with WOTestApp(argv=['debug', '--rewrite']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_debug_fpm(self):
|
||||||
|
with WOTestApp(argv=['debug', '--fpm']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_debug_mysql(self):
|
||||||
|
with WOTestApp(argv=['debug', '--mysql']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_debug_import_slow_log_interval(self):
|
||||||
|
with WOTestApp(argv=['debug', '--mysql',
|
||||||
|
'--import-slow-log-interval']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_debug_site_name_mysql(self):
|
||||||
|
with WOTestApp(argv=['debug', 'example3.com', '--mysql']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_debug_site_name_wp(self):
|
||||||
|
with WOTestApp(argv=['debug', 'example4.com', '--wp']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_debug_site_name_nginx(self):
|
||||||
|
with WOTestApp(argv=['debug', 'example4.com', '--nginx']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_debug_site_name_start(self):
|
||||||
|
with WOTestApp(argv=['debug', 'example1.com', '--start']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_debug_site_name_stop(self):
|
||||||
|
with WOTestApp(argv=['debug', 'example1.com', '--stop']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_debug_site_name_rewrite(self):
|
||||||
|
with WOTestApp(argv=['debug', 'example1.com', '--rewrite']) as app:
|
||||||
|
app.run()
|
||||||
21
tests/cli/27_test_info.py
Normal file
21
tests/cli/27_test_info.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
from wo.utils import test
|
||||||
|
from wo.cli.main import WOTestApp
|
||||||
|
|
||||||
|
|
||||||
|
class CliTestCaseInfo(test.WOTestCase):
|
||||||
|
|
||||||
|
def test_wo_cli(self):
|
||||||
|
with WOTestApp as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_info_mysql(self):
|
||||||
|
with WOTestApp(argv=['info', '--mysql']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_info_php(self):
|
||||||
|
with WOTestApp(argv=['info', '--php']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_info_nginx(self):
|
||||||
|
with WOTestApp(argv=['info', '--nginx']) as app:
|
||||||
|
app.run()
|
||||||
21
tests/cli/28_test_secure.py
Normal file
21
tests/cli/28_test_secure.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
from wo.utils import test
|
||||||
|
from wo.cli.main import WOTestApp
|
||||||
|
|
||||||
|
|
||||||
|
class CliTestCaseSecure(test.WOTestCase):
|
||||||
|
|
||||||
|
def test_wo_cli(self):
|
||||||
|
with WOTestApp as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_secure_auth(self):
|
||||||
|
with WOTestApp(argv=['secure', '--auth', 'abc', 'superpass']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_secure_port(self):
|
||||||
|
with WOTestApp(argv=['secure', '--port', '22222']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_secure_ip(self):
|
||||||
|
with WOTestApp(argv=['secure', '--ip', '172.16.0.1']) as app:
|
||||||
|
app.run()
|
||||||
29
tests/cli/29_test_site_delete.py
Normal file
29
tests/cli/29_test_site_delete.py
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
from wo.utils import test
|
||||||
|
from wo.cli.main import WOTestApp
|
||||||
|
|
||||||
|
|
||||||
|
class CliTestCaseSiteDelete(test.WOTestCase):
|
||||||
|
|
||||||
|
def test_wo_cli(self):
|
||||||
|
with WOTestApp as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_site_detele(self):
|
||||||
|
with WOTestApp(argv=['site', 'delete', 'example1.com',
|
||||||
|
'--no-prompt']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_site_detele_all(self):
|
||||||
|
with WOTestApp(argv=['site', 'delete', 'example2.com',
|
||||||
|
'--all', '--no-prompt']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_site_detele_db(self):
|
||||||
|
with WOTestApp(argv=['site', 'delete', 'example3.com',
|
||||||
|
'--db', '--no-prompt']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_site_detele_files(self):
|
||||||
|
with WOTestApp(argv=['site', 'delete', 'example4.com',
|
||||||
|
'--files', '--no-prompt']) as app:
|
||||||
|
app.run()
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
from wo.utils import test
|
|
||||||
from wo.cli.main import get_test_app
|
|
||||||
|
|
||||||
|
|
||||||
class CliTestCaseStack(test.WOTestCase):
|
|
||||||
|
|
||||||
def test_wo_cli(self):
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_services_start_nginx(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'start', '--nginx'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_services_start_php_fpm(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'start', '--php'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_services_start_mysql(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'start', '--mysql'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_services_start_all(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'start'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
43
tests/cli/30_test_stack_remove.py
Normal file
43
tests/cli/30_test_stack_remove.py
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
from wo.utils import test
|
||||||
|
from wo.cli.main import WOTestApp
|
||||||
|
|
||||||
|
|
||||||
|
class CliTestCaseStackRemove(test.WOTestCase):
|
||||||
|
|
||||||
|
def test_wo_cli(self):
|
||||||
|
with WOTestApp as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_remove_admin(self):
|
||||||
|
with WOTestApp(argv=['stack', 'remove', '--admin', '--force']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_remove_nginx(self):
|
||||||
|
with WOTestApp(argv=['stack', 'remove', '--nginx', '--force']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_remove_php(self):
|
||||||
|
with WOTestApp(argv=['stack', 'remove', '--php', '--force']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_remove_mysql(self):
|
||||||
|
with WOTestApp(argv=['stack', 'remove', '--mysql', '--force']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_remove_wpcli(self):
|
||||||
|
with WOTestApp(argv=['stack', 'remove', '--wpcli', '--force']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_remove_phpmyadmin(self):
|
||||||
|
with WOTestApp(argv=['stack', 'remove',
|
||||||
|
'--phpmyadmin', '--force']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_remove_adminer(self):
|
||||||
|
with WOTestApp(
|
||||||
|
argv=['stack', 'remove', '--adminer', '--force']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_remove_utils(self):
|
||||||
|
with WOTestApp(argv=['stack', 'remove', '--utils', '--force']) as app:
|
||||||
|
app.run()
|
||||||
54
tests/cli/31_test_stack_purge.py
Normal file
54
tests/cli/31_test_stack_purge.py
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
from wo.utils import test
|
||||||
|
from wo.cli.main import WOTestApp
|
||||||
|
|
||||||
|
|
||||||
|
class CliTestCaseStackPurge(test.WOTestCase):
|
||||||
|
|
||||||
|
def test_wo_cli(self):
|
||||||
|
with WOTestApp as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_purge_web(self):
|
||||||
|
with WOTestApp(
|
||||||
|
argv=['stack', 'purge', '--web', '--force']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_purge_admin(self):
|
||||||
|
with WOTestApp(
|
||||||
|
argv=['stack', 'purge', '--admin', '--force']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_purge_nginx(self):
|
||||||
|
with WOTestApp(
|
||||||
|
argv=['stack', 'purge', '--nginx', '--force']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_purge_php(self):
|
||||||
|
with WOTestApp(argv=['stack', 'purge',
|
||||||
|
'--php', '--force']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_purge_mysql(self):
|
||||||
|
with WOTestApp(argv=['stack', 'purge',
|
||||||
|
'--mysql', '--force']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_purge_wpcli(self):
|
||||||
|
with WOTestApp(argv=['stack', 'purge',
|
||||||
|
'--wpcli', '--force']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_purge_phpmyadmin(self):
|
||||||
|
with WOTestApp(
|
||||||
|
argv=['stack', 'purge', '--phpmyadmin', '--force']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_purge_adminer(self):
|
||||||
|
with WOTestApp(
|
||||||
|
argv=['stack', 'purge', '--adminer', '--force']) as app:
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
def test_wo_cli_stack_purge_utils(self):
|
||||||
|
with WOTestApp(argv=['stack', 'purge',
|
||||||
|
'--utils', '--force']) as app:
|
||||||
|
app.run()
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
from wo.utils import test
|
|
||||||
from wo.cli.main import get_test_app
|
|
||||||
|
|
||||||
|
|
||||||
class CliTestCaseStack(test.WOTestCase):
|
|
||||||
|
|
||||||
def test_wo_cli(self):
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_services_status_nginx(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'status', '--nginx'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_services_status_php_fpm(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'status', '--php'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_services_status_mysql(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'status', '--mysql'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_services_status_all(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'status'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
from wo.utils import test
|
|
||||||
from wo.cli.main import get_test_app
|
|
||||||
|
|
||||||
|
|
||||||
class CliTestCaseStack(test.WOTestCase):
|
|
||||||
|
|
||||||
def test_wo_cli(self):
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_services_stop_nginx(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'stop', '--nginx'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_services_stop_php_fpm(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'stop', '--php'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_services_stop_mysql(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'stop', '--mysql'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_services_stop_all(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'stop'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
from wo.utils import test
|
|
||||||
from wo.cli.main import get_test_app
|
|
||||||
|
|
||||||
|
|
||||||
class CliTestCaseStack(test.WOTestCase):
|
|
||||||
|
|
||||||
def test_wo_cli(self):
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_services_restart_nginx(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'restart', '--nginx'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_services_restart_php_fpm(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'restart', '--php'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_services_restart_mysql(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'restart', '--mysql'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_services_restart_all(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'restart'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
from wo.utils import test
|
|
||||||
from wo.cli.main import get_test_app
|
|
||||||
|
|
||||||
|
|
||||||
class CliTestCaseSite(test.WOTestCase):
|
|
||||||
|
|
||||||
def test_wo_cli(self):
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_site_create_html(self):
|
|
||||||
self.app = get_test_app(argv=['site', 'create', 'example1.com',
|
|
||||||
'--html'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_site_create_php(self):
|
|
||||||
self.app = get_test_app(argv=['site', 'create', 'example2.com',
|
|
||||||
'--php'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_site_create_mysql(self):
|
|
||||||
self.app = get_test_app(argv=['site', 'create', 'example3.com',
|
|
||||||
'--mysql'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_site_create_wp(self):
|
|
||||||
self.app = get_test_app(argv=['site', 'create', 'example4.com',
|
|
||||||
'--wp'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_site_create_wpsubdir(self):
|
|
||||||
self.app = get_test_app(argv=['site', 'create', 'example5.com',
|
|
||||||
'--wpsubdir'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_site_create_wpsubdomain(self):
|
|
||||||
self.app = get_test_app(argv=['site', 'create', 'example6.com',
|
|
||||||
'--wpsubdomain'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_site_create_wpfc(self):
|
|
||||||
self.app = get_test_app(argv=['site', 'create', 'example8.com',
|
|
||||||
'--wpfc'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_site_create_wpsc(self):
|
|
||||||
self.app = get_test_app(argv=['site', 'create', 'example9.com',
|
|
||||||
'--wpsc'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
from wo.utils import test
|
|
||||||
from wo.cli.main import get_test_app
|
|
||||||
|
|
||||||
|
|
||||||
class CliTestCaseSite(test.WOTestCase):
|
|
||||||
|
|
||||||
def test_wo_cli(self):
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_site_info(self):
|
|
||||||
self.app = get_test_app(argv=['site', 'info', 'example1.com'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
from wo.utils import test
|
|
||||||
from wo.cli.main import get_test_app
|
|
||||||
|
|
||||||
|
|
||||||
class CliTestCaseSite(test.WOTestCase):
|
|
||||||
|
|
||||||
def test_wo_cli(self):
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_site_list_enable(self):
|
|
||||||
self.app = get_test_app(argv=['site', 'list', '--enabled'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_site_list_disable(self):
|
|
||||||
self.app = get_test_app(argv=['site', 'list', '--disabled'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
from wo.utils import test
|
|
||||||
from wo.cli.main import get_test_app
|
|
||||||
|
|
||||||
|
|
||||||
class CliTestCaseSite(test.WOTestCase):
|
|
||||||
|
|
||||||
def test_wo_cli(self):
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_show_edit(self):
|
|
||||||
self.app = get_test_app(argv=['site', 'show', 'example1.com'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
from wo.utils import test
|
|
||||||
from wo.cli.main import get_test_app
|
|
||||||
|
|
||||||
|
|
||||||
class CliTestCaseSite(test.WOTestCase):
|
|
||||||
|
|
||||||
def test_wo_cli(self):
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_site_update_html(self):
|
|
||||||
self.app = get_test_app(argv=['site', 'update', 'example2.com',
|
|
||||||
'--html'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_site_update_php(self):
|
|
||||||
self.app = get_test_app(argv=['site', 'update', 'example1.com',
|
|
||||||
'--php'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_site_update_mysql(self):
|
|
||||||
self.app = get_test_app(argv=['site', 'update', 'example1.com',
|
|
||||||
'--html'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_site_update_wp(self):
|
|
||||||
self.app = get_test_app(argv=['site', 'update', 'example5.com',
|
|
||||||
'--wp'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_site_update_wpsubdir(self):
|
|
||||||
self.app = get_test_app(argv=['site', 'update', 'example4.com',
|
|
||||||
'--wpsubdir'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_site_update_wpsubdomain(self):
|
|
||||||
self.app = get_test_app(argv=['site', 'update', 'example7.com',
|
|
||||||
'--wpsubdomain'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_site_update_wpfc(self):
|
|
||||||
self.app = get_test_app(argv=['site', 'update', 'example9.com',
|
|
||||||
'--wpfc'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_site_update_wpsc(self):
|
|
||||||
self.app = get_test_app(argv=['site', 'update', 'example6.com',
|
|
||||||
'--wpsc'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
from wo.utils import test
|
|
||||||
from wo.cli.main import get_test_app
|
|
||||||
|
|
||||||
|
|
||||||
class CliTestCaseSite(test.WOTestCase):
|
|
||||||
|
|
||||||
def test_wo_cli(self):
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_site_enable(self):
|
|
||||||
self.app = get_test_app(argv=['site', 'enable', 'example2.com'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
from wo.utils import test
|
|
||||||
from wo.cli.main import get_test_app
|
|
||||||
|
|
||||||
|
|
||||||
class CliTestCaseSite(test.WOTestCase):
|
|
||||||
|
|
||||||
def test_wo_cli(self):
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_site_disable(self):
|
|
||||||
self.app = get_test_app(argv=['site', 'disable', 'example2.com'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
"""Tests for Example Plugin."""
|
|
||||||
|
|
||||||
from wo.utils.test import WOTestCase
|
|
||||||
|
|
||||||
|
|
||||||
class ExamplePluginTestCase(WOTestCase):
|
|
||||||
def test_load_example_plugin(self):
|
|
||||||
self.app.setup()
|
|
||||||
self.app.plugin.load_plugin('example')
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
from wo.utils import test
|
|
||||||
from wo.cli.main import get_test_app
|
|
||||||
|
|
||||||
|
|
||||||
class CliTestCaseClean(test.WOTestCase):
|
|
||||||
|
|
||||||
def test_wo_cli(self):
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_clean(self):
|
|
||||||
self.app = get_test_app(argv=['clean'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_clean_fastcgi(self):
|
|
||||||
self.app = get_test_app(argv=['clean', '--fastcgi'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_clean_all(self):
|
|
||||||
self.app = get_test_app(argv=['clean', '--all'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_clean_opcache(self):
|
|
||||||
self.app = get_test_app(argv=['clean', '--opcache'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
from wo.utils import test
|
|
||||||
from wo.cli.main import get_test_app
|
|
||||||
|
|
||||||
|
|
||||||
class CliTestCaseDebug(test.WOTestCase):
|
|
||||||
|
|
||||||
def test_wo_cli(self):
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_debug_stop(self):
|
|
||||||
self.app = get_test_app(argv=['debug', '--stop'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_debug_start(self):
|
|
||||||
self.app = get_test_app(argv=['debug', '--start'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_debug_php(self):
|
|
||||||
self.app = get_test_app(argv=['debug', '--php'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_debug_nginx(self):
|
|
||||||
self.app = get_test_app(argv=['debug', '--nginx'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_debug_rewrite(self):
|
|
||||||
self.app = get_test_app(argv=['debug', '--rewrite'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_debug_fpm(self):
|
|
||||||
self.app = get_test_app(argv=['debug', '--fpm'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_debug_mysql(self):
|
|
||||||
self.app = get_test_app(argv=['debug', '--mysql'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_debug_import_slow_log_interval(self):
|
|
||||||
self.app = get_test_app(argv=['debug', '--mysql',
|
|
||||||
'--import-slow-log-interval'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_debug_site_name_mysql(self):
|
|
||||||
self.app = get_test_app(argv=['debug', 'example3.com', '--mysql'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_debug_site_name_wp(self):
|
|
||||||
self.app = get_test_app(argv=['debug', 'example4.com', '--wp'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_debug_site_name_nginx(self):
|
|
||||||
self.app = get_test_app(argv=['debug', 'example4.com', '--nginx'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_debug_site_name_start(self):
|
|
||||||
self.app = get_test_app(argv=['debug', 'example1.com', '--start'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_debug_site_name_stop(self):
|
|
||||||
self.app = get_test_app(argv=['debug', 'example1.com', '--stop'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_debug_site_name_rewrite(self):
|
|
||||||
self.app = get_test_app(argv=['debug', 'example1.com', '--rewrite'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
from wo.utils import test
|
|
||||||
from wo.cli.main import get_test_app
|
|
||||||
|
|
||||||
|
|
||||||
class CliTestCaseInfo(test.WOTestCase):
|
|
||||||
|
|
||||||
def test_wo_cli(self):
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_info_mysql(self):
|
|
||||||
self.app = get_test_app(argv=['info', '--mysql'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_info_php(self):
|
|
||||||
self.app = get_test_app(argv=['info', '--php'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_info_nginx(self):
|
|
||||||
self.app = get_test_app(argv=['info', '--nginx'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
from wo.utils import test
|
|
||||||
from wo.cli.main import get_test_app
|
|
||||||
|
|
||||||
|
|
||||||
class CliTestCaseSecure(test.WOTestCase):
|
|
||||||
|
|
||||||
def test_wo_cli(self):
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_secure_auth(self):
|
|
||||||
self.app = get_test_app(argv=['secure', '--auth', 'abc', 'superpass'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_secure_port(self):
|
|
||||||
self.app = get_test_app(argv=['secure', '--port', '22222'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_secure_ip(self):
|
|
||||||
self.app = get_test_app(argv=['secure', '--ip', '172.16.0.1'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
from wo.utils import test
|
|
||||||
from wo.cli.main import get_test_app
|
|
||||||
|
|
||||||
|
|
||||||
class CliTestCaseSite(test.WOTestCase):
|
|
||||||
|
|
||||||
def test_wo_cli(self):
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_site_detele(self):
|
|
||||||
self.app = get_test_app(argv=['site', 'delete', 'example1.com',
|
|
||||||
'--no-prompt'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_site_detele_all(self):
|
|
||||||
self.app = get_test_app(argv=['site', 'delete', 'example2.com',
|
|
||||||
'--all', '--no-prompt'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_site_detele_db(self):
|
|
||||||
self.app = get_test_app(argv=['site', 'delete', 'example3.com',
|
|
||||||
'--db', '--no-prompt'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_site_detele_files(self):
|
|
||||||
self.app = get_test_app(argv=['site', 'delete', 'example4.com',
|
|
||||||
'--files', '--no-prompt'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
from wo.utils import test
|
|
||||||
from wo.cli.main import get_test_app
|
|
||||||
|
|
||||||
|
|
||||||
class CliTestCaseStack(test.WOTestCase):
|
|
||||||
|
|
||||||
def test_wo_cli(self):
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_purge_web(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'purge',
|
|
||||||
'--web', '--force'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_purge_admin(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'purge',
|
|
||||||
'--admin', '--force'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_purge_nginx(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'purge',
|
|
||||||
'--nginx', '--force'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_purge_php(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'purge',
|
|
||||||
'--php', '--force'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_purge_mysql(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'purge',
|
|
||||||
'--mysql', '--force'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_purge_wpcli(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'purge',
|
|
||||||
'--wpcli', '--force'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_purge_phpmyadmin(self):
|
|
||||||
self.app = get_test_app(
|
|
||||||
argv=['stack', 'purge', '--phpmyadmin', '--force'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_purge_adminer(self):
|
|
||||||
self.app = get_test_app(
|
|
||||||
argv=['stack', 'purge', '--adminer', '--force'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_purge_utils(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'purge',
|
|
||||||
'--utils', '--force'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
from wo.utils import test
|
|
||||||
from wo.cli.main import get_test_app
|
|
||||||
|
|
||||||
|
|
||||||
class CliTestCaseStack(test.WOTestCase):
|
|
||||||
|
|
||||||
def test_wo_cli(self):
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_remove_web(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'remove', '--web', '--force'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_install_admin(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'remove', '--admin', '--force'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_install_nginx(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'remove', '--nginx', '--force'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_install_php(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'remove', '--php', '--force'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_install_mysql(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'remove', '--mysql', '--force'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_install_wpcli(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'remove', '--wpcli', '--force'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_install_phpmyadmin(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'remove',
|
|
||||||
'--phpmyadmin', '--force'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_install_adminer(self):
|
|
||||||
self.app = get_test_app(
|
|
||||||
argv=['stack', 'remove', '--adminer', '--force'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
|
|
||||||
def test_wo_cli_stack_install_utils(self):
|
|
||||||
self.app = get_test_app(argv=['stack', 'remove', '--utils', '--force'])
|
|
||||||
self.app.setup()
|
|
||||||
self.app.run()
|
|
||||||
self.app.close()
|
|
||||||
@@ -15,9 +15,11 @@ export LANG='en_US.UTF-8'
|
|||||||
export LC_ALL='C.UTF-8'
|
export LC_ALL='C.UTF-8'
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
|
{
|
||||||
apt-get -qq purge mysql* graphviz* redis*
|
apt-get -qq purge mysql* graphviz* redis*
|
||||||
apt-get install -qq git python3-setuptools python3-dev python3-apt ccze tree
|
apt-get install -qq git python3-setuptools python3-dev python3-apt ccze tree
|
||||||
sudo apt-get -qq autoremove --purge
|
sudo apt-get -qq autoremove --purge
|
||||||
|
} > /dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit_script() {
|
exit_script() {
|
||||||
@@ -221,10 +223,21 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "${CGREEN}#############################################${CEND}"
|
echo -e "${CGREEN}#############################################${CEND}"
|
||||||
echo -e ' various informations '
|
echo -e ' WP-CLI info '
|
||||||
echo -e "${CGREEN}#############################################${CEND}"
|
echo -e "${CGREEN}#############################################${CEND}"
|
||||||
wp --allow-root --info
|
wp --allow-root --info
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo -e "${CGREEN}#############################################${CEND}"
|
||||||
|
echo -e ' wo site info '
|
||||||
|
echo -e "${CGREEN}#############################################${CEND}"
|
||||||
|
|
||||||
wo site info wp.net
|
wo site info wp.net
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo -e "${CGREEN}#############################################${CEND}"
|
||||||
|
echo -e ' wo info '
|
||||||
|
echo -e "${CGREEN}#############################################${CEND}"
|
||||||
wo info
|
wo info
|
||||||
|
|
||||||
echo -e "${CGREEN}#############################################${CEND}"
|
echo -e "${CGREEN}#############################################${CEND}"
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
# Based on https://github.com/datafolklabs/cement/issues/295
|
|
||||||
# To avoid encoding releated error,we defined our custom output handler
|
|
||||||
# I hope we will remove this when we upgarde to Cement 2.6 (Not released yet)
|
|
||||||
import os
|
|
||||||
|
|
||||||
from cement.ext.ext_mustache import MustacheOutputHandler
|
|
||||||
from cement.utils import fs
|
|
||||||
|
|
||||||
|
|
||||||
class WOOutputHandler(MustacheOutputHandler):
|
|
||||||
class Meta:
|
|
||||||
label = 'wo_output_handler'
|
|
||||||
|
|
||||||
def _load_template_from_file(self, path):
|
|
||||||
for templ_dir in self.app._meta.template_dirs:
|
|
||||||
full_path = fs.abspath(os.path.join(templ_dir, path))
|
|
||||||
if os.path.exists(full_path):
|
|
||||||
self.app.log.debug('loading template file %s' % full_path)
|
|
||||||
return open(full_path, encoding='utf-8', mode='r').read()
|
|
||||||
else:
|
|
||||||
continue
|
|
||||||
@@ -1,13 +1,12 @@
|
|||||||
"""WordOps main application entry point."""
|
"""WordOps main application entry point."""
|
||||||
import os
|
|
||||||
import sys
|
import sys
|
||||||
|
from os import geteuid
|
||||||
|
|
||||||
from cement.core.exc import CaughtSignal, FrameworkError
|
from cement.core.exc import CaughtSignal, FrameworkError
|
||||||
from cement.core.foundation import CementApp
|
from cement.core.foundation import CementApp
|
||||||
from cement.ext.ext_argparse import ArgParseArgumentHandler
|
from cement.ext.ext_argparse import ArgParseArgumentHandler
|
||||||
from cement.utils.misc import init_defaults
|
from cement.utils.misc import init_defaults
|
||||||
|
|
||||||
from wo.cli.ext.wo_outputhandler import WOOutputHandler
|
|
||||||
from wo.core import exc
|
from wo.core import exc
|
||||||
|
|
||||||
# this has to happen after you import sys, but before you import anything
|
# this has to happen after you import sys, but before you import anything
|
||||||
@@ -32,6 +31,17 @@ defaults['wo']['plugin_dir'] = '/var/lib/wo/plugins'
|
|||||||
defaults['wo']['template_dir'] = '/var/lib/wo/templates'
|
defaults['wo']['template_dir'] = '/var/lib/wo/templates'
|
||||||
|
|
||||||
|
|
||||||
|
def encode_output(app, text):
|
||||||
|
""" Encode the output to be suitable for the terminal
|
||||||
|
|
||||||
|
:param app: The Cement App (unused)
|
||||||
|
:param text: The rendered text
|
||||||
|
:return: The encoded text
|
||||||
|
"""
|
||||||
|
|
||||||
|
return text.encode("utf-8")
|
||||||
|
|
||||||
|
|
||||||
class WOArgHandler(ArgParseArgumentHandler):
|
class WOArgHandler(ArgParseArgumentHandler):
|
||||||
class Meta:
|
class Meta:
|
||||||
label = 'wo_args_handler'
|
label = 'wo_args_handler'
|
||||||
@@ -57,8 +67,11 @@ class WOApp(CementApp):
|
|||||||
|
|
||||||
extensions = ['mustache']
|
extensions = ['mustache']
|
||||||
|
|
||||||
# default output handler
|
hooks = [
|
||||||
output_handler = WOOutputHandler
|
("post_render", encode_output)
|
||||||
|
]
|
||||||
|
|
||||||
|
output_handler = 'mustache'
|
||||||
|
|
||||||
arg_handler = WOArgHandler
|
arg_handler = WOArgHandler
|
||||||
|
|
||||||
@@ -91,7 +104,7 @@ def main():
|
|||||||
global sys
|
global sys
|
||||||
|
|
||||||
# if not root...kick out
|
# if not root...kick out
|
||||||
if not os.geteuid() == 0:
|
if not geteuid() == 0:
|
||||||
print("\nNon-privileged users cant use WordOps. "
|
print("\nNon-privileged users cant use WordOps. "
|
||||||
"Switch to root or invoke sudo.\n")
|
"Switch to root or invoke sudo.\n")
|
||||||
app.close(1)
|
app.close(1)
|
||||||
@@ -103,14 +116,14 @@ def main():
|
|||||||
# Catch our application errors and exit 1 (error)
|
# Catch our application errors and exit 1 (error)
|
||||||
print('WOError > %s' % e)
|
print('WOError > %s' % e)
|
||||||
app.exit_code = 1
|
app.exit_code = 1
|
||||||
except FrameworkError as e:
|
|
||||||
# Catch framework errors and exit 1 (error)
|
|
||||||
print('FrameworkError > %s' % e)
|
|
||||||
app.exit_code = 1
|
|
||||||
except CaughtSignal as e:
|
except CaughtSignal as e:
|
||||||
# Default Cement signals are SIGINT and SIGTERM, exit 0 (non-error)
|
# Default Cement signals are SIGINT and SIGTERM, exit 0 (non-error)
|
||||||
print('CaughtSignal > %s' % e)
|
print('CaughtSignal > %s' % e)
|
||||||
app.exit_code = 0
|
app.exit_code = 0
|
||||||
|
except FrameworkError as e:
|
||||||
|
# Catch framework errors and exit 1 (error)
|
||||||
|
print('FrameworkError > %s' % e)
|
||||||
|
app.exit_code = 1
|
||||||
finally:
|
finally:
|
||||||
# Print an exception (if it occurred) and --debug was passed
|
# Print an exception (if it occurred) and --debug was passed
|
||||||
if app.debug:
|
if app.debug:
|
||||||
@@ -122,10 +135,5 @@ def main():
|
|||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
||||||
|
|
||||||
def get_test_app(**kw):
|
|
||||||
app = WOApp(**kw)
|
|
||||||
return app
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|||||||
@@ -37,9 +37,8 @@ class WOCleanController(CementBaseController):
|
|||||||
@expose(hide=True)
|
@expose(hide=True)
|
||||||
def default(self):
|
def default(self):
|
||||||
pargs = self.app.pargs
|
pargs = self.app.pargs
|
||||||
if (not (pargs.all or pargs.fastcgi
|
if ((not pargs.all) and (not pargs.fastcgi) and
|
||||||
or pargs.opcache or
|
(not pargs.opcache) and (not pargs.redis)):
|
||||||
pargs.redis)):
|
|
||||||
self.clean_fastcgi()
|
self.clean_fastcgi()
|
||||||
if pargs.all:
|
if pargs.all:
|
||||||
self.clean_fastcgi()
|
self.clean_fastcgi()
|
||||||
@@ -63,7 +62,8 @@ class WOCleanController(CementBaseController):
|
|||||||
|
|
||||||
@expose(hide=True)
|
@expose(hide=True)
|
||||||
def clean_fastcgi(self):
|
def clean_fastcgi(self):
|
||||||
if(os.path.isdir("/var/run/nginx-cache")):
|
if(os.path.isdir("/var/run/nginx-cache") and
|
||||||
|
os.path.exists('/usr/sbin/nginx')):
|
||||||
Log.info(self, "Cleaning NGINX FastCGI cache")
|
Log.info(self, "Cleaning NGINX FastCGI cache")
|
||||||
WOShellExec.cmd_exec(self, "rm -rf /var/run/nginx-cache/*")
|
WOShellExec.cmd_exec(self, "rm -rf /var/run/nginx-cache/*")
|
||||||
WOService.restart_service(self, 'nginx')
|
WOService.restart_service(self, 'nginx')
|
||||||
@@ -72,6 +72,9 @@ class WOCleanController(CementBaseController):
|
|||||||
|
|
||||||
@expose(hide=True)
|
@expose(hide=True)
|
||||||
def clean_opcache(self):
|
def clean_opcache(self):
|
||||||
|
if (os.path.exists('/usr/sbin/nginx') and
|
||||||
|
os.path.exists(
|
||||||
|
'/var/www/22222/htdocs/cache/opcache/opgui.php')):
|
||||||
try:
|
try:
|
||||||
Log.info(self, "Cleaning opcache")
|
Log.info(self, "Cleaning opcache")
|
||||||
opgui = requests.get(
|
opgui = requests.get(
|
||||||
|
|||||||
@@ -733,8 +733,11 @@ class WOSiteCreateController(CementBaseController):
|
|||||||
Log.debug(self, "Going to issue Let's Encrypt certificate")
|
Log.debug(self, "Going to issue Let's Encrypt certificate")
|
||||||
acmedata = dict(acme_domains, dns=False, acme_dns='dns_cf',
|
acmedata = dict(acme_domains, dns=False, acme_dns='dns_cf',
|
||||||
dnsalias=False, acme_alias='', keylength='')
|
dnsalias=False, acme_alias='', keylength='')
|
||||||
acmedata['keylength'] = self.app.config.get('letsencrypt',
|
if self.app.config.has_section('letsencrypt'):
|
||||||
'keylength')
|
acmedata['keylength'] = self.app.config.get(
|
||||||
|
'letsencrypt', 'keylength')
|
||||||
|
else:
|
||||||
|
acmedata['keylength'] = 'ec-384'
|
||||||
if pargs.dns:
|
if pargs.dns:
|
||||||
Log.debug(self, "DNS validation enabled")
|
Log.debug(self, "DNS validation enabled")
|
||||||
acmedata['dns'] = True
|
acmedata['dns'] = True
|
||||||
@@ -813,11 +816,11 @@ class WOSiteCreateController(CementBaseController):
|
|||||||
if WOAcme.setupletsencrypt(
|
if WOAcme.setupletsencrypt(
|
||||||
self, acme_domains, acmedata):
|
self, acme_domains, acmedata):
|
||||||
WOAcme.deploycert(self, wo_domain)
|
WOAcme.deploycert(self, wo_domain)
|
||||||
httpsRedirect(self, wo_domain, True, acme_wildcard)
|
|
||||||
|
|
||||||
if pargs.hsts:
|
if pargs.hsts:
|
||||||
SSL.setuphsts(self, wo_domain)
|
SSL.setuphsts(self, wo_domain)
|
||||||
|
|
||||||
|
httpsRedirect(self, wo_domain, True, acme_wildcard)
|
||||||
SSL.siteurlhttps(self, wo_domain)
|
SSL.siteurlhttps(self, wo_domain)
|
||||||
if not WOService.reload_service(self, 'nginx'):
|
if not WOService.reload_service(self, 'nginx'):
|
||||||
Log.error(self, "service nginx reload failed. "
|
Log.error(self, "service nginx reload failed. "
|
||||||
@@ -1594,7 +1597,7 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
"check issues with `nginx -t` command")
|
"check issues with `nginx -t` command")
|
||||||
|
|
||||||
updateSiteInfo(self, wo_domain, stype=stype, cache=cache,
|
updateSiteInfo(self, wo_domain, stype=stype, cache=cache,
|
||||||
ssl=True if check_site.is_ssl else False,
|
ssl=(bool(check_site.is_ssl)),
|
||||||
php_version=check_php_version)
|
php_version=check_php_version)
|
||||||
|
|
||||||
Log.info(self, "Successfully updated site"
|
Log.info(self, "Successfully updated site"
|
||||||
@@ -1973,7 +1976,10 @@ class WOSiteDeleteController(CementBaseController):
|
|||||||
if wo_site_type in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
|
if wo_site_type in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
|
||||||
wo_db_name = check_site.db_name
|
wo_db_name = check_site.db_name
|
||||||
wo_db_user = check_site.db_user
|
wo_db_user = check_site.db_user
|
||||||
|
if self.app.config.has_section('mysql'):
|
||||||
wo_mysql_grant_host = self.app.config.get('mysql', 'grant-host')
|
wo_mysql_grant_host = self.app.config.get('mysql', 'grant-host')
|
||||||
|
else:
|
||||||
|
wo_mysql_grant_host = 'localhost'
|
||||||
if wo_db_name == 'deleted':
|
if wo_db_name == 'deleted':
|
||||||
mark_db_deleted = True
|
mark_db_deleted = True
|
||||||
if pargs.all:
|
if pargs.all:
|
||||||
|
|||||||
@@ -149,9 +149,15 @@ def setupdatabase(self, data):
|
|||||||
string.ascii_lowercase +
|
string.ascii_lowercase +
|
||||||
string.digits, 24)))
|
string.digits, 24)))
|
||||||
wo_replace_dot = wo_domain_name.replace('.', '')
|
wo_replace_dot = wo_domain_name.replace('.', '')
|
||||||
|
if self.app.config.has_section('mysql'):
|
||||||
prompt_dbname = self.app.config.get('mysql', 'db-name')
|
prompt_dbname = self.app.config.get('mysql', 'db-name')
|
||||||
prompt_dbuser = self.app.config.get('mysql', 'db-user')
|
prompt_dbuser = self.app.config.get('mysql', 'db-user')
|
||||||
wo_mysql_grant_host = self.app.config.get('mysql', 'grant-host')
|
wo_mysql_grant_host = self.app.config.get('mysql', 'grant-host')
|
||||||
|
else:
|
||||||
|
prompt_dbname = False
|
||||||
|
prompt_dbuser = False
|
||||||
|
wo_mysql_grant_host = 'localhost'
|
||||||
|
|
||||||
wo_db_name = ''
|
wo_db_name = ''
|
||||||
wo_db_username = ''
|
wo_db_username = ''
|
||||||
wo_db_password = ''
|
wo_db_password = ''
|
||||||
@@ -165,7 +171,7 @@ def setupdatabase(self, data):
|
|||||||
|
|
||||||
if not wo_db_name:
|
if not wo_db_name:
|
||||||
wo_db_name = wo_replace_dot
|
wo_db_name = wo_replace_dot
|
||||||
wo_db_name = (wo_db_name[0:8] + generate_random())
|
wo_db_name = (wo_db_name[0:16] + generate_random())
|
||||||
|
|
||||||
if prompt_dbuser == 'True' or prompt_dbuser == 'true':
|
if prompt_dbuser == 'True' or prompt_dbuser == 'true':
|
||||||
try:
|
try:
|
||||||
@@ -179,7 +185,7 @@ def setupdatabase(self, data):
|
|||||||
|
|
||||||
if not wo_db_username:
|
if not wo_db_username:
|
||||||
wo_db_username = wo_replace_dot
|
wo_db_username = wo_replace_dot
|
||||||
wo_db_username = (wo_db_name[0:8] + generate_random())
|
wo_db_username = (wo_db_name[0:12] + generate_random())
|
||||||
if not wo_db_password:
|
if not wo_db_password:
|
||||||
wo_db_password = wo_random_pass
|
wo_db_password = wo_random_pass
|
||||||
|
|
||||||
@@ -189,8 +195,8 @@ def setupdatabase(self, data):
|
|||||||
try:
|
try:
|
||||||
if WOMysql.check_db_exists(self, wo_db_name):
|
if WOMysql.check_db_exists(self, wo_db_name):
|
||||||
Log.debug(self, "Database already exists, Updating DB_NAME .. ")
|
Log.debug(self, "Database already exists, Updating DB_NAME .. ")
|
||||||
wo_db_name = (wo_db_name[0:8] + generate_random())
|
wo_db_name = (wo_db_name[0:16] + generate_random())
|
||||||
wo_db_username = (wo_db_name[0:8] + generate_random())
|
wo_db_username = (wo_db_name[0:12] + generate_random())
|
||||||
except MySQLConnectionError:
|
except MySQLConnectionError:
|
||||||
raise SiteError("MySQL Connectivity problem occured")
|
raise SiteError("MySQL Connectivity problem occured")
|
||||||
|
|
||||||
@@ -237,10 +243,16 @@ def setupdatabase(self, data):
|
|||||||
def setupwordpress(self, data, vhostonly=False):
|
def setupwordpress(self, data, vhostonly=False):
|
||||||
wo_domain_name = data['site_name']
|
wo_domain_name = data['site_name']
|
||||||
wo_site_webroot = data['webroot']
|
wo_site_webroot = data['webroot']
|
||||||
|
if self.app.config.has_section('wordpress'):
|
||||||
prompt_wpprefix = self.app.config.get('wordpress', 'prefix')
|
prompt_wpprefix = self.app.config.get('wordpress', 'prefix')
|
||||||
wo_wp_user = self.app.config.get('wordpress', 'user')
|
wo_wp_user = self.app.config.get('wordpress', 'user')
|
||||||
wo_wp_pass = self.app.config.get('wordpress', 'password')
|
wo_wp_pass = self.app.config.get('wordpress', 'password')
|
||||||
wo_wp_email = self.app.config.get('wordpress', 'email')
|
wo_wp_email = self.app.config.get('wordpress', 'email')
|
||||||
|
else:
|
||||||
|
prompt_wpprefix = False
|
||||||
|
wo_wp_user = ''
|
||||||
|
wo_wp_pass = ''
|
||||||
|
wo_wp_email = ''
|
||||||
# Random characters
|
# Random characters
|
||||||
wo_random_pass = (''.join(random.sample(string.ascii_uppercase +
|
wo_random_pass = (''.join(random.sample(string.ascii_uppercase +
|
||||||
string.ascii_lowercase +
|
string.ascii_lowercase +
|
||||||
@@ -380,10 +392,7 @@ def setupwordpress(self, data, vhostonly=False):
|
|||||||
for wp_conf in wp_conf_variables:
|
for wp_conf in wp_conf_variables:
|
||||||
wp_var = wp_conf[0]
|
wp_var = wp_conf[0]
|
||||||
wp_val = wp_conf[1]
|
wp_val = wp_conf[1]
|
||||||
if wp_val == 'true' or wp_val == 'false':
|
var_raw = (bool(wp_val == 'true' or wp_val == 'false'))
|
||||||
var_raw = True
|
|
||||||
else:
|
|
||||||
var_raw = False
|
|
||||||
try:
|
try:
|
||||||
WOShellExec.cmd_exec(
|
WOShellExec.cmd_exec(
|
||||||
self, "/bin/bash -c \"{0} --allow-root "
|
self, "/bin/bash -c \"{0} --allow-root "
|
||||||
@@ -1195,7 +1204,7 @@ def generate_random_pass():
|
|||||||
def generate_random():
|
def generate_random():
|
||||||
wo_random10 = (''.join(random.sample(string.ascii_uppercase +
|
wo_random10 = (''.join(random.sample(string.ascii_uppercase +
|
||||||
string.ascii_lowercase +
|
string.ascii_lowercase +
|
||||||
string.digits, 8)))
|
string.digits, 4)))
|
||||||
return wo_random10
|
return wo_random10
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ class WOStackController(CementBaseController):
|
|||||||
(not pargs.cheat) and (not pargs.nanorc) and
|
(not pargs.cheat) and (not pargs.nanorc) and
|
||||||
(not pargs.ufw) and (not pargs.ngxblocker) and
|
(not pargs.ufw) and (not pargs.ngxblocker) and
|
||||||
(not pargs.phpredisadmin) and (not pargs.sendmail) and
|
(not pargs.phpredisadmin) and (not pargs.sendmail) and
|
||||||
(not pargs.php73)):
|
(not pargs.php73) and (not pargs.all)):
|
||||||
pargs.web = True
|
pargs.web = True
|
||||||
pargs.admin = True
|
pargs.admin = True
|
||||||
pargs.fail2ban = True
|
pargs.fail2ban = True
|
||||||
@@ -563,7 +563,7 @@ class WOStackController(CementBaseController):
|
|||||||
(not pargs.cheat) and (not pargs.nanorc) and
|
(not pargs.cheat) and (not pargs.nanorc) and
|
||||||
(not pargs.ufw) and (not pargs.ngxblocker) and
|
(not pargs.ufw) and (not pargs.ngxblocker) and
|
||||||
(not pargs.phpredisadmin) and (not pargs.sendmail) and
|
(not pargs.phpredisadmin) and (not pargs.sendmail) and
|
||||||
(not pargs.php73)):
|
(not pargs.php73) and (not pargs.all)):
|
||||||
self.app.args.print_help()
|
self.app.args.print_help()
|
||||||
|
|
||||||
if pargs.all:
|
if pargs.all:
|
||||||
@@ -849,7 +849,7 @@ class WOStackController(CementBaseController):
|
|||||||
(not pargs.cheat) and (not pargs.nanorc) and
|
(not pargs.cheat) and (not pargs.nanorc) and
|
||||||
(not pargs.ufw) and (not pargs.ngxblocker) and
|
(not pargs.ufw) and (not pargs.ngxblocker) and
|
||||||
(not pargs.phpredisadmin) and (not pargs.sendmail) and
|
(not pargs.phpredisadmin) and (not pargs.sendmail) and
|
||||||
(not pargs.php73)):
|
(not pargs.php73) and (not pargs.all)):
|
||||||
self.app.args.print_help()
|
self.app.args.print_help()
|
||||||
|
|
||||||
if pargs.all:
|
if pargs.all:
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ def pre_pref(self, apt_packages):
|
|||||||
# add mariadb repository excepted on raspbian and ubuntu 19.04
|
# add mariadb repository excepted on raspbian and ubuntu 19.04
|
||||||
if (not WOVar.wo_distro == 'raspbian'):
|
if (not WOVar.wo_distro == 'raspbian'):
|
||||||
Log.info(self, "Adding repository for MySQL, please wait...")
|
Log.info(self, "Adding repository for MySQL, please wait...")
|
||||||
mysql_pref = ("Package: *\nPin: origin "
|
mysql_pref = (
|
||||||
"sfo1.mirrors.digitalocean.com"
|
"Package: *\nPin: origin mariadb.mirrors.ovh.net"
|
||||||
"\nPin-Priority: 1000\n")
|
"\nPin-Priority: 1000\n")
|
||||||
with open('/etc/apt/preferences.d/'
|
with open('/etc/apt/preferences.d/'
|
||||||
'MariaDB.pref', 'w') as mysql_pref_file:
|
'MariaDB.pref', 'w') as mysql_pref_file:
|
||||||
@@ -215,24 +215,23 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
self, '{0}/upstream.conf'.format(ngxcnf),
|
self, '{0}/upstream.conf'.format(ngxcnf),
|
||||||
'upstream.mustache', data, overwrite=True)
|
'upstream.mustache', data, overwrite=True)
|
||||||
|
|
||||||
data = dict(phpconf=True if
|
data = dict(phpconf=(
|
||||||
WOAptGet.is_installed(self, 'php7.2-fpm')
|
bool(WOAptGet.is_installed(self, 'php7.2-fpm'))))
|
||||||
else False)
|
WOTemplate.deploy(
|
||||||
WOTemplate.deploy(self,
|
self, '{0}/stub_status.conf'.format(ngxcnf),
|
||||||
'{0}/stub_status.conf'.format(ngxcnf),
|
|
||||||
'stub_status.mustache', data)
|
'stub_status.mustache', data)
|
||||||
data = dict()
|
data = dict()
|
||||||
WOTemplate.deploy(self,
|
WOTemplate.deploy(
|
||||||
'{0}/webp.conf'.format(ngxcnf),
|
self, '{0}/webp.conf'.format(ngxcnf),
|
||||||
'webp.mustache', data, overwrite=False)
|
'webp.mustache', data, overwrite=False)
|
||||||
|
|
||||||
WOTemplate.deploy(self,
|
WOTemplate.deploy(
|
||||||
'{0}/cloudflare.conf'.format(ngxcnf),
|
self, '{0}/cloudflare.conf'.format(ngxcnf),
|
||||||
'cloudflare.mustache', data)
|
'cloudflare.mustache', data)
|
||||||
|
|
||||||
WOTemplate.deploy(self,
|
WOTemplate.deploy(
|
||||||
'{0}/map-wp-fastcgi-cache.conf'.format(
|
self,
|
||||||
ngxcnf),
|
'{0}/map-wp-fastcgi-cache.conf'.format(ngxcnf),
|
||||||
'map-wp.mustache', data)
|
'map-wp.mustache', data)
|
||||||
except CommandExecutionError as e:
|
except CommandExecutionError as e:
|
||||||
Log.debug(self, "{0}".format(e))
|
Log.debug(self, "{0}".format(e))
|
||||||
@@ -1401,13 +1400,14 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
Log.debug(self, "{0}".format(e))
|
Log.debug(self, "{0}".format(e))
|
||||||
Log.error(self, "failed to configure Anemometer",
|
Log.error(self, "failed to configure Anemometer",
|
||||||
exit=False)
|
exit=False)
|
||||||
|
if self.app.config.has_section('mysql'):
|
||||||
|
wo_grant_host = self.app.config.get('mysql', 'grant-host')
|
||||||
|
else:
|
||||||
|
wo_grant_host = 'localhost'
|
||||||
WOMysql.execute(self, 'grant select on'
|
WOMysql.execute(self, 'grant select on'
|
||||||
' *.* to \'anemometer\''
|
' *.* to \'anemometer\''
|
||||||
'@\'{0}\' IDENTIFIED'
|
'@\'{0}\' IDENTIFIED'
|
||||||
' BY \'{1}\''.format(self.app.config.get
|
' BY \'{1}\''.format(wo_grant_host,
|
||||||
('mysql',
|
|
||||||
'grant-host'),
|
|
||||||
chars))
|
chars))
|
||||||
Log.debug(self, "grant all on slow-query-log.*"
|
Log.debug(self, "grant all on slow-query-log.*"
|
||||||
" to anemometer@root_user"
|
" to anemometer@root_user"
|
||||||
@@ -1447,9 +1447,23 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
|
|
||||||
def pre_stack(self):
|
def pre_stack(self):
|
||||||
"""Inital server configuration and tweak"""
|
"""Inital server configuration and tweak"""
|
||||||
|
# remove old sysctl tweak
|
||||||
|
if os.path.isfile('/etc/sysctl.d/60-ubuntu-nginx-web-server.conf'):
|
||||||
|
WOFileUtils.rm(
|
||||||
|
self, '/etc/sysctl.d/60-ubuntu-nginx-web-server.conf')
|
||||||
|
# check if version.txt exist
|
||||||
|
if os.path.exists('/var/lib/wo/version.txt'):
|
||||||
|
with open('/var/lib/wo/version.txt',
|
||||||
|
mode='r', encoding='utf-8') as wo_ver:
|
||||||
|
# check version written in version.txt
|
||||||
|
wo_check = bool(wo_ver.read().strip() ==
|
||||||
|
'{0}'.format(WOVar.wo_version))
|
||||||
|
else:
|
||||||
|
wo_check = False
|
||||||
|
if wo_check is False:
|
||||||
# wo sysctl tweaks
|
# wo sysctl tweaks
|
||||||
# check system type
|
# check system type
|
||||||
wo_arch = os.uname()[4]
|
wo_arch = bool(os.uname()[4] == 'x86_x64')
|
||||||
if os.path.isfile('/proc/1/environ'):
|
if os.path.isfile('/proc/1/environ'):
|
||||||
# detect lxc containers
|
# detect lxc containers
|
||||||
wo_lxc = WOFileUtils.grepcheck(
|
wo_lxc = WOFileUtils.grepcheck(
|
||||||
@@ -1460,12 +1474,8 @@ def pre_stack(self):
|
|||||||
else:
|
else:
|
||||||
wo_wsl = True
|
wo_wsl = True
|
||||||
wo_lxc = True
|
wo_lxc = True
|
||||||
# remove old sysctl tweak
|
|
||||||
if os.path.isfile('/etc/sysctl.d/60-ubuntu-nginx-web-server.conf'):
|
|
||||||
WOFileUtils.rm(self, '/etc/sysctl.d/60-ubuntu-nginx-web-server.conf')
|
|
||||||
|
|
||||||
if wo_arch == 'x86_64':
|
if (wo_lxc is not True) and (wo_wsl is not True) and (wo_arch is True):
|
||||||
if (wo_lxc is not True) and (wo_wsl is not True):
|
|
||||||
data = dict()
|
data = dict()
|
||||||
WOTemplate.deploy(
|
WOTemplate.deploy(
|
||||||
self, '/etc/sysctl.d/60-wo-tweaks.conf',
|
self, '/etc/sysctl.d/60-wo-tweaks.conf',
|
||||||
@@ -1474,27 +1484,43 @@ def pre_stack(self):
|
|||||||
if (WOVar.wo_platform_codename == 'bionic' or
|
if (WOVar.wo_platform_codename == 'bionic' or
|
||||||
WOVar.wo_platform_codename == 'disco' or
|
WOVar.wo_platform_codename == 'disco' or
|
||||||
WOVar.wo_platform_codename == 'buster'):
|
WOVar.wo_platform_codename == 'buster'):
|
||||||
if WOShellExec.cmd_exec(self, 'modprobe tcp_bbr'):
|
try:
|
||||||
with open("/etc/modules-load.d/bbr.conf",
|
WOShellExec.cmd_exec(
|
||||||
|
self, 'modprobe tcp_bbr')
|
||||||
|
with open(
|
||||||
|
"/etc/modules-load.d/bbr.conf",
|
||||||
encoding='utf-8', mode='w') as bbr_file:
|
encoding='utf-8', mode='w') as bbr_file:
|
||||||
bbr_file.write('tcp_bbr')
|
bbr_file.write('tcp_bbr')
|
||||||
with open("/etc/sysctl.d/60-wo-tweaks.conf",
|
with open(
|
||||||
|
"/etc/sysctl.d/60-wo-tweaks.conf",
|
||||||
encoding='utf-8', mode='a') as sysctl_file:
|
encoding='utf-8', mode='a') as sysctl_file:
|
||||||
sysctl_file.write(
|
sysctl_file.write(
|
||||||
'\nnet.ipv4.tcp_congestion_control = bbr'
|
'\nnet.ipv4.tcp_congestion_control = bbr'
|
||||||
'\nnet.ipv4.tcp_notsent_lowat = 16384')
|
'\nnet.ipv4.tcp_notsent_lowat = 16384')
|
||||||
|
except OSError as e:
|
||||||
|
Log.debug(self, str(e))
|
||||||
|
Log.warn(self, "failed to tweak sysctl")
|
||||||
else:
|
else:
|
||||||
if WOShellExec.cmd_exec(self, 'modprobe tcp_htcp'):
|
try:
|
||||||
with open("/etc/modules-load.d/htcp.conf",
|
WOShellExec.cmd_exec(
|
||||||
|
self, 'modprobe tcp_htcp')
|
||||||
|
with open(
|
||||||
|
"/etc/modules-load.d/htcp.conf",
|
||||||
encoding='utf-8', mode='w') as bbr_file:
|
encoding='utf-8', mode='w') as bbr_file:
|
||||||
bbr_file.write('tcp_htcp')
|
bbr_file.write('tcp_htcp')
|
||||||
with open("/etc/sysctl.d/60-wo-tweaks.conf",
|
with open(
|
||||||
|
"/etc/sysctl.d/60-wo-tweaks.conf",
|
||||||
encoding='utf-8', mode='a') as sysctl_file:
|
encoding='utf-8', mode='a') as sysctl_file:
|
||||||
sysctl_file.write(
|
sysctl_file.write(
|
||||||
'\nnet.ipv4.tcp_congestion_control = htcp')
|
'\nnet.ipv4.tcp_congestion_control = htcp')
|
||||||
|
except OSError as e:
|
||||||
|
Log.debug(self, str(e))
|
||||||
|
Log.warn(self, "failed to tweak sysctl")
|
||||||
|
|
||||||
# apply sysctl tweaks
|
# apply sysctl tweaks
|
||||||
WOShellExec.cmd_exec(
|
WOShellExec.cmd_exec(
|
||||||
self, 'sysctl -eq -p /etc/sysctl.d/60-wo-tweaks.conf')
|
self, 'sysctl -eq -p /etc/sysctl.d/60-wo-tweaks.conf')
|
||||||
|
|
||||||
# sysctl tweak service
|
# sysctl tweak service
|
||||||
data = dict()
|
data = dict()
|
||||||
if not os.path.isfile('/opt/wo-kernel.sh'):
|
if not os.path.isfile('/opt/wo-kernel.sh'):
|
||||||
@@ -1507,9 +1533,10 @@ def pre_stack(self):
|
|||||||
WOShellExec.cmd_exec(self, 'systemctl enable wo-kernel.service')
|
WOShellExec.cmd_exec(self, 'systemctl enable wo-kernel.service')
|
||||||
WOService.start_service(self, 'wo-kernel')
|
WOService.start_service(self, 'wo-kernel')
|
||||||
# open_files_limit tweak
|
# open_files_limit tweak
|
||||||
if not WOFileUtils.grepcheck(self, '/etc/security/limits.conf', '500000'):
|
if not WOFileUtils.grepcheck(self,
|
||||||
|
'/etc/security/limits.conf', '500000'):
|
||||||
with open("/etc/security/limits.conf",
|
with open("/etc/security/limits.conf",
|
||||||
encoding='utf-8', mode='w') as limit_file:
|
encoding='utf-8', mode='a') as limit_file:
|
||||||
limit_file.write(
|
limit_file.write(
|
||||||
'* hard nofile 500000\n'
|
'* hard nofile 500000\n'
|
||||||
'* soft nofile 500000\n'
|
'* soft nofile 500000\n'
|
||||||
@@ -1519,13 +1546,12 @@ def pre_stack(self):
|
|||||||
data = dict()
|
data = dict()
|
||||||
# check if update-motd.d directory exist
|
# check if update-motd.d directory exist
|
||||||
if os.path.isdir('/etc/update-motd.d/'):
|
if os.path.isdir('/etc/update-motd.d/'):
|
||||||
if not os.path.isfile('/etc/update-motd.d/98-wo-update'):
|
|
||||||
# render custom motd template
|
# render custom motd template
|
||||||
WOTemplate.deploy(
|
WOTemplate.deploy(
|
||||||
self, '/etc/update-motd.d/98-wo-update',
|
self, '/etc/update-motd.d/98-wo-update',
|
||||||
'wo-update.mustache', data)
|
'wo-update.mustache', data)
|
||||||
WOFileUtils.chmod(
|
WOFileUtils.chmod(
|
||||||
self, "/etc/update-motd.d/98-wo-update", 0o755)
|
self, "/etc/update-motd.d/98-wo-update", 0o755)
|
||||||
# restart motd-news service if available
|
with open('/var/lib/wo/version.txt',
|
||||||
if os.path.isfile('/lib/systemd/system/motd-news.service'):
|
mode='w', encoding='utf-8') as wo_ver:
|
||||||
WOService.restart_service(self, 'motd-news')
|
wo_ver.write('{0}'.format(WOVar.wo_version))
|
||||||
|
|||||||
@@ -65,9 +65,10 @@ class WOUpdateController(CementBaseController):
|
|||||||
wo_current = ("v{0}".format(WOVar.wo_version))
|
wo_current = ("v{0}".format(WOVar.wo_version))
|
||||||
wo_latest = WODownload.latest_release(self, "WordOps/WordOps")
|
wo_latest = WODownload.latest_release(self, "WordOps/WordOps")
|
||||||
if wo_current == wo_latest:
|
if wo_current == wo_latest:
|
||||||
Log.error(
|
Log.info(
|
||||||
self, "WordOps {0} is already installed"
|
self, "WordOps {0} is already installed"
|
||||||
.format(wo_latest))
|
.format(wo_latest))
|
||||||
|
self.app.close(0)
|
||||||
|
|
||||||
if not os.path.isdir('/var/lib/wo/tmp'):
|
if not os.path.isdir('/var/lib/wo/tmp'):
|
||||||
os.makedirs('/var/lib/wo/tmp')
|
os.makedirs('/var/lib/wo/tmp')
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ location /wp-content/uploads {
|
|||||||
expires max;
|
expires max;
|
||||||
try_files $uri$webp_suffix $uri =404;
|
try_files $uri$webp_suffix $uri =404;
|
||||||
}
|
}
|
||||||
location ~* \.(php|gz|log|zip|tar|rar)$ {
|
location ~* \.(php|gz|log|zip|tar|rar|xz)$ {
|
||||||
#Prevent Direct Access Of PHP Files & BackupsFrom Web Browsers
|
#Prevent Direct Access Of PHP Files & BackupsFrom Web Browsers
|
||||||
deny all;
|
deny all;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,8 @@ class WOAcme:
|
|||||||
if acmedata['dns'] is True:
|
if acmedata['dns'] is True:
|
||||||
Log.error(
|
Log.error(
|
||||||
self, "Please make sure your properly "
|
self, "Please make sure your properly "
|
||||||
"set your DNS API credentials for acme.sh")
|
"set your DNS API credentials for acme.sh\n"
|
||||||
|
"If you are using sudo, use \"sudo -E wo\"")
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
Log.error(
|
Log.error(
|
||||||
@@ -145,10 +146,19 @@ class WOAcme:
|
|||||||
|
|
||||||
def check_dns(self, acme_domains):
|
def check_dns(self, acme_domains):
|
||||||
"""Check if a list of domains point to the server IP"""
|
"""Check if a list of domains point to the server IP"""
|
||||||
server_ip = requests.get('http://v4.wordops.eu/').text
|
server_ip = requests.get('https://v4.wordops.eu/').text
|
||||||
for domain in acme_domains:
|
for domain in acme_domains:
|
||||||
domain_ip = requests.get('http://v4.wordops.eu/dns/{0}/'
|
url = (
|
||||||
.format(domain)).text
|
"https://cloudflare-dns.com/dns-query?name={0}&type=A"
|
||||||
|
.format(domain))
|
||||||
|
headers = {
|
||||||
|
'accept': 'application/dns-json'
|
||||||
|
}
|
||||||
|
try:
|
||||||
|
response = requests.get(url, headers=headers).json()
|
||||||
|
domain_ip = response["Answer"][0]['data']
|
||||||
|
except requests.RequestException:
|
||||||
|
Log.error(self, 'Resolving domain IP failed')
|
||||||
if(not domain_ip == server_ip):
|
if(not domain_ip == server_ip):
|
||||||
Log.warn(
|
Log.warn(
|
||||||
self, "{0}".format(domain) +
|
self, "{0}".format(domain) +
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class WOVar():
|
|||||||
"""Intialization of core variables"""
|
"""Intialization of core variables"""
|
||||||
|
|
||||||
# WordOps version
|
# WordOps version
|
||||||
wo_version = "3.10.2"
|
wo_version = "3.10.3"
|
||||||
# WordOps packages versions
|
# WordOps packages versions
|
||||||
wo_wp_cli = "2.3.0"
|
wo_wp_cli = "2.3.0"
|
||||||
wo_adminer = "4.7.3"
|
wo_adminer = "4.7.3"
|
||||||
@@ -170,15 +170,16 @@ class WOVar():
|
|||||||
wo_clamav = ["clamav", "clamav-freshclam"]
|
wo_clamav = ["clamav", "clamav-freshclam"]
|
||||||
wo_ubuntu_backports = 'ppa:jonathonf/backports'
|
wo_ubuntu_backports = 'ppa:jonathonf/backports'
|
||||||
|
|
||||||
# Redis repo details
|
# APT repositories
|
||||||
|
wo_mysql_repo = ("deb [arch=amd64,ppc64el] "
|
||||||
|
"http://mariadb.mirrors.ovh.net/MariaDB/repo/"
|
||||||
|
"10.3/{distro} {codename} main"
|
||||||
|
.format(distro=wo_distro,
|
||||||
|
codename=wo_platform_codename))
|
||||||
if wo_distro == 'ubuntu':
|
if wo_distro == 'ubuntu':
|
||||||
wo_php_repo = "ppa:ondrej/php"
|
wo_php_repo = "ppa:ondrej/php"
|
||||||
wo_redis_repo = ("ppa:chris-lea/redis-server")
|
wo_redis_repo = ("ppa:chris-lea/redis-server")
|
||||||
wo_goaccess_repo = ("ppa:alex-p/goaccess")
|
wo_goaccess_repo = ("ppa:alex-p/goaccess")
|
||||||
wo_mysql_repo = ("deb [arch=amd64,ppc64el] "
|
|
||||||
"http://mariadb.mirrors.ovh.net/MariaDB/repo/"
|
|
||||||
"10.3/ubuntu {codename} main"
|
|
||||||
.format(codename=wo_platform_codename))
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
wo_php_repo = (
|
wo_php_repo = (
|
||||||
@@ -187,10 +188,6 @@ class WOVar():
|
|||||||
wo_php_key = 'AC0E47584A7A714D'
|
wo_php_key = 'AC0E47584A7A714D'
|
||||||
wo_redis_repo = ("deb https://packages.sury.org/php/ {codename} all"
|
wo_redis_repo = ("deb https://packages.sury.org/php/ {codename} all"
|
||||||
.format(codename=wo_platform_codename))
|
.format(codename=wo_platform_codename))
|
||||||
wo_mysql_repo = ("deb [arch=amd64,ppc64el] "
|
|
||||||
"http://mariadb.mirrors.ovh.net/MariaDB/repo/"
|
|
||||||
"10.3/debian {codename} main"
|
|
||||||
.format(codename=wo_platform_codename))
|
|
||||||
|
|
||||||
wo_redis = ['redis-server']
|
wo_redis = ['redis-server']
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
"""Testing utilities for WordOps"""
|
"""Testing utilities for WordOps"""
|
||||||
from cement.utils.test import *
|
from cement.utils import test
|
||||||
from wo.cli.main import WOTestApp
|
from wo.cli.main import WOTestApp
|
||||||
|
|
||||||
|
|
||||||
class WOTestCase(CementTestCase):
|
class WOTestCase(test.CementTestCase):
|
||||||
app_class = WOTestApp
|
app_class = WOTestApp
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user