diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 09a965f..8000200 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -2,6 +2,12 @@ ## CHANGELOG +### 1.2.0 + +- use Redis for Session for Platform.sh configuration by default +- Wizard Simplification, to remove the questions in 'standard' mode +- Fix TCP port mapping with Memached Admin + ### 1.1.0 - ezplatform-http-cache is enabled when not loaded diff --git a/docs/backup/ez.phar b/docs/backup/1.0.0/ez.phar similarity index 100% rename from docs/backup/ez.phar rename to docs/backup/1.0.0/ez.phar diff --git a/docs/backup/ez.phar.pubkey b/docs/backup/1.0.0/ez.phar.pubkey similarity index 100% rename from docs/backup/ez.phar.pubkey rename to docs/backup/1.0.0/ez.phar.pubkey diff --git a/docs/backup/ez.phar.version b/docs/backup/1.0.0/ez.phar.version similarity index 100% rename from docs/backup/ez.phar.version rename to docs/backup/1.0.0/ez.phar.version diff --git a/docs/backup/1.1.0/ez.phar b/docs/backup/1.1.0/ez.phar new file mode 100755 index 0000000..90e3bb6 Binary files /dev/null and b/docs/backup/1.1.0/ez.phar differ diff --git a/docs/backup/1.1.0/ez.phar.pubkey b/docs/backup/1.1.0/ez.phar.pubkey new file mode 100644 index 0000000..d62ed90 --- /dev/null +++ b/docs/backup/1.1.0/ez.phar.pubkey @@ -0,0 +1,14 @@ +-----BEGIN PUBLIC KEY----- +MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAzzMKkvmPQvqdPGax6BQz +Wd4U3M2O2s/bgbX2KF5sXWitSzccrnoje2TIcWfhnRZXiqcgbagxconI2V3WJP7U +oiZ2iqhJs3WqEdciYmX8tdc3JMAMaNMkhpEDcJcXnhYVuoA/i2Ad3RAfnW/XIUYy +anD3VQNZTdu/oolhv5/kbMQdUFaf5NnI+j13qPQjoaqNOZh/5CaOkRYUnDdNPn7C +vzyF9YQ3nW5wSrWR9TqkvIeVoJ/4kdemeEh+DYZZlNa55f/nPkW2SXiXC4UJfbA/ +EkfAJWSdJNR73XtCqen96BV8zeE0VsVGouPRFtKasNCPkhsUzpbf77QNnESatuDi +gaoYWZCRQJ3tmgQBV4o35H2ZI36mz48z2vUuqdtb4ONTKtc5yEZZNiqfDARAys5a +nr4V3CGifCoMq/2bmF4QxDc0//J7aDV63dc3W+b7dYOoCs5RvPLSAzei7QCvQmwN +3ihCp5qJurqm4boZVTiEtwGMKYPe04gHQKivwB196wBLMhgMpAw7tBebG6uJl2i2 +0oe08WAASJ7agiE04gM0+0e4xHXopTfOjYtiLm4khLtHm4vORoCbX1hm+ZYo8fL5 +ynl9opd2vopwukVIC2t2WXGa/0SLVcygnjq4ow4it6zq+zPemS/AiR23//UMKr8h +gkX9cNgYQNT9Ko+Plqe+kT8CAwEAAQ== +-----END PUBLIC KEY----- diff --git a/docs/backup/1.1.0/ez.phar.version b/docs/backup/1.1.0/ez.phar.version new file mode 100644 index 0000000..d723def --- /dev/null +++ b/docs/backup/1.1.0/ez.phar.version @@ -0,0 +1 @@ +5d16a58a3c1724fc77de301ac2d0aae9bd87a9d2 ez.phar diff --git a/payload/dev/docker-compose.yml b/payload/dev/docker-compose.yml index 81238d7..3e99f13 100644 --- a/payload/dev/docker-compose.yml +++ b/payload/dev/docker-compose.yml @@ -94,7 +94,7 @@ services: environment: - "MEMCACHE_HOST=memcache" ports: - - "${PROJECTPORTPREFIX}083:8080" + - "${PROJECTPORTPREFIX}083:9083" # Blackfire blackfire: diff --git a/payload/platformsh/.platform.app.yaml b/payload/platformsh/.platform.app.yaml index 6a3f605..20a1c55 100644 --- a/payload/platformsh/.platform.app.yaml +++ b/payload/platformsh/.platform.app.yaml @@ -22,6 +22,7 @@ build: relationships: database: "mysqldb:mysql" cache: "cache:memcached" + redis: "rediscache:redis" # The configuration of app when it is exposed to the web. web: @@ -86,9 +87,10 @@ runtime: - readline - memcached - msgpack + - redis variables: php: memory_limit: 256M - session.save_handler: memcached - session.save_path: "cache.internal:11211?persistent=1&weight=1&timeout=1&retry_interval=15" + session.save_handler: redis + session.save_path: "tcp://redis.internal:6379" diff --git a/payload/platformsh/.platform/services.yaml b/payload/platformsh/.platform/services.yaml index 1775bf6..ea769fd 100644 --- a/payload/platformsh/.platform/services.yaml +++ b/payload/platformsh/.platform/services.yaml @@ -3,3 +3,5 @@ mysqldb: disk: 2048 cache: type: 'memcached:1.4' +rediscache: + type: 'redis:3.2' diff --git a/src/Core/ProjectWizard.php b/src/Core/ProjectWizard.php index 7b9205c..42234b1 100644 --- a/src/Core/ProjectWizard.php +++ b/src/Core/ProjectWizard.php @@ -22,6 +22,24 @@ class ProjectWizard */ protected $projectConfiguration; + const INIT_STD = 'standard'; + const INIT_STD_COMPOER_AUTH = 'standard-with-composer-auth'; + const INIT_EXPERT = 'expert'; + + /** + * @var array + */ + protected static $modes = [ + self::INIT_STD, + self::INIT_STD_COMPOER_AUTH, + self::INIT_EXPERT, + ]; + + /** + * @var string + */ + protected $mode; + /** * ProjectWizard constructor. * @@ -41,7 +59,9 @@ public function __construct(SymfonyStyle $io, ProjectConfiguration $configuratio */ public function __invoke(DockerCompose $compose) { - return [ + $this->mode = $this->getInitializationMode(); + + $configuration = [ $this->getNetworkName(), $this->getNetworkTCPPort(), $this->getComposerHttpBasicCredentials(), @@ -52,6 +72,28 @@ public function __invoke(DockerCompose $compose) $this->getProvisioningFolderName(), $this->getComposeFileName(), ]; + + return $configuration; + } + + /** + * @return string + */ + public function getInitializationMode() + { + $standard = self::INIT_STD; + $withComposer = self::INIT_STD_COMPOER_AUTH; + $expert = self::INIT_EXPERT; + $question = <<{$standard}: All the services, no composer auth + - {$withComposer}: Standard with ability to provide Composer Auth, useful for eZ Platform Enterprise + - {$expert}: All the questions will be asked and you can select the services you want only + Please select your Initialization mode +END; + + return $this->io->choice($question, self::$modes, self::INIT_STD); } /** @@ -59,6 +101,9 @@ public function __invoke(DockerCompose $compose) */ protected function getComposerHttpBasicCredentials() { + if (!$this->requireComposerAuth()) { + return []; + } $credentials = []; $endString = 'Composer HTTP-BASIC for this project?'; $questionString = 'Do you want to set '.$endString; @@ -97,6 +142,14 @@ protected function getOneComposerHttpBasic() */ protected function getProvisioningFolderName() { + $default = $this->projectConfiguration->get('provisioning.folder_name'); + if (empty($default)) { + $default = 'provisioning'; + } + + if ($this->isStandardMode()) { + return $default; + } $pattern = '^[a-zA-Z0-9]*$'; $validator = function ($value) use ($pattern) { @@ -105,10 +158,6 @@ protected function getProvisioningFolderName() $message = 'What is your preferred name for the provisioning folder?'; $errorMessage = "The name of the folder MUST respect {$pattern}."; - $default = $this->projectConfiguration->get('provisioning.folder_name'); - if (empty($default)) { - $default = 'provisioning'; - } return $this->io->askQuestion($this->getQuestion($message, $default, $validator, $errorMessage)); } @@ -118,6 +167,14 @@ protected function getProvisioningFolderName() */ public function getComposeFileName() { + $default = $this->projectConfiguration->get('docker.compose_file'); + if (empty($default)) { + $default = 'docker-compose.yml'; + } + if ($this->isStandardMode()) { + return $default; + } + $pattern = '^[a-zA-Z0-9\-]*\.yml$'; $validator = function ($value) use ($pattern) { @@ -126,10 +183,6 @@ public function getComposeFileName() $message = 'What is your preferred filename for the Docker Compose file?'; $errorMessage = "The name of the filename MUST respect {$pattern}."; - $default = $this->projectConfiguration->get('docker.compose_file'); - if (empty($default)) { - $default = 'docker-compose.yml'; - } return $this->io->askQuestion($this->getQuestion($message, $default, $validator, $errorMessage)); } @@ -145,7 +198,8 @@ protected function getSelectedServices($services, $questionnable) $selectedServices = []; foreach ($services as $name => $service) { if (in_array($name, $questionnable)) { - if ($this->io->confirm("Do you want the service {$name}")) { + if ($this->isStandardMode() || + $this->io->confirm("Do you want the service {$name}")) { $selectedServices[] = $name; } } else { @@ -161,15 +215,18 @@ protected function getSelectedServices($services, $questionnable) */ protected function getNetworkName() { - $pattern = '^[a-zA-Z0-9]*$'; - + $default = str_replace(['-', '_', '.'], '', strtolower(basename(getcwd()))); + $pattern = '^[a-zA-Z0-9]*$'; $validator = function ($value) use ($pattern) { return preg_match("/{$pattern}/", $value); }; + if ($validator($default) && $this->isStandardMode()) { + return $default; + } + $message = 'Please select a name for the containers Docker Network'; $errorMessage = "The name of the network MUST respect {$pattern}."; - $default = strtolower(basename(getcwd())); return $this->io->askQuestion($this->getQuestion($message, $default, $validator, $errorMessage)); } @@ -179,6 +236,7 @@ protected function getNetworkName() */ protected function getNetworkTCPPort() { + $default = 42; $validator = function ($value) { if (($value > 0) && ($value <= 65)) { $socket = @fsockopen('127.0.0.1', intval("{$value}080"), $errno, $errstr, 5); @@ -194,9 +252,12 @@ protected function getNetworkTCPPort() return false; }; + if ($validator($default) && $this->isStandardMode()) { + return $default; + } + $message = 'What is the TCP Port Prefix you want?'; $errorMessage = 'The TCP Port Prefix is not correct (already used or not between 1 and 65.'; - $default = 42; return (int) $this->io->askQuestion($this->getQuestion($message, $default, $validator, $errorMessage)); } @@ -226,4 +287,20 @@ function ($value) use ($validator, $exceptionMessage) { return $question; } + + /** + * @return bool + */ + protected function isStandardMode() + { + return self::INIT_STD == $this->mode; + } + + /** + * @return bool + */ + protected function requireComposerAuth() + { + return self::INIT_STD !== $this->mode; + } }