@@ -483,6 +483,87 @@ def post_pref(self, apt_packages, packages):
483483 self .msg = (self .msg + ["HTTP Auth User Name: easyengine" ]
484484 + ["HTTP Auth Password : {0}" .format (passwd )])
485485
486+ if set (EEVariables .ee_hhvm ).issubset (set (apt_packages )):
487+
488+ EEShellExec .cmd_exec (self , "update-rc.d hhvm defaults" )
489+
490+ EEFileUtils .searchreplace (self , "/etc/hhvm/server.ini" ,
491+ "9000" , "8000" )
492+ EEFileUtils .searchreplace (self , "/etc/nginx/hhvm.conf" ,
493+ "9000" , "8000" )
494+
495+ with open ("/etc/hhvm/php.ini" , "a" ) as hhvm_file :
496+ hhvm_file .write ("hhvm.log.header = true\n "
497+ "hhvm.log.natives_stack_trace = true\n "
498+ "hhvm.mysql.socket = "
499+ "/var/run/mysqld/mysqld.sock\n "
500+ "hhvm.pdo_mysql.socket = "
501+ "/var/run/mysqld/mysqld.sock\n "
502+ "hhvm.mysqli.socket = "
503+ "/var/run/mysqld/mysqld.sock\n " )
504+
505+ if os .path .isfile ("/etc/nginx/conf.d/fastcgi.conf" ):
506+ if not EEFileUtils .grep (self , "/etc/nginx/conf.d/"
507+ "fastcgi.conf" ,
508+ "fastcgi_keep_conn" ):
509+ with open ("/etc/nginx/conf.d/fastcgi.conf" ,
510+ "a" ) as hhvm_file :
511+ hhvm_file .write ("fastcgi_keep_conn on;\n " )
512+
513+ if os .path .isfile ("/etc/nginx/conf.d/upstream.conf" ):
514+ if not EEFileUtils .grep (self , "/etc/nginx/conf.d/"
515+ "upstream.conf" ,
516+ "hhvm" ):
517+ with open ("/etc/nginx/conf.d/upstream.conf" ,
518+ "a" ) as hhvm_file :
519+ hhvm_file .write ("upstream hhvm {\n server "
520+ "127.0.0.1:8000;\n "
521+ "server 127.0.0.1:9000 backup;\n }"
522+ "\n " )
523+
524+ EEGit .add (self , ["/etc/hhvm" ], msg = "Adding HHVM into Git" )
525+ EEService .restart_service (self , 'hhvm' )
526+
527+ if os .path .isfile ("/etc/nginx/nginx.conf" ) and (not
528+ os .path .isfile ("/etc/nginx/common/php-hhvm.conf" )):
529+
530+ data = dict ()
531+ Log .debug (self , 'Writting the nginx configuration to '
532+ 'file /etc/nginx/common/php-hhvm.conf' )
533+ ee_nginx = open ('/etc/nginx/common/php-hhvm.conf' ,
534+ encoding = 'utf-8' , mode = 'w' )
535+ self .app .render ((data ), 'php-hhvm.mustache' ,
536+ out = ee_nginx )
537+ ee_nginx .close ()
538+
539+ Log .debug (self , 'Writting the nginx configuration to '
540+ 'file /etc/nginx/common/w3tc-hhvm.conf' )
541+ ee_nginx = open ('/etc/nginx/common/w3tc-hhvm.conf' ,
542+ encoding = 'utf-8' , mode = 'w' )
543+ self .app .render ((data ), 'w3tc-hhvm.mustache' ,
544+ out = ee_nginx )
545+ ee_nginx .close ()
546+
547+ Log .debug (self , 'Writting the nginx configuration to '
548+ 'file /etc/nginx/common/wpfc-hhvm.conf' )
549+ ee_nginx = open ('/etc/nginx/common/wpfc-hhvm.conf' ,
550+ encoding = 'utf-8' , mode = 'w' )
551+ self .app .render ((data ), 'wpfc-hhvm.mustache' ,
552+ out = ee_nginx )
553+ ee_nginx .close ()
554+
555+ Log .debug (self , 'Writting the nginx configuration to '
556+ 'file /etc/nginx/common/wpsc-hhvm.conf' )
557+ ee_nginx = open ('/etc/nginx/common/wpsc-hhvm.conf' ,
558+ encoding = 'utf-8' , mode = 'w' )
559+ self .app .render ((data ), 'wpsc-hhvm.mustache' ,
560+ out = ee_nginx )
561+ ee_nginx .close ()
562+
563+ if not EEService .reload_service (self , 'nginx' ):
564+ Log .error (self , "Failed to reload Nginx, please check "
565+ "output of `nginx -t`" )
566+
486567 if set (EEVariables .ee_php ).issubset (set (apt_packages )):
487568 # Create log directories
488569 if not os .path .exists ('/var/log/php5/' ):
@@ -623,88 +704,7 @@ def post_pref(self, apt_packages, packages):
623704 EEVariables .ee_php_user , recursive = True )
624705
625706 EEGit .add (self , ["/etc/php5" ], msg = "Adding PHP into Git" )
626- EEService .reload_service (self , 'php5-fpm' )
627-
628- if set (EEVariables .ee_hhvm ).issubset (set (apt_packages )):
629-
630- EEShellExec .cmd_exec (self , "update-rc.d hhvm defaults" )
631-
632- EEFileUtils .searchreplace (self , "/etc/hhvm/server.ini" ,
633- "9000" , "8000" )
634- EEFileUtils .searchreplace (self , "/etc/nginx/hhvm.conf" ,
635- "9000" , "8000" )
636-
637- with open ("/etc/hhvm/php.ini" , "a" ) as hhvm_file :
638- hhvm_file .write ("hhvm.log.header = true\n "
639- "hhvm.log.natives_stack_trace = true\n "
640- "hhvm.mysql.socket = "
641- "/var/run/mysqld/mysqld.sock\n "
642- "hhvm.pdo_mysql.socket = "
643- "/var/run/mysqld/mysqld.sock\n "
644- "hhvm.mysqli.socket = "
645- "/var/run/mysqld/mysqld.sock\n " )
646-
647- if os .path .isfile ("/etc/nginx/conf.d/fastcgi.conf" ):
648- if not EEFileUtils .grep (self , "/etc/nginx/conf.d/"
649- "fastcgi.conf" ,
650- "fastcgi_keep_conn" ):
651- with open ("/etc/nginx/conf.d/fastcgi.conf" ,
652- "a" ) as hhvm_file :
653- hhvm_file .write ("fastcgi_keep_conn on;\n " )
654-
655- if os .path .isfile ("/etc/nginx/conf.d/upstream.conf" ):
656- if not EEFileUtils .grep (self , "/etc/nginx/conf.d/"
657- "upstream.conf" ,
658- "hhvm" ):
659- with open ("/etc/nginx/conf.d/upstream.conf" ,
660- "a" ) as hhvm_file :
661- hhvm_file .write ("upstream hhvm {\n server "
662- "127.0.0.1:8000;\n "
663- "server 127.0.0.1:9000 backup;\n }"
664- "\n " )
665-
666- EEGit .add (self , ["/etc/hhvm" ], msg = "Adding HHVM into Git" )
667- EEService .restart_service (self , 'hhvm' )
668-
669- if os .path .isfile ("/etc/nginx/nginx.conf" ) and (not
670- os .path .isfile ("/etc/nginx/common/php-hhvm.conf" )):
671-
672- data = dict ()
673- Log .debug (self , 'Writting the nginx configuration to '
674- 'file /etc/nginx/common/php-hhvm.conf' )
675- ee_nginx = open ('/etc/nginx/common/php-hhvm.conf' ,
676- encoding = 'utf-8' , mode = 'w' )
677- self .app .render ((data ), 'php-hhvm.mustache' ,
678- out = ee_nginx )
679- ee_nginx .close ()
680-
681- Log .debug (self , 'Writting the nginx configuration to '
682- 'file /etc/nginx/common/w3tc-hhvm.conf' )
683- ee_nginx = open ('/etc/nginx/common/w3tc-hhvm.conf' ,
684- encoding = 'utf-8' , mode = 'w' )
685- self .app .render ((data ), 'w3tc-hhvm.mustache' ,
686- out = ee_nginx )
687- ee_nginx .close ()
688-
689- Log .debug (self , 'Writting the nginx configuration to '
690- 'file /etc/nginx/common/wpfc-hhvm.conf' )
691- ee_nginx = open ('/etc/nginx/common/wpfc-hhvm.conf' ,
692- encoding = 'utf-8' , mode = 'w' )
693- self .app .render ((data ), 'wpfc-hhvm.mustache' ,
694- out = ee_nginx )
695- ee_nginx .close ()
696-
697- Log .debug (self , 'Writting the nginx configuration to '
698- 'file /etc/nginx/common/wpsc-hhvm.conf' )
699- ee_nginx = open ('/etc/nginx/common/wpsc-hhvm.conf' ,
700- encoding = 'utf-8' , mode = 'w' )
701- self .app .render ((data ), 'wpsc-hhvm.mustache' ,
702- out = ee_nginx )
703- ee_nginx .close ()
704-
705- if not EEService .reload_service (self , 'nginx' ):
706- Log .error (self , "Failed to reload Nginx, please check "
707- "output of `nginx -t`" )
707+ EEService .restart_service (self , 'php5-fpm' )
708708
709709 if set (EEVariables .ee_mysql ).issubset (set (apt_packages )):
710710 # TODO: Currently we are using, we need to remove it in future
0 commit comments