You are reading the documentation for version 2.2. Magento 2.3 is the latest version available. Ensure you are reading the documentation for your version of Magento.

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:

  1. Upgrade to the ece-tools package or update the ece-tools version Your Magento Commerce Cloud project must have the latest ece-tools package so that you have the tools available to configure an optimal deployment. If you have the latest ece-tools, continue to the next step.

    Even though it is a best practice to use the latest ece-tools package, the zero-downtime deployment method works with ece-tools version 2002.0.13 and later.

  2. 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.

  3. 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.

  4. Reduce theme files You can reduce the amount of unnecessary theme files by configuring the SCD_MATRIX environment variable.

  5. 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.

You can validate your project configuration for optimal deployment by running the ideal state wizard.