Skip to content

Commit 3a514ce

Browse files
authored
Merge pull request WordOps#219 from WordOps/updating-configuration
Updating configuration
2 parents 9f22455 + a9fc1ab commit 3a514ce

File tree

10 files changed

+63
-29
lines changed

10 files changed

+63
-29
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,19 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
88

99
### v3.9.x - [Unreleased]
1010

11+
### v3.11.2 - 2019-12-07
12+
13+
#### Changed
14+
15+
- Proxy virtualhost now include proxy_params with X-Forwarded-Proto header
16+
- Acme.sh upgrade
17+
18+
#### Fixed
19+
20+
- Issue with Nginx variables_hash_bucket_size & variables_hash_max_size
21+
- Netdata MySQL user error when purging/reinstalling Netdata stack
22+
- Fix `wo site cd`
23+
1124
### v3.11.1 - 2019-12-04
1225

1326
#### Added

install

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# -------------------------------------------------------------------------
1010
# wget -qO wo wops.cc && sudo bash wo
1111
# -------------------------------------------------------------------------
12-
# Version 3.11.1 - 2019-12-04
12+
# Version 3.11.2 - 2019-12-07
1313
# -------------------------------------------------------------------------
1414

1515
# CONTENTS
@@ -388,9 +388,6 @@ wo_install_acme_sh() {
388388
--home /etc/letsencrypt \
389389
--config-home /etc/letsencrypt/config \
390390
--cert-home /etc/letsencrypt/renewal
391-
# enable auto-upgrade
392-
/etc/letsencrypt/acme.sh --config-home '/etc/letsencrypt/config' --upgrade --auto-upgrade
393-
394391
fi
395392

396393
if [ -x "$HOME/.acme.sh/acme.sh" ]; then
@@ -411,15 +408,20 @@ wo_install_acme_sh() {
411408
mkdir "$HOME/.acme.sh"
412409
touch "$HOME/.acme.sh/acme.sh.env"
413410
# removing previous cronjob
414-
crontab -l | sed '/41 0 \* \* \* "\/root\/\.acme\.sh"\/acme.sh --cron --home "\/root\/\.acme\.sh" > \/dev\/null/d' | crontab -
415-
416411
fi
417412
# Let's Encrypt .well-known folder setup
418413
if [ ! -d /var/www/html/.well-known/acme-challenge ]; then
419414
mkdir -p /var/www/html/.well-known/acme-challenge
420415
fi
421416
chown -R www-data:www-data /var/www/html /var/www/html/.well-known
422417
chmod 750 /var/www/html /var/www/html/.well-known
418+
if [ -x /etc/letsencrypt/acme.sh ]; then
419+
export LE_WORKING_DIR="/etc/letsencrypt"
420+
export LE_CONFIG_HOME="/etc/letsencrypt/config"
421+
/etc/letsencrypt/acme.sh --config-home '/etc/letsencrypt/config' --upgrade --auto-upgrade
422+
/etc/letsencrypt/acme.sh --config-home "/etc/letsencrypt/config" --uninstall-cronjob
423+
/etc/letsencrypt/acme.sh --config-home "/etc/letsencrypt/config" --install-cronjob
424+
fi
423425

424426
}
425427

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
os.makedirs('/var/lib/wo/tmp/')
2828

2929
setup(name='wordops',
30-
version='3.11.1',
30+
version='3.11.2',
3131
description='An essential toolset that eases server administration',
3232
long_description=LONG,
3333
long_description_content_type='text/markdown',

wo/cli/plugins/site.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,11 @@ def cd(self):
241241
wo_site_webroot = getSiteInfo(self, wo_domain).site_path
242242
if os.path.isdir(wo_site_webroot):
243243
WOFileUtils.chdir(self, wo_site_webroot)
244+
245+
try:
246+
subprocess.call(['/bin/bash'])
247+
except OSError as e:
248+
Log.debug(self, "{0}{1}".format(e.errno, e.strerror))
244249
else:
245250
Log.error(self, "unable to change directory")
246251

wo/cli/plugins/stack.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ def install(self, packages=[], apt_packages=[], disp_msg=True):
166166

167167
# Nginx
168168
if pargs.nginx:
169+
pargs.ngxblocker = True
169170
Log.debug(self, "Setting apt_packages variable for Nginx")
170171
if not WOAptGet.is_exec(self, 'nginx'):
171172
apt_packages = apt_packages + WOVar.wo_nginx
@@ -1139,6 +1140,9 @@ def purge(self):
11391140
WOShellExec.cmd_exec(self, "bash /opt/netdata/usr/"
11401141
"libexec/netdata/netdata-"
11411142
"uninstaller.sh -y -f")
1143+
if WOShellExec.cmd_exec(self, 'mysqladmin ping'):
1144+
WOMysql.execute(
1145+
self, "DELETE FROM mysql.user WHERE User = 'netdata';")
11421146

11431147
if (apt_packages):
11441148
Log.wait(self, "Purging APT Packages ")

wo/cli/plugins/stack_pref.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,15 @@ def post_pref(self, apt_packages, packages, upgrade=False):
321321
"'\"$http_referer\" "
322322
"\"$http_user_agent\"';\n")
323323

324-
# Nginx-Plus does not have nginx
325-
# package structure like this
326-
# So creating directories
324+
if not os.path.exists('/etc/nginx/bots.d'):
325+
WOFileUtils.textwrite(
326+
self, '/etc/nginx/conf.d/variables-hash.conf',
327+
'variables_hash_max_size 4096;\n'
328+
'variables_hash_bucket_size 4096;')
329+
330+
# Nginx-Plus does not have nginx
331+
# package structure like this
332+
# So creating directories
327333
if not os.path.exists('/etc/nginx/sites-available'):
328334
Log.debug(self, 'Creating directory'
329335
'/etc/nginx/sites-available')
@@ -1404,11 +1410,15 @@ def post_pref(self, apt_packages, packages, upgrade=False):
14041410
try:
14051411
WOMysql.execute(
14061412
self,
1407-
"create user 'netdata'@'localhost';",
1413+
"DELETE FROM mysql.user WHERE User = 'netdata';",
14081414
log=False)
14091415
WOMysql.execute(
14101416
self,
1411-
"grant usage on *.* to 'netdata'@'localhost';",
1417+
"create user 'netdata'@'127.0.0.1';",
1418+
log=False)
1419+
WOMysql.execute(
1420+
self,
1421+
"grant usage on *.* to 'netdata'@'127.0.0.1';",
14121422
log=False)
14131423
WOMysql.execute(
14141424
self, "flush privileges;",
@@ -1585,11 +1595,16 @@ def post_pref(self, apt_packages, packages, upgrade=False):
15851595
# ngxblocker
15861596
if any('/usr/local/sbin/install-ngxblocker' == x[1]
15871597
for x in packages):
1598+
# remove duplicate directives
1599+
if os.path.exists('/etc/nginx/conf.d/variables-hash.conf'):
1600+
WOFileUtils.rm(self, '/etc/nginx/conf.d/variables-hash.conf')
15881601
WOFileUtils.chmod(
15891602
self, "/usr/local/sbin/install-ngxblocker", 0o700)
15901603
WOShellExec.cmd_exec(self, '/usr/local/sbin/install-ngxblocker -x')
15911604
WOFileUtils.chmod(
15921605
self, "/usr/local/sbin/update-ngxblocker", 0o700)
1606+
if not WOService.restart_service(self, 'nginx'):
1607+
Log.error(self, 'ngxblocker install failed')
15931608

15941609

15951610
def pre_stack(self):

wo/cli/plugins/stack_upgrade.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,6 @@ def default(self, disp_msg=False):
269269
'/usr/local/sbin/update-ngxblocker',
270270
'ngxblocker'
271271
]]
272-
else:
273-
Log.info(self, "ngxblocker is not installed")
274272

275273
if ((not (apt_packages)) and (not(packages))):
276274
self.app.args.print_help()
@@ -347,6 +345,9 @@ def default(self, disp_msg=False):
347345
WOFileUtils.chmod(self, "/usr/local/bin/wp", 0o775)
348346

349347
if WOAptGet.is_selected(self, 'ngxblocker', packages):
348+
if os.path.exists('/etc/nginx/conf.d/variables-hash.conf'):
349+
WOFileUtils.rm(
350+
self, '/etc/nginx/conf.d/variables-hash.conf')
350351
WOFileUtils.chmod(
351352
self, '/usr/local/sbin/update-ngxblocker', 0o775)
352353
WOShellExec.cmd_exec(

wo/cli/templates/virtualconf.mustache

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ server {
2121
location / {
2222
proxy_pass http://{{host}}:{{port}};
2323
proxy_redirect off;
24-
proxy_set_header Host $host;
25-
proxy_set_header X-Real-IP $remote_addr;
26-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
24+
include proxy_params;
2725
}
2826

2927
# Security settings for better privacy

wo/core/mysql.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -108,17 +108,13 @@ def backupAll(self):
108108
if dbs == "":
109109
continue
110110
Log.info(self, "Backing up {0} database".format(dbs))
111-
p1 = subprocess.Popen("/usr/bin/mysqldump {0}"
112-
" --max_allowed_packet=1024M"
113-
" --single-transaction".format(dbs),
114-
stdout=subprocess.PIPE,
115-
stderr=subprocess.PIPE, shell=True)
116-
p2 = subprocess.Popen("/usr/bin/pigz -c > "
117-
"/var/lib/wo-backup/mysql/{0}{1}.sql.gz"
118-
.format(dbs, WOVar.wo_date),
119-
stdin=p1.stdout,
120-
shell=True)
121-
111+
p1 = subprocess.Popen(
112+
"/usr/bin/mysqldump {0} --max_allowed_packet=1024M "
113+
"--single-transaction ".format(dbs),
114+
stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
115+
p2 = subprocess.Popen(
116+
"/usr/bin/pigz -c > /var/lib/wo-backup/mysql/{0}{1}.sql.gz"
117+
.format(dbs, WOVar.wo_date), stdin=p1.stdout, shell=True)
122118
# Allow p1 to receive a SIGPIPE if p2 exits
123119
p1.stdout.close()
124120
output = p1.stderr.read()

wo/core/variables.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class WOVar():
1414
"""Intialization of core variables"""
1515

1616
# WordOps version
17-
wo_version = "3.11.1"
17+
wo_version = "3.11.2"
1818
# WordOps packages versions
1919
wo_wp_cli = "2.4.0"
2020
wo_adminer = "4.7.5"

0 commit comments

Comments
 (0)