@@ -1641,6 +1641,7 @@ def install(self, packages=[], apt_packages=[], disp_msg=True):
16411641 if self .app .pargs .redis :
16421642 if not EEAptGet .is_installed (self , 'redis-server' ):
16431643 apt_packages = apt_packages + EEVariables .ee_redis
1644+ self .app .pargs .php = True
16441645 else :
16451646 Log .info (self , "Redis already installed" )
16461647
@@ -1808,6 +1809,33 @@ def install(self, packages=[], apt_packages=[], disp_msg=True):
18081809 EEDownload .download (self , packages )
18091810 Log .debug (self , "Calling post_pref" )
18101811 self .post_pref (apt_packages , packages )
1812+ if 'redis-server' in apt_packages :
1813+ # set redis.conf parameter
1814+ # set maxmemory 10% for ram below 512MB and 20% for others
1815+ # set maxmemory-policy volatile-lru
1816+ if os .path .isfile ("/etc/redis/redis.conf" ):
1817+ if EEVariables .ee_ram < 512 :
1818+ Log .debug (self , "Setting maxmemory variable to {0} in redis.conf"
1819+ .format (int (EEVariables .ee_ram * 1024 * 1024 * 0.1 )))
1820+ EEFileUtils .searchreplace (self , "/etc/redis/redis.conf" ,
1821+ "# maxmemory <bytes>" ,
1822+ "maxmemory {0}" .format (int (EEVariables .ee_ram * 1024 * 1024 * 0.1 )))
1823+ Log .debug (self , "Setting maxmemory-policy variable to volatile-lru in redis.conf" )
1824+ EEFileUtils .searchreplace (self , "/etc/redis/redis.conf" ,
1825+ "# maxmemory-policy volatile-lru" ,
1826+ "maxmemory-policy volatile-lru" )
1827+ EEService .restart_service (self , 'redis-server' )
1828+ else :
1829+ Log .debug (self , "Setting maxmemory variable to {0} in redis.conf"
1830+ .format (int (EEVariables .ee_ram * 1024 * 1024 * 0.2 )))
1831+ EEFileUtils .searchreplace (self , "/etc/redis/redis.conf" ,
1832+ "# maxmemory <bytes>" ,
1833+ "maxmemory {0}" .format (int (EEVariables .ee_ram * 1024 * 1024 * 0.2 )))
1834+ Log .debug (self , "Setting maxmemory-policy variable to volatile-lru in redis.conf" )
1835+ EEFileUtils .searchreplace (self , "/etc/redis/redis.conf" ,
1836+ "# maxmemory-policy volatile-lru" ,
1837+ "maxmemory-policy volatile-lru" )
1838+ EEService .restart_service (self , 'redis-server' )
18111839 if disp_msg :
18121840 if len (self .msg ):
18131841 for msg in self .msg :
0 commit comments