Skip to content

Commit 4231e3d

Browse files
authored
Merge pull request #83 from magento-commerce/develop
MCLOUD-8486: Release Cloud Tools
2 parents 43169af + b4ea5e1 commit 4231e3d

File tree

269 files changed

+2891
-1125
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

269 files changed

+2891
-1125
lines changed

.github/.metadata.json

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"templateVersion": "0.1",
3+
"product": {
4+
"name": "Magento Commerce Cloud Deployment Tools",
5+
"description": "ECE-Tools is a set of scripts and tools designed to manage and deploy Cloud projects"
6+
},
7+
"contacts": {
8+
"team": {
9+
"name": "Magic Mountain",
10+
"DL": "Grp-magento-cloud-all",
11+
"slackChannel": "magic_mountain"
12+
}
13+
},
14+
"ticketTracker": {
15+
"functionalJiraQueue": {
16+
"projectKey": "MCLOUD"
17+
},
18+
"securityJiraQueue": {
19+
"projectKey": "MAGREQ",
20+
"component": "Magento Cloud Engineering"
21+
}
22+
},
23+
"staticScan": {
24+
"enable": false
25+
}
26+
}

.github/workflows/ci.yaml

-39
This file was deleted.

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@
99
/codeception.yml
1010
/_workdir
1111
/*.code-workspace
12+
**/.phpunit.result.cache

composer.json

+14-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/ece-tools",
33
"description": "Provides tools to build and deploy Magento 2 Enterprise Edition",
44
"type": "magento2-component",
5-
"version": "2002.1.8",
5+
"version": "2002.1.9",
66
"license": "OSL-3.0",
77
"repositories": {
88
"repo.magento.com": {
@@ -11,7 +11,7 @@
1111
}
1212
},
1313
"require": {
14-
"php": "^7.1.3",
14+
"php": "^7.2 || ^8.0",
1515
"ext-PDO": "*",
1616
"ext-json": "*",
1717
"ext-sockets": "*",
@@ -20,7 +20,7 @@
2020
"composer/semver": "@stable",
2121
"graylog2/gelf-php": "^1.4.2",
2222
"guzzlehttp/guzzle": "^6.3||^7.3",
23-
"illuminate/config": "^5.5",
23+
"illuminate/config": "^5.5||^8.77",
2424
"magento/magento-cloud-components": "^1.0.8",
2525
"magento/magento-cloud-docker": "^1.0.0",
2626
"magento/magento-cloud-patches": "^1.0.11",
@@ -37,13 +37,17 @@
3737
"symfony/yaml": "^3.3 || ^4.0 || ^5.1"
3838
},
3939
"require-dev": {
40-
"codeception/codeception": "^2.5.3",
40+
"codeception/codeception": "^4.1",
41+
"codeception/module-asserts": "^1.2",
42+
"codeception/module-db": "^1.0",
43+
"codeception/module-phpbrowser": "^1.0",
44+
"codeception/module-rest": "^1.2",
4145
"consolidation/robo": "^1.2",
4246
"php-mock/php-mock-phpunit": "^2.0",
4347
"phpmd/phpmd": "@stable",
4448
"phpstan/phpstan": "^0.12",
45-
"phpunit/php-code-coverage": "^6.0",
46-
"phpunit/phpunit": "^7.2",
49+
"phpunit/php-code-coverage": "^7.0 || ^9.2",
50+
"phpunit/phpunit": "^8.5 || ^9.5",
4751
"squizlabs/php_codesniffer": "^3.0",
4852
"funkjedi/composer-include-files": "^1.0"
4953
},
@@ -91,7 +95,10 @@
9195
]
9296
},
9397
"config": {
94-
"sort-packages": true
98+
"sort-packages": true,
99+
"allow-plugins": {
100+
"funkjedi/composer-include-files": true
101+
}
95102
},
96103
"prefer-stable": true,
97104
"extra": {

config/schema.error.yaml

+23
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,11 @@
326326
suggestion: 'Check for valid Elasticsearch credentials and verify that the service is running'
327327
stage: deploy
328328
type: critical
329+
!php/const Magento\MagentoCloud\App\Error::DEPLOY_OS_CANNOT_CONNECT:
330+
title: 'Can not connect to the Opensearch service'
331+
suggestion: 'Check for valid Opensearch credentials and verify that the service is running'
332+
stage: deploy
333+
type: critical
329334
!php/const Magento\MagentoCloud\App\Error::DEPLOY_WRONG_BRAINTREE_VARIABLE:
330335
step: validate-config
331336
title: 'Remove Magento Braintree module configuration which is no longer supported in Magento 2.4 and later versions.'
@@ -338,6 +343,12 @@
338343
suggestion: 'Install Elasticsearch service'
339344
stage: deploy
340345
type: critical
346+
!php/const Magento\MagentoCloud\App\Error::DEPLOY_OS_SERVICE_NOT_INSTALLED:
347+
step: validate-config
348+
title: 'Magento 2.4.4 requires Opensearch or Elasticsearch service to be installed'
349+
suggestion: 'Install Opensearch service'
350+
stage: deploy
351+
type: critical
341352
!php/const Magento\MagentoCloud\App\Error::DEPLOY_WRONG_SEARCH_ENGINE:
342353
step: validate-config
343354
title: 'The search engine must be set to Elasticsearch for Magento >= 2.4.0'
@@ -634,3 +645,15 @@
634645
title: 'Can not get system processor count:'
635646
type: warning
636647
stage: general
648+
!php/const Magento\MagentoCloud\App\Error::WARN_OS_ES_SERVICES_BOTH_INSTALLED:
649+
title: 'Elasticsearch and Opensearch services are both installed at infrastructure layer. Magento 2.4.4 and higher uses Opensearch by default'
650+
suggestion: 'Consider removing the Elasticsearch or Opensearch service from the infrastructure layer to optimize resource usage.'
651+
stage: deploy
652+
step: validate-config
653+
type: warning
654+
!php/const Magento\MagentoCloud\App\Error::DEPLOY_MAGENTO_VERSION_DOES_NOT_SUPPORT_OS:
655+
step: validate-config
656+
title: 'Incorrect search engine'
657+
suggestion: 'This Magento version does not support Opensearch. You must use versions 2.3.7-p3, 2.4.3-p2, or higher'
658+
stage: deploy
659+
type: critical

config/schema.yaml

+6-1
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,9 @@ variables:
561561
process before terminating. Although we do not recommend it, you can use 0
562562
to prevent the consumer from terminating.\n\n
563563
consumers — an array of strings specifying which consumer(s) to run.
564-
An empty array runs all consumers."
564+
An empty array runs all consumers.\n\n
565+
multiple_processes - a number specifying the number of processes to spawn for each consumer.
566+
Supported in Magento 2.4.4 or greater."
565567
type: array
566568
stages:
567569
- deploy
@@ -576,6 +578,9 @@ variables:
576578
consumers:
577579
- consumer1
578580
- consumer2
581+
multiple_processes:
582+
consumer1: 4
583+
consumer2: 3
579584
CONSUMERS_WAIT_FOR_MAX_MESSAGES:
580585
description: Use this variable to configure how consumers process messages. If this value is true, a consumer waits
581586
to process the number of messages (max_messages) from the message queue specified in the CRONS_CONSUMERS_RUNNER

dist/error-codes.md

+4
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,13 @@ Critical errors indicate a problem with the Magento Commerce Cloud project confi
7272
| 130 | install-update: cache_type | Command failed: `php ./bin/magento cache:enable` | Command `php ./bin/magento cache:enable` runs only when Magento was installed but `./app/etc/env.php` file was absent or empty at the beginning of the deployment. Check the `cloud.log` for more information. Add `VERBOSE_COMMANDS: '-vvv'` into `.magento.env.yaml` for more detailed command output. |
7373
| 131 | install-update | The `crypt/key` key value does not exist in the `./app/etc/env.php` file or the `CRYPT_KEY` cloud environment variable | This error occurs if the `./app/etc/env.php` file is not present when Magento deployment begins, or if the `crypt/key` value is undefined. If you migrated the database from another environment, retrieve the crypt key value from that environment. Then, add the value to the [CRYPT_KEY](https://devdocs.magento.com/cloud/env/variables-deploy.html#crypt_key) cloud environment variable in your current environment. See [Add the Magento encryption key](https://devdocs.magento.com/cloud/setup/first-time-setup-import-import.html#encryption-key). If you accidentally removed the `./app/etc/env.php` file, use the following command to restore it from the backup files created from a previous deployment: `./vendor/bin/ece-tools backup:restore` CLI command ." |
7474
| 132 | | Can not connect to the Elasticsearch service | Check for valid Elasticsearch credentials and verify that the service is running |
75+
| 137 | | Can not connect to the Opensearch service | Check for valid Opensearch credentials and verify that the service is running |
7576
| 133 | validate-config | Remove Magento Braintree module configuration which is no longer supported in Magento 2.4 and later versions. | Support for the Braintree module is no longer included with Magento 2.4.0 and later. Remove the CONFIG__STORES__DEFAULT__PAYMENT__BRAINTREE__CHANNEL variable from the variables section of the .magento.app.yaml file. For Braintree support, use an official Braintree Payments extension from the Magento Marketplace instead. |
7677
| 134 | validate-config | Magento 2.4.0 requires Elasticsearch service to be installed | Install Elasticsearch service |
78+
| 138 | validate-config | Magento 2.4.4 requires Opensearch or Elasticsearch service to be installed | Install Opensearch service |
7779
| 135 | validate-config | The search engine must be set to Elasticsearch for Magento >= 2.4.0 | Check the SEARCH_CONFIGURATION variable for the `engine` option. If it is configured, remove the option, or set the value to "elasticsearch". |
7880
| 136 | validate-config | Split Database was removed starting from Magento 2.5.0. | If you use split database you have to revert to or migrate to a single database or use an alternative approach. |
81+
| 139 | validate-config | Incorrect search engine | This Magento version does not support Opensearch. You must use versions 2.3.7-p3, 2.4.3-p2, or higher |
7982

8083
### Post-deploy stage
8184

@@ -153,6 +156,7 @@ Warning errors indicate a problem with the Magento Commerce Cloud project config
153156
| 2026 | pre-deploy:restore-writable-dirs | Failed to restore some data generated during the build phase to the mounted directories | Check the `cloud.log` for more information. |
154157
| 2027 | validate-config:mage-mode-variable | Mode value for MAGE_MODE environment variable not supported | Remove the MAGE_MODE environment variable, or change its value to "production". Magento Cloud supports "production" mode only. |
155158
| 2028 | remote-storage | Remote storage could not be enabled. | Verify remote storage credentials. |
159+
| 2030 | validate-config | Elasticsearch and Opensearch services are both installed at infrastructure layer. Magento 2.4.4 and higher uses Opensearch by default | Consider removing the Elasticsearch or Opensearch service from the infrastructure layer to optimize resource usage. |
156160

157161
### Post-deploy stage
158162

scenario/deploy.xml

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
<item name="resource-configuration" xsi:type="object">Magento\MagentoCloud\Config\Validator\Deploy\ResourceConfiguration</item>
3232
<item name="session-configuration" xsi:type="object">Magento\MagentoCloud\Config\Validator\Deploy\SessionConfiguration</item>
3333
<item name="elasticsearch-integrity" xsi:type="object">Magento\MagentoCloud\Config\Validator\Deploy\ElasticSearchIntegrity</item>
34+
<item name="opensearch-integrity" xsi:type="object">Magento\MagentoCloud\Config\Validator\Deploy\OpenSearchIntegrity</item>
3435
<item name="elasticsuite-integrity" xsi:type="object">Magento\MagentoCloud\Config\Validator\Deploy\ElasticSuiteIntegrity</item>
3536
<item name="removed-split-db" xsi:type="object">Magento\MagentoCloud\Config\Validator\Deploy\RemovedSplitDb</item>
3637
</item>
@@ -43,6 +44,7 @@
4344
<item name="solr-integrity" xsi:type="object">Magento\MagentoCloud\Config\Validator\Deploy\SolrIntegrity</item>
4445
<item name="es-usage" xsi:type="object">Magento\MagentoCloud\Config\Validator\Deploy\ElasticSearchUsage</item>
4546
<item name="es-version" xsi:type="object">Magento\MagentoCloud\Config\Validator\Deploy\ElasticSearchVersion</item>
47+
<item name="es-os-installed-both" xsi:type="object">Magento\MagentoCloud\Config\Validator\Deploy\OpenSearchElasticSearchBothInstalled</item>
4648
<item name="appropriate-version" xsi:type="object">Magento\MagentoCloud\Config\Validator\Deploy\AppropriateVersion</item>
4749
<item name="scd-options-ignorance" xsi:type="object">Magento\MagentoCloud\Config\Validator\Deploy\ScdOptionsIgnorance</item>
4850
<item name="deprecated-variables" xsi:type="object">Magento\MagentoCloud\Config\Validator\Deploy\DeprecatedVariables</item>
@@ -99,6 +101,7 @@
99101
<item name="remote-storage" xsi:type="object" priority="1000">Magento\MagentoCloud\Step\Deploy\RemoteStorage</item>
100102
<!-- Config update end -->
101103
<item name="set-admin-url" xsi:type="object" priority="1000">Magento\MagentoCloud\Step\Deploy\InstallUpdate\Update\SetAdminUrl</item>
104+
<item name="clean-cache" xsi:type="object" priority="1050">CleanCache.Deploy</item>
102105
<item name="setup" xsi:type="object" priority="1100">Magento\MagentoCloud\Step\Deploy\InstallUpdate\Update\Setup</item>
103106
<item name="split-db" xsi:type="object" priority="1200">Magento\MagentoCloud\Step\Deploy\SplitDbConnection</item>
104107
<item name="cache-type" xsi:type="object" priority="1300">Magento\MagentoCloud\Step\Deploy\InstallUpdate\ConfigUpdate\CacheType</item>

src/App/Error.php

+5
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ class Error
7676
public const DEPLOY_ES_SERVICE_NOT_INSTALLED = 134;
7777
public const DEPLOY_WRONG_SEARCH_ENGINE = 135;
7878
public const DEPLOY_REMOVED_SPLIT_DB = 136;
79+
public const DEPLOY_OS_CANNOT_CONNECT = 137;
80+
public const DEPLOY_OS_SERVICE_NOT_INSTALLED = 138;
81+
public const DEPLOY_MAGENTO_VERSION_DOES_NOT_SUPPORT_OS = 139;
7982

8083
public const PD_DEPLOY_IS_FAILED = 201;
8184
public const PD_ENV_PHP_IS_NOT_WRITABLE = 202;
@@ -135,6 +138,8 @@ class Error
135138
public const WARN_NOT_SUPPORTED_MAGE_MODE = 2027;
136139
public const WARN_REMOTE_STORAGE_CANNOT_BE_ENABLED = 2028;
137140
public const WARN_DEPRECATED_SPLIT_DB = 2029;
141+
public const WARN_OS_ES_SERVICES_BOTH_INSTALLED = 2030;
142+
public const WARN_REMOTE_STORAGE_CANNOT_BE_DISABLED = 2031;
138143

139144
/**
140145
* Post-deploy

src/Config/SearchEngine.php

+23-8
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
use Magento\MagentoCloud\Package\MagentoVersion;
1313
use Magento\MagentoCloud\Package\UndefinedPackageException;
1414
use Magento\MagentoCloud\Service\ElasticSearch;
15+
use Magento\MagentoCloud\Service\OpenSearch;
1516
use Magento\MagentoCloud\Service\ServiceException;
17+
use Magento\MagentoCloud\Service\Search\AbstractService as AbstractSearchService;
1618

1719
/**
1820
* Returns search configuration.
@@ -36,6 +38,11 @@ class SearchEngine
3638
*/
3739
private $elasticSearch;
3840

41+
/**
42+
* @var OpenSearch
43+
*/
44+
private $openSearch;
45+
3946
/**
4047
* @var MagentoVersion
4148
*/
@@ -60,6 +67,7 @@ class SearchEngine
6067
* @param Environment $environment
6168
* @param DeployInterface $stageConfig
6269
* @param ElasticSearch $elasticSearch
70+
* @param OpenSearch $openSearch
6371
* @param ElasticSuite $elasticSuite
6472
* @param MagentoVersion $version
6573
* @param ConfigMerger $configMerger
@@ -68,13 +76,15 @@ public function __construct(
6876
Environment $environment,
6977
DeployInterface $stageConfig,
7078
ElasticSearch $elasticSearch,
79+
OpenSearch $openSearch,
7180
ElasticSuite $elasticSuite,
7281
MagentoVersion $version,
7382
ConfigMerger $configMerger
7483
) {
7584
$this->environment = $environment;
7685
$this->stageConfig = $stageConfig;
7786
$this->elasticSearch = $elasticSearch;
87+
$this->openSearch = $openSearch;
7888
$this->elasticSuite = $elasticSuite;
7989
$this->magentoVersion = $version;
8090
$this->configMerger = $configMerger;
@@ -134,7 +144,7 @@ public function isESFamily(): bool
134144
$searchEngine = $this->getName();
135145

136146
return (strpos($searchEngine, ElasticSearch::ENGINE_NAME) === 0)
137-
|| ($searchEngine === ElasticSuite::ENGINE_NAME);
147+
|| ($searchEngine === ElasticSuite::ENGINE_NAME) || ($searchEngine === OpenSearch::ENGINE_NAME);
138148
}
139149

140150
/**
@@ -145,8 +155,12 @@ public function isESFamily(): bool
145155
*/
146156
private function getSearchConfig(): array
147157
{
148-
if ($esConfig = $this->elasticSearch->getConfiguration()) {
149-
return $this->getElasticSearchConfiguration($esConfig);
158+
if ($this->openSearch->getConfiguration()) {
159+
return $this->getElasticSearchFamilyConfiguration($this->openSearch);
160+
}
161+
162+
if ($this->elasticSearch->getConfiguration()) {
163+
return $this->getElasticSearchFamilyConfiguration($this->elasticSearch);
150164
}
151165

152166
$solrConfig = $this->environment->getRelationship('solr');
@@ -178,22 +192,23 @@ private function getSolrConfiguration(array $config): array
178192
/**
179193
* Returns ElasticSearch configuration
180194
*
181-
* @param array $config Elasticsearch connection configuration
195+
* @param AbstractSearchService $searchService
182196
* @return array
183197
*
184198
* @throws ServiceException
185199
*/
186-
private function getElasticSearchConfiguration(array $config): array
200+
private function getElasticSearchFamilyConfiguration(AbstractSearchService $searchService): array
187201
{
188-
$engine = $this->elasticSearch->getFullVersion();
202+
$engine = $searchService->getFullEngineName();
203+
$config = $searchService->getConfiguration();
189204

190205
$elasticSearchConfig = [
191206
'engine' => $engine,
192-
"{$engine}_server_hostname" => $config['host'],
207+
"{$engine}_server_hostname" => $searchService->getHost(),
193208
"{$engine}_server_port" => $config['port'],
194209
];
195210

196-
if ($this->elasticSearch->isAuthEnabled()) {
211+
if ($searchService->isAuthEnabled()) {
197212
$elasticSearchConfig["{$engine}_enable_auth"] = 1;
198213
$elasticSearchConfig["{$engine}_username"] = $config['username'];
199214
$elasticSearchConfig["{$engine}_password"] = $config['password'];

0 commit comments

Comments
 (0)