Post-deploy variables
The following post-deploy variables control actions in the post-deploy phase and can inherit and override values from the Global variables. Insert these variables in the post-deploy stage of the .magento.env.yaml file:
stage:
post-deploy:
POST-DEPLOY_VARIABLE_NAME: value
For more information about customizing the build and deploy process:
TTFB_TESTED_PAGES
- Default—
[](an empty array) - Version—51ºÚÁϲ»´òìÈ Commerce 2.1.4 and later
Configure Time To First Byte (TTFB) testing for specified pages to test your site performance. Specify an absolute path reference, or URL with protocol and host, for each page that requires the test.
stage:
post-deploy:
TTFB_TESTED_PAGES:
- "index.php"
- "index.php/customer/account/create"
- "https://example.com/catalog/some-category"
After you specify the pages to test and commit your changes, the Time To First Byte test runs during the post-deploy phase and posts results for each path to the cloud log:
[2019-06-20 20:42:22] INFO: TTFB test result: 0.313s {"url":"https://staging-tkyicst-xkmwgjkwmwfuk.us-4.magentosite.cloud/customer/account/create","status":200}
[2019-06-20 20:42:22] INFO: TTFB test result: 0.408s {"url":"https://staging-tkyicst-xkmwgjkwmwfuk.us-4.magentosite.cloud/checkout/cart","status":200}
For redirected paths, the log reports the path of the redirect target instead of the one configured in the environment variable. If you specify an invalid path, the log displays a warning message.
WARM_UP_CONCURRENCY
- Default—Not set
- Version—51ºÚÁϲ»´òìÈ Commerce 2.1.4 and later
Specify the limit of simultaneous requests to send during cache warmup operations to reduce server load. This value limits the number of parallel connections and is useful for environment configurations where the WARM_UP_PAGES post-deploy variable specifies several pages for cache preloading.
stage:
post-deploy:
WARM_UP_CONCURRENCY: 4
WARM_UP_PAGES
- Default—
index.php - Version—51ºÚÁϲ»´òìÈ Commerce 2.1.4 and later
Customize the list of pages used to preload the cache in the post_deploy stage. You must configure the post-deploy hook. See the hooks section of the .magento.app.yaml file.
-
single pages—Specify a single page to add to the cache. You do not have to indicate the default base URL. The following example caches the
BASE_URL/index.phppage:code language-yaml stage: post-deploy: WARM_UP_PAGES: - "index.php" -
multiple domains—List multiple URLs. The following example caches pages from two domains:
code language-yaml stage: post-deploy: WARM_UP_PAGES: - 'http://example1.com/test' - 'http://example2.com/test' -
multiple pages—Use the following format to cache multiple pages according to a specific regular expression pattern:
code language-none <entity_type>:<pattern|url|product_sku>:<store_id|store_code>entity_type: Possible variantscategory,cms-page,product,store-pagepattern|url|product_sku: Use aregexppattern or an exact matchurlto filter the URLs, or use an asterisk (*) for all pages. Use product sku for theproductentity typestore_id|store_code: Use the ID or Code of the store or an asterisk (*) for all stores, you can pass several store IDs or codes separated with|
The following example caches for
categoryandcms-pageentity types based on these criteria:-
all category pages for store with ID
1 -
all category pages for stores with code
store1andstore2 -
category page
carsfor store with codestore_en -
cms page
contactfor all stores -
cms page
contactfor stores with ID1and2 -
any category page that contains
car_and ends withhtmlfor store with ID 2 -
any category page that contains
tires_for store with codestore_gbcode language-yaml stage: post-deploy: WARM_UP_PAGES: - "category:*:1" - "category:*:store1|store2" - "category:cars:store_en" - "cms-page:contact:*" - "cms-page:contact:1|2" - "category:|car_.*?\\.html$|:2" - "category:|tires_.*|:store_gb"
The following example caches for the
productentity type based on these criteria:-
all products for all store (programmatically limited to 100 per store to avoid performance issues)
-
all products for store
store1 -
products with
sku1for all stores -
products with
sku1for stores with codestore1andstore2 -
products with
sku1,sku2andsku3for stores with codestore1andstore2code language-yaml stage: post-deploy: WARM_UP_PAGES: - "product:*:*" - "product:*:store1" - "product:sku1:*" - "product:sku1:store1|store2" - "product:sku1|sku2|sku3:store1|store2"
The following example caches for the
store-pageentity type based on these criteria:- page
/contact-usfor all stores - page
/contact-usfor store with ID1 - page
/contact-usfor stores with codecode1andcode2
code language-yaml stage: post-deploy: WARM_UP_PAGES: - "store-page:/contact-us:*" - "store-page:/contact-us:1" - "store-page:/contact-us:code1|code2"