Browse Source

Merge branch 'master' into stable

stable v3.1.3
gau1991 10 years ago
parent
commit
f12909fbd0
  1. 4
      CHANGELOG.txt
  2. 11
      ee/cli/plugins/site.py
  3. 7
      ee/cli/templates/22222.mustache
  4. 2
      ee/cli/templates/locations.mustache
  5. 2
      ee/cli/templates/php-hhvm.mustache
  6. 2
      ee/cli/templates/php.mustache
  7. 2
      ee/cli/templates/w3tc-hhvm.mustache
  8. 2
      ee/cli/templates/w3tc.mustache
  9. 2
      ee/cli/templates/wpcommon.mustache
  10. 2
      ee/cli/templates/wpfc-hhvm.mustache
  11. 2
      ee/cli/templates/wpfc.mustache
  12. 2
      ee/cli/templates/wpsc-hhvm.mustache
  13. 2
      ee/cli/templates/wpsc.mustache
  14. 2
      ee/cli/templates/wpsubdir.mustache
  15. 59
      ee/core/aptget.py
  16. 59
      ee/core/nginxhashbucket.py
  17. 2
      ee/core/variables.py
  18. 2
      install
  19. 2
      setup.py

4
CHANGELOG.txt

@ -1,3 +1,7 @@
v 3.1.3 - May 6, 2015
- EasyEngine now fixes missing GPG keys automatically, fixes #470
- Fixed Nginx hash bucket issue, fixes #449
v 3.1.2 - April 29, 2015
- Updated PHP version from PHP 5.5 to PHP 5.6 #425
- Added ee stack upgrade command for stack upgrade #458

11
ee/cli/plugins/site.py

@ -9,6 +9,7 @@ from ee.core.services import EEService
from ee.cli.plugins.sitedb import *
from ee.core.git import EEGit
from subprocess import Popen
from ee.core.nginxhashbucket import hashbucket
import sys
import os
import glob
@ -471,10 +472,20 @@ class EESiteCreateController(CementBaseController):
# Check rerequired packages are installed or not
ee_auth = site_package_check(self, stype)
try:
pre_run_checks(self)
except SiteError as e:
Log.debug(self, str(e))
Log.error(self, "NGINX configuration check failed.")
try:
try:
# setup NGINX configuration, and webroot
setupdomain(self, data)
# Fix Nginx Hashbucket size error
hashbucket(self)
except SiteError as e:
# call cleanup actions on failure
Log.info(self, Log.FAIL + "Oops Something went wrong !!")

7
ee/cli/templates/22222.mustache

@ -19,21 +19,24 @@ server {
# Turn on directory listing
autoindex on;
# HTTP Authentication on port 22222
include common/acl.conf;
location / {
include common/acl.conf;
try_files $uri $uri/ /index.php?$args;
}
# Display menu at location /fpm/status/
location = /fpm/status/ {}
location ~ /fpm/status/(.*) {
try_files $uri =404;
include fastcgi_params;
fastcgi_param SCRIPT_NAME /status;
fastcgi_pass $1;
}
location ~ \.php$ {
include common/acl.conf;
try_files $uri =404;
include fastcgi_params;
fastcgi_pass php;

2
ee/cli/templates/locations.mustache

@ -1,5 +1,5 @@
# NGINX CONFIGURATION FOR COMMON LOCATION
# DO NOT MODIFY, ALL CHNAGES LOST AFTER UPDATE EasyEngine (ee)
# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE EasyEngine (ee)
# Basic locations files
location = /favicon.ico {
access_log off;

2
ee/cli/templates/php-hhvm.mustache

@ -1,5 +1,5 @@
# PHP NGINX CONFIGURATION
# DO NOT MODIFY, ALL CHNAGES LOST AFTER UPDATE EasyEngine (ee)
# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE EasyEngine (ee)
location / {
try_files $uri $uri/ /index.php?$args;
}

2
ee/cli/templates/php.mustache

@ -1,5 +1,5 @@
# PHP NGINX CONFIGURATION
# DO NOT MODIFY, ALL CHNAGES LOST AFTER UPDATE EasyEngine (ee)
# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE EasyEngine (ee)
location / {
try_files $uri $uri/ /index.php?$args;
}

2
ee/cli/templates/w3tc-hhvm.mustache

@ -1,6 +1,6 @@
# W3TC NGINX CONFIGURATION
# DO NOT MODIFY, ALL CHNAGES LOST AFTER UPDATE EasyEngine (ee)
# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE EasyEngine (ee)
set $cache_uri $request_uri;
# POST requests and URL with a query string should always go to php
if ($request_method = POST) {

2
ee/cli/templates/w3tc.mustache

@ -1,6 +1,6 @@
# W3TC NGINX CONFIGURATION
# DO NOT MODIFY, ALL CHNAGES LOST AFTER UPDATE EasyEngine (ee)
# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE EasyEngine (ee)
set $cache_uri $request_uri;
# POST requests and URL with a query string should always go to php
if ($request_method = POST) {

2
ee/cli/templates/wpcommon.mustache

@ -1,5 +1,5 @@
# WordPress COMMON SETTINGS
# DO NOT MODIFY, ALL CHNAGES LOST AFTER UPDATE EasyEngine (ee)
# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE EasyEngine (ee)
# Limit access to avoid brute force attack
location = /wp-login.php {
limit_req zone=one burst=1 nodelay;

2
ee/cli/templates/wpfc-hhvm.mustache

@ -1,5 +1,5 @@
# WPFC NGINX CONFIGURATION
# DO NOT MODIFY, ALL CHNAGES LOST AFTER UPDATE EasyEngine (ee)
# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE EasyEngine (ee)
set $skip_cache 0;
# POST requests and URL with a query string should always go to php
if ($request_method = POST) {

2
ee/cli/templates/wpfc.mustache

@ -1,5 +1,5 @@
# WPFC NGINX CONFIGURATION
# DO NOT MODIFY, ALL CHNAGES LOST AFTER UPDATE EasyEngine (ee)
# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE EasyEngine (ee)
set $skip_cache 0;
# POST requests and URL with a query string should always go to php
if ($request_method = POST) {

2
ee/cli/templates/wpsc-hhvm.mustache

@ -1,5 +1,5 @@
# WPSC NGINX CONFIGURATION
# DO NOT MODIFY, ALL CHNAGES LOST AFTER UPDATE EasyEngine (ee)
# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE EasyEngine (ee)
set $cache_uri $request_uri;
# POST requests and URL with a query string should always go to php
if ($request_method = POST) {

2
ee/cli/templates/wpsc.mustache

@ -1,5 +1,5 @@
# WPSC NGINX CONFIGURATION
# DO NOT MODIFY, ALL CHNAGES LOST AFTER UPDATE EasyEngine (ee)
# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE EasyEngine (ee)
set $cache_uri $request_uri;
# POST requests and URL with a query string should always go to php
if ($request_method = POST) {

2
ee/cli/templates/wpsubdir.mustache

@ -1,5 +1,5 @@
# WPSUBDIRECTORY NGINX CONFIGURATION
# DO NOT MODIFY, ALL CHNAGES LOST AFTER UPDATE EasyEngine (ee)
# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE EasyEngine (ee)
if (!-e $request_filename) {
# Redirect wp-admin to wp-admin/
rewrite /wp-admin$ $scheme://$host$uri/ permanent;

59
ee/core/aptget.py

@ -4,6 +4,7 @@ import apt_pkg
import sys
import subprocess
from ee.core.logging import Log
from ee.core.apt_repo import EERepo
from sh import apt_get
from sh import ErrorReturnCode
@ -13,24 +14,45 @@ class EEAptGet():
def update(self):
"""
Similar to `apt-get upgrade`
Similar to `apt-get update`
"""
try:
with open('/var/log/ee/ee.log', 'a') as f:
proc = subprocess.Popen('apt-get update',
shell=True,
stdin=None, stdout=f, stderr=f,
stdin=None, stdout=f,
stderr=subprocess.PIPE,
executable="/bin/bash")
proc.wait()
output, error_output = proc.communicate()
# Check what is error in error_output
if "NO_PUBKEY" in str(error_output):
# Split the output
Log.info(self, "Fixing missing GPG keys, please wait...")
error_list = str(error_output).split("\\n")
# Use a loop to add misising keys
for single_error in error_list:
if "NO_PUBKEY" in single_error:
key = single_error.rsplit(None, 1)[-1]
EERepo.add_key(self, key)
proc = subprocess.Popen('apt-get update',
shell=True,
stdin=None, stdout=f, stderr=f,
executable="/bin/bash")
proc.wait()
if proc.returncode == 0:
return True
else:
Log.error(self, "Unable to run apt-get update")
if proc.returncode == 0:
return True
else:
Log.info(self, Log.FAIL + "Oops Something went wrong!!")
Log.error(self, "Check logs for reason "
"`tail /var/log/ee/ee.log` & Try Again!!!")
except Exception as e:
Log.error(self, "Error while installing packages, "
"apt-get exited with error")
Log.error(self, "apt-get update exited with error")
def check_upgrade(self):
"""
@ -71,7 +93,10 @@ class EEAptGet():
if proc.returncode == 0:
return True
else:
Log.error(self, "Unable to run apt-get dist_upgrade")
Log.info(self, Log.FAIL + "Oops Something went "
"wrong!!")
Log.error(self, "Check logs for reason "
"`tail /var/log/ee/ee.log` & Try Again!!!")
except Exception as e:
Log.error(self, "Error while installing packages, "
"apt-get exited with error")
@ -94,11 +119,16 @@ class EEAptGet():
if proc.returncode == 0:
return True
else:
Log.error(self, "Unable to run apt-get install")
Log.info(self, Log.FAIL + "Oops Something went "
"wrong!!")
Log.error(self, "Check logs for reason "
"`tail /var/log/ee/ee.log` & Try Again!!!")
except Exception as e:
Log.error(self, "Error while installing packages, "
"apt-get exited with error")
Log.info(self, Log.FAIL + "Oops Something went "
"wrong!!")
Log.error(self, "Check logs for reason "
"`tail /var/log/ee/ee.log` & Try Again!!!")
def remove(self, packages, auto=False, purge=False):
all_packages = ' '.join(packages)
@ -118,7 +148,10 @@ class EEAptGet():
if proc.returncode == 0:
return True
else:
Log.error(self, "Unable to run apt-get remove/purge")
Log.info(self, Log.FAIL + "Oops Something went "
"wrong!!")
Log.error(self, "Check logs for reason "
"`tail /var/log/ee/ee.log` & Try Again!!!")
except Exception as e:
Log.error(self, "Error while installing packages, "

59
ee/core/nginxhashbucket.py

@ -0,0 +1,59 @@
"""EasyEngine Hash bucket calculate function for Nginx"""
from ee.core.fileutils import EEFileUtils
import math
import os
import fileinput
import re
import subprocess
def hashbucket(self):
# Check Nginx Hashbucket error
sub = subprocess.Popen('nginx -t', stdout=subprocess.PIPE,
stderr=subprocess.PIPE, shell=True)
output, error_output = sub.communicate()
if 'server_names_hash_bucket_size' not in str(error_output):
return True
count = 0
# Get the list of sites-availble
sites_list = os.listdir("/etc/nginx/sites-enabled/")
# Count the number of characters in site names
for site in sites_list:
count = sum([count, len(site)])
# Calculate Nginx hash bucket size
ngx_calc = math.trunc(sum([math.log(count, 2), 2]))
ngx_hash = math.trunc(math.pow(2, ngx_calc))
# Replace hashbucket in Nginx.conf file
if EEFileUtils.grep(self, "/etc/nginx/nginx.conf",
"server_names_hash_bucket_size"):
for line in fileinput.FileInput("/etc/nginx/nginx.conf", inplace=1):
if "server_names_hash_bucket_size" in line:
print("\tserver_names_hash_bucket_size {0};".format(ngx_hash))
else:
print(line, end='')
elif os.path.isfile('/etc/nginx/conf.d/ee-nginx.conf'):
if EEFileUtils.grep(self, "/etc/nginx/conf.d/ee-nginx.conf",
"server_names_hash_bucket_size"):
for line in fileinput.FileInput("/etc/nginx/conf.d/ee-nginx.conf",
inplace=1):
if "server_names_hash_bucket_size" in line:
print("server_names_hash_bucket_size {0};"
.format(ngx_hash))
else:
print(line, end='')
else:
with open('/etc/nginx/conf.d/ee-nginx.conf', 'a') as conf:
conf.write("server_names_hash_bucket_size {0};\n"
.format(ngx_hash))
else:
EEFileUtils.searchreplace(self, '/etc/nginx/nginx.conf',
"gzip_disable \"msie6\";",
"gzip_disable \"msie6\";\n"
"\tserver_names_hash_bucket_size {0};\n"
.format(ngx_hash))

2
ee/core/variables.py

@ -12,7 +12,7 @@ class EEVariables():
"""Intialization of core variables"""
# EasyEngine version
ee_version = "3.1.2"
ee_version = "3.1.3"
# EasyEngine packages versions
ee_wp_cli = "0.19.0"

2
install

@ -48,7 +48,7 @@ fi
# Define variables for later use
ee_branch=$1
readonly ee_version_old="2.2.3"
readonly ee_version_new="3.1.2"
readonly ee_version_new="3.1.3"
readonly ee_log_dir=/var/log/ee/
readonly ee_install_log=/var/log/ee/install.log
readonly ee_linux_distro=$(lsb_release -i | awk '{print $3}')

2
setup.py

@ -54,7 +54,7 @@ except Exception as e:
os.system("git config --global user.email {0}".format(ee_email))
setup(name='ee',
version='3.1.2',
version='3.1.3',
description=long_description,
long_description=long_description,
classifiers=[],

Loading…
Cancel
Save