Browse Source

Merge branch 'master' into stable

stable v3.1.5
gau1991 10 years ago
parent
commit
acce40ee4e
  1. 5
      CHANGELOG.txt
  2. 2
      README.md
  3. 6
      ee/cli/plugins/debug.py
  4. 6
      ee/cli/plugins/secure.py
  5. 63
      ee/cli/plugins/site.py
  6. 19
      ee/cli/plugins/site_functions.py
  7. 62
      ee/cli/plugins/stack.py
  8. 4
      ee/cli/plugins/stack_upgrade.py
  9. 2
      ee/cli/templates/nginx-core.mustache
  10. 9
      ee/core/apt_repo.py
  11. 19
      ee/core/variables.py
  12. 2
      install
  13. 2
      setup.py

5
CHANGELOG.txt

@ -1,3 +1,8 @@
v 3.1.5 - May 14, 2015
- Fixed Debain 7 stack issues. see #538 #539 #540 #435 #546
- Updated MySQLTuner see #484
- Minor fixes and improvements.
v 3.1.4 - May 7, 2015
- Fixed XSS Vulnerability found in some WordPress themes and plugins

2
README.md

@ -15,7 +15,7 @@ EasyEngine (ee) is a python tool, which makes it easy to manage your wordpress s
```bash
wget -qO ee rt.cx/ee && sudo bash ee # Install easyengine 3
sudo ee site create example.com --wp # Install required packages & setup WordPress on example.com
sudo ee site create example.com --wp # Install required packages & setup WordPress on example.com
```
## Update EasyEngine

6
ee/cli/plugins/debug.py

@ -454,21 +454,27 @@ class EEDebugController(CementBaseController):
"""Handle Ctrl+c hevent for -i option of debug"""
self.start = False
if self.app.pargs.nginx:
self.app.pargs.nginx = 'off'
self.debug_nginx()
if self.app.pargs.php:
self.app.pargs.php = 'off'
self.debug_php()
if self.app.pargs.fpm:
self.app.pargs.fpm = 'off'
self.debug_fpm()
if self.app.pargs.mysql:
# MySQL debug will not work for remote MySQL
if EEVariables.ee_mysql_host is "localhost":
self.app.pargs.mysql = 'off'
self.debug_mysql()
else:
Log.warn(self, "Remote MySQL found, EasyEngine will not "
"enable remote debug")
if self.app.pargs.wp:
self.app.pargs.wp = 'off'
self.debug_wp()
if self.app.pargs.rewrite:
self.app.pargs.rewrite = 'off'
self.debug_rewrite()
# Reload Nginx

6
ee/cli/plugins/secure.py

@ -93,7 +93,7 @@ class EESecureController(CementBaseController):
Log.info(self, "Please Enter valid port number :")
port = input("EasyEngine admin port [22222]:")
self.app.pargs.user_input = port
if EEVariables.ee_platform_distro == 'Ubuntu':
if EEVariables.ee_platform_distro == 'ubuntu':
EEShellExec.cmd_exec(self, "sed -i \"s/listen.*/listen "
"{port} default_server ssl spdy;/\" "
"/etc/nginx/sites-available/22222"
@ -105,7 +105,9 @@ class EESecureController(CementBaseController):
.format(port=self.app.pargs.user_input))
EEGit.add(self, ["/etc/nginx"],
msg="Adding changed secure port into Git")
EEService.reload_service(self, 'nginx')
if not EEService.reload_service(self, 'nginx'):
Log.error(self, "service nginx reload failed. "
"check issues with `nginx -t` command")
Log.info(self, "Successfully port changed {port}"
.format(port=self.app.pargs.user_input))

63
ee/cli/plugins/site.py

@ -69,7 +69,9 @@ class EESiteController(CementBaseController):
.format(ee_domain))
updateSiteInfo(self, ee_domain, enabled=True)
Log.info(self, "[" + Log.ENDC + "OK" + Log.OKBLUE + "]")
EEService.reload_service(self, 'nginx')
if not EEService.reload_service(self, 'nginx'):
Log.error(self, "service nginx reload failed. "
"check issues with `nginx -t` command")
else:
Log.error(self, "nginx configuration file does not exist"
.format(ee_domain))
@ -107,7 +109,9 @@ class EESiteController(CementBaseController):
.format(ee_domain))
updateSiteInfo(self, ee_domain, enabled=False)
Log.info(self, "[" + Log.ENDC + "OK" + Log.OKBLUE + "]")
EEService.reload_service(self, 'nginx')
if not EEService.reload_service(self, 'nginx'):
Log.error(self, "service nginx reload failed. "
"check issues with `nginx -t` command")
else:
Log.error(self, "nginx configuration file does not exist"
.format(ee_domain))
@ -277,7 +281,9 @@ class EESiteEditController(CementBaseController):
EEGit.add(self, ["/etc/nginx"], msg="Edit website: {0}"
.format(ee_domain))
# Reload NGINX
EEService.reload_service(self, 'nginx')
if not EEService.reload_service(self, 'nginx'):
Log.error(self, "service nginx reload failed. "
"check issues with `nginx -t` command")
else:
Log.error(self, "nginx configuration file does not exists"
.format(ee_domain))
@ -298,7 +304,9 @@ class EESiteEditController(CementBaseController):
msg="Edit Pagespped config of site: {0}"
.format(ee_domain))
# Reload NGINX
EEService.reload_service(self, 'nginx')
if not EEService.reload_service(self, 'nginx'):
Log.error(self, "service nginx reload failed. "
"check issues with `nginx -t` command")
else:
Log.error(self, "Pagespeed configuration file does not exists"
.format(ee_domain))
@ -499,7 +507,15 @@ class EESiteCreateController(CementBaseController):
if 'proxy' in data.keys() and data['proxy']:
addNewSite(self, ee_domain, stype, cache, ee_site_webroot)
# Service Nginx Reload
EEService.reload_service(self, 'nginx')
if not EEService.reload_service(self, 'nginx'):
Log.info(self, Log.FAIL + "Oops Something went wrong !!")
Log.info(self, Log.FAIL + "Calling cleanup actions ...")
doCleanupAction(self, domain=ee_domain)
Log.debug(self, str(e))
Log.error(self, "service nginx reload failed. "
"check issues with `nginx -t` command")
Log.error(self, "Check logs for reason "
"`tail /var/log/ee/ee.log` & Try Again!!!")
if ee_auth and len(ee_auth):
for msg in ee_auth:
Log.info(self, Log.ENDC + msg, log=False)
@ -588,8 +604,22 @@ class EESiteCreateController(CementBaseController):
Log.error(self, "Check logs for reason "
"`tail /var/log/ee/ee.log` & Try Again!!!")
# Service Nginx Reload
EEService.reload_service(self, 'nginx')
# Service Nginx Reload call cleanup if failed to reload nginx
if not EEService.reload_service(self, 'nginx'):
Log.info(self, Log.FAIL + "Oops Something went wrong !!")
Log.info(self, Log.FAIL + "Calling cleanup actions ...")
doCleanupAction(self, domain=ee_domain,
webroot=data['webroot'])
if 'ee_db_name' in data.keys():
doCleanupAction(self, domain=ee_domain,
dbname=data['ee_db_name'],
dbuser=data['ee_db_user'],
dbhost=data['ee_db_host'])
deleteSiteInfo(self, ee_domain)
Log.info(self, Log.FAIL + "service nginx reload failed."
" check issues with `nginx -t` command.")
Log.error(self, "Check logs for reason "
"`tail /var/log/ee/ee.log` & Try Again!!!")
EEGit.add(self, ["/etc/nginx"],
msg="{0} created with {1} {2}"
@ -602,10 +632,13 @@ class EESiteCreateController(CementBaseController):
Log.info(self, Log.FAIL + "Oops Something went wrong !!")
Log.info(self, Log.FAIL + "Calling cleanup actions ...")
doCleanupAction(self, domain=ee_domain,
webroot=data['webroot'],
dbname=data['ee_db_name'],
dbuser=data['ee_db_user'],
dbhost=data['ee_db_host'])
webroot=data['webroot'])
if 'ee_db_name' in data.keys():
print("Inside db cleanup")
doCleanupAction(self, domain=ee_domain,
dbname=data['ee_db_name'],
dbuser=data['ee_db_user'],
dbhost=data['ee_db_host'])
deleteSiteInfo(self, ee_domain)
Log.error(self, "Check logs for reason "
"`tail /var/log/ee/ee.log` & Try Again!!!")
@ -985,7 +1018,9 @@ class EESiteUpdateController(CementBaseController):
if stype == oldsitetype and cache == oldcachetype:
# Service Nginx Reload
EEService.reload_service(self, 'nginx')
if not EEService.reload_service(self, 'nginx'):
Log.error(self, "service nginx reload failed. "
"check issues with `nginx -t` command")
updateSiteInfo(self, ee_domain, stype=stype, cache=cache,
hhvm=hhvm, pagespeed=pagespeed)
@ -1090,7 +1125,9 @@ class EESiteUpdateController(CementBaseController):
"`tail /var/log/ee/ee.log` & Try Again!!!")
return 1
# Service Nginx Reload
EEService.reload_service(self, 'nginx')
if not EEService.reload_service(self, 'nginx'):
Log.error(self, "service nginx reload failed. "
"check issues with `nginx -t` command")
EEGit.add(self, ["/etc/nginx"],
msg="{0} updated with {1} {2}"

19
ee/cli/plugins/site_functions.py

@ -566,6 +566,14 @@ def site_package_check(self, stype):
if not EEAptGet.is_installed(self, check_nginx):
apt_packages = apt_packages + EEVariables.ee_nginx
else:
# Fix for Nginx white screen death
if not EEFileUtils.grep(self, '/etc/nginx/fastcgi_params',
'SCRIPT_FILENAME'):
with open('/etc/nginx/fastcgi_params', encoding='utf-8',
mode='a') as ee_nginx:
ee_nginx.write('fastcgi_param \tSCRIPT_FILENAME '
'\t$request_filename;\n')
if stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
Log.debug(self, "Setting apt_packages variable for PHP")
@ -576,6 +584,10 @@ def site_package_check(self, stype):
Log.debug(self, "Setting apt_packages variable for MySQL")
if not EEShellExec.cmd_exec(self, "mysqladmin ping"):
apt_packages = apt_packages + EEVariables.ee_mysql
packages = packages + [["https://raw.githubusercontent.com/"
"major/MySQLTuner-perl/master/"
"mysqltuner.pl", "/usr/bin/mysqltuner",
"MySQLTuner"]]
if stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
Log.debug(self, "Setting apt_packages variable for Postfix")
@ -630,6 +642,13 @@ def site_package_check(self, stype):
out=ee_nginx)
ee_nginx.close()
if os.path.isfile("/etc/nginx/conf.d/upstream.conf"):
if not EEFileUtils.grep(self, "/etc/nginx/conf.d/upstream.conf",
"hhvm"):
with open("/etc/nginx/conf.d/upstream.conf", "a") as hhvm_file:
hhvm_file.write("upstream hhvm {\nserver 127.0.0.1:8000;\n"
"server 127.0.0.1:9000 backup;\n}\n")
# Check if Nginx is allready installed and Pagespeed config there or not
# If not then copy pagespeed config
if self.app.pargs.pagespeed:

62
ee/cli/plugins/stack.py

@ -102,11 +102,12 @@ class EEStackController(CementBaseController):
with open('/etc/apt/preferences.d/'
'MariaDB.pref', 'w') as mysql_pref_file:
mysql_pref_file.write(mysql_pref)
EERepo.add(self, repo_url=EEVariables.ee_mysql_repo)
Log.debug(self, 'Adding key for {0}'
.format(EEVariables.ee_mysql_repo))
EERepo.add_key(self, '0xcbcb082a1bb943db',
keyserver="keyserver.ubuntu.com")
if EEVariables.ee_platform_codename != 'jessie':
EERepo.add(self, repo_url=EEVariables.ee_mysql_repo)
Log.debug(self, 'Adding key for {0}'
.format(EEVariables.ee_mysql_repo))
EERepo.add_key(self, '0xcbcb082a1bb943db',
keyserver="keyserver.ubuntu.com")
chars = ''.join(random.sample(string.ascii_letters, 8))
Log.debug(self, "Pre-seeding MySQL")
Log.debug(self, "echo \"mariadb-server-10.0 "
@ -160,11 +161,13 @@ class EEStackController(CementBaseController):
if set(EEVariables.ee_php).issubset(set(apt_packages)):
Log.info(self, "Adding repository for PHP, please wait...")
# Add repository for php
if EEVariables.ee_platform_distro == 'debian':
Log.debug(self, 'Adding repo_url of php for debian')
EERepo.add(self, repo_url=EEVariables.ee_php_repo)
Log.debug(self, 'Adding Dotdeb/php GPG key')
EERepo.add_key(self, '89DF5277')
if EEVariables.ee_platform_codename != 'jessie':
Log.debug(self, 'Adding repo_url of php for debian')
EERepo.add(self, repo_url=EEVariables.ee_php_repo)
Log.debug(self, 'Adding Dotdeb/php GPG key')
EERepo.add_key(self, '89DF5277')
else:
Log.debug(self, 'Adding ppa for PHP')
EERepo.add(self, ppa=EEVariables.ee_php_repo)
@ -201,7 +204,7 @@ class EEStackController(CementBaseController):
EEService.reload_service(self, 'postfix')
if set(EEVariables.ee_nginx).issubset(set(apt_packages)):
if ((not EEShellExec.cmd_exec(self, "grep EasyEngine "
if ((not EEShellExec.cmd_exec(self, "grep -q -Hr EasyEngine "
"/etc/nginx")) and os.path.isfile('/etc/nginx/nginx.conf')):
nc = NginxConfig()
Log.debug(self, 'Loading file /etc/nginx/nginx.conf ')
@ -218,7 +221,12 @@ class EEStackController(CementBaseController):
nc.savef('/etc/nginx/nginx.conf')
# Custom Nginx configuration by EasyEngine
data = dict(version=EEVariables.ee_version)
if EEVariables.ee_platform_distro == 'ubuntu':
data = dict(version=EEVariables.ee_version,
Ubuntu=True)
else:
data = dict(version=EEVariables.ee_version,
Debian=True)
Log.debug(self, 'Writting the nginx configuration to '
'file /etc/nginx/conf.d/ee-nginx.conf ')
ee_nginx = open('/etc/nginx/conf.d/ee-nginx.conf',
@ -353,6 +361,17 @@ class EEStackController(CementBaseController):
out=ee_nginx)
ee_nginx.close()
# Fix whitescreen of death beacuse of missing value
# fastcgi_param SCRIPT_FILENAME $request_filename; in file
# /etc/nginx/fastcgi_params
if not EEFileUtils.grep(self, '/etc/nginx/fastcgi_params',
'SCRIPT_FILENAME'):
with open('/etc/nginx/fastcgi_params',
encoding='utf-8', mode='a') as ee_nginx:
ee_nginx.write('fastcgi_param \tSCRIPT_FILENAME '
'\t$request_filename;\n')
# Pagespeed configuration
Log.debug(self, 'Writting the Pagespeed Global '
'configuration to file /etc/nginx/conf.d/'
@ -472,7 +491,8 @@ class EEStackController(CementBaseController):
# For debian install xdebug
if EEVariables.ee_platform_distro == "debian":
if (EEVariables.ee_platform_distro == "debian" and
EEVariables.ee_platform_codename == 'wheezy'):
EEShellExec.cmd_exec(self, "pecl install xdebug")
with open("/etc/php5/mods-available/xdebug.ini",
@ -682,7 +702,9 @@ class EEStackController(CementBaseController):
out=ee_nginx)
ee_nginx.close()
EEService.reload_service(self, 'nginx')
if not EEService.reload_service(self, 'nginx'):
Log.error(self, "Failed to reload Nginx, please check "
"output of `nginx -t`")
if set(EEVariables.ee_mysql).issubset(set(apt_packages)):
# TODO: Currently we are using, we need to remove it in future
@ -712,6 +734,9 @@ class EEStackController(CementBaseController):
except CommandExecutionError as e:
Log.error(self, "Unable to update MySQL file")
# Set MySQLTuner permission
EEFileUtils.chmod(self, "/usr/bin/mysqltuner", 0o775)
EEGit.add(self, ["/etc/mysql"], msg="Adding MySQL into Git")
EEService.reload_service(self, 'mysql')
@ -1449,7 +1474,7 @@ class EEStackController(CementBaseController):
if self.app.pargs.nginx:
Log.debug(self, "Setting apt_packages variable for Nginx")
if EEVariables.ee_platform_distro == 'Debian':
if EEVariables.ee_platform_distro == 'debian':
check_nginx = 'nginx-extras'
else:
check_nginx = 'nginx-custom'
@ -1479,6 +1504,13 @@ class EEStackController(CementBaseController):
Log.debug(self, "Setting apt_packages variable for MySQL")
if not EEShellExec.cmd_exec(self, "mysqladmin ping"):
apt_packages = apt_packages + EEVariables.ee_mysql
packages = packages + [["https://raw."
"githubusercontent.com/"
"major/MySQLTuner-perl"
"/master/mysqltuner.pl",
"/usr/bin/mysqltuner",
"MySQLTuner"]]
else:
Log.debug(self, "MySQL connection is already alive")
Log.info(self, "MySQL connection is already alive")
@ -1664,6 +1696,7 @@ class EEStackController(CementBaseController):
if self.app.pargs.mysql:
Log.debug(self, "Removing apt_packages variable of MySQL")
apt_packages = apt_packages + EEVariables.ee_mysql
packages = packages + ['/usr/bin/mysqltuner']
if self.app.pargs.postfix:
Log.debug(self, "Removing apt_packages variable of Postfix")
apt_packages = apt_packages + EEVariables.ee_postfix
@ -1777,6 +1810,7 @@ class EEStackController(CementBaseController):
if self.app.pargs.mysql:
Log.debug(self, "Purge apt_packages variable MySQL")
apt_packages = apt_packages + EEVariables.ee_mysql
packages = packages + ['/usr/bin/mysqltuner']
if self.app.pargs.postfix:
Log.debug(self, "Purge apt_packages variable PostFix")
apt_packages = apt_packages + EEVariables.ee_postfix

4
ee/cli/plugins/stack_upgrade.py

@ -48,7 +48,7 @@ class EEStackUpgradeController(CementBaseController):
@expose(hide=True)
def upgrade_php56(self):
if EEVariables.ee_platform_distro == "Ubuntu":
if EEVariables.ee_platform_distro == "ubuntu":
if os.path.isfile("/etc/apt/sources.list.d/ondrej-php5-5_6-{0}."
"list".format(EEVariables.ee_platform_codename)):
Log.error(self, "Unable to find PHP 5.5")
@ -67,7 +67,7 @@ class EEStackUpgradeController(CementBaseController):
if start_upgrade != "Y" and start_upgrade != "y":
Log.error(self, "Not starting PHP package update")
if EEVariables.ee_platform_distro == "Ubuntu":
if EEVariables.ee_platform_distro == "ubuntu":
EERepo.remove(self, ppa="ppa:ondrej/php5")
EERepo.add(self, ppa=EEVariables.ee_php_repo)
else:

2
ee/cli/templates/nginx-core.mustache

@ -21,7 +21,9 @@ client_max_body_size 100m;
# SSL Settings
ssl_session_cache shared:SSL:20m;
ssl_session_timeout 10m;
{{#Ubuntu}}
ssl_prefer_server_ciphers on;
{{/Ubuntu}}
ssl_ciphers HIGH:!aNULL:!MD5:!kEDH;
# Log format Settings

9
ee/core/apt_repo.py

@ -47,13 +47,8 @@ class EERepo():
Log.debug(self, "{0}".format(e))
Log.error(self, "Unable to add repo")
if ppa is not None:
if EEVariables.ee_platform_distro == 'squeeze':
print("Cannot add repo for {distro}"
.format(distro=EEVariables.ee_platform_distro))
else:
EEShellExec.cmd_exec(self, "add-apt-repository -y "
"'{ppa_name}'"
.format(ppa_name=ppa))
EEShellExec.cmd_exec(self, "add-apt-repository -y '{ppa_name}'"
.format(ppa_name=ppa))
def remove(self, ppa=None, repo_url=None):
"""

19
ee/core/variables.py

@ -12,10 +12,10 @@ class EEVariables():
"""Intialization of core variables"""
# EasyEngine version
ee_version = "3.1.4"
ee_version = "3.1.5"
# EasyEngine packages versions
ee_wp_cli = "0.19.0"
ee_wp_cli = "0.19.1"
ee_adminer = "4.2.1"
ee_roundcube = "1.1.1"
ee_vimbadmin = "3.0.11"
@ -24,7 +24,7 @@ class EEVariables():
ee_date = datetime.datetime.now().strftime('%d%b%Y%H%M%S')
# EasyEngine core variables
ee_platform_distro = platform.linux_distribution()[0]
ee_platform_distro = platform.linux_distribution()[0].lower()
ee_platform_version = platform.linux_distribution()[1]
ee_platform_codename = os.popen("lsb_release -sc | tr -d \'\\n\'").read()
@ -76,7 +76,7 @@ class EEVariables():
# EasyEngine stack installation varibales
# Nginx repo and packages
if ee_platform_distro == 'Ubuntu':
if ee_platform_distro == 'ubuntu':
ee_nginx_repo = "ppa:rtcamp/nginx"
ee_nginx = ["nginx-custom", "nginx-common"]
elif ee_platform_distro == 'debian':
@ -85,7 +85,7 @@ class EEVariables():
ee_nginx = ["nginx-extras", "nginx-common"]
# PHP repo and packages
if ee_platform_distro == 'Ubuntu':
if ee_platform_distro == 'ubuntu':
ee_php_repo = "ppa:ondrej/php5-5.6"
elif ee_platform_codename == 'wheezy':
ee_php_repo = ("deb http://packages.dotdeb.org {codename}-php56 all"
@ -95,11 +95,11 @@ class EEVariables():
"php5-mysql", "php5-cli", "php5-memcache", "php5-imagick",
"memcached", "graphviz", "php-pear", "php5-dev"]
if ee_platform_distro == 'Ubuntu':
if ee_platform_distro == 'ubuntu' or ee_platform_codename == 'jessie':
ee_php = ee_php + ["php5-xdebug"]
# MySQL repo and packages
if ee_platform_distro == 'Ubuntu':
if ee_platform_distro == 'ubuntu':
ee_mysql_repo = ("deb http://mirror.aarnet.edu.au/pub/MariaDB/repo/"
"10.0/ubuntu {codename} main"
.format(codename=ee_platform_codename))
@ -107,7 +107,8 @@ class EEVariables():
ee_mysql_repo = ("deb http://mirror.aarnet.edu.au/pub/MariaDB/repo/"
"10.0/debian {codename} main"
.format(codename=ee_platform_codename))
ee_mysql = ["mariadb-server", "mysqltuner", "percona-toolkit"]
ee_mysql = ["mariadb-server", "percona-toolkit"]
# Postfix repo and packages
ee_postfix_repo = ""
@ -130,7 +131,7 @@ class EEVariables():
# HHVM repo details
# 12.04 requires boot repository
if ee_platform_distro == 'Ubuntu':
if ee_platform_distro == 'ubuntu':
if ee_platform_codename == "precise":
ee_boost_repo = ("ppa:mapnik/boost")

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.4"
readonly ee_version_new="3.1.5"
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.4',
version='3.1.5',
description=long_description,
long_description=long_description,
classifiers=[],

Loading…
Cancel
Save