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:
1
2
3
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—Magento 2.1.4 and later
Configure Time To First Byte (TTFB) testing for specified pages to test your Magento Commerce Cloud site performance. Specify an absolute path reference, or URL with protocol and host, for each page that requires the test.
1
2
3
4
5
6
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:
1
2
[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_PAGES
- Default—
index.php
- Version—Magento 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.php
page:1 2 3 4
stage: post-deploy: WARM_UP_PAGES: - "index.php"
-
multiple domains—List multiple URLs. The following example caches pages from two domains:
1 2 3 4 5
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:
1
<entity_type>:<pattern|url>:<store_id|store_code>
entity_type
: Choosecategory
orcms-page
pattern|url
: Use aregexp
pattern or an exact matchurl
to filter the URLs, or use an asterisk (*) for all pagesstore_id|store_code
: Use the ID or Code of the store or an asterisk (*) for all stores
The following example caches these items:
- all category pages for store with ID 1
- category page
cars
for store with codestore_en
- cms page
contact
for all stores - any category page that contains
car_
and ends withhtml
for store with ID 2 - any category page that contains
tires_
for store with codestore_gb
1 2 3 4 5 6 7 8
stage: post-deploy: WARM_UP_PAGES: - "category:*:1" - "category:cars:store_en" - "cms-page:contact:* - "category:|car_.*?\\.html$|:2" - "category:|tires_.*|:store_gb"