Enable Dynamic Multistore
Edit on GitHubThis document describes how to enable Dynamic Multistore (DMS).
Prerequisites
If your project version is below 202307.0, Install Dynamic Multistore.
Enable Dynamic Multistore
- Replace
StoreClient::getCurrentStore()
andStoreFacade::getCurrentStore()
methods withStoreStorageClient:getStoreNames()
,StoreStorageClient::findStoreByName()
, orStoreFacade::getStoreCollection()
in the following:
- Back Office
- Merchant Portal
- Console Commands
- Gateway
- BackendAPI
- Update custom console commands to meet the following rules:
Store(Facade|Client)::getCurrentStore()
isn’t used in the code a console command executes.- All store-aware commands implement
Spryker\Zed\Kernel\Communication\Console\StoreAwareConsole
and execute actions for a specific store if a store parameter is provided; if not provided, actions are executed for all the stores in the region. - Optional: We recommend using the
--store
parameter instead ofAPPLICATION_STORE
env variable; both methods are supported.
-
After enabling DMS, the basic domain structure will change from store to region for all the applications. For example,
https://yves.de.mysprykershop.com
will change tohttps://yves.eu.mysprykershop.com
. To prevent negative SEO effects, set up the needed redirects. -
DMS changes the structure of RabbitMQ messages. When you’re ready for the migration, wait for all the remaining messages in the queue to be processed. When the queue is empty, enable the maintenance mode. The downtime associated with the maintenance mode is limited to the deployment time, which usually takes up to an hour.
-
Update AWS deployment files to DMS mode using the example:
Original environment variables section:
SPRYKER_HOOK_BEFORE_DEPLOY: 'vendor/bin/install -r pre-deploy.dynamic-store-off -vvv'
SPRYKER_HOOK_AFTER_DEPLOY: 'true'
SPRYKER_HOOK_INSTALL: 'vendor/bin/install -r production.dynamic-store-off --no-ansi -vvv'
SPRYKER_HOOK_DESTRUCTIVE_INSTALL: 'vendor/bin/install -r destructive.dynamic-store-off --no-ansi -vvv'
SPRYKER_YVES_HOST_DE: de.
SPRYKER_YVES_HOST_AT: at.
Updated environment variables section:
SPRYKER_HOOK_BEFORE_DEPLOY: 'vendor/bin/install -r pre-deploy -vvv'
SPRYKER_HOOK_AFTER_DEPLOY: 'true'
SPRYKER_HOOK_INSTALL: 'vendor/bin/install -r dynamic-store --no-ansi -vvv'
SPRYKER_HOOK_DESTRUCTIVE_INSTALL: 'vendor/bin/install -r destructive --no-ansi -vvv'
SPRYKER_DYNAMIC_STORE_MODE: true
SPRYKER_YVES_HOST_EU: yves.eu.
Original regions section:
regions:
stores:
DE:
services:
broker:
namespace: de_queue
key_value_store:
namespace: 1
search:
namespace: de_search
session:
namespace: 2
AT:
services:
broker:
namespace: at_queue
key_value_store:
namespace: 3
search:
namespace: at_search
session:
namespace: 4
Updated regions section:
regions:
broker:
namespace: eu-docker
key_value_store:
namespace: 1
search:
namespace: eu_search
- Run a normal deploy for your server pipeline.
Your shop is now running in DMS mode.
Check if Dynamic Multistore is enabled
DMS is enabled if at least one of the following applies:
- Using environment: If the value of
SPRYKER_DYNAMIC_STORE_MODE
environment variable istrue
- Using interface: In the Back Office > Administration > Stores, an Edit button is displayed next to each store.
Disable Dynamic Multistore
- After disabling DMS, the basic domain structure will change from region to store for all the applications. To prevent negative SEO effects, set up the needed redirects.
- DMS changes the structure of RabbitMQ messages. When you’re ready for the migration, wait for all the remaining messages in the queue to be processed. When the queue is empty, enable the maintenance mode. (Expected downtime is limited to the deployment time, normally it takes less than 1hr)
- Revert changes in deploy files to disable DMS:
Original environment variables section:
SPRYKER_HOOK_BEFORE_DEPLOY: 'vendor/bin/install -r pre-deploy -vvv'
SPRYKER_HOOK_AFTER_DEPLOY: 'true'
SPRYKER_HOOK_INSTALL: 'vendor/bin/install -r dynamic-store --no-ansi -vvv'
SPRYKER_HOOK_DESTRUCTIVE_INSTALL: 'vendor/bin/install -r destructive --no-ansi -vvv'
SPRYKER_DYNAMIC_STORE_MODE: true
SPRYKER_YVES_HOST_EU: yves.eu.
Updated environment variables section:
SPRYKER_HOOK_BEFORE_DEPLOY: 'vendor/bin/install -r pre-deploy.dynamic-store-off -vvv'
SPRYKER_HOOK_AFTER_DEPLOY: 'true'
SPRYKER_HOOK_INSTALL: 'vendor/bin/install -r production.dynamic-store-off --no-ansi -vvv'
SPRYKER_HOOK_DESTRUCTIVE_INSTALL: 'vendor/bin/install -r destructive.dynamic-store-off --no-ansi -vvv'
SPRYKER_YVES_HOST_DE: de.
SPRYKER_YVES_HOST_AT: at.
Original regions section:
regions:
broker:
namespace: eu-docker
key_value_store:
namespace: 1
search:
namespace: eu_search
Updated regions section:
regions:
stores:
DE:
services:
broker:
namespace: de_queue
key_value_store:
namespace: 1
search:
namespace: de_search
session:
namespace: 2
AT:
services:
broker:
namespace: at_queue
key_value_store:
namespace: 3
search:
namespace: at_search
session:
namespace: 4
- Run a normal deploy for your server pipeline.
Thank you!
For submitting the form