Skip to content

Commit a474999

Browse files
Merge pull request #175 from magento-commerce/MCLOUD-13455
MCLOUD-13455 Make valkey compatible with ece-tools
2 parents 067a062 + 57c0b1d commit a474999

38 files changed

+2510
-160
lines changed

config/eol.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,6 @@ redis:
7878
eol: 2023-08-15
7979
- version: '7.2'
8080
eol: 2025-08-31
81+
valkey:
82+
- version: '8.0'
83+
eol: 2029-04-16

config/schema.error.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,12 @@
179179
step: 'pre-deploy: clean-redis-cache'
180180
stage: deploy
181181
type: critical
182+
!php/const Magento\MagentoCloud\App\Error::DEPLOY_VALKEY_CACHE_CLEAN_FAILED:
183+
title: 'Failed to clean the Valkey cache'
184+
suggestion: 'Failed to clean the Valkey cache. Check that the Valkey cache configuration is correct and that the Valkey service is available. See [Setup Valkey service](https://experienceleague.adobe.com/docs/commerce-cloud-service/user-guide/configure/service/valkey.html).'
185+
step: 'pre-deploy: clean-valkey-cache'
186+
stage: deploy
187+
type: critical
182188
!php/const Magento\MagentoCloud\App\Error::DEPLOY_MAINTENANCE_MODE_ENABLING_FAILED:
183189
step: 'pre-deploy: set-production-mode'
184190
title: 'Command `/bin/magento maintenance:enable` failed'
@@ -491,6 +497,11 @@
491497
stage: deploy
492498
step: 'pre-deploy:cache'
493499
type: warning
500+
!php/const Magento\MagentoCloud\App\Error::WARN_VALKEY_SERVICE_NOT_AVAILABLE:
501+
title: 'Cache is configured for a Valkey service that is not available. Configuration will be ignored.'
502+
stage: deploy
503+
step: 'pre-deploy:cache'
504+
type: warning
494505
!php/const Magento\MagentoCloud\App\Error::WARN_WRONG_SPLIT_DB_CONFIG:
495506
title: 'The configured state is not ideal'
496507
stage: deploy

config/schema.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,20 @@ variables:
270270
- stage:
271271
deploy:
272272
REDIS_USE_SLAVE_CONNECTION: true
273+
VALKEY_USE_SLAVE_CONNECTION:
274+
description: Set to true to automatically use a read-only connection to a Valkey instance to receive read-only
275+
traffic on a non-master node. This improves performance through load balancing because only one node needs to
276+
handle read-write traffic.
277+
type: boolean
278+
stages:
279+
- global
280+
- deploy
281+
default:
282+
deploy: false
283+
examples:
284+
- stage:
285+
deploy:
286+
VALKEY_USE_SLAVE_CONNECTION: true
273287
MYSQL_USE_SLAVE_CONNECTION:
274288
description: Set to true to automatically use a read-only connection to the database to receive read-only traffic on
275289
a non-master node. This improves performance through load balancing, because only one node needs to
@@ -446,6 +460,21 @@ variables:
446460
- stage:
447461
deploy:
448462
REDIS_BACKEND: '\Magento\Framework\Cache\Backend\Redis'
463+
VALKEY_BACKEND:
464+
description: "Configuration the backend model for valkey cache."
465+
type: string
466+
allowed:
467+
- 'Cm_Cache_Backend_Redis'
468+
- '\Magento\Framework\Cache\Backend\Valkey'
469+
- '\Magento\Framework\Cache\Backend\RemoteSynchronizedCache'
470+
stages:
471+
- deploy
472+
default:
473+
deploy: 'Cm_Cache_Backend_Redis'
474+
examples:
475+
- stage:
476+
deploy:
477+
VALKEY_BACKEND: '\Magento\Framework\Cache\Backend\Valkey'
449478
CACHE_CONFIGURATION:
450479
description: "Replace or modify the Magento cache configuration generated during the deployment process.
451480
To replace the existing configuration, specify values for each configuration option required for your environment.

scenario/deploy.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<item name="clean-file-cache" xsi:type="object" priority="500">Magento\MagentoCloud\Step\Deploy\PreDeploy\CleanFileCache</item>
1616
<item name="restore-writable-dirs" xsi:type="object" priority="600">Magento\MagentoCloud\Step\Deploy\PreDeploy\RestoreWritableDirectories</item>
1717
<item name="set-production-mode" xsi:type="object" priority="700">Magento\MagentoCloud\Step\SetProductionMode</item>
18+
<item name="clean-valkey-cache" xsi:type="object" priority="800">Magento\MagentoCloud\Step\Deploy\PreDeploy\CleanValkeyCache</item>
1819
</argument>
1920
</arguments>
2021
</step>

src/App/Error.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ class Error
7979
public const DEPLOY_OS_CANNOT_CONNECT = 137;
8080
public const DEPLOY_OS_SERVICE_NOT_INSTALLED = 138;
8181
public const DEPLOY_MAGENTO_VERSION_DOES_NOT_SUPPORT_OS = 139;
82+
public const DEPLOY_VALKEY_CACHE_CLEAN_FAILED = 140;
8283

8384
public const PD_DEPLOY_IS_FAILED = 201;
8485
public const PD_ENV_PHP_IS_NOT_WRITABLE = 202;
@@ -145,6 +146,7 @@ class Error
145146
public const WARN_DEPRECATED_SPLIT_DB = 2029;
146147
public const WARN_OS_ES_SERVICES_BOTH_INSTALLED = 2030;
147148
public const WARN_REMOTE_STORAGE_CANNOT_BE_DISABLED = 2031;
149+
public const WARN_VALKEY_SERVICE_NOT_AVAILABLE = 2032;
148150

149151
/**
150152
* Post-deploy

src/Command/Wizard/MasterSlave.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ public function execute(InputInterface $input, OutputInterface $output): int
6969
$errors[] = 'Redis slave connection is not configured';
7070
}
7171

72+
if (!$this->deployConfig->get(DeployInterface::VAR_VALKEY_USE_SLAVE_CONNECTION)) {
73+
$errors[] = 'Valkey slave connection is not configured';
74+
}
7275
foreach ($errors as $error) {
7376
$this->outputFormatter->writeItem($output, $error);
7477
}

0 commit comments

Comments
 (0)