Skip to content

Commit b607ba7

Browse files
authored
Merge pull request #48 from magento-commerce/develop
MCLOUD-7868: Merge develop into 2002.1
2 parents 2340afb + 4ff1387 commit b607ba7

Some content is hidden

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

49 files changed

+1581
-398
lines changed

.travis.yml

-79
This file was deleted.

config/schema.error.yaml

+20
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Critical errors
12
!php/const Magento\MagentoCloud\App\Error::BUILD_ENV_PHP_IS_NOT_WRITABLE:
23
title: 'Cannot write to the `./app/etc/env.php` file'
34
suggestion: 'Deployment script cannot make required changes to the `/app/etc/env.php` file. Check your filesystem permissions.'
@@ -343,6 +344,12 @@
343344
suggestion: 'Check the SEARCH_CONFIGURATION variable for the `engine` option. If it is configured, remove the option, or set the value to "elasticsearch".'
344345
stage: deploy
345346
type: critical
347+
!php/const Magento\MagentoCloud\App\Error::DEPLOY_REMOVED_SPLIT_DB:
348+
step: validate-config
349+
title: 'Split Database was removed starting from Magento 2.5.0.'
350+
suggestion: 'If you use split database you have to revert to or migrate to a single database or use an alternative approach.'
351+
stage: deploy
352+
type: critical
346353
!php/const Magento\MagentoCloud\App\Error::PD_DEPLOY_IS_FAILED:
347354
step: is-deploy-failed
348355
title: 'Deploy stage failed'
@@ -412,6 +419,7 @@
412419
suggestion: ''
413420
stage: general
414421
type: critical
422+
# Warning errors
415423
!php/const Magento\MagentoCloud\App\Error::WARN_CONFIG_PHP_NOT_EXISTS:
416424
title: 'File app/etc/config.php does not exist'
417425
stage: build
@@ -546,6 +554,12 @@
546554
stage: deploy
547555
step: validate-config
548556
type: warning
557+
!php/const Magento\MagentoCloud\App\Error::WARN_DEPRECATED_SPLIT_DB:
558+
title: 'Split Database was deprecated in the Magento 2.4.2 and will be removed in 2.5.'
559+
stage: deploy
560+
suggestion: 'If you use split database you should start planning to revert to or migrate to a single database or use an alternative approach.'
561+
step: validate-config
562+
type: warning
549563
!php/const Magento\MagentoCloud\App\Error::WARN_ENV_PHP_MISSED:
550564
title: 'Magento installation completed, but the `app/etc/env.php` configuration file was missing or empty.'
551565
suggestion: 'Required data will be restored from environment configurations and from .magento.env.yaml file.'
@@ -589,6 +603,12 @@
589603
suggestion: 'Remove the MAGE_MODE environment variable, or change its value to "production". Magento Cloud supports "production" mode only.'
590604
step: 'validate-config:mage-mode-variable'
591605
type: warning
606+
!php/const Magento\MagentoCloud\App\Error::WARN_REMOTE_STORAGE_CANNOT_BE_ENABLED:
607+
title: 'Remote storage could not be enabled.'
608+
stage: deploy
609+
suggestion: 'Verify remote storage credentials.'
610+
step: remote-storage
611+
type: warning
592612
!php/const Magento\MagentoCloud\App\Error::WARN_DEBUG_LOG_ENABLED:
593613
title: 'Debug logging is enabled in Magento'
594614
suggestion: 'To save disk space, do not enable debug logging for your production environments.'

dist/error-codes.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ Critical errors indicate a problem with the Magento Commerce Cloud project confi
7575
| 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. |
7676
| 134 | validate-config | Magento 2.4.0 requires Elasticsearch service to be installed | Install Elasticsearch service |
7777
| 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". |
78+
| 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. |
7879

7980
### Post-deploy stage
8081

@@ -142,6 +143,7 @@ Warning errors indicate a problem with the Magento Commerce Cloud project config
142143
| 2017 | validate-config | The current configuration is not compatible with this version of Magento | |
143144
| 2018 | validate-config | Some services have passed EOL | |
144145
| 2019 | validate-config | The MySQL search configuration option is deprecated | Use Elasticsearch instead. |
146+
| 2029 | validate-config | Split Database was deprecated in the Magento 2.4.2 and will be removed in 2.5. | If you use split database you should start planning to revert to or migrate to a single database or use an alternative approach. |
145147
| 2020 | install-update | Magento installation completed, but the `app/etc/env.php` configuration file was missing or empty. | Required data will be restored from environment configurations and from .magento.env.yaml file. |
146148
| 2021 | install-update:db-connection | For split databases used custom connections | |
147149
| 2022 | install-update:db-connection | You have changed to a database configuration that is not compatible with the slave connection. | |
@@ -150,7 +152,7 @@ Warning errors indicate a problem with the Magento Commerce Cloud project config
150152
| 2025 | install-update:split-db | Slave connection not set. | |
151153
| 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. |
152154
| 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. |
153-
| 2028 | remote-storage | Remote storage could not be enabled. | Verify remote storage credentials |
155+
| 2028 | remote-storage | Remote storage could not be enabled. | Verify remote storage credentials. |
154156

155157
### Post-deploy stage
156158

scenario/deploy.xml

+4-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
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>
3434
<item name="elasticsuite-integrity" xsi:type="object">Magento\MagentoCloud\Config\Validator\Deploy\ElasticSuiteIntegrity</item>
35+
<item name="removed-split-db" xsi:type="object">Magento\MagentoCloud\Config\Validator\Deploy\RemovedSplitDb</item>
3536
</item>
3637
<item name="warning" xsi:type="array">
3738
<item name="mage-mode-variable" xsi:type="object">Magento\MagentoCloud\Config\Validator\Deploy\MageModeVariable</item>
@@ -50,6 +51,7 @@
5051
<item name="service-version" xsi:type="object">Magento\MagentoCloud\Config\Validator\Deploy\ServiceVersion</item>
5152
<item name="service-eol-warning" xsi:type="object">ServiceEol.Warnings</item>
5253
<item name="deprecated-search-engine" xsi:type="object">Magento\MagentoCloud\Config\Validator\Deploy\DeprecatedSearchEngine</item>
54+
<item name="deprecated-split-db" xsi:type="object">Magento\MagentoCloud\Config\Validator\Deploy\DeprecatedSplitDb</item>
5355
</item>
5456
<item name="notice" xsi:type="array">
5557
<item name="service-eol-notice" xsi:type="object">ServiceEol.Notices</item>
@@ -77,6 +79,7 @@
7779
<item name="urls" xsi:type="object" priority="800">Magento\MagentoCloud\Step\Deploy\InstallUpdate\ConfigUpdate\Urls</item>
7880
<item name="document-root" xsi:type="object" priority="900">Magento\MagentoCloud\Step\Deploy\InstallUpdate\ConfigUpdate\DocumentRoot</item>
7981
<item name="lock" xsi:type="object" priority="1000">Magento\MagentoCloud\Step\Deploy\InstallUpdate\ConfigUpdate\Lock</item>
82+
<item name="remote-storage" xsi:type="object" priority="1100">Magento\MagentoCloud\Step\Deploy\RemoteStorage</item>
8083
<!-- Config update end -->
8184
<item name="config-import" xsi:type="object" priority="1100">Magento\MagentoCloud\Step\Deploy\InstallUpdate\Install\ConfigImport</item>
8285
<item name="split-db" xsi:type="object" priority="1150">Magento\MagentoCloud\Step\Deploy\SplitDbConnection</item>
@@ -93,6 +96,7 @@
9396
<item name="urls" xsi:type="object" priority="700">Magento\MagentoCloud\Step\Deploy\InstallUpdate\ConfigUpdate\Urls</item>
9497
<item name="document-root" xsi:type="object" priority="800">Magento\MagentoCloud\Step\Deploy\InstallUpdate\ConfigUpdate\DocumentRoot</item>
9598
<item name="lock" xsi:type="object" priority="900">Magento\MagentoCloud\Step\Deploy\InstallUpdate\ConfigUpdate\Lock</item>
99+
<item name="remote-storage" xsi:type="object" priority="1000">Magento\MagentoCloud\Step\Deploy\RemoteStorage</item>
96100
<!-- Config update end -->
97101
<item name="set-admin-url" xsi:type="object" priority="1000">Magento\MagentoCloud\Step\Deploy\InstallUpdate\Update\SetAdminUrl</item>
98102
<item name="setup" xsi:type="object" priority="1100">Magento\MagentoCloud\Step\Deploy\InstallUpdate\Update\Setup</item>
@@ -127,7 +131,6 @@
127131
</argument>
128132
</arguments>
129133
</step>
130-
<step name="remote-storage" type="Magento\MagentoCloud\Step\Deploy\RemoteStorage" priority="1250"/>
131134
<step name="disable-maintenance-mode" type="Magento\MagentoCloud\Step\DisableMaintenanceMode" priority="1300"/>
132135
<onFail>
133136
<action name="create-deploy-failed-flag" type="Magento\MagentoCloud\OnFail\Action\CreateDeployFailedFlag" priority="100"/>

src/App/Error.php

+2
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ class Error
7575
public const DEPLOY_WRONG_BRAINTREE_VARIABLE = 133;
7676
public const DEPLOY_ES_SERVICE_NOT_INSTALLED = 134;
7777
public const DEPLOY_WRONG_SEARCH_ENGINE = 135;
78+
public const DEPLOY_REMOVED_SPLIT_DB = 136;
7879

7980
public const PD_DEPLOY_IS_FAILED = 201;
8081
public const PD_ENV_PHP_IS_NOT_WRITABLE = 202;
@@ -133,6 +134,7 @@ class Error
133134
public const WARN_COPY_MOUNTED_DIRS_FAILED = 2026;
134135
public const WARN_NOT_SUPPORTED_MAGE_MODE = 2027;
135136
public const WARN_REMOTE_STORAGE_CANNOT_BE_ENABLED = 2028;
137+
public const WARN_DEPRECATED_SPLIT_DB = 2029;
136138

137139
/**
138140
* Post-deploy

src/Command/Wizard/SplitDbState.php

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
* Verifies whether DB was split or not
2323
*
2424
* @api
25+
* @deprecated started from Magento 2.4.2 and will be removed in 2.5.0
2526
*/
2627
class SplitDbState extends Command
2728
{

src/Config/Factory/Cache.php

+31-12
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Magento\MagentoCloud\Config\Factory;
99

10+
use Magento\MagentoCloud\Config\ConfigException;
1011
use Magento\MagentoCloud\Config\ConfigMerger;
1112
use Magento\MagentoCloud\Config\Stage\DeployInterface;
1213
use Magento\MagentoCloud\Service\Redis;
@@ -20,18 +21,18 @@ class Cache
2021
/**
2122
* Redis database to store default cache data
2223
*/
23-
const REDIS_DATABASE_DEFAULT = 1;
24+
public const REDIS_DATABASE_DEFAULT = 1;
2425

2526
/**
2627
* Redis database to store page cache data
2728
*/
28-
const REDIS_DATABASE_PAGE_CACHE = 2;
29+
public const REDIS_DATABASE_PAGE_CACHE = 2;
2930

30-
const REDIS_BACKEND_CM_CACHE = 'Cm_Cache_Backend_Redis';
31-
const REDIS_BACKEND_REDIS_CACHE = '\Magento\Framework\Cache\Backend\Redis';
32-
const REDIS_BACKEND_REMOTE_SYNCHRONIZED_CACHE = '\Magento\Framework\Cache\Backend\RemoteSynchronizedCache';
31+
public const REDIS_BACKEND_CM_CACHE = 'Cm_Cache_Backend_Redis';
32+
public const REDIS_BACKEND_REDIS_CACHE = '\Magento\Framework\Cache\Backend\Redis';
33+
public const REDIS_BACKEND_REMOTE_SYNCHRONIZED_CACHE = '\Magento\Framework\Cache\Backend\RemoteSynchronizedCache';
3334

34-
const AVAILABLE_REDIS_BACKEND = [
35+
public const AVAILABLE_REDIS_BACKEND = [
3536
self::REDIS_BACKEND_CM_CACHE,
3637
self::REDIS_BACKEND_REDIS_CACHE,
3738
self::REDIS_BACKEND_REMOTE_SYNCHRONIZED_CACHE
@@ -83,7 +84,7 @@ public function __construct(
8384
* Returns an empty array in other case.
8485
*
8586
* @return array
86-
* @throws \Magento\MagentoCloud\Config\ConfigException
87+
* @throws ConfigException
8788
*/
8889
public function get(): array
8990
{
@@ -162,7 +163,7 @@ public function get(): array
162163
* @param array $envCacheConfiguration
163164
* @param array $redisConfig
164165
* @return array
165-
* @throws \Magento\MagentoCloud\Config\ConfigException
166+
* @throws ConfigException
166167
*/
167168
private function getSlaveConnection(array $envCacheConfiguration, array $redisConfig): array
168169
{
@@ -176,6 +177,11 @@ private function getSlaveConnection(array $envCacheConfiguration, array $redisCo
176177
$config['load_from_slave']['port'] = $redisSlaveConfig['port'] ?? '';
177178
$config['read_timeout'] = 1;
178179
$config['retry_reads_on_master'] = 1;
180+
181+
if (!empty($redisSlaveConfig['password'])) {
182+
$config['load_from_slave']['password'] = $redisSlaveConfig['password'];
183+
}
184+
179185
$this->logger->info('Set Redis slave connection');
180186
} else {
181187
$this->logger->notice(
@@ -211,7 +217,7 @@ private function isCacheConfigurationValid(array $cacheConfiguration): bool
211217
* @param array $envCacheConfig
212218
* @param array $redisConfig
213219
* @return bool
214-
* @throws \Magento\MagentoCloud\Config\ConfigException
220+
* @throws ConfigException
215221
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
216222
*/
217223
private function isConfigurationCompatibleWithSlaveConnection(
@@ -253,13 +259,19 @@ private function isConfigurationCompatibleWithSlaveConnection(
253259
*/
254260
private function getUnsyncedConfigStructure(string $envCacheBackendModel, array $redisConfig): array
255261
{
256-
return [
262+
$config = [
257263
'backend' => $envCacheBackendModel,
258264
'backend_options' => [
259265
'server' => $redisConfig['host'],
260266
'port' => $redisConfig['port'],
261267
]
262268
];
269+
270+
if (!empty($redisConfig['password'])) {
271+
$config['backend_options']['password'] = (string)$redisConfig['password'];
272+
}
273+
274+
return $config;
263275
}
264276

265277
/**
@@ -271,7 +283,7 @@ private function getUnsyncedConfigStructure(string $envCacheBackendModel, array
271283
*/
272284
private function getSynchronizedConfigStructure(string $envCacheBackendModel, array $redisConfig): array
273285
{
274-
return [
286+
$config = [
275287
'backend' => $envCacheBackendModel,
276288
'backend_options' => [
277289
'remote_backend' => '\Magento\Framework\Cache\Backend\Redis',
@@ -292,17 +304,24 @@ private function getSynchronizedConfigStructure(string $envCacheBackendModel, ar
292304
'write_control' => false,
293305
]
294306
];
307+
308+
if (!empty($redisConfig['password'])) {
309+
$config['backend_options']['remote_backend_options']['password'] = (string)$redisConfig['password'];
310+
}
311+
312+
return $config;
295313
}
296314

297315
/**
298316
* Checks that config contains synchronized cache model and need to use synchronized config structure.
299317
*
300318
* @return bool
301-
* @throws \Magento\MagentoCloud\Config\ConfigException
319+
* @throws ConfigException
302320
*/
303321
private function isSynchronizedConfigStructure(): bool
304322
{
305323
$model = (string)$this->stageConfig->get(DeployInterface::VAR_CACHE_REDIS_BACKEND);
324+
306325
return $model === self::REDIS_BACKEND_REMOTE_SYNCHRONIZED_CACHE;
307326
}
308327
}

src/Config/SearchEngine.php

+6
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,12 @@ private function getElasticSearchConfiguration(array $config): array
193193
"{$engine}_server_port" => $config['port'],
194194
];
195195

196+
if ($this->elasticSearch->isAuthEnabled()) {
197+
$elasticSearchConfig["{$engine}_enable_auth"] = 1;
198+
$elasticSearchConfig["{$engine}_username"] = $config['username'];
199+
$elasticSearchConfig["{$engine}_password"] = $config['password'];
200+
}
201+
196202
if (isset($config['query']['index'])) {
197203
$elasticSearchConfig["{$engine}_index_prefix"] = $config['query']['index'];
198204
}

src/Config/Stage/DeployInterface.php

+8
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,29 @@ interface DeployInterface extends StageConfigInterface
4848

4949
/**
5050
* The variable responsible to use split database.
51+
*
52+
* @deprecated started from Magento 2.4.2 and will be removed in 2.5.0
5153
*/
5254
const VAR_SPLIT_DB = 'SPLIT_DB';
5355

5456
/**
5557
* The value of the variable SPLIT_DB
58+
*
59+
* @deprecated started from Magento 2.4.2 and will be removed in 2.5.0
5660
*/
5761
const SPLIT_DB_VALUE_QUOTE = 'quote';
5862

5963
/**
6064
* The value of the variable SPLIT_DB
65+
*
66+
* @deprecated started from Magento 2.4.2 and will be removed in 2.5.0
6167
*/
6268
const SPLIT_DB_VALUE_SALES = 'sales';
6369

6470
/**
6571
* Values for variable SPLIT_DB
72+
*
73+
* @deprecated started from Magento 2.4.2 and will be removed in 2.5.0
6674
*/
6775
const SPLIT_DB_VALUES = [
6876
self::SPLIT_DB_VALUE_QUOTE,

0 commit comments

Comments
 (0)