Zero downtime deployment
Magento Commerce Cloud runs Magento in maintenance mode during the deploy phase, which takes your site offline until the deployment is complete. The length of time your Production site is in maintenance mode depends on the size of the site, the number of changes applied during the deployment, and the configuration for static content deployment. It is possible to configure your project so that it deploys with a zero downtime effect.
During the deployment process, all connections queue for up to 5 minutes preserving any active sessions and pending actions, such as adding to cart or checkout. After deployment, the queue is released and connections continue without interruption. To use this connection hold to your advantage and reduce deployment to zero downtime, you must configure your project to use the most efficient deploy strategy.
Use the following steps to reduce the amount of time it takes your store to deploy an update to Production:
Upgrade to the
ece-toolspackage or update the
Your Magento Commerce Cloud project must have the latest
ece-toolspackage so that you have the tools available to configure an optimal deployment. If you have the latest
ece-tools, continue to the next step.
Configure static content deployment
If static content deployment fails in the deploy phase, your site gets stuck in maintenance mode. When a failure occurs during the build phase, the process avoids downtime because it never begins the deploy phase. Generating static content during the build phase with minified HTML, also known as the ideal state, is the optimal configuration for zero-downtime deployments and prevents downtime if a failure occurs.
You can validate your project configuration by running the ideal state wizard.
Configure the post-deploy hook
You must configure the post-deploy hook to clean and warm the cache. By default, cache clean occurs during the deploy phase when the site is down. Moving the cache clean to the post-deploy phase means that your cache remains live until the deploy phase is complete, and then you can safely clean the cache.
Customize the list of pages used to preload the cache with the WARM_UP_PAGES environment variable.
Reduce theme files
You can reduce the amount of unnecessary theme files by configuring the SCD_MATRIX environment variable.
Speed up static content deployment
You can speed up the deployment process by updating the SCD_THREADS environment variable to increase the number of threads for static content deployment.