Merge pull request #219 from WordOps/updating-configuration

Updating configuration
This commit is contained in:
VirtuBox
2019-12-07 15:12:55 +01:00
committed by GitHub
10 changed files with 63 additions and 29 deletions

View File

@@ -8,6 +8,19 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### v3.9.x - [Unreleased]
### v3.11.2 - 2019-12-07
#### Changed
- Proxy virtualhost now include proxy_params with X-Forwarded-Proto header
- Acme.sh upgrade
#### Fixed
- Issue with Nginx variables_hash_bucket_size & variables_hash_max_size
- Netdata MySQL user error when purging/reinstalling Netdata stack
- Fix `wo site cd`
### v3.11.1 - 2019-12-04
#### Added

14
install
View File

@@ -9,7 +9,7 @@
# -------------------------------------------------------------------------
# wget -qO wo wops.cc && sudo bash wo
# -------------------------------------------------------------------------
# Version 3.11.1 - 2019-12-04
# Version 3.11.2 - 2019-12-07
# -------------------------------------------------------------------------
# CONTENTS
@@ -388,9 +388,6 @@ wo_install_acme_sh() {
--home /etc/letsencrypt \
--config-home /etc/letsencrypt/config \
--cert-home /etc/letsencrypt/renewal
# enable auto-upgrade
/etc/letsencrypt/acme.sh --config-home '/etc/letsencrypt/config' --upgrade --auto-upgrade
fi
if [ -x "$HOME/.acme.sh/acme.sh" ]; then
@@ -411,8 +408,6 @@ wo_install_acme_sh() {
mkdir "$HOME/.acme.sh"
touch "$HOME/.acme.sh/acme.sh.env"
# removing previous cronjob
crontab -l | sed '/41 0 \* \* \* "\/root\/\.acme\.sh"\/acme.sh --cron --home "\/root\/\.acme\.sh" > \/dev\/null/d' | crontab -
fi
# Let's Encrypt .well-known folder setup
if [ ! -d /var/www/html/.well-known/acme-challenge ]; then
@@ -420,6 +415,13 @@ wo_install_acme_sh() {
fi
chown -R www-data:www-data /var/www/html /var/www/html/.well-known
chmod 750 /var/www/html /var/www/html/.well-known
if [ -x /etc/letsencrypt/acme.sh ]; then
export LE_WORKING_DIR="/etc/letsencrypt"
export LE_CONFIG_HOME="/etc/letsencrypt/config"
/etc/letsencrypt/acme.sh --config-home '/etc/letsencrypt/config' --upgrade --auto-upgrade
/etc/letsencrypt/acme.sh --config-home "/etc/letsencrypt/config" --uninstall-cronjob
/etc/letsencrypt/acme.sh --config-home "/etc/letsencrypt/config" --install-cronjob
fi
}

View File

@@ -27,7 +27,7 @@ if os.geteuid() == 0:
os.makedirs('/var/lib/wo/tmp/')
setup(name='wordops',
version='3.11.1',
version='3.11.2',
description='An essential toolset that eases server administration',
long_description=LONG,
long_description_content_type='text/markdown',

View File

@@ -241,6 +241,11 @@ class WOSiteController(CementBaseController):
wo_site_webroot = getSiteInfo(self, wo_domain).site_path
if os.path.isdir(wo_site_webroot):
WOFileUtils.chdir(self, wo_site_webroot)
try:
subprocess.call(['/bin/bash'])
except OSError as e:
Log.debug(self, "{0}{1}".format(e.errno, e.strerror))
else:
Log.error(self, "unable to change directory")

View File

@@ -166,6 +166,7 @@ class WOStackController(CementBaseController):
# Nginx
if pargs.nginx:
pargs.ngxblocker = True
Log.debug(self, "Setting apt_packages variable for Nginx")
if not WOAptGet.is_exec(self, 'nginx'):
apt_packages = apt_packages + WOVar.wo_nginx
@@ -1139,6 +1140,9 @@ class WOStackController(CementBaseController):
WOShellExec.cmd_exec(self, "bash /opt/netdata/usr/"
"libexec/netdata/netdata-"
"uninstaller.sh -y -f")
if WOShellExec.cmd_exec(self, 'mysqladmin ping'):
WOMysql.execute(
self, "DELETE FROM mysql.user WHERE User = 'netdata';")
if (apt_packages):
Log.wait(self, "Purging APT Packages ")

View File

@@ -321,9 +321,15 @@ def post_pref(self, apt_packages, packages, upgrade=False):
"'\"$http_referer\" "
"\"$http_user_agent\"';\n")
# Nginx-Plus does not have nginx
# package structure like this
# So creating directories
if not os.path.exists('/etc/nginx/bots.d'):
WOFileUtils.textwrite(
self, '/etc/nginx/conf.d/variables-hash.conf',
'variables_hash_max_size 4096;\n'
'variables_hash_bucket_size 4096;')
# Nginx-Plus does not have nginx
# package structure like this
# So creating directories
if not os.path.exists('/etc/nginx/sites-available'):
Log.debug(self, 'Creating directory'
'/etc/nginx/sites-available')
@@ -1404,11 +1410,15 @@ def post_pref(self, apt_packages, packages, upgrade=False):
try:
WOMysql.execute(
self,
"create user 'netdata'@'localhost';",
"DELETE FROM mysql.user WHERE User = 'netdata';",
log=False)
WOMysql.execute(
self,
"grant usage on *.* to 'netdata'@'localhost';",
"create user 'netdata'@'127.0.0.1';",
log=False)
WOMysql.execute(
self,
"grant usage on *.* to 'netdata'@'127.0.0.1';",
log=False)
WOMysql.execute(
self, "flush privileges;",
@@ -1585,11 +1595,16 @@ def post_pref(self, apt_packages, packages, upgrade=False):
# ngxblocker
if any('/usr/local/sbin/install-ngxblocker' == x[1]
for x in packages):
# remove duplicate directives
if os.path.exists('/etc/nginx/conf.d/variables-hash.conf'):
WOFileUtils.rm(self, '/etc/nginx/conf.d/variables-hash.conf')
WOFileUtils.chmod(
self, "/usr/local/sbin/install-ngxblocker", 0o700)
WOShellExec.cmd_exec(self, '/usr/local/sbin/install-ngxblocker -x')
WOFileUtils.chmod(
self, "/usr/local/sbin/update-ngxblocker", 0o700)
if not WOService.restart_service(self, 'nginx'):
Log.error(self, 'ngxblocker install failed')
def pre_stack(self):

View File

@@ -269,8 +269,6 @@ class WOStackUpgradeController(CementBaseController):
'/usr/local/sbin/update-ngxblocker',
'ngxblocker'
]]
else:
Log.info(self, "ngxblocker is not installed")
if ((not (apt_packages)) and (not(packages))):
self.app.args.print_help()
@@ -347,6 +345,9 @@ class WOStackUpgradeController(CementBaseController):
WOFileUtils.chmod(self, "/usr/local/bin/wp", 0o775)
if WOAptGet.is_selected(self, 'ngxblocker', packages):
if os.path.exists('/etc/nginx/conf.d/variables-hash.conf'):
WOFileUtils.rm(
self, '/etc/nginx/conf.d/variables-hash.conf')
WOFileUtils.chmod(
self, '/usr/local/sbin/update-ngxblocker', 0o775)
WOShellExec.cmd_exec(

View File

@@ -21,9 +21,7 @@ server {
location / {
proxy_pass http://{{host}}:{{port}};
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
include proxy_params;
}
# Security settings for better privacy

View File

@@ -108,17 +108,13 @@ class WOMysql():
if dbs == "":
continue
Log.info(self, "Backing up {0} database".format(dbs))
p1 = subprocess.Popen("/usr/bin/mysqldump {0}"
" --max_allowed_packet=1024M"
" --single-transaction".format(dbs),
stdout=subprocess.PIPE,
stderr=subprocess.PIPE, shell=True)
p2 = subprocess.Popen("/usr/bin/pigz -c > "
"/var/lib/wo-backup/mysql/{0}{1}.sql.gz"
.format(dbs, WOVar.wo_date),
stdin=p1.stdout,
shell=True)
p1 = subprocess.Popen(
"/usr/bin/mysqldump {0} --max_allowed_packet=1024M "
"--single-transaction ".format(dbs),
stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
p2 = subprocess.Popen(
"/usr/bin/pigz -c > /var/lib/wo-backup/mysql/{0}{1}.sql.gz"
.format(dbs, WOVar.wo_date), stdin=p1.stdout, shell=True)
# Allow p1 to receive a SIGPIPE if p2 exits
p1.stdout.close()
output = p1.stderr.read()

View File

@@ -14,7 +14,7 @@ class WOVar():
"""Intialization of core variables"""
# WordOps version
wo_version = "3.11.1"
wo_version = "3.11.2"
# WordOps packages versions
wo_wp_cli = "2.4.0"
wo_adminer = "4.7.5"