From 00223229c6347d187e8368230b022244d59ba2be Mon Sep 17 00:00:00 2001 From: Rahul Bansal Date: Thu, 22 Nov 2018 10:59:59 +0530 Subject: [PATCH 01/13] Removed BitPay Donate link Our BitPay account is running into compliance --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index fa2981b85..7aa9e8d4d 100644 --- a/README.md +++ b/README.md @@ -107,4 +107,3 @@ We warmheartedly welcome all contributions however and in whatever capacity you ## Donations [![PayPal-Donate](https://cloud.githubusercontent.com/assets/4115/5297691/c7b50292-7bd7-11e4-987b-2dc21069e756.png)](http://rt.cx/eedonate) -[![BitCoin-Donate](https://bitpay.com/img/donate-button.svg)](https://bitpay.com/417008/donate) From ce7e73d97abb7e067530173d34a31744def79a18 Mon Sep 17 00:00:00 2001 From: Kirtan Gajjar Date: Fri, 23 Nov 2018 17:12:44 +0530 Subject: [PATCH 02/13] Correct download URL and add license badge --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7aa9e8d4d..8de7874da 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ EasyEngine Logo [![Build Status](https://travis-ci.org/EasyEngine/easyengine.svg?branch=master-v4)](https://travis-ci.org/EasyEngine/easyengine) +[![License](https://poser.pugx.org/phpunit/phpunit/license)](https://packagist.org/packages/phpunit/phpunit) [![Join EasyEngine Slack Channel](http://slack.easyengine.io/badge.svg)](http://slack.easyengine.io/) ## Requirements @@ -19,7 +20,7 @@ For Linux, we have created an installer script which will install all the dependencies for you. We have tested this on Ubuntu 14.04, 16.04, 18.04 and Debian 8. ```bash -wget -qO ee https://rt.cx/ee4beta && sudo bash ee +wget -qO ee https://rt.cx/ee4 && sudo bash ee ``` Even if the script doesn't work for your distribution, you can manually install the dependencies and then run the following commands to install EasyEngine From 91f841a3cb9f6be7bbb933596177f5ecbec0b609 Mon Sep 17 00:00:00 2001 From: Riddhesh Sanghvi Date: Fri, 23 Nov 2018 18:29:03 +0530 Subject: [PATCH 03/13] Update checks in running commands Signed-off-by: Riddhesh Sanghvi --- php/EE/Runner.php | 54 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 17 deletions(-) diff --git a/php/EE/Runner.php b/php/EE/Runner.php index c7227ae16..74eae8b57 100644 --- a/php/EE/Runner.php +++ b/php/EE/Runner.php @@ -64,27 +64,47 @@ private function init_ee() { if ( ! empty( $this->arguments ) && - ( 'help' !== $this->arguments[0] ) - && $this->arguments !== [ 'cli', 'version' ] - ) - { + ( ! in_array( $this->arguments[0], [ 'cli', 'config', 'help' ], true ) ) + ) { + $this->check_requirements(); + $this->maybe_trigger_migration(); + } + if ( [ 'cli', 'info' ] === $this->arguments && $this->check_requirements( false ) ) { + $this->maybe_trigger_migration(); + } + } - // Minimum requirement checks. - $docker_running = 'docker ps > /dev/null'; - if ( ! EE::exec( $docker_running ) ) { - EE::error( 'docker not installed or not running.' ); - } + /** + * Check EE requirements for required commands. + * + * @param bool $show_error To display error or to retutn status. + */ + public function check_requirements( $show_error = true ) { - $docker_compose_installed = 'command -v docker-compose > /dev/null'; - if ( ! EE::exec( $docker_compose_installed ) ) { - EE::error( 'EasyEngine requires docker-compose.' ); - } + $status = true; - if ( version_compare( PHP_VERSION, '7.2.0' ) < 0 ) { - EE::error( 'EasyEngine requires minimum PHP 7.2.0 to run.' ); - } + // Minimum requirement checks. + $docker_running = 'docker ps > /dev/null'; + if ( ! EE::exec( $docker_running ) ) { + $status = false; + $error = 'Docker not installed or not running.'; + } - $this->maybe_trigger_migration(); + $docker_compose_installed = 'command -v docker-compose > /dev/null'; + if ( ! EE::exec( $docker_compose_installed ) ) { + $status = false; + $error = 'EasyEngine requires docker-compose.'; + } + + if ( version_compare( PHP_VERSION, '7.2.0' ) < 0 ) { + $status = false; + $error = 'EasyEngine requires minimum PHP 7.2.0 to run.'; + } + + if ( ! $show_error ) { + return $status; + } elseif ( ! $status ) { + EE::error( $error ); } } From 30601354a67f5150cef8d0c48444277e4daecc66 Mon Sep 17 00:00:00 2001 From: Riddhesh Sanghvi Date: Fri, 23 Nov 2018 18:29:21 +0530 Subject: [PATCH 04/13] Run checks before replacing phar Signed-off-by: Riddhesh Sanghvi --- php/commands/src/CLI_Command.php | 1 + 1 file changed, 1 insertion(+) diff --git a/php/commands/src/CLI_Command.php b/php/commands/src/CLI_Command.php index c1bafea71..2929aae21 100644 --- a/php/commands/src/CLI_Command.php +++ b/php/commands/src/CLI_Command.php @@ -286,6 +286,7 @@ public function update( $_, $assoc_args ) { $download_url = $newest['package_url']; $md5_url = str_replace( '.phar', '.phar.md5', $download_url ); } + EE::get_runner()->check_requirements(); EE::log( sprintf( 'Downloading from %s...', $download_url ) ); $temp = \EE\Utils\get_temp_dir() . uniqid( 'ee_', true ) . '.phar'; $headers = array(); From 37dd137768eee30be5f7381afe315cbe99bf0b8c Mon Sep 17 00:00:00 2001 From: Riddhesh Sanghvi Date: Fri, 23 Nov 2018 19:00:29 +0530 Subject: [PATCH 05/13] Update ci prepration of phar Signed-off-by: Riddhesh Sanghvi --- ci/prepare.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ci/prepare.sh b/ci/prepare.sh index 7ae98d55f..5f2a38056 100755 --- a/ci/prepare.sh +++ b/ci/prepare.sh @@ -10,4 +10,7 @@ if [[ "$TRAVIS_BRANCH" != $DEPLOY_BRANCH ]]; then sed -i 's/\:\ \"\(.*\)\"/\:\ \"\1-nightly\"/g' img-versions.json fi -php -dphar.readonly=0 ./utils/make-phar.php easyengine.phar --quiet \ No newline at end of file +php -dphar.readonly=0 ./utils/make-phar.php easyengine.phar --quiet + +# Checking the phar is working. +./easyengine.phar cli info \ No newline at end of file From e3cf4146b9f45ea238a9d5e409511e282122d857 Mon Sep 17 00:00:00 2001 From: Riddhesh Sanghvi Date: Fri, 23 Nov 2018 19:22:27 +0530 Subject: [PATCH 06/13] Update returning status Signed-off-by: Riddhesh Sanghvi --- php/EE/Runner.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/php/EE/Runner.php b/php/EE/Runner.php index 74eae8b57..8d919aa20 100644 --- a/php/EE/Runner.php +++ b/php/EE/Runner.php @@ -101,11 +101,11 @@ public function check_requirements( $show_error = true ) { $error = 'EasyEngine requires minimum PHP 7.2.0 to run.'; } - if ( ! $show_error ) { - return $status; - } elseif ( ! $status ) { + if ( $show_error && ! $status ) { EE::error( $error ); } + + return $status; } /** From 972393ade3261c241ba05f05564b9852cb583321 Mon Sep 17 00:00:00 2001 From: Riddhesh Sanghvi Date: Fri, 23 Nov 2018 19:31:54 +0530 Subject: [PATCH 07/13] Update self-uninstall dependency check Signed-off-by: Riddhesh Sanghvi --- php/commands/src/CLI_Command.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/php/commands/src/CLI_Command.php b/php/commands/src/CLI_Command.php index 2929aae21..a80198165 100644 --- a/php/commands/src/CLI_Command.php +++ b/php/commands/src/CLI_Command.php @@ -494,6 +494,11 @@ public function cmd_dump() { */ public function self_uninstall( $args, $assoc_args ) { + if ( ! EE::get_runner()->check_requirements( false ) ) { + EE::error( 'Unable to proceed with uninstallation. Seems there is a dependency down.', false ); + die; + } + EE::confirm( "Are you sure you want to remove EasyEngine and all its sites(along with their data)?\nThis is an irreversible action. No backup will be kept.", $assoc_args ); EE::exec( 'docker rm -f $(docker ps -aqf label=org.label-schema.vendor="EasyEngine")' ); From 73488a81f323425595133ea0de6356cb52abebf1 Mon Sep 17 00:00:00 2001 From: Riddhesh Sanghvi Date: Fri, 23 Nov 2018 19:49:28 +0530 Subject: [PATCH 08/13] Update to show first message Signed-off-by: Riddhesh Sanghvi --- php/EE/Runner.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/php/EE/Runner.php b/php/EE/Runner.php index 8d919aa20..99a2549b8 100644 --- a/php/EE/Runner.php +++ b/php/EE/Runner.php @@ -82,27 +82,27 @@ private function init_ee() { public function check_requirements( $show_error = true ) { $status = true; + $error = []; - // Minimum requirement checks. $docker_running = 'docker ps > /dev/null'; if ( ! EE::exec( $docker_running ) ) { - $status = false; - $error = 'Docker not installed or not running.'; + $status = false; + $error[] = 'Docker not installed or not running.'; } $docker_compose_installed = 'command -v docker-compose > /dev/null'; if ( ! EE::exec( $docker_compose_installed ) ) { - $status = false; - $error = 'EasyEngine requires docker-compose.'; + $status = false; + $error[] = 'EasyEngine requires docker-compose.'; } if ( version_compare( PHP_VERSION, '7.2.0' ) < 0 ) { - $status = false; - $error = 'EasyEngine requires minimum PHP 7.2.0 to run.'; + $status = false; + $error[] = 'EasyEngine requires minimum PHP 7.2.0 to run.'; } if ( $show_error && ! $status ) { - EE::error( $error ); + EE::error( reset( $error ) ); } return $status; From 34e7e3ce4ff8862acc3dd605fd92478e5241273e Mon Sep 17 00:00:00 2001 From: Riddhesh Sanghvi Date: Fri, 23 Nov 2018 20:31:49 +0530 Subject: [PATCH 09/13] Check prepare.sh Signed-off-by: Riddhesh Sanghvi --- ci/prepare.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ci/prepare.sh b/ci/prepare.sh index 5f2a38056..a3fd49a41 100755 --- a/ci/prepare.sh +++ b/ci/prepare.sh @@ -13,4 +13,5 @@ fi php -dphar.readonly=0 ./utils/make-phar.php easyengine.phar --quiet # Checking the phar is working. -./easyengine.phar cli info \ No newline at end of file +sudo ./easyengine.phar cli info +docker ps -a \ No newline at end of file From 2276fe78aaad17fbfd5ea685191591853cbacdee Mon Sep 17 00:00:00 2001 From: Riddhesh Sanghvi Date: Fri, 23 Nov 2018 20:44:10 +0530 Subject: [PATCH 10/13] Update checks and messages for macOS Signed-off-by: Riddhesh Sanghvi --- php/EE/Runner.php | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/php/EE/Runner.php b/php/EE/Runner.php index 99a2549b8..fa0133b3a 100644 --- a/php/EE/Runner.php +++ b/php/EE/Runner.php @@ -81,28 +81,33 @@ private function init_ee() { */ public function check_requirements( $show_error = true ) { - $status = true; - $error = []; + $docker_running = true; + $status = true; + $error = []; - $docker_running = 'docker ps > /dev/null'; - if ( ! EE::exec( $docker_running ) ) { - $status = false; - $error[] = 'Docker not installed or not running.'; + $docker_running_cmd = 'docker ps > /dev/null'; + if ( ! EE::exec( $docker_running_cmd ) ) { + $status = false; + $docker_running = false; + $error[] = 'Docker not installed or not running.'; } $docker_compose_installed = 'command -v docker-compose > /dev/null'; if ( ! EE::exec( $docker_compose_installed ) ) { - $status = false; - $error[] = 'EasyEngine requires docker-compose.'; + $status = false; + $error[] = 'EasyEngine requires docker-compose.'; } if ( version_compare( PHP_VERSION, '7.2.0' ) < 0 ) { - $status = false; - $error[] = 'EasyEngine requires minimum PHP 7.2.0 to run.'; + $status = false; + $error[] = 'EasyEngine requires minimum PHP 7.2.0 to run.'; } if ( $show_error && ! $status ) { - EE::error( reset( $error ) ); + EE::error( reset( $error ), false ); + if ( IS_DARWIN && ! $docker_running ) { + EE::log( 'For macOS docker can be installed using: `brew cask install docker`' ); + } } return $status; From 94a1fd381516c60ec7258348bbfa985bdb0164dc Mon Sep 17 00:00:00 2001 From: Riddhesh Sanghvi Date: Fri, 23 Nov 2018 20:48:59 +0530 Subject: [PATCH 11/13] Exit after showing error. Signed-off-by: Riddhesh Sanghvi --- php/EE/Runner.php | 1 + 1 file changed, 1 insertion(+) diff --git a/php/EE/Runner.php b/php/EE/Runner.php index fa0133b3a..3a83acfea 100644 --- a/php/EE/Runner.php +++ b/php/EE/Runner.php @@ -108,6 +108,7 @@ public function check_requirements( $show_error = true ) { if ( IS_DARWIN && ! $docker_running ) { EE::log( 'For macOS docker can be installed using: `brew cask install docker`' ); } + die; } return $status; From 9fa620ca1e21381ea2b1f3ec4abc7e5c74b15072 Mon Sep 17 00:00:00 2001 From: Riddhesh Sanghvi Date: Fri, 23 Nov 2018 20:54:05 +0530 Subject: [PATCH 12/13] Update self-uninstall Signed-off-by: Riddhesh Sanghvi --- php/commands/src/CLI_Command.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/php/commands/src/CLI_Command.php b/php/commands/src/CLI_Command.php index a80198165..6ab58af42 100644 --- a/php/commands/src/CLI_Command.php +++ b/php/commands/src/CLI_Command.php @@ -502,18 +502,19 @@ public function self_uninstall( $args, $assoc_args ) { EE::confirm( "Are you sure you want to remove EasyEngine and all its sites(along with their data)?\nThis is an irreversible action. No backup will be kept.", $assoc_args ); EE::exec( 'docker rm -f $(docker ps -aqf label=org.label-schema.vendor="EasyEngine")' ); - $home = Utils\get_home_dir(); - EE::exec( "rm -rf $home/.ee/" ); + EE::exec( 'docker network prune -f $(docker network ls -f "label=org.label-schema.vendor=EasyEngine")' ); + EE::exec( 'docker volume rm -f $(docker volume ls -f "label=org.label-schema.vendor=EasyEngine" -q)' ); + EE::exec( 'docker image rm $(docker image ls -f "label=org.label-schema.vendor=EasyEngine" -q)' ); $records = Site::all( [ 'site_fs_path' ] ); + $fs = new Filesystem(); if ( ! empty( $records ) ) { $sites_paths = array_column( $records, 'site_fs_path' ); - $fs = new Filesystem(); $fs->remove( $sites_paths ); } - EE::exec( "rm -rf " . EE_ROOT_DIR ); + $fs->remove( EE_ROOT_DIR ); if ( Utils\inside_phar() ) { unlink( realpath( $_SERVER['argv'][0] ) ); From d3289d05c9df5c93868ed032d8249f853657e2ad Mon Sep 17 00:00:00 2001 From: Rahul Prajapati Date: Fri, 23 Nov 2018 21:18:22 +0530 Subject: [PATCH 13/13] Bump version to 4.0.1. Note: Maintenance Release for macOS Brew Package `brew install easyengine`. --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index fcdb2e109..1454f6ed4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.0.0 +4.0.1