@@ -23,6 +23,7 @@ before_script:
|
||||
|
||||
|
||||
after_script:
|
||||
- sudo -E python3 setup.py sdist bdist_wheel
|
||||
- sudo -E bash install --purge
|
||||
|
||||
|
||||
@@ -31,7 +32,5 @@ script:
|
||||
- sudo bash -c 'echo -e "[user]\n\tname = abc\n\temail = root@localhost.com" > /home/travis/.gitconfig'
|
||||
- sudo echo "Travis Banch = $TRAVIS_BRANCH"
|
||||
- sudo -E time bash install --travis -b "$TRAVIS_BRANCH"
|
||||
- sudo -E python3 -m pip install -U -r requirements.txt
|
||||
- sudo -E time bash tests/travis.sh
|
||||
- sudo -E wo update --travis
|
||||
- sudo python3 setup.py sdist bdist_wheel
|
||||
17
CHANGELOG.md
17
CHANGELOG.md
@@ -8,6 +8,23 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
|
||||
### v3.9.x - [Unreleased]
|
||||
|
||||
### v3.10.2 - 2019-11-06
|
||||
|
||||
#### Added
|
||||
|
||||
- [STACK] nanorc syntax highlighting for nano editor : `--nanorc`
|
||||
|
||||
#### Changed
|
||||
|
||||
- `wo stack remove/purge` without argument print help instead of removing main stacks
|
||||
|
||||
#### Fixed
|
||||
|
||||
- Import rtCamp:EasyEngine GPG key to avoid issues with previous nginx repository
|
||||
- Unable to issue certificate for a domain if a subdomain certificate exist
|
||||
- Incorrect WP-CLI path site_url_https function
|
||||
- `wo stack upgrade --ngxblocker` not working properly
|
||||
|
||||
### v3.10.1 - 2019-10-30
|
||||
|
||||
#### Fixed
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<img src="https://img.shields.io/github/license/wordops/wordops.svg?cacheSeconds=86400" alt="MIT">
|
||||
<img src="https://img.shields.io/github/last-commit/wordops/wordops.svg?cacheSeconds=86400" alt="Commits">
|
||||
<img alt="GitHub release" src="https://img.shields.io/github/release/WordOps/WordOps.svg">
|
||||
<br><a href="https://pypi.org/project/wordops/" target="_blank"><img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dd/wordops.svg?cacheSeconds=86400"></a>
|
||||
<br><a href="https://pypi.org/project/wordops/" target="_blank"><img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dw/wordops.svg?cacheSeconds=86400"></a>
|
||||
<a href="https://www.codacy.com/app/VirtuBox/WordOps?utm_source=github.com&utm_medium=referral&utm_content=WordOps/WordOps&utm_campaign=Badge_Grade"><img src="https://api.codacy.com/project/badge/Grade/fe9100fd2c634de7882ecec17f00a11a" alt="codacy"/></a>
|
||||
<a href="https://twitter.com/WordOps_" target="_blank"><img src="https://img.shields.io/badge/twitter-%40WordOps__-blue.svg?style=flat&logo=twitter&cacheSeconds=86400" alt="Badge Twitter" /></a>
|
||||
<a href="https://chat.wordops.net" target="_blank"><img src="https://img.shields.io/badge/Rocket.Chat-WordOps-DB2323.svg?style=flat&cacheSeconds=86400&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsIAAA7CARUoSoAAAAVOSURBVFhH7ZZbaJRHFIDP/P/uupsYkzQkrWIS3Wh0E280fciDUiyC2hdrQxUUBLFqaauoVFFoevGh6IOCWIQqfSiFVqIPrVSlIrYStPqQKhJz0e5v3GwuBk2q3WQv/2V6ztnZWxIrtXlq+8Hyzznz75wzcy7zw38eoZ7MTwCu4oqK8nyfb6pp2040Hg+d6e7u/xTAUa9MOOxA6/TpL7g9noMawCoQopRnFGg5JKVssh3n89qurvtKPWGgTYDacHgIDUdGGyfwhQpdiA88ut7WWVX1vlT/mSjSIaCF71ZVnUbFaqUaF3zvW/zdxlOpBClLhBDon4jiCfVrmmZYjnMzGou1vNLXN6L+8pfk5MBNv78sT4gOVBYr1XOBDo6ggxcdIb6cGwyexfVsNTWGHAcIPAXMOfgoKT0d4XKB8HpB6DpI0wQnFsOEGZur6EinLeXuwL17P5CY1GYY40DbjBmvunX9ZyWm0fLyIG/JEvAtXgzeRYvAXVEBwuPBFXAJNCyjUYjfuQOxlhYYuXwZYjdugLQs/i9alejJ195E4p2KcDjKSsUYB9pnzmxwadppJYJeXAzFW7fClLVrQSsoUNpnY4bD8Pvx4/CkqSntCDrRHPd6X5/X1hZJKkY50FFdPVOz7RZUcg7kL1sGZQcOgF5UxPPPQ7y9HR7s2AGJYJBlDMl3sw3jTbTB4UiXFEpCs6xjKeNT1qyBqceO/SPjxKRAAKbjKdCTwIp54+6sWetZQNIOdPj9dTi5gsaTamuhdP9+nJ2YktcKC+El3AwlLeM4ez9WttMWNCHeUkMo2bWLszwNJln0+nU+zmys3l5OOEkVoJCJBIw0N4PZ1aU0Sdzl5VC4bh2PcaO1DZWV1TTOhEDKl+lJ2e6rr2ddikeHD0PP+vXQvWoVDF+6xDozFILQ8uXQu2kT9G3ZQguwfmDPHujduBFCK1dC/PZt1qXIX7pUjdAhTaujZ8YBITj2wudLllcW0atXkwM6iWvXeEiLO1h6ROzWLe4FBO2eIJlKMhu9pESNADxudyE9MyGQsoeeTiQCzvAw61IUbd7MJeiaNo2Tk8ijfrBgAce1cMOGtNPF27bxJjyzZ8NkPIVs6NRSJEzzgRomwSTci11Q0u/xyZMYkVwc05TSxp6WjeNIJ5FQQgZ+F+dG07d9O69/x++32svLp5HdTAhs+yTGkc9x8MgRsIeGWJ+Ck3J0VWAXFG63EjLwu9Qhs6Akjpw/z2PMluZAd3cvjdMrBu7f78LL4wSNrYEBTizn8WOe+6dQ9fRjaNRdYaMDH/IEkrMlx+Xai5OtNKZe/vDgQdY/L3iq8OTUKejBvLEHB1mHLnw21zCusIDkOBDo7PwDP8XeUyJY/f1q9PegvhA5exbCq1fDwL59XC24MYkZdPSbYPAT9RqTGyiko6pqhQ7AwSrAun/x0CHWE8MXLkDk4kXwLlzItyF1uNR1bD98CAnD4NKjeFM1pcD8i+AHwe6AYXxBYlKbZIwDnX7/CeyKb9O4DEMwpaGBVuCjHGhsxAg+9dtiDGgphv9tSgA0zjOMTA1mkeMAXsXzXUL8ihnsomu4EtsstdvBo0chcu4cO/Is8I0o7vgmPs84lvVVTSjUp6bGJe1A+5w5BbplXUHFfJL10lLQsMnQvZ42LCUV/c64prVPknKGJWURdlAXfhSOCCkfYf50QH7+b9n3/bNgB1praiZ74vHvUXiNteOALrTiZ8WWmmDwF6WaEDDfAN7F3eqmiV1FUFehHq2hMyb2sgdo+Ef8NVYbxs6yoaFx4zihoDHRU1eXF6qv96GYDtH//EsB+BOmU3nrC4LJegAAAABJRU5ErkJggg==" alt="Badge Rocket.chat" /></a>
|
||||
|
||||
18
install
18
install
@@ -9,7 +9,7 @@
|
||||
# -------------------------------------------------------------------------
|
||||
# wget -qO wo wops.cc && sudo bash wo
|
||||
# -------------------------------------------------------------------------
|
||||
# Version 3.10.1 - 2019-10-30
|
||||
# Version 3.10.2 - 2019-11-06
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
# CONTENTS
|
||||
@@ -220,7 +220,6 @@ wo_install_dep() {
|
||||
# add nginx repository gpg key
|
||||
curl -sL https://download.opensuse.org/repositories/home:virtubox:WordOps/Debian_10/Release.key | apt-key add -
|
||||
fi
|
||||
|
||||
locale-gen en
|
||||
# enable unattended upgades
|
||||
if [ ! -f /etc/apt/apt.conf.d/20auto-upgrades ]; then
|
||||
@@ -631,6 +630,8 @@ wo_init() {
|
||||
###
|
||||
|
||||
if [ -z "$wo_travis" ]; then
|
||||
# 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
|
||||
if ! {
|
||||
apt-get update --allow-releaseinfo-change -qq >/dev/null 2>&1
|
||||
}; then
|
||||
@@ -640,10 +641,10 @@ wo_init() {
|
||||
apt-get -y install curl -qq >/dev/null 2>&1
|
||||
fi
|
||||
if ! command_exists lsb_release; then
|
||||
apt-get install lsb-release -qq > /dev/null 2>&1
|
||||
apt-get install lsb-release -qq >/dev/null 2>&1
|
||||
fi
|
||||
if ! command_exists jq; then
|
||||
apt-get install jq -qq > /dev/null 2>&1
|
||||
apt-get install jq -qq >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
if [ "$wo_force_install" = "y" ]; then
|
||||
@@ -652,7 +653,7 @@ wo_init() {
|
||||
if [ -f ./setup.py ]; then
|
||||
readonly wo_version_new=$(grep "version='" setup.py | awk -F "'" '{print $2}' 2>&1)
|
||||
else
|
||||
readonly wo_version_new=$(curl -m 5 --retry 3 -sL https://api.github.com/repos/WordOps/WordOps/releases/latest 2>&1 | jq -r '.tag_name' )
|
||||
readonly wo_version_new=$(curl -m 5 --retry 3 -sL https://api.github.com/repos/WordOps/WordOps/releases/latest 2>&1 | jq -r '.tag_name')
|
||||
fi
|
||||
|
||||
echo ""
|
||||
@@ -673,8 +674,11 @@ wo_init
|
||||
wo_init_variables
|
||||
# remove old repositories
|
||||
_run wo_clean_repo
|
||||
# check distribution support
|
||||
wo_check_distro
|
||||
|
||||
if [ -z "$wo_force_install" ]; then
|
||||
# check distribution support
|
||||
wo_check_distro
|
||||
fi
|
||||
|
||||
# wo uninstall script
|
||||
if [ "$wo_purge" = "y" ]; then
|
||||
|
||||
4
setup.py
4
setup.py
@@ -27,7 +27,7 @@ if os.geteuid() == 0:
|
||||
os.makedirs('/var/lib/wo/tmp/')
|
||||
|
||||
setup(name='wordops',
|
||||
version='3.10.1',
|
||||
version='3.10.2',
|
||||
description='An essential toolset that eases server administration',
|
||||
long_description=LONG,
|
||||
long_description_content_type='text/markdown',
|
||||
@@ -50,7 +50,7 @@ setup(name='wordops',
|
||||
include_package_data=True,
|
||||
zip_safe=False,
|
||||
test_suite='nose.collector',
|
||||
python_requires='>=3.5',
|
||||
python_requires='>=3.4',
|
||||
install_requires=[
|
||||
# Required to build documentation
|
||||
# "Sphinx >= 1.0",
|
||||
|
||||
@@ -28,12 +28,12 @@ exit_script() {
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
echo -e ' stack install '
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
stack_list='nginx php php73 mysql redis fail2ban clamav proftpd netdata phpmyadmin composer dashboard extplorer adminer redis phpredisadmin mysqltuner utils ufw ngxblocker cheat'
|
||||
stack_list='nginx php php73 mysql redis fail2ban clamav proftpd netdata phpmyadmin composer dashboard extplorer adminer redis phpredisadmin mysqltuner utils ufw ngxblocker cheat nanorc'
|
||||
for stack in $stack_list; do
|
||||
echo -ne " Installing $stack [..]\r"
|
||||
if {
|
||||
wo stack install --${stack}
|
||||
} >> /var/log/wo/test.log; then
|
||||
} >>/var/log/wo/test.log; then
|
||||
echo -ne " Installing $stack [${CGREEN}OK${CEND}]\\r"
|
||||
echo -ne '\n'
|
||||
else
|
||||
@@ -52,7 +52,7 @@ for site in $site_types; do
|
||||
echo -ne " Creating $site [..]\r"
|
||||
if {
|
||||
wo site create ${site}.net --${site}
|
||||
} >> /var/log/wo/test.log; then
|
||||
} >>/var/log/wo/test.log; then
|
||||
echo -ne " Creating $site [${CGREEN}OK${CEND}]\\r"
|
||||
echo -ne '\n'
|
||||
else
|
||||
@@ -70,7 +70,7 @@ for site in $other_site_types; do
|
||||
echo -ne " Updating site to $site php73 [..]\r"
|
||||
if {
|
||||
wo site update ${site}.net --php73
|
||||
} >> /var/log/wo/test.log; then
|
||||
} >>/var/log/wo/test.log; then
|
||||
echo -ne " Updating site to $site php73 [${CGREEN}OK${CEND}]\\r"
|
||||
echo -ne '\n'
|
||||
else
|
||||
@@ -86,12 +86,12 @@ echo -e ' wo site update WP '
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
|
||||
wp_site_types='wpfc wpsc wpce wprocket wpredis'
|
||||
wo site create wp.io --wp >> /dev/null 2>&1
|
||||
wo site create wp.io --wp >>/dev/null 2>&1
|
||||
for site in $wp_site_types; do
|
||||
echo -ne " Updating WP to $site [..]\r"
|
||||
if {
|
||||
wo site update wp.io --${site}
|
||||
} >> /var/log/wo/test.log; then
|
||||
} >>/var/log/wo/test.log; then
|
||||
echo -ne " Updating WP to $site [${CGREEN}OK${CEND}]\\r"
|
||||
echo -ne '\n'
|
||||
else
|
||||
@@ -111,7 +111,7 @@ for site in $wp_site_types; do
|
||||
echo -ne " Creating wpsubdir $site [..]\r"
|
||||
if {
|
||||
wo site create wpsubdir"$site".io --wpsubdir --${site}
|
||||
} >> /var/log/wo/test.log; then
|
||||
} >>/var/log/wo/test.log; then
|
||||
echo -ne " Creating wpsubdir $site [${CGREEN}OK${CEND}]\\r"
|
||||
echo -ne '\n'
|
||||
else
|
||||
@@ -131,7 +131,7 @@ for site in $wp_site_types; do
|
||||
echo -ne " Creating wpsubdomain $site [..]\r"
|
||||
if {
|
||||
wo site create wpsubdomain"$site".io --wpsubdomain --${site}
|
||||
} >> /var/log/wo/test.log; then
|
||||
} >>/var/log/wo/test.log; then
|
||||
echo -ne " Creating wpsubdomain $site [${CGREEN}OK${CEND}]\\r"
|
||||
echo -ne '\n'
|
||||
else
|
||||
@@ -150,7 +150,7 @@ if [ -z "$1" ]; then
|
||||
echo -ne " Upgrading $stack [..]\r"
|
||||
if {
|
||||
wo stack upgrade --${stack} --force
|
||||
} >> /var/log/wo/test.log; then
|
||||
} >>/var/log/wo/test.log; then
|
||||
echo -ne " Upgrading $stack [${CGREEN}OK${CEND}]\\r"
|
||||
echo -ne '\n'
|
||||
else
|
||||
@@ -169,7 +169,7 @@ for stack in $stack_clean; do
|
||||
echo -ne " cleaning $stack cache [..]\r"
|
||||
if {
|
||||
wo clean --${stack}
|
||||
} >> /var/log/wo/test.log; then
|
||||
} >>/var/log/wo/test.log; then
|
||||
echo -ne " cleaning $stack cache [${CGREEN}OK${CEND}]\\r"
|
||||
echo -ne '\n'
|
||||
else
|
||||
@@ -186,7 +186,7 @@ echo -e "${CGREEN}#############################################${CEND}"
|
||||
echo -ne " wo secure --auth [..]\r"
|
||||
if {
|
||||
wo secure --auth wordops mypassword
|
||||
} >> /var/log/wo/test.log; then
|
||||
} >>/var/log/wo/test.log; then
|
||||
echo -ne " wo secure --auth [${CGREEN}OK${CEND}]\\r"
|
||||
echo -ne '\n'
|
||||
else
|
||||
@@ -198,7 +198,7 @@ fi
|
||||
echo -ne " wo secure --sshport [..]\r"
|
||||
if {
|
||||
wo secure --sshport 2022
|
||||
} >> /var/log/wo/test.log; then
|
||||
} >>/var/log/wo/test.log; then
|
||||
echo -ne " wo secure --sshport [${CGREEN}OK${CEND}]\\r"
|
||||
echo -ne '\n'
|
||||
else
|
||||
@@ -210,7 +210,7 @@ fi
|
||||
echo -ne " wo secure --ssh [..]\r"
|
||||
if {
|
||||
wo secure --ssh --force
|
||||
} >> /var/log/wo/test.log; then
|
||||
} >>/var/log/wo/test.log; then
|
||||
echo -ne " wo secure --ssh [${CGREEN}OK${CEND}]\\r"
|
||||
echo -ne '\n'
|
||||
else
|
||||
@@ -230,12 +230,12 @@ wo info
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
echo -e ' wo stack purge '
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
stack_purge='nginx php php73 mysql redis fail2ban clamav proftpd netdata phpmyadmin composer dashboard extplorer adminer redis ufw ngxblocker cheat'
|
||||
stack_purge='nginx php php73 mysql redis fail2ban clamav proftpd netdata phpmyadmin composer dashboard extplorer adminer redis ufw ngxblocker cheat nanorc'
|
||||
for stack in $stack_purge; do
|
||||
echo -ne " purging $stack [..]\r"
|
||||
if {
|
||||
wo stack purge --${stack} --force
|
||||
} >> /var/log/wo/test.log; then
|
||||
} >>/var/log/wo/test.log; then
|
||||
echo -ne " purging $stack [${CGREEN}OK${CEND}]\\r"
|
||||
echo -ne '\n'
|
||||
else
|
||||
|
||||
@@ -49,15 +49,12 @@ class WOApp(CementApp):
|
||||
# All built-in application bootstrapping (always run)
|
||||
bootstrap = 'wo.cli.bootstrap'
|
||||
|
||||
# Optional plugin bootstrapping (only run if plugin is enabled)
|
||||
# Internal plugins (ship with application code)
|
||||
plugin_bootstrap = 'wo.cli.plugins'
|
||||
|
||||
# Internal templates (ship with application code)
|
||||
template_module = 'wo.cli.templates'
|
||||
|
||||
# Internal plugins (ship with application code)
|
||||
plugin_bootstrap = 'wo.cli.plugins'
|
||||
|
||||
extensions = ['mustache']
|
||||
|
||||
# default output handler
|
||||
@@ -73,18 +70,23 @@ class WOApp(CementApp):
|
||||
class WOTestApp(WOApp):
|
||||
"""A test app that is better suited for testing."""
|
||||
class Meta:
|
||||
# default argv to empty (don't use sys.argv)
|
||||
argv = []
|
||||
|
||||
# don't look for config files (could break tests)
|
||||
config_files = []
|
||||
exit_on_close = True
|
||||
|
||||
# don't call sys.exit() when app.close() is called in tests
|
||||
exit_on_close = False
|
||||
|
||||
|
||||
# Define the applicaiton object outside of main, as some libraries might wish
|
||||
# to import it as a global (rather than passing it into another class/func)
|
||||
# app = WOApp()
|
||||
app = WOApp()
|
||||
|
||||
|
||||
def main():
|
||||
with WOApp() as app:
|
||||
with app:
|
||||
try:
|
||||
global sys
|
||||
|
||||
@@ -99,7 +101,7 @@ def main():
|
||||
app.exit_code = 1
|
||||
except exc.WOError as e:
|
||||
# Catch our application errors and exit 1 (error)
|
||||
print(e)
|
||||
print('WOError > %s' % e)
|
||||
app.exit_code = 1
|
||||
except FrameworkError as e:
|
||||
# Catch framework errors and exit 1 (error)
|
||||
|
||||
@@ -87,6 +87,9 @@ class WOStackController(CementBaseController):
|
||||
action='store_true')),
|
||||
(['--cheat'],
|
||||
dict(help='Install cheat.sh', action='store_true')),
|
||||
(['--nanorc'],
|
||||
dict(help='Install nanorc syntax highlighting',
|
||||
action='store_true')),
|
||||
(['--force'],
|
||||
dict(help='Force install/remove/purge without prompt',
|
||||
action='store_true')),
|
||||
@@ -118,7 +121,7 @@ class WOStackController(CementBaseController):
|
||||
(not pargs.adminer) and (not pargs.utils) and
|
||||
(not pargs.redis) and (not pargs.proftpd) and
|
||||
(not pargs.extplorer) and (not pargs.clamav) and
|
||||
(not pargs.cheat) and
|
||||
(not pargs.cheat) and (not pargs.nanorc) and
|
||||
(not pargs.ufw) and (not pargs.ngxblocker) and
|
||||
(not pargs.phpredisadmin) and (not pargs.sendmail) and
|
||||
(not pargs.php73)):
|
||||
@@ -325,8 +328,7 @@ class WOStackController(CementBaseController):
|
||||
|
||||
# Composer
|
||||
if pargs.composer:
|
||||
if ((not WOAptGet.is_installed(self, 'php7.2-fpm')) and
|
||||
(not WOAptGet.is_installed(self, 'php7.3-fpm'))):
|
||||
if not WOShellExec.cmd_exec(self, 'php -v'):
|
||||
pargs.php = True
|
||||
if not os.path.isfile('/usr/local/bin/composer'):
|
||||
Log.debug(self, "Setting packages variable for Composer ")
|
||||
@@ -459,6 +461,11 @@ class WOStackController(CementBaseController):
|
||||
"/etc/bash_completion.d/cht.sh",
|
||||
"bash_completion"]]
|
||||
|
||||
if pargs.nanorc:
|
||||
if not os.path.exists('/usr/share/nano-syntax-highlighting'):
|
||||
Log.debug(self, "Setting packages variable for nanorc")
|
||||
apt_packages = apt_packages + ['nano']
|
||||
|
||||
# UTILS
|
||||
if pargs.utils:
|
||||
Log.debug(self, "Setting packages variable for utils")
|
||||
@@ -466,26 +473,22 @@ class WOStackController(CementBaseController):
|
||||
"https://raw.githubusercontent.com"
|
||||
"/rtCamp/eeadmin/master/cache/nginx/"
|
||||
"clean.php",
|
||||
"{0}22222/htdocs/cache/"
|
||||
"nginx/clean.php"
|
||||
"{0}22222/htdocs/cache/nginx/clean.php"
|
||||
.format(WOVar.wo_webroot),
|
||||
"clean.php"],
|
||||
["https://raw.github.com/rlerdorf/"
|
||||
"opcache-status/master/opcache.php",
|
||||
"{0}22222/htdocs/cache/"
|
||||
"opcache/opcache.php"
|
||||
"{0}22222/htdocs/cache/opcache/opcache.php"
|
||||
.format(WOVar.wo_webroot),
|
||||
"opcache.php"],
|
||||
["https://raw.github.com/amnuts/"
|
||||
"opcache-gui/master/index.php",
|
||||
"{0}22222/htdocs/"
|
||||
"cache/opcache/opgui.php"
|
||||
"{0}22222/htdocs/cache/opcache/opgui.php"
|
||||
.format(WOVar.wo_webroot),
|
||||
"Opgui"],
|
||||
["https://raw.githubusercontent.com/"
|
||||
"mlazarov/ocp/master/ocp.php",
|
||||
"{0}22222/htdocs/cache/"
|
||||
"opcache/ocp.php"
|
||||
"{0}22222/htdocs/cache/opcache/ocp.php"
|
||||
.format(WOVar.wo_webroot),
|
||||
"OCP.php"],
|
||||
["https://github.com/jokkedk/webgrind/"
|
||||
@@ -557,12 +560,11 @@ class WOStackController(CementBaseController):
|
||||
(not pargs.adminer) and (not pargs.utils) and
|
||||
(not pargs.redis) and (not pargs.proftpd) and
|
||||
(not pargs.extplorer) and (not pargs.clamav) and
|
||||
(not pargs.cheat) and
|
||||
(not pargs.cheat) and (not pargs.nanorc) and
|
||||
(not pargs.ufw) and (not pargs.ngxblocker) and
|
||||
(not pargs.phpredisadmin) and (not pargs.sendmail) and
|
||||
(not pargs.php73)):
|
||||
pargs.web = True
|
||||
pargs.admin = True
|
||||
self.app.args.print_help()
|
||||
|
||||
if pargs.all:
|
||||
pargs.web = True
|
||||
@@ -573,6 +575,7 @@ class WOStackController(CementBaseController):
|
||||
pargs.utils = True
|
||||
pargs.redis = True
|
||||
pargs.security = True
|
||||
pargs.nanorc = True
|
||||
packages = packages + ['/var/www/22222/htdocs']
|
||||
|
||||
if pargs.web:
|
||||
@@ -670,7 +673,14 @@ class WOStackController(CementBaseController):
|
||||
if pargs.ufw:
|
||||
if WOAptGet.is_installed(self, 'ufw'):
|
||||
Log.debug(self, "Remove apt_packages variable for UFW")
|
||||
apt_packages = apt_packages + ["ufw"]
|
||||
WOShellExec.cmd_exec(self, 'ufw disable && ufw --force reset')
|
||||
|
||||
# nanorc
|
||||
if pargs.nanorc:
|
||||
if os.path.exists('/usr/share/nano-syntax-highlighting'):
|
||||
Log.debug(self, "Add nano to apt_packages list")
|
||||
packages = packages + \
|
||||
["/usr/share/nano-syntax-highlighting"]
|
||||
|
||||
# WPCLI
|
||||
if pargs.wpcli:
|
||||
@@ -787,18 +797,29 @@ class WOStackController(CementBaseController):
|
||||
WOShellExec.cmd_exec(
|
||||
self, "bash /usr/"
|
||||
"libexec/netdata/"
|
||||
"netdata-uninstaller.sh -y -f")
|
||||
"netdata-uninstaller.sh -y -f",
|
||||
errormsg='', log=False)
|
||||
else:
|
||||
WOShellExec.cmd_exec(
|
||||
self, "bash /opt/netdata/usr/"
|
||||
"libexec/netdata/"
|
||||
"netdata-uninstaller.sh - y - f",
|
||||
"netdata-uninstaller.sh -y -f",
|
||||
errormsg='', log=False)
|
||||
|
||||
if (packages):
|
||||
Log.wait(self, "Removing packages ")
|
||||
WOFileUtils.remove(self, packages)
|
||||
Log.valide(self, "Removing packages ")
|
||||
|
||||
if '/usr/share/nano-syntax-highlighting' in packages:
|
||||
# removing include line from nanorc
|
||||
WOShellExec.cmd_exec(
|
||||
self, 'grep -v "nano-syntax-highlighting" '
|
||||
'/etc/nanorc > /etc/nanorc.new')
|
||||
WOFileUtils.rm(self, '/etc/nanorc')
|
||||
WOFileUtils.mvfile(
|
||||
self, '/etc/nanorc.new', '/etc/nanorc')
|
||||
|
||||
if (apt_packages):
|
||||
Log.debug(self, "Removing apt_packages")
|
||||
Log.wait(self, "Removing APT packages ")
|
||||
@@ -825,13 +846,11 @@ class WOStackController(CementBaseController):
|
||||
(not pargs.adminer) and (not pargs.utils) and
|
||||
(not pargs.redis) and (not pargs.proftpd) and
|
||||
(not pargs.extplorer) and (not pargs.clamav) and
|
||||
(not pargs.cheat) and
|
||||
(not pargs.cheat) and (not pargs.nanorc) and
|
||||
(not pargs.ufw) and (not pargs.ngxblocker) and
|
||||
(not pargs.phpredisadmin) and (not pargs.sendmail) and
|
||||
(not pargs.php73)):
|
||||
pargs.web = True
|
||||
pargs.admin = True
|
||||
pargs.security = True
|
||||
self.app.args.print_help()
|
||||
|
||||
if pargs.all:
|
||||
pargs.web = True
|
||||
@@ -932,7 +951,7 @@ class WOStackController(CementBaseController):
|
||||
if pargs.ufw:
|
||||
if WOAptGet.is_installed(self, 'ufw'):
|
||||
Log.debug(self, "Add UFW to apt_packages list")
|
||||
apt_packages = apt_packages + ["ufw"]
|
||||
WOShellExec.cmd_exec(self, 'ufw disable && ufw --force reset')
|
||||
|
||||
# sendmail
|
||||
if pargs.sendmail:
|
||||
@@ -946,6 +965,13 @@ class WOStackController(CementBaseController):
|
||||
Log.debug(self, "Add Proftpd to apt_packages list")
|
||||
apt_packages = apt_packages + ["proftpd-basic"]
|
||||
|
||||
# nanorc
|
||||
if pargs.nanorc:
|
||||
if os.path.exists('/usr/share/nano-syntax-highlighting'):
|
||||
Log.debug(self, "Add nano to apt_packages list")
|
||||
packages = packages + \
|
||||
["/usr/share/nano-syntax-highlighting"]
|
||||
|
||||
# WP-CLI
|
||||
if pargs.wpcli:
|
||||
if os.path.isfile('/usr/local/bin/wp'):
|
||||
@@ -1075,11 +1101,20 @@ class WOStackController(CementBaseController):
|
||||
WOAptGet.remove(self, apt_packages, purge=True)
|
||||
WOAptGet.auto_remove(self)
|
||||
Log.valide(self, "Purging APT Packages ")
|
||||
|
||||
if (packages):
|
||||
Log.wait(self, "Purging Packages ")
|
||||
WOFileUtils.remove(self, packages)
|
||||
Log.valide(self, "Purging Packages ")
|
||||
|
||||
if '/usr/share/nano-syntax-highlighting' in packages:
|
||||
# removing include line from nanorc
|
||||
WOShellExec.cmd_exec(
|
||||
self, 'grep -v "nano-syntax-highlighting" '
|
||||
'/etc/nanorc > /etc/nanorc.new')
|
||||
WOFileUtils.rm(self, '/etc/nanorc')
|
||||
WOFileUtils.mvfile(
|
||||
self, '/etc/nanorc.new', '/etc/nanorc')
|
||||
|
||||
Log.info(self, "Successfully purged packages")
|
||||
|
||||
|
||||
|
||||
@@ -44,25 +44,18 @@ def pre_pref(self, apt_packages):
|
||||
# generate random 24 characters root password
|
||||
chars = ''.join(random.sample(string.ascii_letters, 24))
|
||||
|
||||
# configure MySQL non-interactive install
|
||||
if ((WOVar.wo_distro == 'raspbian') and
|
||||
(WOVar.wo_platform_codename == 'stretch')):
|
||||
mariadb_ver = '10.1'
|
||||
else:
|
||||
mariadb_ver = '10.3'
|
||||
|
||||
Log.debug(self, "Pre-seeding MySQL")
|
||||
Log.debug(self, "echo \"mariadb-server-{0} "
|
||||
"mysql-server/root_password "
|
||||
"password \" | "
|
||||
"debconf-set-selections"
|
||||
.format(mariadb_ver))
|
||||
.format(WOVar.mariadb_ver))
|
||||
try:
|
||||
WOShellExec.cmd_exec(self, "echo \"mariadb-server-{0} "
|
||||
"mysql-server/root_password "
|
||||
"password {chars}\" | "
|
||||
"debconf-set-selections"
|
||||
.format(mariadb_ver, chars=chars),
|
||||
.format(WOVar.mariadb_ver, chars=chars),
|
||||
log=False)
|
||||
except CommandExecutionError as e:
|
||||
Log.debug(self, "{0}".format(e))
|
||||
@@ -72,13 +65,13 @@ def pre_pref(self, apt_packages):
|
||||
"mysql-server/root_password_again "
|
||||
"password \" | "
|
||||
"debconf-set-selections"
|
||||
.format(mariadb_ver))
|
||||
.format(WOVar.mariadb_ver))
|
||||
try:
|
||||
WOShellExec.cmd_exec(self, "echo \"mariadb-server-{0} "
|
||||
"mysql-server/root_password_again "
|
||||
"password {chars}\" | "
|
||||
"debconf-set-selections"
|
||||
.format(mariadb_ver, chars=chars),
|
||||
.format(WOVar.mariadb_ver, chars=chars),
|
||||
log=False)
|
||||
except CommandExecutionError as e:
|
||||
Log.debug(self, "{0}".format(e))
|
||||
@@ -112,7 +105,7 @@ def pre_pref(self, apt_packages):
|
||||
else:
|
||||
if not WOFileUtils.grepcheck(
|
||||
self, '/etc/apt/sources.list/wo-repo.list',
|
||||
'download.opensuse.org'):
|
||||
'WordOps'):
|
||||
Log.info(self, "Adding repository for NGINX, please wait...")
|
||||
Log.debug(self, 'Adding repository for Nginx')
|
||||
WORepo.add(self, repo_url=WOVar.wo_nginx_repo)
|
||||
@@ -160,11 +153,23 @@ def pre_pref(self, apt_packages):
|
||||
else:
|
||||
if not WOFileUtils.grepcheck(
|
||||
self, '/etc/apt/sources.list/wo-repo.list',
|
||||
'download.opensuse.org'):
|
||||
'WordOps'):
|
||||
Log.info(self, "Adding repository for Redis, please wait...")
|
||||
WORepo.add(self, repo_url=WOVar.wo_php_repo)
|
||||
WORepo.add(self, repo_url=WOVar.wo_nginx_repo)
|
||||
WORepo.add_key(self, WOVar.wo_nginx_key)
|
||||
|
||||
# nano
|
||||
if 'nano' in apt_packages:
|
||||
if WOVar.wo_distro == 'ubuntu':
|
||||
if (WOVar.wo_platform_codename == 'bionic' or
|
||||
WOVar.wo_platform_codename == 'xenial'):
|
||||
if not os.path.exists(
|
||||
'/etc/apt/sources.list.d/'
|
||||
'jonathonf-ubuntu-backports-{0}.list'
|
||||
.format(WOVar.wo_platform_codename)):
|
||||
Log.debug(self, 'Adding ppa for nano')
|
||||
WORepo.add(self, ppa=WOVar.wo_ubuntu_backports)
|
||||
|
||||
|
||||
def post_pref(self, apt_packages, packages, upgrade=False):
|
||||
"""Post activity after installation of packages"""
|
||||
@@ -1072,6 +1077,20 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
||||
comment='ClamAV freshclam cronjob '
|
||||
'added by WordOps')
|
||||
|
||||
# nanorc
|
||||
if 'nano' in apt_packages:
|
||||
Log.debug(self, 'Setting up nanorc')
|
||||
WOGit.clone(self, 'https://github.com/scopatz/nanorc.git',
|
||||
'/usr/share/nano-syntax-highlighting')
|
||||
if os.path.exists('/etc/nanorc'):
|
||||
Log.debug(
|
||||
self, 'including nano syntax highlighting to /etc/nanorc')
|
||||
if not WOFileUtils.grepcheck(self, '/etc/nanorc',
|
||||
'nano-syntax-highlighting'):
|
||||
WOFileUtils.textappend(
|
||||
self, '/etc/nanorc', 'include /usr/share/'
|
||||
'nano-syntax-highlighting/*.nanorc')
|
||||
|
||||
if (packages):
|
||||
# WP-CLI
|
||||
if any('/usr/local/bin/wp' == x[1] for x in packages):
|
||||
|
||||
@@ -200,7 +200,7 @@ class WOStackUpgradeController(CementBaseController):
|
||||
|
||||
# ngxblocker
|
||||
if pargs.ngxblocker:
|
||||
if os.path.exists('/usr/local/sbin/update-ngxblocker'):
|
||||
if os.path.exists('/usr/local/sbin/install-ngxblocker'):
|
||||
packages = packages + [[
|
||||
'https://raw.githubusercontent.com/mitchellkrogza/'
|
||||
'nginx-ultimate-bad-bot-blocker/master/update-ngxblocker',
|
||||
|
||||
@@ -62,7 +62,7 @@ class WOUpdateController(CementBaseController):
|
||||
if ((not pargs.force) and (not pargs.travis) and
|
||||
(not pargs.mainline) and (not pargs.beta) and
|
||||
(not pargs.branch)):
|
||||
wo_current = WOVar.wo_version
|
||||
wo_current = ("v{0}".format(WOVar.wo_version))
|
||||
wo_latest = WODownload.latest_release(self, "WordOps/WordOps")
|
||||
if wo_current == wo_latest:
|
||||
Log.error(
|
||||
|
||||
@@ -33,5 +33,8 @@ if [ -n "$CURRENT_RELEASE" ] && [ -n "$LATEST_RELEASE" ]; then
|
||||
safe_print "$NEWS"
|
||||
# Try to update the cache
|
||||
safe_print "$NEWS" 2> /dev/null > $CACHE || true
|
||||
fi
|
||||
else
|
||||
# clean news
|
||||
echo '' > "$NEWS" 2> "$ERR"
|
||||
safe_print "$NEWS" 2> /dev/null > $CACHE || true
|
||||
fi
|
||||
|
||||
@@ -172,7 +172,7 @@ class WOAcme:
|
||||
reader = csv.reader(certfile, 'acmeconf')
|
||||
for row in reader:
|
||||
# check if domain exist
|
||||
if wo_domain_name in row[0]:
|
||||
if wo_domain_name == row[0]:
|
||||
# check if cert expiration exist
|
||||
if not row[3] == '':
|
||||
return True
|
||||
|
||||
@@ -368,4 +368,4 @@ class WOFileUtils():
|
||||
final_file.write('{0}'.format(content))
|
||||
except IOError as e:
|
||||
Log.debug(self, "{0}".format(e))
|
||||
Log.error(self, "Unable to write content in {0}".format(path))
|
||||
Log.error(self, "Unable to append content in {0}".format(path))
|
||||
|
||||
@@ -83,3 +83,20 @@ class WOGit:
|
||||
.format(path))
|
||||
else:
|
||||
Log.debug(self, "WOGit: Path {0} not present".format(path))
|
||||
|
||||
def clone(self, repo, path, branch='master'):
|
||||
"""Equivalent to git clone """
|
||||
if not os.path.exists('{0}'.format(path)):
|
||||
global git
|
||||
try:
|
||||
git.clone(
|
||||
'{0}'.format(repo),
|
||||
'{0}'.format(path),
|
||||
'--branch={0}'.format(branch),
|
||||
'--depth=1')
|
||||
except ErrorReturnCode as e:
|
||||
Log.debug(self, "{0}".format(e))
|
||||
Log.error(self, "Unable to git clone at {0} "
|
||||
.format(path))
|
||||
else:
|
||||
Log.debug(self, "WOGit: Path {0} already exist".format(path))
|
||||
|
||||
@@ -37,6 +37,27 @@ class WOShellExec():
|
||||
Log.debug(self, str(e))
|
||||
raise CommandExecutionError
|
||||
|
||||
def cmd_exist(self, command):
|
||||
"""Check if a command exist with command -v"""
|
||||
try:
|
||||
Log.debug(self, "Testing command: {0}".format(command))
|
||||
testing_command = ("command -v {0}".format(command))
|
||||
with subprocess.Popen([testing_command], stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE, shell=True) as proc:
|
||||
(cmd_stdout_bytes, cmd_stderr_bytes) = proc.communicate()
|
||||
(cmd_stdout, cmd_stderr) = (
|
||||
cmd_stdout_bytes.decode('utf-8', "replace"),
|
||||
cmd_stderr_bytes.decode('utf-8', "replace"))
|
||||
Log.debug(self, "Command Output: {0}, \nCommand Error: {1}"
|
||||
.format(cmd_stdout, cmd_stderr))
|
||||
return bool(proc.returncode == 0)
|
||||
except OSError as e:
|
||||
Log.debug(self, str(e))
|
||||
raise CommandExecutionError
|
||||
except Exception as e:
|
||||
Log.debug(self, str(e))
|
||||
raise CommandExecutionError
|
||||
|
||||
def invoke_editor(self, filepath, errormsg=''):
|
||||
"""
|
||||
Open files using sensible editor
|
||||
|
||||
@@ -63,7 +63,7 @@ class SSL:
|
||||
self, '{0}/htdocs/'.format(wo_site_webroot))
|
||||
if WOShellExec.cmd_exec(
|
||||
self, "{0} --allow-root core is-installed"
|
||||
.format(WOVar.wo_wp_cli)):
|
||||
.format(WOVar.wo_wpcli_path)):
|
||||
wo_siteurl = (
|
||||
WOShellExec.cmd_exec_stdout(
|
||||
self, "{0} option get siteurl "
|
||||
@@ -75,17 +75,17 @@ class SSL:
|
||||
try:
|
||||
WOShellExec.cmd_exec(
|
||||
self, "{0} option update siteurl "
|
||||
"\'https://{1}\' --allow-root".format(
|
||||
WOVar.wo_wpcli_path, domain))
|
||||
"\'https://{1}\' --allow-root"
|
||||
.format(WOVar.wo_wpcli_path, domain))
|
||||
WOShellExec.cmd_exec(
|
||||
self, "{0} option update home "
|
||||
"\'https://{1}\' --allow-root".format(
|
||||
WOVar.wo_wpcli_path, domain))
|
||||
"\'https://{1}\' --allow-root"
|
||||
.format(WOVar.wo_wpcli_path, domain))
|
||||
WOShellExec.cmd_exec(
|
||||
self, "{0} search-replace \'http://{0}\'"
|
||||
"\'https://{0}\' --skip-columns=guid "
|
||||
self, "{0} search-replace \'http://{1}\'"
|
||||
"\'https://{1}\' --skip-columns=guid "
|
||||
"--skip-tables=wp_users"
|
||||
.format(domain))
|
||||
.format(WOVar.wo_wpcli_path, domain))
|
||||
except Exception as e:
|
||||
Log.debug(self, str(e))
|
||||
Log.failed(self, "Updating site url with https")
|
||||
|
||||
@@ -14,7 +14,7 @@ class WOVar():
|
||||
"""Intialization of core variables"""
|
||||
|
||||
# WordOps version
|
||||
wo_version = "3.10.1"
|
||||
wo_version = "3.10.2"
|
||||
# WordOps packages versions
|
||||
wo_wp_cli = "2.3.0"
|
||||
wo_adminer = "4.7.3"
|
||||
@@ -149,7 +149,12 @@ class WOVar():
|
||||
wo_mysql = ["mariadb-server", "percona-toolkit"]
|
||||
if wo_distro == 'raspbian':
|
||||
wo_mysql = wo_mysql + ["python3-mysqldb"]
|
||||
if wo_platform_codename == 'stretch':
|
||||
mariadb_ver = '10.1'
|
||||
else:
|
||||
mariadb_ver = '10.3'
|
||||
else:
|
||||
mariadb_ver = '10.3'
|
||||
if wo_platform_codename == 'jessie':
|
||||
wo_mysql = wo_mysql + ["python3-mysql.connector"]
|
||||
else:
|
||||
@@ -163,6 +168,7 @@ class WOVar():
|
||||
|
||||
wo_fail2ban = ["fail2ban"]
|
||||
wo_clamav = ["clamav", "clamav-freshclam"]
|
||||
wo_ubuntu_backports = 'ppa:jonathonf/backports'
|
||||
|
||||
# Redis repo details
|
||||
if wo_distro == 'ubuntu':
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""Testing utilities for WordOps"""
|
||||
from cement.utils.test import CementTestCase
|
||||
from cement.utils.test import *
|
||||
from wo.cli.main import WOTestApp
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user