From 2fbaa00be382c3bfc0b7fdde3ccf55415575ce85 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Tue, 7 Jul 2015 17:13:20 +0530 Subject: [PATCH] Added support for redis with HHVM --- ee/cli/plugins/site_functions.py | 34 ++++++++++++++++++++++++++++++++ ee/cli/plugins/stack.py | 12 +++++++++++ 2 files changed, 46 insertions(+) diff --git a/ee/cli/plugins/site_functions.py b/ee/cli/plugins/site_functions.py index e2ce928f..a37682ef 100644 --- a/ee/cli/plugins/site_functions.py +++ b/ee/cli/plugins/site_functions.py @@ -614,6 +614,40 @@ def site_package_check(self, stype): if not EEAptGet.is_installed(self, 'redis-server'): apt_packages = apt_packages + EEVariables.ee_redis + if os.path.isfile("/etc/nginx/nginx.conf") and (not + os.path.isfile("/etc/nginx/common/redis.conf")): + + data = dict() + Log.debug(self, 'Writting the nginx configuration to ' + 'file /etc/nginx/common/redis.conf') + ee_nginx = open('/etc/nginx/common/redis.conf', + encoding='utf-8', mode='w') + self.app.render((data), 'redis.mustache', + out=ee_nginx) + ee_nginx.close() + + if os.path.isfile("/etc/nginx/nginx.conf") and (not + os.path.isfile("/etc/nginx/common/redis-hhvm.conf")): + + data = dict() + Log.debug(self, 'Writting the nginx configuration to ' + 'file /etc/nginx/common/redis-hhvm.conf') + ee_nginx = open('/etc/nginx/common/redis-hhvm.conf', + encoding='utf-8', mode='w') + self.app.render((data), 'redis-hhvm.mustache', + 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", + "redis"): + with open("/etc/nginx/conf.d/upstream.conf", + "a") as redis_file: + redis_file.write("upstream redis {\n" + " server 127.0.0.1:6379;\n" + " keepalive 10;\n}") + if self.app.pargs.hhvm: if platform.architecture()[0] is '32bit': Log.error(self, "HHVM is not supported by 32bit system") diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index 2f8abf56..5a830dfc 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -537,6 +537,18 @@ class EEStackController(CementBaseController): out=ee_nginx) ee_nginx.close() + if os.path.isfile("/etc/nginx/nginx.conf") and (not + os.path.isfile("/etc/nginx/common/redis-hhvm.conf")): + + data = dict() + Log.debug(self, 'Writting the nginx configuration to ' + 'file /etc/nginx/common/redis-hhvm.conf') + ee_nginx = open('/etc/nginx/common/redis-hhvm.conf', + encoding='utf-8', mode='w') + self.app.render((data), 'redis-hhvm.mustache', + 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",