@@ -72,6 +72,8 @@ class Meta:
7272 dict (help = 'Install Adminer stack' , action = 'store_true' )),
7373 (['--utils' ],
7474 dict (help = 'Install Utils stack' , action = 'store_true' )),
75+ (['--pagespeed' ],
76+ dict (help = 'Install Pagespeed' , action = 'store_true' )),
7577 ]
7678 usage = "ee stack (command) [options]"
7779
@@ -307,16 +309,6 @@ def post_pref(self, apt_packages, packages):
307309 out = ee_nginx )
308310 ee_nginx .close ()
309311
310- # Pagespeed configuration
311- Log .debug (self , 'Writting the Pagespeed Global '
312- 'configuration to file /etc/nginx/conf.d/'
313- 'pagespeed.conf' )
314- ee_nginx = open ('/etc/nginx/conf.d/pagespeed.conf' ,
315- encoding = 'utf-8' , mode = 'w' )
316- self .app .render ((data ), 'pagespeed-global.mustache' ,
317- out = ee_nginx )
318- ee_nginx .close ()
319-
320312 # 22222 port settings
321313 Log .debug (self , 'Writting the nginx configuration to '
322314 'file /etc/nginx/sites-available/'
@@ -418,6 +410,21 @@ def post_pref(self, apt_packages, packages):
418410 self .msg = (self .msg + ["HTTP Auth User Name: easyengine" ]
419411 + ["HTTP Auth Password : {0}" .format (passwd )])
420412
413+ # Set up pagespeed config
414+ if self .app .pargs .pagespeed :
415+ if (os .path .isfile ('/etc/nginx/nginx.conf' ) and
416+ (not os .path .isfile ('/etc/nginx/conf.d/pagespeed.conf' ))):
417+ # Pagespeed configuration
418+ data = dict ()
419+ Log .debug (self , 'Writting the Pagespeed Global '
420+ 'configuration to file /etc/nginx/conf.d/'
421+ 'pagespeed.conf' )
422+ ee_nginx = open ('/etc/nginx/conf.d/pagespeed.conf' ,
423+ encoding = 'utf-8' , mode = 'w' )
424+ self .app .render ((data ), 'pagespeed-global.mustache' ,
425+ out = ee_nginx )
426+ ee_nginx .close ()
427+
421428 if set (EEVariables .ee_hhvm ).issubset (set (apt_packages )):
422429
423430 EEShellExec .cmd_exec (self , "update-rc.d hhvm defaults" )
@@ -1347,7 +1354,7 @@ def install(self, packages=[], apt_packages=[], disp_msg=True):
13471354 (not self .app .pargs .php ) and (not self .app .pargs .mysql ) and
13481355 (not self .app .pargs .postfix ) and (not self .app .pargs .wpcli ) and
13491356 (not self .app .pargs .phpmyadmin ) and (not self .app .pargs .hhvm )
1350- and
1357+ and ( not self . app . pargs . pagespeed ) and
13511358 (not self .app .pargs .adminer ) and (not self .app .pargs .utils ) and
13521359 (not self .app .pargs .mailscanner ) and (not self .app .pargs .all )):
13531360 self .app .pargs .web = True
@@ -1405,6 +1412,12 @@ def install(self, packages=[], apt_packages=[], disp_msg=True):
14051412 else :
14061413 Log .info (self , "Mail server is already installed" )
14071414
1415+ if self .app .pargs .pagespeed :
1416+ if not EEAptGet .is_installed (self , 'nginx-custom' ):
1417+ self .app .pargs .nginx = True
1418+ else :
1419+ Log .info (self , "Nginx already installed" )
1420+
14081421 if self .app .pargs .nginx :
14091422 Log .debug (self , "Setting apt_packages variable for Nginx" )
14101423
@@ -1575,7 +1588,8 @@ def remove(self):
15751588 (not self .app .pargs .postfix ) and (not self .app .pargs .wpcli ) and
15761589 (not self .app .pargs .phpmyadmin ) and (not self .app .pargs .hhvm ) and
15771590 (not self .app .pargs .adminer ) and (not self .app .pargs .utils ) and
1578- (not self .app .pargs .mailscanner ) and (not self .app .pargs .all )):
1591+ (not self .app .pargs .mailscanner ) and (not self .app .pargs .all ) and
1592+ (not self .app .pargs .pagespeed )):
15791593 self .app .pargs .web = True
15801594 self .app .pargs .admin = True
15811595
@@ -1611,6 +1625,10 @@ def remove(self):
16111625 if self .app .pargs .mailscanner :
16121626 apt_packages = (apt_packages + EEVariables .ee_mailscanner )
16131627
1628+ if self .app .pargs .pagespeed :
1629+ Log .debug (self , "Removing packages varible of Pagespeed" )
1630+ packages = packages + ['/etc/nginx/conf.d/pagespeed.conf' ]
1631+
16141632 if self .app .pargs .nginx :
16151633 Log .debug (self , "Removing apt_packages variable of Nginx" )
16161634 apt_packages = apt_packages + EEVariables .ee_nginx
@@ -1655,7 +1673,7 @@ def remove(self):
16551673 '{0}22222/htdocs/db/anemometer'
16561674 .format (EEVariables .ee_webroot )]
16571675 ee_prompt = input ('Are you sure you to want to'
1658- ' purge from server.'
1676+ ' remove from server.'
16591677 'Package configuration will remain'
16601678 ' on server after this operation.\n '
16611679 'Any answer other than '
@@ -1690,7 +1708,8 @@ def purge(self):
16901708 (not self .app .pargs .postfix ) and (not self .app .pargs .wpcli ) and
16911709 (not self .app .pargs .phpmyadmin ) and (not self .app .pargs .hhvm ) and
16921710 (not self .app .pargs .adminer ) and (not self .app .pargs .utils ) and
1693- (not self .app .pargs .mailscanner ) and (not self .app .pargs .all )):
1711+ (not self .app .pargs .mailscanner ) and (not self .app .pargs .all ) and
1712+ (not self .app .pargs .pagespeed )):
16941713 self .app .pargs .web = True
16951714 self .app .pargs .admin = True
16961715
@@ -1726,6 +1745,10 @@ def purge(self):
17261745 if self .app .pargs .mailscanner :
17271746 apt_packages = (apt_packages + EEVariables .ee_mailscanner )
17281747
1748+ if self .app .pargs .pagespeed :
1749+ Log .debug (self , "Purge packages varible of Pagespeed" )
1750+ packages = packages + ['/etc/nginx/conf.d/pagespeed.conf' ]
1751+
17291752 if self .app .pargs .nginx :
17301753 Log .debug (self , "Purge apt_packages variable of Nginx" )
17311754 apt_packages = apt_packages + EEVariables .ee_nginx
0 commit comments