From ac8e38776f0672e77f06ebd4853ec8e47261525e Mon Sep 17 00:00:00 2001 From: gau1991 Date: Mon, 11 May 2015 15:26:07 +0530 Subject: [PATCH 01/23] Fix nginx config writing for debian --- ee/cli/plugins/stack.py | 7 ++++++- ee/cli/templates/nginx-core.mustache | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index cd0d624f..272385c3 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -218,7 +218,12 @@ class EEStackController(CementBaseController): nc.savef('/etc/nginx/nginx.conf') # Custom Nginx configuration by EasyEngine - data = dict(version=EEVariables.ee_version) + if EEVariables.ee_platform_distro == 'Ubuntu': + data = dict(version=EEVariables.ee_version, + Ubuntu=True) + else: + data = dict(version=EEVariables.ee_version, + Debian=True) Log.debug(self, 'Writting the nginx configuration to ' 'file /etc/nginx/conf.d/ee-nginx.conf ') ee_nginx = open('/etc/nginx/conf.d/ee-nginx.conf', diff --git a/ee/cli/templates/nginx-core.mustache b/ee/cli/templates/nginx-core.mustache index c1cd7d60..bdce6d2d 100644 --- a/ee/cli/templates/nginx-core.mustache +++ b/ee/cli/templates/nginx-core.mustache @@ -21,7 +21,9 @@ client_max_body_size 100m; # SSL Settings ssl_session_cache shared:SSL:20m; ssl_session_timeout 10m; +{{#Ubuntu}} ssl_prefer_server_ciphers on; +{{/Ubuntu}} ssl_ciphers HIGH:!aNULL:!MD5:!kEDH; # Log format Settings From a4a202459d3370f4053fc460b16181fb4ca0789b Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Mon, 11 May 2015 15:58:09 +0530 Subject: [PATCH 02/23] bypass php repo add for jessie --- ee/cli/plugins/stack.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index 272385c3..7e9d652e 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -160,11 +160,13 @@ class EEStackController(CementBaseController): if set(EEVariables.ee_php).issubset(set(apt_packages)): Log.info(self, "Adding repository for PHP, please wait...") + # Add repository for php if EEVariables.ee_platform_distro == 'debian': - Log.debug(self, 'Adding repo_url of php for debian') - EERepo.add(self, repo_url=EEVariables.ee_php_repo) - Log.debug(self, 'Adding Dotdeb/php GPG key') - EERepo.add_key(self, '89DF5277') + if EEVariables.ee_platform_codename is not 'jessie': + Log.debug(self, 'Adding repo_url of php for debian') + EERepo.add(self, repo_url=EEVariables.ee_php_repo) + Log.debug(self, 'Adding Dotdeb/php GPG key') + EERepo.add_key(self, '89DF5277') else: Log.debug(self, 'Adding ppa for PHP') EERepo.add(self, ppa=EEVariables.ee_php_repo) From 6c70b0784dea171386f5697fe0da0918914c41e4 Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Mon, 11 May 2015 16:02:04 +0530 Subject: [PATCH 03/23] added jessie support in install script --- ee/cli/plugins/stack.py | 2 +- install | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index 7e9d652e..5d242489 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -162,7 +162,7 @@ class EEStackController(CementBaseController): Log.info(self, "Adding repository for PHP, please wait...") # Add repository for php if EEVariables.ee_platform_distro == 'debian': - if EEVariables.ee_platform_codename is not 'jessie': + if EEVariables.ee_platform_codename != 'jessie': Log.debug(self, 'Adding repo_url of php for debian') EERepo.add(self, repo_url=EEVariables.ee_php_repo) Log.debug(self, 'Adding Dotdeb/php GPG key') diff --git a/install b/install index 2ca76cf7..c7a1648e 100644 --- a/install +++ b/install @@ -63,7 +63,7 @@ if [ "$ee_linux_distro" != "Ubuntu" ] && [ "$ee_linux_distro" != "Debian" ]; the fi # EasyEngine (ee) only support all Ubuntu/Debian distro except the distro reached EOL -lsb_release -d | egrep -e "12.04|14.04|wheezy" &>> /dev/null +lsb_release -d | egrep -e "12.04|14.04|wheezy|jessie" &>> /dev/null if [ "$?" -ne "0" ]; then ee_lib_echo_fail "EasyEngine (ee) only support Ubuntu 12.04/14.04 and Debian 7.x" exit 100 From 8b89d434cf03a35cf4ae9f4aaa9f8461442f713d Mon Sep 17 00:00:00 2001 From: gau1991 Date: Mon, 11 May 2015 16:03:08 +0530 Subject: [PATCH 04/23] Fixed issue where upstream hhvm causing site failure --- ee/cli/plugins/site_functions.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ee/cli/plugins/site_functions.py b/ee/cli/plugins/site_functions.py index f51cdcb8..bbb7783d 100644 --- a/ee/cli/plugins/site_functions.py +++ b/ee/cli/plugins/site_functions.py @@ -630,6 +630,13 @@ def site_package_check(self, stype): 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", + "hhvm"): + with open("/etc/nginx/conf.d/upstream.conf", "a") as hhvm_file: + hhvm_file.write("upstream hhvm {\nserver 127.0.0.1:8000;\n" + "server 127.0.0.1:9000 backup;\n}\n") + # Check if Nginx is allready installed and Pagespeed config there or not # If not then copy pagespeed config if self.app.pargs.pagespeed: From 53c5069dae5a2a395eb5d807458919ef0dce9f88 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Mon, 11 May 2015 18:39:59 +0530 Subject: [PATCH 05/23] Updated MySQLTuner to fix issue MariaDB conflict --- ee/cli/plugins/stack.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index 5d242489..0e59f405 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -719,6 +719,9 @@ class EEStackController(CementBaseController): except CommandExecutionError as e: Log.error(self, "Unable to update MySQL file") + # Set MySQLTuner permission + EEFileUtils.chmod(self, "/usr/bin/mysqltunner", 0o775) + EEGit.add(self, ["/etc/mysql"], msg="Adding MySQL into Git") EEService.reload_service(self, 'mysql') @@ -1486,6 +1489,13 @@ class EEStackController(CementBaseController): Log.debug(self, "Setting apt_packages variable for MySQL") if not EEShellExec.cmd_exec(self, "mysqladmin ping"): apt_packages = apt_packages + EEVariables.ee_mysql + packages = packages + [["https://raw." + "githubusercontent.com/" + "major/MySQLTuner-perl" + "/master/mysqltuner.pl", + "/usr/bin/mysqltuner", + "MySQLTuner"]] + else: Log.debug(self, "MySQL connection is already alive") Log.info(self, "MySQL connection is already alive") @@ -1671,6 +1681,7 @@ class EEStackController(CementBaseController): if self.app.pargs.mysql: Log.debug(self, "Removing apt_packages variable of MySQL") apt_packages = apt_packages + EEVariables.ee_mysql + packages = packages + ['/usr/bin/mysqltuner'] if self.app.pargs.postfix: Log.debug(self, "Removing apt_packages variable of Postfix") apt_packages = apt_packages + EEVariables.ee_postfix @@ -1784,6 +1795,7 @@ class EEStackController(CementBaseController): if self.app.pargs.mysql: Log.debug(self, "Purge apt_packages variable MySQL") apt_packages = apt_packages + EEVariables.ee_mysql + packages = packages + ['/usr/bin/mysqltuner'] if self.app.pargs.postfix: Log.debug(self, "Purge apt_packages variable PostFix") apt_packages = apt_packages + EEVariables.ee_postfix From 2739d229e9213cfbd6db12dea2689e377ec66709 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Mon, 11 May 2015 18:40:51 +0530 Subject: [PATCH 06/23] Removed MySQLtuner from global variable --- ee/core/variables.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ee/core/variables.py b/ee/core/variables.py index 7c4cb57f..4461a910 100644 --- a/ee/core/variables.py +++ b/ee/core/variables.py @@ -107,7 +107,7 @@ class EEVariables(): ee_mysql_repo = ("deb http://mirror.aarnet.edu.au/pub/MariaDB/repo/" "10.0/debian {codename} main" .format(codename=ee_platform_codename)) - ee_mysql = ["mariadb-server", "mysqltuner", "percona-toolkit"] + ee_mysql = ["mariadb-server", "percona-toolkit"] # Postfix repo and packages ee_postfix_repo = "" From d40dcb7a666e56e294c2b0493e5ff7a14d39e84a Mon Sep 17 00:00:00 2001 From: gau1991 Date: Mon, 11 May 2015 18:56:18 +0530 Subject: [PATCH 07/23] Fixed Typos --- ee/cli/plugins/stack.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index 0e59f405..c13d0b7d 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -720,7 +720,7 @@ class EEStackController(CementBaseController): Log.error(self, "Unable to update MySQL file") # Set MySQLTuner permission - EEFileUtils.chmod(self, "/usr/bin/mysqltunner", 0o775) + EEFileUtils.chmod(self, "/usr/bin/mysqltuner", 0o775) EEGit.add(self, ["/etc/mysql"], msg="Adding MySQL into Git") EEService.reload_service(self, 'mysql') From 05acb9d589f9b3337335aaed4a31166e14826b89 Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Mon, 11 May 2015 19:01:43 +0530 Subject: [PATCH 08/23] updated php5-xdebug install method on jessie and removed mysqltuner package from mysql stack --- ee/cli/plugins/stack.py | 14 ++++++++------ ee/core/variables.py | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index 5d242489..b2907bf1 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -102,11 +102,12 @@ class EEStackController(CementBaseController): with open('/etc/apt/preferences.d/' 'MariaDB.pref', 'w') as mysql_pref_file: mysql_pref_file.write(mysql_pref) - EERepo.add(self, repo_url=EEVariables.ee_mysql_repo) - Log.debug(self, 'Adding key for {0}' - .format(EEVariables.ee_mysql_repo)) - EERepo.add_key(self, '0xcbcb082a1bb943db', - keyserver="keyserver.ubuntu.com") + if EEVariables.ee_platform_codename != 'jessie': + EERepo.add(self, repo_url=EEVariables.ee_mysql_repo) + Log.debug(self, 'Adding key for {0}' + .format(EEVariables.ee_mysql_repo)) + EERepo.add_key(self, '0xcbcb082a1bb943db', + keyserver="keyserver.ubuntu.com") chars = ''.join(random.sample(string.ascii_letters, 8)) Log.debug(self, "Pre-seeding MySQL") Log.debug(self, "echo \"mariadb-server-10.0 " @@ -479,7 +480,8 @@ class EEStackController(CementBaseController): # For debian install xdebug - if EEVariables.ee_platform_distro == "debian": + if (EEVariables.ee_platform_distro == "debian" and + EEVariables.ee_platform_distro == 'wheezy'): EEShellExec.cmd_exec(self, "pecl install xdebug") with open("/etc/php5/mods-available/xdebug.ini", diff --git a/ee/core/variables.py b/ee/core/variables.py index 7c4cb57f..b3dbc1e3 100644 --- a/ee/core/variables.py +++ b/ee/core/variables.py @@ -95,7 +95,7 @@ class EEVariables(): "php5-mysql", "php5-cli", "php5-memcache", "php5-imagick", "memcached", "graphviz", "php-pear", "php5-dev"] - if ee_platform_distro == 'Ubuntu': + if ee_platform_distro == 'Ubuntu' or ee_platform_codename == 'jessie': ee_php = ee_php + ["php5-xdebug"] # MySQL repo and packages @@ -107,7 +107,7 @@ class EEVariables(): ee_mysql_repo = ("deb http://mirror.aarnet.edu.au/pub/MariaDB/repo/" "10.0/debian {codename} main" .format(codename=ee_platform_codename)) - ee_mysql = ["mariadb-server", "mysqltuner", "percona-toolkit"] + ee_mysql = (["mariadb-server", "percona-toolkit"]) # Postfix repo and packages ee_postfix_repo = "" From 993a0ab026b8b3ddbd375d289615239d97dda6cf Mon Sep 17 00:00:00 2001 From: gau1991 Date: Tue, 12 May 2015 11:36:39 +0530 Subject: [PATCH 09/23] Fixed issue where mysqltuner is not downloading while site creation --- ee/cli/plugins/site_functions.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ee/cli/plugins/site_functions.py b/ee/cli/plugins/site_functions.py index bbb7783d..333b982e 100644 --- a/ee/cli/plugins/site_functions.py +++ b/ee/cli/plugins/site_functions.py @@ -576,6 +576,10 @@ def site_package_check(self, stype): Log.debug(self, "Setting apt_packages variable for MySQL") if not EEShellExec.cmd_exec(self, "mysqladmin ping"): apt_packages = apt_packages + EEVariables.ee_mysql + packages = packages + [["https://raw.githubusercontent.com/" + "major/MySQLTuner-perl/master/" + "mysqltuner.pl", "/usr/bin/mysqltuner", + "MySQLTuner"]] if stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: Log.debug(self, "Setting apt_packages variable for Postfix") From 79ffd96deef7990d12155ceb490891a975692fff Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Wed, 13 May 2015 11:32:28 +0530 Subject: [PATCH 10/23] lowercase distros --- ee/cli/plugins/secure.py | 2 +- ee/cli/plugins/stack.py | 6 +++--- ee/cli/plugins/stack_upgrade.py | 4 ++-- ee/core/apt_repo.py | 2 +- ee/core/variables.py | 13 ++++++------- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/ee/cli/plugins/secure.py b/ee/cli/plugins/secure.py index 02c20bb3..ad32c40e 100644 --- a/ee/cli/plugins/secure.py +++ b/ee/cli/plugins/secure.py @@ -93,7 +93,7 @@ class EESecureController(CementBaseController): Log.info(self, "Please Enter valid port number :") port = input("EasyEngine admin port [22222]:") self.app.pargs.user_input = port - if EEVariables.ee_platform_distro == 'Ubuntu': + if EEVariables.ee_platform_distro == 'ubuntu': EEShellExec.cmd_exec(self, "sed -i \"s/listen.*/listen " "{port} default_server ssl spdy;/\" " "/etc/nginx/sites-available/22222" diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index 9b851cec..36540e66 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -221,7 +221,7 @@ class EEStackController(CementBaseController): nc.savef('/etc/nginx/nginx.conf') # Custom Nginx configuration by EasyEngine - if EEVariables.ee_platform_distro == 'Ubuntu': + if EEVariables.ee_platform_distro == 'ubuntu': data = dict(version=EEVariables.ee_version, Ubuntu=True) else: @@ -481,7 +481,7 @@ class EEStackController(CementBaseController): # For debian install xdebug if (EEVariables.ee_platform_distro == "debian" and - EEVariables.ee_platform_distro == 'wheezy'): + EEVariables.ee_platform_codename == 'wheezy'): EEShellExec.cmd_exec(self, "pecl install xdebug") with open("/etc/php5/mods-available/xdebug.ini", @@ -1461,7 +1461,7 @@ class EEStackController(CementBaseController): if self.app.pargs.nginx: Log.debug(self, "Setting apt_packages variable for Nginx") - if EEVariables.ee_platform_distro == 'Debian': + if EEVariables.ee_platform_distro == 'debian': check_nginx = 'nginx-extras' else: check_nginx = 'nginx-custom' diff --git a/ee/cli/plugins/stack_upgrade.py b/ee/cli/plugins/stack_upgrade.py index 1bfe07e3..4c9eac0a 100644 --- a/ee/cli/plugins/stack_upgrade.py +++ b/ee/cli/plugins/stack_upgrade.py @@ -48,7 +48,7 @@ class EEStackUpgradeController(CementBaseController): @expose(hide=True) def upgrade_php56(self): - if EEVariables.ee_platform_distro == "Ubuntu": + if EEVariables.ee_platform_distro == "ubuntu": if os.path.isfile("/etc/apt/sources.list.d/ondrej-php5-5_6-{0}." "list".format(EEVariables.ee_platform_codename)): Log.error(self, "Unable to find PHP 5.5") @@ -67,7 +67,7 @@ class EEStackUpgradeController(CementBaseController): if start_upgrade != "Y" and start_upgrade != "y": Log.error(self, "Not starting PHP package update") - if EEVariables.ee_platform_distro == "Ubuntu": + if EEVariables.ee_platform_distro == "ubuntu": EERepo.remove(self, ppa="ppa:ondrej/php5") EERepo.add(self, ppa=EEVariables.ee_php_repo) else: diff --git a/ee/core/apt_repo.py b/ee/core/apt_repo.py index ecfd4cfc..601a88cc 100644 --- a/ee/core/apt_repo.py +++ b/ee/core/apt_repo.py @@ -47,7 +47,7 @@ class EERepo(): Log.debug(self, "{0}".format(e)) Log.error(self, "Unable to add repo") if ppa is not None: - if EEVariables.ee_platform_distro == 'squeeze': + if EEVariables.ee_platform_codename == 'squeeze': print("Cannot add repo for {distro}" .format(distro=EEVariables.ee_platform_distro)) else: diff --git a/ee/core/variables.py b/ee/core/variables.py index ad7e1344..ceb7b0b4 100644 --- a/ee/core/variables.py +++ b/ee/core/variables.py @@ -24,7 +24,7 @@ class EEVariables(): ee_date = datetime.datetime.now().strftime('%d%b%Y%H%M%S') # EasyEngine core variables - ee_platform_distro = platform.linux_distribution()[0] + ee_platform_distro = platform.linux_distribution()[0].lower() ee_platform_version = platform.linux_distribution()[1] ee_platform_codename = os.popen("lsb_release -sc | tr -d \'\\n\'").read() @@ -76,7 +76,7 @@ class EEVariables(): # EasyEngine stack installation varibales # Nginx repo and packages - if ee_platform_distro == 'Ubuntu': + if ee_platform_distro == 'ubuntu': ee_nginx_repo = "ppa:rtcamp/nginx" ee_nginx = ["nginx-custom", "nginx-common"] elif ee_platform_distro == 'debian': @@ -85,7 +85,7 @@ class EEVariables(): ee_nginx = ["nginx-extras", "nginx-common"] # PHP repo and packages - if ee_platform_distro == 'Ubuntu': + if ee_platform_distro == 'ubuntu': ee_php_repo = "ppa:ondrej/php5-5.6" elif ee_platform_codename == 'wheezy': ee_php_repo = ("deb http://packages.dotdeb.org {codename}-php56 all" @@ -95,11 +95,11 @@ class EEVariables(): "php5-mysql", "php5-cli", "php5-memcache", "php5-imagick", "memcached", "graphviz", "php-pear", "php5-dev"] - if ee_platform_distro == 'Ubuntu' or ee_platform_codename == 'jessie': + if ee_platform_distro == 'ubuntu' or ee_platform_codename == 'jessie': ee_php = ee_php + ["php5-xdebug"] # MySQL repo and packages - if ee_platform_distro == 'Ubuntu': + if ee_platform_distro == 'ubuntu': ee_mysql_repo = ("deb http://mirror.aarnet.edu.au/pub/MariaDB/repo/" "10.0/ubuntu {codename} main" .format(codename=ee_platform_codename)) @@ -110,7 +110,6 @@ class EEVariables(): ee_mysql = ["mariadb-server", "percona-toolkit"] - # Postfix repo and packages ee_postfix_repo = "" ee_postfix = ["postfix"] @@ -132,7 +131,7 @@ class EEVariables(): # HHVM repo details # 12.04 requires boot repository - if ee_platform_distro == 'Ubuntu': + if ee_platform_distro == 'ubuntu': if ee_platform_codename == "precise": ee_boost_repo = ("ppa:mapnik/boost") From f566f9863598fd836ff66065ae9237e3f307ded4 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Wed, 13 May 2015 12:51:02 +0530 Subject: [PATCH 11/23] Now if nginx reload failed then it will stop the executation during ee stack install --- ee/cli/plugins/stack.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index 9b851cec..51dc52c5 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -691,7 +691,9 @@ class EEStackController(CementBaseController): out=ee_nginx) ee_nginx.close() - EEService.reload_service(self, 'nginx') + if not EEService.reload_service(self, 'nginx'): + Log.error(self, "Failed to reload Nginx, please check " + "output of `nginx -t`") if set(EEVariables.ee_mysql).issubset(set(apt_packages)): # TODO: Currently we are using, we need to remove it in future From 2e27829ccffb9574e6ad04f4919b2ca93a8b326d Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Wed, 13 May 2015 14:13:48 +0530 Subject: [PATCH 12/23] exit and throw error when nginx reload fails --- ee/cli/plugins/secure.py | 4 ++- ee/cli/plugins/site.py | 63 +++++++++++++++++++++++++++++++--------- 2 files changed, 53 insertions(+), 14 deletions(-) diff --git a/ee/cli/plugins/secure.py b/ee/cli/plugins/secure.py index ad32c40e..ee1f069f 100644 --- a/ee/cli/plugins/secure.py +++ b/ee/cli/plugins/secure.py @@ -105,7 +105,9 @@ class EESecureController(CementBaseController): .format(port=self.app.pargs.user_input)) EEGit.add(self, ["/etc/nginx"], msg="Adding changed secure port into Git") - EEService.reload_service(self, 'nginx') + if not EEService.reload_service(self, 'nginx'): + Log.error(self, "service nginx reload failed. " + "check issues with `nginx -t` command") Log.info(self, "Successfully port changed {port}" .format(port=self.app.pargs.user_input)) diff --git a/ee/cli/plugins/site.py b/ee/cli/plugins/site.py index 54a130e0..c5fc7dca 100644 --- a/ee/cli/plugins/site.py +++ b/ee/cli/plugins/site.py @@ -69,7 +69,9 @@ class EESiteController(CementBaseController): .format(ee_domain)) updateSiteInfo(self, ee_domain, enabled=True) Log.info(self, "[" + Log.ENDC + "OK" + Log.OKBLUE + "]") - EEService.reload_service(self, 'nginx') + if not EEService.reload_service(self, 'nginx'): + Log.error(self, "service nginx reload failed. " + "check issues with `nginx -t` command") else: Log.error(self, "nginx configuration file does not exist" .format(ee_domain)) @@ -107,7 +109,9 @@ class EESiteController(CementBaseController): .format(ee_domain)) updateSiteInfo(self, ee_domain, enabled=False) Log.info(self, "[" + Log.ENDC + "OK" + Log.OKBLUE + "]") - EEService.reload_service(self, 'nginx') + if not EEService.reload_service(self, 'nginx'): + Log.error(self, "service nginx reload failed. " + "check issues with `nginx -t` command") else: Log.error(self, "nginx configuration file does not exist" .format(ee_domain)) @@ -277,7 +281,9 @@ class EESiteEditController(CementBaseController): EEGit.add(self, ["/etc/nginx"], msg="Edit website: {0}" .format(ee_domain)) # Reload NGINX - EEService.reload_service(self, 'nginx') + if not EEService.reload_service(self, 'nginx'): + Log.error(self, "service nginx reload failed. " + "check issues with `nginx -t` command") else: Log.error(self, "nginx configuration file does not exists" .format(ee_domain)) @@ -298,7 +304,9 @@ class EESiteEditController(CementBaseController): msg="Edit Pagespped config of site: {0}" .format(ee_domain)) # Reload NGINX - EEService.reload_service(self, 'nginx') + if not EEService.reload_service(self, 'nginx'): + Log.error(self, "service nginx reload failed. " + "check issues with `nginx -t` command") else: Log.error(self, "Pagespeed configuration file does not exists" .format(ee_domain)) @@ -499,7 +507,15 @@ class EESiteCreateController(CementBaseController): if 'proxy' in data.keys() and data['proxy']: addNewSite(self, ee_domain, stype, cache, ee_site_webroot) # Service Nginx Reload - EEService.reload_service(self, 'nginx') + if not EEService.reload_service(self, 'nginx'): + Log.info(self, Log.FAIL + "Oops Something went wrong !!") + Log.info(self, Log.FAIL + "Calling cleanup actions ...") + doCleanupAction(self, domain=ee_domain) + Log.debug(self, str(e)) + Log.error(self, "service nginx reload failed. " + "check issues with `nginx -t` command") + Log.error(self, "Check logs for reason " + "`tail /var/log/ee/ee.log` & Try Again!!!") if ee_auth and len(ee_auth): for msg in ee_auth: Log.info(self, Log.ENDC + msg, log=False) @@ -588,8 +604,22 @@ class EESiteCreateController(CementBaseController): Log.error(self, "Check logs for reason " "`tail /var/log/ee/ee.log` & Try Again!!!") - # Service Nginx Reload - EEService.reload_service(self, 'nginx') + # Service Nginx Reload call cleanup if failed to reload nginx + if not EEService.reload_service(self, 'nginx'): + Log.info(self, Log.FAIL + "Oops Something went wrong !!") + Log.info(self, Log.FAIL + "Calling cleanup actions ...") + doCleanupAction(self, domain=ee_domain, + webroot=data['webroot']) + if 'ee_db_name' in data.keys(): + doCleanupAction(self, domain=ee_domain, + dbname=data['ee_db_name'], + dbuser=data['ee_db_user'], + dbhost=data['ee_db_host']) + deleteSiteInfo(self, ee_domain) + Log.info(self, Log.FAIL + "service nginx reload failed." + " check issues with `nginx -t` command.") + Log.error(self, "Check logs for reason " + "`tail /var/log/ee/ee.log` & Try Again!!!") EEGit.add(self, ["/etc/nginx"], msg="{0} created with {1} {2}" @@ -602,10 +632,13 @@ class EESiteCreateController(CementBaseController): Log.info(self, Log.FAIL + "Oops Something went wrong !!") Log.info(self, Log.FAIL + "Calling cleanup actions ...") doCleanupAction(self, domain=ee_domain, - webroot=data['webroot'], - dbname=data['ee_db_name'], - dbuser=data['ee_db_user'], - dbhost=data['ee_db_host']) + webroot=data['webroot']) + if 'ee_db_name' in data.keys(): + print("Inside db cleanup") + doCleanupAction(self, domain=ee_domain, + dbname=data['ee_db_name'], + dbuser=data['ee_db_user'], + dbhost=data['ee_db_host']) deleteSiteInfo(self, ee_domain) Log.error(self, "Check logs for reason " "`tail /var/log/ee/ee.log` & Try Again!!!") @@ -985,7 +1018,9 @@ class EESiteUpdateController(CementBaseController): if stype == oldsitetype and cache == oldcachetype: # Service Nginx Reload - EEService.reload_service(self, 'nginx') + if not EEService.reload_service(self, 'nginx'): + Log.error(self, "service nginx reload failed. " + "check issues with `nginx -t` command") updateSiteInfo(self, ee_domain, stype=stype, cache=cache, hhvm=hhvm, pagespeed=pagespeed) @@ -1090,7 +1125,9 @@ class EESiteUpdateController(CementBaseController): "`tail /var/log/ee/ee.log` & Try Again!!!") return 1 # Service Nginx Reload - EEService.reload_service(self, 'nginx') + if not EEService.reload_service(self, 'nginx'): + Log.error(self, "service nginx reload failed. " + "check issues with `nginx -t` command") EEGit.add(self, ["/etc/nginx"], msg="{0} updated with {1} {2}" From 50673867d4e64c23dcbedd81a4b85b62ec0a4e39 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Wed, 13 May 2015 17:23:31 +0530 Subject: [PATCH 13/23] Fix for Nginx white screen of death, fixes #538 --- ee/cli/plugins/site_functions.py | 8 ++++++++ ee/cli/plugins/stack.py | 11 +++++++++++ 2 files changed, 19 insertions(+) diff --git a/ee/cli/plugins/site_functions.py b/ee/cli/plugins/site_functions.py index 333b982e..782a8eba 100644 --- a/ee/cli/plugins/site_functions.py +++ b/ee/cli/plugins/site_functions.py @@ -566,6 +566,14 @@ def site_package_check(self, stype): if not EEAptGet.is_installed(self, check_nginx): apt_packages = apt_packages + EEVariables.ee_nginx + else: + # Fix for Nginx white screen death + if not EEFileUtils.grep(self, '/etc/nginx/fastcgi_params', + 'SCRIPT_FILENAME'): + with open('/etc/nginx/fastcgi_params', encoding='utf-8', + mode='a') as ee_nginx: + ee_nginx.write('fastcgi_param \tSCRIPT_FILENAME ' + '\t$request_filename;') if stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: Log.debug(self, "Setting apt_packages variable for PHP") diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index 63b50308..2bb80ed5 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -361,6 +361,17 @@ class EEStackController(CementBaseController): out=ee_nginx) ee_nginx.close() + # Fix whitescreen of death beacuse of missing value + # fastcgi_param SCRIPT_FILENAME $request_filename; in file + # /etc/nginx/fastcgi_params + + if not EEFileUtils.grep(self, '/etc/nginx/fastcgi_params', + 'SCRIPT_FILENAME'): + with open('/etc/nginx/fastcgi_params', + encoding='utf-8', mode='a') as ee_nginx: + ee_nginx.write('fastcgi_param \tSCRIPT_FILENAME ' + '\t$request_filename;') + # Pagespeed configuration Log.debug(self, 'Writting the Pagespeed Global ' 'configuration to file /etc/nginx/conf.d/' From 53be1a9290be87b118437c9a868a72f412aa84fa Mon Sep 17 00:00:00 2001 From: gau1991 Date: Wed, 13 May 2015 17:43:38 +0530 Subject: [PATCH 14/23] Fixed debug is not get disabled after clossing interactive debug --- ee/cli/plugins/debug.py | 6 ++++++ ee/cli/plugins/site_functions.py | 2 +- ee/cli/plugins/stack.py | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ee/cli/plugins/debug.py b/ee/cli/plugins/debug.py index 7d5f20b7..9af9ee46 100644 --- a/ee/cli/plugins/debug.py +++ b/ee/cli/plugins/debug.py @@ -454,21 +454,27 @@ class EEDebugController(CementBaseController): """Handle Ctrl+c hevent for -i option of debug""" self.start = False if self.app.pargs.nginx: + self.app.pargs.nginx = 'off' self.debug_nginx() if self.app.pargs.php: + self.app.pargs.php = 'off' self.debug_php() if self.app.pargs.fpm: + self.app.pargs.fpm = 'off' self.debug_fpm() if self.app.pargs.mysql: # MySQL debug will not work for remote MySQL if EEVariables.ee_mysql_host is "localhost": + self.app.pargs.mysql = 'off' self.debug_mysql() else: Log.warn(self, "Remote MySQL found, EasyEngine will not " "enable remote debug") if self.app.pargs.wp: + self.app.pargs.wp = 'off' self.debug_wp() if self.app.pargs.rewrite: + self.app.pargs.rewrite = 'off' self.debug_rewrite() # Reload Nginx diff --git a/ee/cli/plugins/site_functions.py b/ee/cli/plugins/site_functions.py index 782a8eba..d082a6e3 100644 --- a/ee/cli/plugins/site_functions.py +++ b/ee/cli/plugins/site_functions.py @@ -573,7 +573,7 @@ def site_package_check(self, stype): with open('/etc/nginx/fastcgi_params', encoding='utf-8', mode='a') as ee_nginx: ee_nginx.write('fastcgi_param \tSCRIPT_FILENAME ' - '\t$request_filename;') + '\t$request_filename;\n') if stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: Log.debug(self, "Setting apt_packages variable for PHP") diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index 2bb80ed5..64f0eec8 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -370,7 +370,7 @@ class EEStackController(CementBaseController): with open('/etc/nginx/fastcgi_params', encoding='utf-8', mode='a') as ee_nginx: ee_nginx.write('fastcgi_param \tSCRIPT_FILENAME ' - '\t$request_filename;') + '\t$request_filename;\n') # Pagespeed configuration Log.debug(self, 'Writting the Pagespeed Global ' From 64e22ed085afd46d66415c9d942ee66c09f69fc7 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Thu, 14 May 2015 11:36:51 +0530 Subject: [PATCH 15/23] Updated wp-cli version --- ee/core/variables.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ee/core/variables.py b/ee/core/variables.py index 7c4cb57f..67c6a699 100644 --- a/ee/core/variables.py +++ b/ee/core/variables.py @@ -15,7 +15,7 @@ class EEVariables(): ee_version = "3.1.4" # EasyEngine packages versions - ee_wp_cli = "0.19.0" + ee_wp_cli = "0.19.1" ee_adminer = "4.2.1" ee_roundcube = "1.1.1" ee_vimbadmin = "3.0.11" From a8ae1a33ed908e0f4a7dcf829caa73ffcd752c63 Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Thu, 14 May 2015 12:15:06 +0530 Subject: [PATCH 16/23] updated ee version --- ee/core/variables.py | 2 +- install | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ee/core/variables.py b/ee/core/variables.py index 2c458aa3..2dc5b0e8 100644 --- a/ee/core/variables.py +++ b/ee/core/variables.py @@ -12,7 +12,7 @@ class EEVariables(): """Intialization of core variables""" # EasyEngine version - ee_version = "3.1.4" + ee_version = "3.1.5" # EasyEngine packages versions ee_wp_cli = "0.19.1" diff --git a/install b/install index c7a1648e..362d1525 100644 --- a/install +++ b/install @@ -48,7 +48,7 @@ fi # Define variables for later use ee_branch=$1 readonly ee_version_old="2.2.3" -readonly ee_version_new="3.1.4" +readonly ee_version_new="3.1.5" readonly ee_log_dir=/var/log/ee/ readonly ee_install_log=/var/log/ee/install.log readonly ee_linux_distro=$(lsb_release -i | awk '{print $3}') diff --git a/setup.py b/setup.py index e79d3a23..cf3e6bf6 100644 --- a/setup.py +++ b/setup.py @@ -54,7 +54,7 @@ except Exception as e: os.system("git config --global user.email {0}".format(ee_email)) setup(name='ee', - version='3.1.4', + version='3.1.5', description=long_description, long_description=long_description, classifiers=[], From 03fa8e2684c26f829f56094c9d2fe6021cfe5a1d Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Thu, 14 May 2015 12:17:01 +0530 Subject: [PATCH 17/23] Added Debian 8 as supported OS --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5fc623f2..edf70ef7 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ EasyEngine (ee) is a python tool, which makes it easy to manage your wordpress s **EasyEngine currently supports:** - Ubuntu 12.04 & 14.04 -- Debian 7 +- Debian 7 & 8 ## Quick Start From fa24734264c01b1a1408950bbb3884d02098fe43 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Thu, 14 May 2015 12:20:52 +0530 Subject: [PATCH 18/23] Adjust space --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index edf70ef7..1e8438b8 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ EasyEngine (ee) is a python tool, which makes it easy to manage your wordpress s ```bash wget -qO ee rt.cx/ee && sudo bash ee # Install easyengine 3 -sudo ee site create example.com --wp # Install required packages & setup WordPress on example.com +sudo ee site create example.com --wp # Install required packages & setup WordPress on example.com ``` ## Update EasyEngine From 21ed4e491f368074f909082a83c9b78ef036ad61 Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Thu, 14 May 2015 13:00:27 +0530 Subject: [PATCH 19/23] v3.1.5 Changelog --- CHANGELOG.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index f79e33a5..283cc2e0 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,9 @@ +v 3.1.5 - May 14, 2015 +- Added Debian 8 (jessie) support. see #524 +- Fixed Debain 7 stack issues. see #538 #539 #540 #435 +- Updated MySQLTuner see #484 +- Minor fixes and improvements. +- v 3.1.4 - May 7, 2015 - Fixed XSS Vulnerability found in some WordPress themes and plugins From 05619ba4b3ee2b82674c58e0d7ae796e84c683bb Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Thu, 14 May 2015 14:10:50 +0530 Subject: [PATCH 20/23] updated command to check nginx installed by EE or other --- ee/cli/plugins/stack.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index 64f0eec8..50316c62 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -204,7 +204,7 @@ class EEStackController(CementBaseController): EEService.reload_service(self, 'postfix') if set(EEVariables.ee_nginx).issubset(set(apt_packages)): - if ((not EEShellExec.cmd_exec(self, "grep EasyEngine " + if ((not EEShellExec.cmd_exec(self, "grep -q -Hr EasyEngine " "/etc/nginx")) and os.path.isfile('/etc/nginx/nginx.conf')): nc = NginxConfig() Log.debug(self, 'Loading file /etc/nginx/nginx.conf ') From 2063c22a035011777d1077065b3c4201501334a8 Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Thu, 14 May 2015 16:08:32 +0530 Subject: [PATCH 21/23] removed debian 8 support --- CHANGELOG.txt | 1 - README.md | 2 +- install | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 283cc2e0..1e10cda9 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,4 @@ v 3.1.5 - May 14, 2015 -- Added Debian 8 (jessie) support. see #524 - Fixed Debain 7 stack issues. see #538 #539 #540 #435 - Updated MySQLTuner see #484 - Minor fixes and improvements. diff --git a/README.md b/README.md index 1e8438b8..9ebf32b6 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ EasyEngine (ee) is a python tool, which makes it easy to manage your wordpress s **EasyEngine currently supports:** - Ubuntu 12.04 & 14.04 -- Debian 7 & 8 +- Debian 7 ## Quick Start diff --git a/install b/install index 362d1525..ac0a3425 100644 --- a/install +++ b/install @@ -63,7 +63,7 @@ if [ "$ee_linux_distro" != "Ubuntu" ] && [ "$ee_linux_distro" != "Debian" ]; the fi # EasyEngine (ee) only support all Ubuntu/Debian distro except the distro reached EOL -lsb_release -d | egrep -e "12.04|14.04|wheezy|jessie" &>> /dev/null +lsb_release -d | egrep -e "12.04|14.04|wheezy" &>> /dev/null if [ "$?" -ne "0" ]; then ee_lib_echo_fail "EasyEngine (ee) only support Ubuntu 12.04/14.04 and Debian 7.x" exit 100 From 78644e7bf69f8860c5175e2fb33e0438abbb4d16 Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Thu, 14 May 2015 16:38:02 +0530 Subject: [PATCH 22/23] removed squeeze --- ee/core/apt_repo.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/ee/core/apt_repo.py b/ee/core/apt_repo.py index 601a88cc..c743cfdf 100644 --- a/ee/core/apt_repo.py +++ b/ee/core/apt_repo.py @@ -47,13 +47,8 @@ class EERepo(): Log.debug(self, "{0}".format(e)) Log.error(self, "Unable to add repo") if ppa is not None: - if EEVariables.ee_platform_codename == 'squeeze': - print("Cannot add repo for {distro}" - .format(distro=EEVariables.ee_platform_distro)) - else: - EEShellExec.cmd_exec(self, "add-apt-repository -y " - "'{ppa_name}'" - .format(ppa_name=ppa)) + EEShellExec.cmd_exec(self, "add-apt-repository -y '{ppa_name}'" + .format(ppa_name=ppa)) def remove(self, ppa=None, repo_url=None): """ From f2a3016f76eb408531379c8e6ae8ab14a49c4603 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Mon, 18 May 2015 11:18:46 +0530 Subject: [PATCH 23/23] Updated changelog --- CHANGELOG.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 1e10cda9..a3e2b518 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,8 +1,8 @@ v 3.1.5 - May 14, 2015 -- Fixed Debain 7 stack issues. see #538 #539 #540 #435 +- Fixed Debain 7 stack issues. see #538 #539 #540 #435 #546 - Updated MySQLTuner see #484 - Minor fixes and improvements. -- + v 3.1.4 - May 7, 2015 - Fixed XSS Vulnerability found in some WordPress themes and plugins