|
|
@ -1641,6 +1641,7 @@ class EEStackController(CementBaseController): |
|
|
|
if self.app.pargs.redis: |
|
|
|
if not EEAptGet.is_installed(self, 'redis-server'): |
|
|
|
apt_packages = apt_packages + EEVariables.ee_redis |
|
|
|
self.app.pargs.php = True |
|
|
|
else: |
|
|
|
Log.info(self, "Redis already installed") |
|
|
|
|
|
|
@ -1808,6 +1809,33 @@ class EEStackController(CementBaseController): |
|
|
|
EEDownload.download(self, packages) |
|
|
|
Log.debug(self, "Calling post_pref") |
|
|
|
self.post_pref(apt_packages, packages) |
|
|
|
if 'redis-server' in apt_packages: |
|
|
|
# set redis.conf parameter |
|
|
|
# set maxmemory 10% for ram below 512MB and 20% for others |
|
|
|
# set maxmemory-policy volatile-lru |
|
|
|
if os.path.isfile("/etc/redis/redis.conf"): |
|
|
|
if EEVariables.ee_ram < 512: |
|
|
|
Log.debug(self, "Setting maxmemory variable to {0} in redis.conf" |
|
|
|
.format(int(EEVariables.ee_ram*1024*1024*0.1))) |
|
|
|
EEFileUtils.searchreplace(self, "/etc/redis/redis.conf", |
|
|
|
"# maxmemory <bytes>", |
|
|
|
"maxmemory {0}".format(int(EEVariables.ee_ram*1024*1024*0.1))) |
|
|
|
Log.debug(self, "Setting maxmemory-policy variable to volatile-lru in redis.conf") |
|
|
|
EEFileUtils.searchreplace(self, "/etc/redis/redis.conf", |
|
|
|
"# maxmemory-policy volatile-lru", |
|
|
|
"maxmemory-policy volatile-lru") |
|
|
|
EEService.restart_service(self, 'redis-server') |
|
|
|
else: |
|
|
|
Log.debug(self, "Setting maxmemory variable to {0} in redis.conf" |
|
|
|
.format(int(EEVariables.ee_ram*1024*1024*0.2))) |
|
|
|
EEFileUtils.searchreplace(self, "/etc/redis/redis.conf", |
|
|
|
"# maxmemory <bytes>", |
|
|
|
"maxmemory {0}".format(int(EEVariables.ee_ram*1024*1024*0.2))) |
|
|
|
Log.debug(self, "Setting maxmemory-policy variable to volatile-lru in redis.conf") |
|
|
|
EEFileUtils.searchreplace(self, "/etc/redis/redis.conf", |
|
|
|
"# maxmemory-policy volatile-lru", |
|
|
|
"maxmemory-policy volatile-lru") |
|
|
|
EEService.restart_service(self, 'redis-server') |
|
|
|
if disp_msg: |
|
|
|
if len(self.msg): |
|
|
|
for msg in self.msg: |
|
|
|