From 2811416e360d824871b8428a6df0297c682d68e6 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Fri, 17 Apr 2015 13:03:20 +0530 Subject: [PATCH 1/3] Improved HHVM setup --- ee/cli/plugins/site_functions.py | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/ee/cli/plugins/site_functions.py b/ee/cli/plugins/site_functions.py index 6dac2414..e292355f 100644 --- a/ee/cli/plugins/site_functions.py +++ b/ee/cli/plugins/site_functions.py @@ -571,6 +571,40 @@ def site_package_check(self, stype): if not EEAptGet.is_installed(self, 'hhvm'): apt_packages = apt_packages + EEVariables.ee_hhvm + if os.path.isdir("/etc/nginx/common") 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() + # Check if Nginx is allready installed and Pagespeed config there or not # If not then copy pagespeed config if self.app.pargs.pagespeed: From 63c7b154d97bcf7f999cab82f22ddb73f73c8f4e Mon Sep 17 00:00:00 2001 From: gau1991 Date: Mon, 20 Apr 2015 17:31:37 +0530 Subject: [PATCH 2/3] Updated configs --- ee/cli/plugins/site_functions.py | 2 +- ee/cli/plugins/stack.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ee/cli/plugins/site_functions.py b/ee/cli/plugins/site_functions.py index e292355f..0827f4e3 100644 --- a/ee/cli/plugins/site_functions.py +++ b/ee/cli/plugins/site_functions.py @@ -608,7 +608,7 @@ def site_package_check(self, stype): # 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 + if (os.path.isfile('/etc/nginx/nginx.conf') and (not os.path.isfile('/etc/nginx/conf.d/pagespeed.conf'))): # Pagespeed configuration data = dict() diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index 8b1ec21a..fada0f61 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -624,9 +624,8 @@ class EEStackController(CementBaseController): 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 + if os.path.isfile("/etc/nginx/nginx.conf") and (not os.path.isfile("/etc/nginx/common/php-hhvm.conf")): data = dict() @@ -662,6 +661,8 @@ class EEStackController(CementBaseController): out=ee_nginx) ee_nginx.close() + EEService.reload_service(self, 'nginx') + if set(EEVariables.ee_mysql).issubset(set(apt_packages)): # TODO: Currently we are using, we need to remove it in future # config = configparser.ConfigParser() From d2542db434fd8a0d59b179f37cb21a0c8138c535 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Mon, 20 Apr 2015 18:29:25 +0530 Subject: [PATCH 3/3] Autostart HHVM on reboot --- ee/cli/plugins/stack.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index fada0f61..f13d33a0 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -588,6 +588,9 @@ class EEStackController(CementBaseController): EEService.reload_service(self, 'php5-fpm') if set(EEVariables.ee_hhvm).issubset(set(apt_packages)): + + EEShellExec.cmd_exec(self, "update-rc.d hhvm defaults") + EEFileUtils.searchreplace(self, "/etc/hhvm/server.ini", "9000", "8000") EEFileUtils.searchreplace(self, "/etc/nginx/hhvm.conf",