Browse Source

Merge with latest code

bugfixes
gau1991 10 years ago
parent
commit
38c3cd6da4
  1. 8
      ee/cli/plugins/debug.py
  2. 108
      ee/cli/plugins/site.py
  3. 39
      ee/cli/plugins/site_functions.py
  4. 179
      ee/cli/plugins/stack.py
  5. 52
      ee/cli/plugins/stack_services.py
  6. 1
      ee/cli/templates/fastcgi.mustache
  7. 39
      ee/cli/templates/pagespeed-common.mustache
  8. 21
      ee/cli/templates/pagespeed-global.mustache
  9. 10
      ee/cli/templates/php-hhvm.mustache
  10. 5
      ee/cli/templates/upstream.mustache
  11. 3
      ee/cli/templates/virtualconf.mustache
  12. 31
      ee/cli/templates/w3tc-hhvm.mustache
  13. 36
      ee/cli/templates/wpfc-hhvm.mustache
  14. 31
      ee/cli/templates/wpsc-hhvm.mustache
  15. 1
      ee/core/fileutils.py
  16. 16
      ee/core/variables.py
  17. 5
      install

8
ee/cli/plugins/debug.py

@ -163,9 +163,9 @@ class EEDebugController(CementBaseController):
"conf.d/upstream.conf "
"| grep 9001")):
Log.info(self, "Enabling PHP debug")
data = dict(php="9001", debug="9001")
Log.info(self, 'Writting the Nginx debug configration to file '
'/etc/nginx/conf.d/upstream.conf ')
data = dict(php="9001", debug="9001", hhvm="9001")
Log.debug(self, 'Writting the Nginx debug configration to file'
' /etc/nginx/conf.d/upstream.conf ')
ee_nginx = open('/etc/nginx/conf.d/upstream.conf',
encoding='utf-8', mode='w')
self.app.render((data), 'upstream.mustache', out=ee_nginx)
@ -183,7 +183,7 @@ class EEDebugController(CementBaseController):
"/etc/nginx/conf.d/upstream.conf "
"| grep 9001"):
Log.info(self, "Disabling PHP debug")
data = dict(php="9000", debug="9001")
data = dict(php="9000", debug="9001", hhvm="8000")
Log.debug(self, 'Writting the Nginx debug configration to file'
' /etc/nginx/conf.d/upstream.conf ')
ee_nginx = open('/etc/nginx/conf.d/upstream.conf',

108
ee/cli/plugins/site.py

@ -268,6 +268,10 @@ class EESiteCreateController(CementBaseController):
(['--wpsc'],
dict(help="create wordpress single/multi site with wpsc cache",
action='store_true')),
(['--hhvm'],
dict(help="create HHVM site", action='store_true')),
(['--pagespeed'],
dict(help="create pagespeed site", action='store_true')),
]
@expose(hide=True)
@ -325,6 +329,20 @@ class EESiteCreateController(CementBaseController):
if stype == 'wpsubdir':
data['wpsubdir'] = True
if data and self.app.pargs.hhvm:
data['hhvm'] = True
hhvm = True
elif data:
data['hhvm'] = False
hhvm = False
if data and self.app.pargs.pagespeed:
data['pagespeed'] = True
pagespeed = True
elif data:
data['pagespeed'] = False
pagespeed = False
if not data:
self.app.args.print_help()
self.app.close(1)
@ -496,6 +514,14 @@ class EESiteUpdateController(CementBaseController):
dict(help="update to wpfc cache", action='store_true')),
(['--wpsc'],
dict(help="update to wpsc cache", action='store_true')),
(['--hhvm'],
dict(help='Use HHVM for site',
action='store' or 'store_const',
choices=('on', 'off'), const='on', nargs='?')),
(['--pagespeed'],
dict(help='Use PageSpeed for site',
action='store' or 'store_const',
choices=('on', 'off'), const='on', nargs='?'))
]
@expose(help="Update site type or cache")
@ -574,11 +600,84 @@ class EESiteUpdateController(CementBaseController):
if stype == 'wpsubdir':
data['wpsubdir'] = True
if self.app.pargs.pagespeed or self.app.pargs.hhvm:
if not stype:
stype = oldsitetype
if not cache:
cache = oldcachetype
if not data:
data = dict(site_name=ee_domain, www_domain=ee_www_domain,
currsitetype=oldsitetype,
currcachetype=oldcachetype,
webroot=ee_site_webroot)
if stype == 'html':
data['static'] = True
data['wp'] = False
data['multisite'] = False
data['wpsubdir'] = False
elif stype == 'php' or stype == 'mysql':
data['static'] = False
data['wp'] = False
data['multisite'] = False
data['wpsubdir'] = False
elif stype == 'wp':
data['static'] = False
data['wp'] = True
data['multisite'] = False
data['wpsubdir'] = False
elif stype == 'wpsubdir':
data['static'] = False
data['wp'] = True
data['multisite'] = True
data['wpsubdir'] = True
elif stype == 'wpsubdomain':
data['static'] = False
data['wp'] = True
data['multisite'] = True
data['wpsubdir'] = False
if cache == 'basic':
data['basic'] = True
data['w3tc'] = False
data['wpfc'] = False
data['wpsc'] = False
elif cache == 'w3tc':
data['basic'] = False
data['w3tc'] = True
data['wpfc'] = False
data['wpsc'] = False
elif cache == 'wpfc':
data['basic'] = False
data['w3tc'] = False
data['wpfc'] = True
data['wpsc'] = False
elif cache == 'wpsc':
data['basic'] = False
data['w3tc'] = False
data['wpfc'] = False
data['wpsc'] = True
if self.app.pargs.hhvm == 'on':
data['hhvm'] = True
hhvm = True
elif self.app.pargs.hhvm == 'off':
data['hhvm'] = False
hhvm = False
if self.app.pargs.pagespeed == 'on':
data['pagespeed'] = True
pagespeed = True
elif self.app.pargs.pagespeed == 'off':
data['pagespeed'] = False
pagespeed = False
if not data:
Log.error(self, " Cannot update {0}, Invalid Options"
.format(ee_domain))
ee_auth = site_package_check(self, stype)
sitebackup(self, data)
# setup NGINX configuration, and webroot
@ -589,6 +688,15 @@ class EESiteUpdateController(CementBaseController):
Log.error(self, "Update site failed. Check logs for reason "
"`tail /var/log/ee/ee.log` & Try Again!!!")
if stype == oldsitetype and cache == oldcachetype:
# Service Nginx Reload
EEService.reload_service(self, 'nginx')
Log.info(self, "Successfully updated site"
" http://{0}".format(ee_domain))
self.app.close(0)
if 'ee_db_name' in data.keys() and not data['wp']:
try:
data = setupdatabase(self, data)

39
ee/cli/plugins/site_functions.py

@ -526,7 +526,13 @@ def site_package_check(self, stype):
stack.app = self.app
if stype in ['html', 'php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
Log.debug(self, "Setting apt_packages variable for Nginx")
if not EEAptGet.is_installed(self, 'nginx-common'):
if EEVariables.ee_platform_distro == 'Debian':
check_nginx = 'nginx-extras'
else:
check_nginx = 'nginx-custom'
if not EEAptGet.is_installed(self, check_nginx):
apt_packages = apt_packages + EEVariables.ee_nginx
if stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
@ -552,6 +558,37 @@ def site_package_check(self, stype):
"wp-cli-{0}.phar"
.format(EEVariables.ee_wp_cli),
"/usr/bin/wp", "WP-CLI"]]
if self.app.pargs.hhvm:
Log.debug(self, "Setting apt_packages variable for HHVM")
if not EEAptGet.is_installed(self, 'hhvm'):
apt_packages = apt_packages + EEVariables.ee_hhvm
# Check if Nginx is allready installed and Pagespeed config there or not
# If not then copy pagespeed config
if self.app.pargs.pagespeed:
if (os.path.isdir('/etc/nginx') and
(not os.path.isfile('/etc/nginx/conf.d/pagespeed.conf'))):
# Pagespeed configuration
data = dict()
Log.debug(self, 'Writting the Pagespeed Global '
'configuration to file /etc/nginx/conf.d/'
'pagespeed.conf')
ee_nginx = open('/etc/nginx/conf.d/pagespeed.conf',
encoding='utf-8', mode='w')
self.app.render((data), 'pagespeed-global.mustache',
out=ee_nginx)
ee_nginx.close()
Log.debug(self, 'Writting the Pagespeed common '
'configuration to file /etc/nginx/common/'
'pagespeed.conf')
ee_nginx = open('/etc/nginx/common/pagespeed.conf',
encoding='utf-8', mode='w')
self.app.render((data), 'pagespeed-common.mustache',
out=ee_nginx)
ee_nginx.close()
return(stack.install(apt_packages=apt_packages, packages=packages,
disp_msg=False))

179
ee/cli/plugins/stack.py

@ -58,6 +58,8 @@ class EEStackController(CementBaseController):
dict(help='Install PHP stack', action='store_true')),
(['--mysql'],
dict(help='Install MySQL stack', action='store_true')),
(['--hhvm'],
dict(help='Install HHVM stack', action='store_true')),
(['--postfix'],
dict(help='Install Postfix stack', action='store_true')),
(['--wpcli'],
@ -166,6 +168,16 @@ class EEStackController(CementBaseController):
Log.debug(self, 'Adding ppa for PHP')
EERepo.add(self, ppa=EEVariables.ee_php_repo)
if set(EEVariables.ee_hhvm).issubset(set(apt_packages)):
Log.info(self, "Adding repository for HHVM, please wait ...")
if EEVariables.ee_platform_codename == 'precise':
Log.debug(self, 'Adding PPA for Boost')
EERepo.add(self, ppa=EEVariables.ee_boost_repo)
Log.debug(self, 'Adding ppa repo for HHVM')
EERepo.add(self, repo_url=EEVariables.ee_hhvm_repo)
Log.debug(self, 'Adding HHVM GPG Key')
EERepo.add_key(self, '0x5a16e7281be7a449')
if set(EEVariables.ee_mail).issubset(set(apt_packages)):
Log.debug(self, 'Executing the command debconf-set-selections.')
try:
@ -229,7 +241,7 @@ class EEStackController(CementBaseController):
self.app.render((data), 'fastcgi.mustache', out=ee_nginx)
ee_nginx.close()
data = dict(php="9000", debug="9001")
data = dict(php="9000", debug="9001", hhvm="8000")
Log.debug(self, 'Writting the nginx configuration to '
'file /etc/nginx/conf.d/upstream.conf ')
ee_nginx = open('/etc/nginx/conf.d/upstream.conf',
@ -261,7 +273,39 @@ class EEStackController(CementBaseController):
ee_nginx.close()
Log.debug(self, 'Writting the nginx configuration to '
'file /etc/nginx/common/ php.conf')
'file /etc/nginx/common/php-hhvm.conf')
ee_nginx = open('/etc/nginx/common/php-hhvm.conf',
encoding='utf-8', mode='w')
self.app.render((data), 'php-hhvm.mustache',
out=ee_nginx)
ee_nginx.close()
Log.debug(self, 'Writting the nginx configuration to '
'file /etc/nginx/common/w3tc-hhvm.conf')
ee_nginx = open('/etc/nginx/common/w3tc-hhvm.conf',
encoding='utf-8', mode='w')
self.app.render((data), 'w3tc-hhvm.mustache',
out=ee_nginx)
ee_nginx.close()
Log.debug(self, 'Writting the nginx configuration to '
'file /etc/nginx/common/wpfc-hhvm.conf')
ee_nginx = open('/etc/nginx/common/wpfc-hhvm.conf',
encoding='utf-8', mode='w')
self.app.render((data), 'wpfc-hhvm.mustache',
out=ee_nginx)
ee_nginx.close()
Log.debug(self, 'Writting the nginx configuration to '
'file /etc/nginx/common/wpsc-hhvm.conf')
ee_nginx = open('/etc/nginx/common/wpsc-hhvm.conf',
encoding='utf-8', mode='w')
self.app.render((data), 'wpsc-hhvm.mustache',
out=ee_nginx)
ee_nginx.close()
Log.debug(self, 'Writting the nginx configuration to '
'file /etc/nginx/common/php.conf')
ee_nginx = open('/etc/nginx/common/php.conf',
encoding='utf-8', mode='w')
self.app.render((data), 'php.mustache',
@ -308,6 +352,25 @@ class EEStackController(CementBaseController):
out=ee_nginx)
ee_nginx.close()
# Pagespeed configuration
Log.debug(self, 'Writting the Pagespeed Global '
'configuration to file /etc/nginx/conf.d/'
'pagespeed.conf')
ee_nginx = open('/etc/nginx/conf.d/pagespeed.conf',
encoding='utf-8', mode='w')
self.app.render((data), 'pagespeed-global.mustache',
out=ee_nginx)
ee_nginx.close()
Log.debug(self, 'Writting the Pagespeed common '
'configuration to file /etc/nginx/common/'
'pagespeed.conf')
ee_nginx = open('/etc/nginx/common/pagespeed.conf',
encoding='utf-8', mode='w')
self.app.render((data), 'pagespeed-common.mustache',
out=ee_nginx)
ee_nginx.close()
# 22222 port settings
Log.debug(self, 'Writting the nginx configuration to '
'file /etc/nginx/sites-available/'
@ -527,6 +590,81 @@ class EEStackController(CementBaseController):
EEGit.add(self, ["/etc/php5"], msg="Adding PHP into Git")
EEService.reload_service(self, 'php5-fpm')
if set(EEVariables.ee_hhvm).issubset(set(apt_packages)):
EEFileUtils.searchreplace(self, "/etc/hhvm/server.ini",
"9000", "8000")
EEFileUtils.searchreplace(self, "/etc/nginx/hhvm.conf",
"9000", "8000")
with open("/etc/hhvm/php.ini", "a") as hhvm_file:
hhvm_file.write("hhvm.log.header = true\n"
"hhvm.log.natives_stack_trace = true\n"
"hhvm.mysql.socket = "
"/var/run/mysqld/mysqld.sock\n"
"hhvm.pdo_mysql.socket = "
"/var/run/mysqld/mysqld.sock\n"
"hhvm.mysqli.socket = "
"/var/run/mysqld/mysqld.sock\n")
if os.path.isfile("/etc/nginx/conf.d/fastcgi.conf"):
if not EEFileUtils.grep(self, "/etc/nginx/conf.d/"
"fastcgi.conf",
"fastcgi_keep_conn"):
with open("/etc/nginx/conf.d/fastcgi.conf",
"a") as hhvm_file:
hhvm_file.write("fastcgi_keep_conn on;\n")
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")
EEGit.add(self, ["/etc/hhvm"], msg="Adding HHVM into Git")
EEService.restart_service(self, 'hhvm')
EEService.reload_service(self, 'nginx')
if os.path.isdir("/etc/nginx") and (not
os.path.isfile("/etc/nginx/common/php-hhvm.conf")):
data = dict()
Log.debug(self, 'Writting the nginx configuration to '
'file /etc/nginx/common/php-hhvm.conf')
ee_nginx = open('/etc/nginx/common/php-hhvm.conf',
encoding='utf-8', mode='w')
self.app.render((data), 'php-hhvm.mustache',
out=ee_nginx)
ee_nginx.close()
Log.debug(self, 'Writting the nginx configuration to '
'file /etc/nginx/common/w3tc-hhvm.conf')
ee_nginx = open('/etc/nginx/common/w3tc-hhvm.conf',
encoding='utf-8', mode='w')
self.app.render((data), 'w3tc-hhvm.mustache',
out=ee_nginx)
ee_nginx.close()
Log.debug(self, 'Writting the nginx configuration to '
'file /etc/nginx/common/wpfc-hhvm.conf')
ee_nginx = open('/etc/nginx/common/wpfc-hhvm.conf',
encoding='utf-8', mode='w')
self.app.render((data), 'wpfc-hhvm.mustache',
out=ee_nginx)
ee_nginx.close()
Log.debug(self, 'Writting the nginx configuration to '
'file /etc/nginx/common/wpsc-hhvm.conf')
ee_nginx = open('/etc/nginx/common/wpsc-hhvm.conf',
encoding='utf-8', mode='w')
self.app.render((data), 'wpsc-hhvm.mustache',
out=ee_nginx)
ee_nginx.close()
if set(EEVariables.ee_mysql).issubset(set(apt_packages)):
# TODO: Currently we are using, we need to remove it in future
# config = configparser.ConfigParser()
@ -1217,7 +1355,8 @@ class EEStackController(CementBaseController):
(not self.app.pargs.mail) and (not self.app.pargs.nginx) and
(not self.app.pargs.php) and (not self.app.pargs.mysql) and
(not self.app.pargs.postfix) and (not self.app.pargs.wpcli) and
(not self.app.pargs.phpmyadmin) and
(not self.app.pargs.phpmyadmin) and (not self.app.pargs.hhvm)
and
(not self.app.pargs.adminer) and (not self.app.pargs.utils) and
(not self.app.pargs.mailscanner) and (not self.app.pargs.all)):
self.app.pargs.web = True
@ -1229,13 +1368,12 @@ class EEStackController(CementBaseController):
self.app.pargs.mail = True
if self.app.pargs.web:
Log.debug(self, "Setting apt_packages variable for Nginx ,PHP"
" ,MySQL ")
self.app.pargs.nginx = True
self.app.pargs.php = True
self.app.pargs.mysql = True
self.app.pargs.wpcli = True
self.app.pargs.postfix = True
self.app.pargs.hhvm = True
if self.app.pargs.admin:
self.app.pargs.nginx = True
@ -1279,7 +1417,13 @@ class EEStackController(CementBaseController):
if self.app.pargs.nginx:
Log.debug(self, "Setting apt_packages variable for Nginx")
if not EEAptGet.is_installed(self, 'nginx-common'):
if EEVariables.ee_platform_distro == 'Debian':
check_nginx = 'nginx-extras'
else:
check_nginx = 'nginx-custom'
if not EEAptGet.is_installed(self, check_nginx):
apt_packages = apt_packages + EEVariables.ee_nginx
else:
Log.debug(self, "Nginx already installed")
@ -1291,6 +1435,15 @@ class EEStackController(CementBaseController):
else:
Log.debug(self, "PHP already installed")
Log.info(self, "PHP already installed")
if self.app.pargs.hhvm:
Log.debug(self, "Setting apt packages variable for HHVM")
if not EEAptGet.is_installed(self, 'hhvm'):
apt_packages = apt_packages + EEVariables.ee_hhvm
else:
Log.debug(self, "HHVM already installed")
Log.info(self, "HHVM already installed")
if self.app.pargs.mysql:
Log.debug(self, "Setting apt_packages variable for MySQL")
if not EEShellExec.cmd_exec(self, "mysqladmin ping"):
@ -1426,7 +1579,7 @@ class EEStackController(CementBaseController):
(not self.app.pargs.mail) and (not self.app.pargs.nginx) and
(not self.app.pargs.php) and (not self.app.pargs.mysql) and
(not self.app.pargs.postfix) and (not self.app.pargs.wpcli) and
(not self.app.pargs.phpmyadmin) and
(not self.app.pargs.phpmyadmin) and (not self.app.pargs.hhvm) and
(not self.app.pargs.adminer) and (not self.app.pargs.utils) and
(not self.app.pargs.mailscanner) and (not self.app.pargs.all)):
self.app.pargs.web = True
@ -1440,6 +1593,7 @@ class EEStackController(CementBaseController):
if self.app.pargs.web:
self.app.pargs.nginx = True
self.app.pargs.php = True
self.app.pargs.hhvm = True
self.app.pargs.mysql = True
self.app.pargs.wpcli = True
self.app.pargs.postfix = True
@ -1470,6 +1624,11 @@ class EEStackController(CementBaseController):
if self.app.pargs.php:
Log.debug(self, "Removing apt_packages variable of PHP")
apt_packages = apt_packages + EEVariables.ee_php
if self.app.pargs.hhvm:
Log.debug(self, "Removing apt_packages varible of HHVM")
apt_packages = apt_packages + EEVariables.ee_hhvm
if self.app.pargs.mysql:
Log.debug(self, "Removing apt_packages variable of MySQL")
apt_packages = apt_packages + EEVariables.ee_mysql
@ -1522,7 +1681,7 @@ class EEStackController(CementBaseController):
(not self.app.pargs.mail) and (not self.app.pargs.nginx) and
(not self.app.pargs.php) and (not self.app.pargs.mysql) and
(not self.app.pargs.postfix) and (not self.app.pargs.wpcli) and
(not self.app.pargs.phpmyadmin) and
(not self.app.pargs.phpmyadmin) and (not self.app.pargs.hhvm) and
(not self.app.pargs.adminer) and (not self.app.pargs.utils) and
(not self.app.pargs.mailscanner) and (not self.app.pargs.all)):
self.app.pargs.web = True
@ -1539,6 +1698,7 @@ class EEStackController(CementBaseController):
self.app.pargs.mysql = True
self.app.pargs.wpcli = True
self.app.pargs.postfix = True
self.app.pargs.hhvm = True
if self.app.pargs.admin:
self.app.pargs.adminer = True
@ -1566,6 +1726,9 @@ class EEStackController(CementBaseController):
if self.app.pargs.php:
Log.debug(self, "Purge apt_packages variable PHP")
apt_packages = apt_packages + EEVariables.ee_php
if self.app.pargs.hhvm:
Log.debug(self, "Removing apt_packages varible of HHVM")
apt_packages = apt_packages + EEVariables.ee_hhvm
if self.app.pargs.mysql:
Log.debug(self, "Purge apt_packages variable MySQL")
apt_packages = apt_packages + EEVariables.ee_mysql

52
ee/cli/plugins/stack_services.py

@ -38,6 +38,9 @@ class EEStackStatusController(CementBaseController):
if self.app.pargs.postfix:
Log.debug(self, "postfix service start")
services = services + ['postfix']
if self.app.pargs.hhvm:
services = services + ['hhvm']
Log.debug(self, "hhvm service start")
if self.app.pargs.memcache:
Log.debug(self, "memcached service start")
services = services + ['memcached']
@ -45,11 +48,12 @@ class EEStackStatusController(CementBaseController):
Log.debug(self, "dovecot service start")
services = services + ['dovecot']
if not services and EEVariables.ee_mysql_host is "localhost":
services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix']
Log.debug(self, "nginx,php5-fpm,mysql,postfix services start")
services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix',
'hhvm']
Log.debug(self, "nginx,php5-fpm,mysql,postfix,hhvm services start")
elif not services:
services = services + ['nginx', 'php5-fpm', 'postfix']
Log.debug(self, "nginx,php5-fpm,postfix services start")
services = services + ['nginx', 'php5-fpm', 'postfix', 'hhvm']
Log.debug(self, "nginx,php5-fpm,postfix,hhvm services start")
for service in services:
EEService.start_service(self, service)
@ -74,6 +78,9 @@ class EEStackStatusController(CementBaseController):
if self.app.pargs.postfix:
Log.debug(self, "postfix service stop")
services = services + ['postfix']
if self.app.pargs.hhvm:
services = services + ['hhvm']
Log.debug(self, "hhvm service stop")
if self.app.pargs.memcache:
Log.debug(self, "memcached service stop")
services = services + ['memcached']
@ -81,11 +88,12 @@ class EEStackStatusController(CementBaseController):
Log.debug(self, "dovecot service stop")
services = services + ['dovecot']
if not services and EEVariables.ee_mysql_host is "localhost":
services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix']
Log.debug(self, "nginx,php5-fpm,mysql,postfix services stop")
services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix',
'hhvm']
Log.debug(self, "nginx,php5-fpm,mysql,postfix,hhvm services stop")
elif not services:
services = services + ['nginx', 'php5-fpm', 'postfix']
Log.debug(self, "nginx,php5-fpm,postfix services stop")
services = services + ['nginx', 'php5-fpm', 'postfix', 'hhvm']
Log.debug(self, "nginx,php5-fpm,postfix,hhvm services stop")
for service in services:
EEService.stop_service(self, service)
@ -109,6 +117,9 @@ class EEStackStatusController(CementBaseController):
if self.app.pargs.postfix:
Log.debug(self, "postfix service restart")
services = services + ['postfix']
if self.app.pargs.hhvm:
services = services + ['hhvm']
Log.debug(self, "hhvm service restart")
if self.app.pargs.memcache:
Log.debug(self, "memcached service restart")
services = services + ['memcached']
@ -116,11 +127,13 @@ class EEStackStatusController(CementBaseController):
Log.debug(self, "dovecot service restart")
services = services + ['dovecot']
if not services and EEVariables.ee_mysql_host is "localhost":
services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix']
Log.debug(self, "nginx,php5-fpm,mysql,postfix services restart")
services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix',
'hhvm']
Log.debug(self, "nginx,php5-fpm,mysql,postfix,hhvm services"
"restart")
elif not services:
services = services + ['nginx', 'php5-fpm', 'postfix']
Log.debug(self, "nginx,php5-fpm,postfix services restart")
services = services + ['nginx', 'php5-fpm', 'postfix', 'hhvm']
Log.debug(self, "nginx,php5-fpm,postfix,hhvm services restart")
for service in services:
EEService.restart_service(self, service)
@ -144,6 +157,9 @@ class EEStackStatusController(CementBaseController):
if self.app.pargs.postfix:
services = services + ['postfix']
Log.debug(self, "postfix service status")
if self.app.pargs.hhvm:
services = services + ['hhvm']
Log.debug(self, "hhvm service status")
if self.app.pargs.memcache:
Log.debug(self, "memcached service status")
services = services + ['memcached']
@ -151,11 +167,13 @@ class EEStackStatusController(CementBaseController):
Log.debug(self, "dovecot service status")
services = services + ['dovecot']
if not services and EEVariables.ee_mysql_host is "localhost":
services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix']
Log.debug(self, "nginx,php5-fpm,mysql,postfix services status")
services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix',
'hhvm']
Log.debug(self, "nginx,php5-fpm,mysql,postfix,hhvm services"
" status")
elif not services:
services = services + ['nginx', 'php5-fpm', 'postfix']
Log.debug(self, "nginx,php5-fpm,postfix services status")
services = services + ['nginx', 'php5-fpm', 'postfix', 'hhvm']
Log.debug(self, "nginx,php5-fpm,postfix,hhvm services status")
for service in services:
if EEService.get_service_status(self, service):
Log.info(self, "{0:10}: {1}".format(service, "Running"))
@ -180,6 +198,8 @@ class EEStackStatusController(CementBaseController):
if self.app.pargs.postfix:
Log.debug(self, "postfix service reload")
services = services + ['postfix']
if self.app.pargs.hhvm:
Log.warn(self, "hhvm does not support to reload")
if self.app.pargs.memcache:
Log.debug(self, "memcached service reload")
services = services + ['memcached']

1
ee/cli/templates/fastcgi.mustache

@ -7,3 +7,4 @@ fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
fastcgi_param SERVER_NAME $http_host;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
fastcgi_keep_conn on;

39
ee/cli/templates/pagespeed-common.mustache

@ -0,0 +1,39 @@
# PageSpeed Admin
location /ngx_pagespeed_statistics { include common/acl.conf; }
location /ngx_pagespeed_global_statistics { include common/acl.conf; }
location /ngx_pagespeed_message { include common/acl.conf; }
location /pagespeed_console { include common/acl.conf; }
location ~ ^/pagespeed_admin { include common/acl.conf; }
location ~ ^/pagespeed_global_admin { include common/acl.conf; }
# Ensure requests for pagespeed optimized resources go to the pagespeed handler
# and no extraneous headers get set.
location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
add_header "" "";
}
location ~ "^/pagespeed_static/" { }
location ~ "^/ngx_pagespeed_beacon$" { }
# HTTPS Support
# pagespeed FetchHttps enable;
# PageSpeed Filters
# CSS Minification
# pagespeed EnableFilters combine_css,rewrite_css;
# JS Minification
# pagespeed EnableFilters combine_javascript,rewrite_javascript;
# Images Optimization
#pagespeed EnableFilters lazyload_images;
#pagespeed EnableFilters rewrite_images;
#pagespeed EnableFilters convert_jpeg_to_progressive,convert_png_to_jpeg,convert_jpeg_to_webp,convert_to_webp_lossless;
# Remove comments from HTML
#pagespeed EnableFilters remove_comments;
# Remove WHITESPACE from HTML
#pagespeed EnableFilters collapse_whitespace;
# CDN Support
#pagespeed MapRewriteDomain cdn.example.com www.example.com;

21
ee/cli/templates/pagespeed-global.mustache

@ -0,0 +1,21 @@
# Turning the module on and off
pagespeed on;
# Configuring PageSpeed Filters
pagespeed RewriteLevel PassThrough;
# Needs to exist and be writable by nginx. Use tmpfs for best performance.
pagespeed MemcachedServers "127.0.0.1:11211";
pagespeed FileCachePath /var/ngx_pagespeed_cache;
# PageSpeed Admin
pagespeed StatisticsPath /ngx_pagespeed_statistics;
pagespeed GlobalStatisticsPath /ngx_pagespeed_global_statistics;
pagespeed MessagesPath /ngx_pagespeed_message;
pagespeed ConsolePath /pagespeed_console;
pagespeed AdminPath /pagespeed_admin;
pagespeed GlobalAdminPath /pagespeed_global_admin;
# PageSpeed Cache Purge
pagespeed EnableCachePurge on;
pagespeed PurgeMethod PURGE;

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

@ -0,0 +1,10 @@
# PHP NGINX CONFIGURATION
# DO NOT MODIFY, ALL CHNAGES LOST AFTER UPDATE EasyEngine (ee)
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass hhvm;
}

5
ee/cli/templates/upstream.mustache

@ -7,3 +7,8 @@ upstream debug {
# Debug Pool
server 127.0.0.1:{{debug}};
}
upstream hhvm {
# HHVM Pool
server 127.0.0.1:{{hhvm}};
server 127.0.0.1:{{php}} backup;
}

3
ee/cli/templates/virtualconf.mustache

@ -27,8 +27,9 @@ server {
}
{{/static}}
{{^static}}include{{/static}} {{#basic}}common/php.conf;{{/basic}}{{#w3tc}}common/w3tc.conf;{{/w3tc}}{{#wpfc}}common/wpfc.conf;{{/wpfc}} {{#wpsc}}common/wpsc.conf;{{/wpsc}}
{{^static}}include{{/static}} {{^hhvm}}{{#basic}}common/php.conf;{{/basic}}{{#w3tc}}common/w3tc.conf;{{/w3tc}}{{#wpfc}}common/wpfc.conf;{{/wpfc}} {{#wpsc}}common/wpsc.conf;{{/wpsc}} {{/hhvm}}{{#hhvm}}{{#basic}}common/php-hhvm.conf;{{/basic}}{{#w3tc}}common/w3tc-hhvm.conf;{{/w3tc}}{{#wpfc}}common/wpfc-hhvm.conf;{{/wpfc}} {{#wpsc}}common/wpsc-hhvm.conf;{{/wpsc}} {{/hhvm}}
{{#wpsubdir}}include common/wpsubdir.conf;{{/wpsubdir}}
{{#wp}}include common/wpcommon.conf;{{/wp}}
{{#pagespeed}}include common/pagespeed.conf;{{/pagespeed}}
include common/locations.conf;
}

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

@ -0,0 +1,31 @@
# W3TC NGINX CONFIGURATION
# DO NOT MODIFY, ALL CHNAGES 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) {
set $cache_uri 'null cache';
}
if ($query_string != "") {
set $cache_uri 'null cache';
}
# Don't cache URL containing the following segments
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
set $cache_uri 'null cache';
}
# Don't use the cache for logged in users or recent commenter
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") {
set $cache_uri 'null cache';
}
# Use cached or actual file if they exists, Otherwise pass request to WordPress
location / {
try_files /wp-content/cache/page_enhanced/${host}${cache_uri}_index.html $uri $uri/ /index.php?$args;
}
location ~ ^/wp-content/cache/minify/(.+\.(css|js))$ {
try_files $uri /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass hhvm;
}

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

@ -0,0 +1,36 @@
# WPFC NGINX CONFIGURATION
# DO NOT MODIFY, ALL CHNAGES 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) {
set $skip_cache 1;
}
if ($query_string != "") {
set $skip_cache 1;
}
# Don't cache URL containing the following segments
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
set $skip_cache 1;
}
# Don't use the cache for logged in users or recent commenter
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") {
set $skip_cache 1;
}
# Use cached or actual file if they exists, Otherwise pass request to WordPress
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ ^/wp-content/cache/minify/(.+\.(css|js))$ {
try_files $uri /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass hhvm;
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
fastcgi_cache WORDPRESS;
}
location ~ /purge(/.*) {
fastcgi_cache_purge WORDPRESS "$scheme$request_method$host$1";
}

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

@ -0,0 +1,31 @@
# WPSC NGINX CONFIGURATION
# DO NOT MODIFY, ALL CHNAGES 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) {
set $cache_uri 'null cache';
}
if ($query_string != "") {
set $cache_uri 'null cache';
}
# Don't cache URL containing the following segments
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
set $cache_uri 'null cache';
}
# Don't use the cache for logged in users or recent commenter
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") {
set $cache_uri 'null cache';
}
# Use cached or actual file if they exists, Otherwise pass request to WordPress
location / {
# If we add index.php?$args its break WooCommerce like plugins
# Ref: #330
try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass hhvm;
# Following line is needed by WP Super Cache plugin
fastcgi_param SERVER_NAME $http_host;
}

1
ee/core/fileutils.py

@ -218,6 +218,7 @@ class EEFileUtils():
for line in open(fnm, encoding='utf-8'):
if sstr in line:
return line
return False
except OSError as e:
Log.debug(self, "{0}".format(e.strerror))
Log.error(self, "Unable to Search string {0} in {1}"

16
ee/core/variables.py

@ -73,7 +73,7 @@ class EEVariables():
elif ee_platform_distro == 'debian':
ee_nginx_repo = ("deb http://packages.dotdeb.org {codename} all"
.format(codename=ee_platform_codename))
ee_nginx = ["nginx-full", "nginx-common"]
ee_nginx = ["nginx-extras", "nginx-common"]
# PHP repo and packages
if ee_platform_distro == 'Ubuntu':
@ -116,6 +116,20 @@ class EEVariables():
"arj", "zoo", "nomarch", "lzop", "cabextract", "p7zip",
"rpm", "unrar-free"]
# HHVM repo details
# 12.04 requires boot repository
if ee_platform_distro == 'Ubuntu':
if ee_platform_codename == "precise":
ee_boost_repo = ("ppa:mapnik/boost")
ee_hhvm_repo = ("deb http://dl.hhvm.com/ubuntu {codename} main"
.format(codename=ee_platform_codename))
else:
ee_hhvm_repo = ("deb http://dl.hhvm.com/debian {codename} main"
.format(codename=ee_platform_codename))
ee_hhvm = ["hhvm"]
# Repo path
ee_repo_file = "ee-repo.list"
ee_repo_file_path = ("/etc/apt/sources.list.d/" + ee_repo_file)

5
install

@ -89,9 +89,9 @@ function ee_install_dep()
{
ee_lib_echo "Installing required packages, please wait..."
if [ "$ee_linux_distro" == "Ubuntu" ]; then
apt-get -y install gcc gzip python3 python3-apt python3-setuptools python3-dev sqlite3 git tar python-software-properties software-properties-common || ee_lib_error "Unable to install pre depedencies, exit status " 1
apt-get -y install gcc curl gzip python3 python3-apt python3-setuptools python3-dev sqlite3 git tar python-software-properties software-properties-common || ee_lib_error "Unable to install pre depedencies, exit status " 1
elif [ "$ee_linux_distro" == "Debian" ]; then
apt-get -y install gcc gzip python3 python3-apt python3-setuptools python3-dev sqlite3 git tar python-software-properties || ee_lib_error "Unable to pre depedencies, exit status " 1
apt-get -y install gcc curl gzip python3 python3-apt python3-setuptools python3-dev sqlite3 git tar python-software-properties || ee_lib_error "Unable to pre depedencies, exit status " 1
fi
# Generating Locale
@ -216,7 +216,6 @@ function secure_ee_db()
chmod -R 600 /var/lib/ee/
}
# Install EasyEngine 3.x
function ee_install()
{

Loading…
Cancel
Save