Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

MAGECLOUD-3234 Reducing downtime #4005

Merged
merged 11 commits into from
Mar 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions _data/toc/cloud-guide.yml
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,9 @@ pages:
- label: Cloud deployment process
url: /cloud/deploy/cloud-deployment-process.html

- label: Reduce downtime
url: /cloud/deploy/reduce-downtime.html

- label: Static content deployment
url: /cloud/deploy/static-content-deployment.html

Expand Down
5 changes: 4 additions & 1 deletion guides/v2.1/cloud/deploy/optimize-cloud-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@ The following topics can help you to better understand how to optimize the deplo
- [Static content deployment]({{page.baseurl}}/cloud/deploy/static-content-deployment.html)
The best way to optimize your Cloud deployment is to control how and when to generate static content.

- [Reduce downtime]({{page.baseurl}}/cloud/deploy/reduce-downtime.html)
Understand what happens during deployment and how to reduce the amount of downtime your store experiences during an update to the Production environment.

- [Smart wizards]({{page.baseurl}}/cloud/deploy/smart-wizards.html)
The `{{site.data.var.ct}}` package provides the smart wizard commands to quickly evaluate your Cloud configuration.
The `{{site.data.var.ct}}` package provides the smart wizard commands to quickly evaluate your project configuration.
34 changes: 34 additions & 0 deletions guides/v2.1/cloud/deploy/reduce-downtime.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
group: cloud-guide
title: Reduce downtime
functional_areas:
- Cloud
- Deploy
- SCD
---

{{site.data.var.ece}} runs Magento in [_maintenance_ mode]({{page.baseurl}}/config-guide/bootstrap/magento-modes.html#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.

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 downtime to **zero**, 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 `{{site.data.var.ct}}` package]({{page.baseurl}}/cloud/project/ece-tools-upgrade-project.html) or [update the `{{site.data.var.ct}}` version]({{page.baseurl}}/cloud/project/ece-tools-update.html)
Your {{site.data.var.ece}} project must have the latest `{{site.data.var.ct}}` package so that you have the tools available to configure an optimal deployment. If you have the latest `{{site.data.var.ct}}`, continue to the next step.

1. [Configure static content deployment]({{page.baseurl}}/cloud/deploy/static-content-deployment.html)
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]({{page.baseurl}}/cloud/deploy/static-content-deployment.html#setting-the-scd-on-build), 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]({{page.baseurl}}/cloud/deploy/smart-wizards.html#verifying-an-ideal-configuration).

1. [Configure the post-deploy hook]({{page.baseurl}}/cloud/project/project-conf-files_magento-app.html#hooks)
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]({{page.baseurl}}/cloud/env/variables-post-deploy.html#warm_up_pages).

1. [Reduce theme files]({{page.baseurl}}/cloud/env/variables-deploy.html#scd_matrix)
You can reduce the amount of unnecessary theme files by configuring the SCD\_MATRIX environment variable.

1. [Speed up static content deployment]({{page.baseurl}}/cloud/env/variables-deploy.html#scd_threads)
You can speed up the deployment process by updating the SCD\_THREADS environment variable to increase the number of threads for static content deployment.

11 changes: 7 additions & 4 deletions guides/v2.1/cloud/deploy/static-content-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Static content deployment (SCD) has a significant impact on the store deployment
You can improve the SCD load time during the deployment process if you skip copying the static view files in the `var/view_preprocessed` directory and generate _minified_ HTML when requested. You can activate this by setting the [SKIP_HTML_MINIFICATION]({{page.baseurl}}/cloud/env/variables-global.html#skip_html_minification) global environment variable to `true` in the `.magento.env.yaml` file.

{: .bs-callout .bs-callout-info}
Beginning with the `{{site.data.var.ct}}` package version 2002.0.13, the default value for the SKIP_HTML_MINIFICATION variable is set to `false`.
Beginning with the `{{site.data.var.ct}}` package version 2002.0.13, the default value for the SKIP_HTML_MINIFICATION variable is set to `true`.

You can save **more** deployment time and disk space by reducing the amount of unnecessary theme files. For example, you can deploy the `magento/backend` theme in English and a custom theme in other languages. You can configure these theme settings with the [SCD_MATRIX]({{page.baseurl}}/cloud/env/variables-deploy.html#scd_matrix) environment variable.

Expand All @@ -25,7 +25,7 @@ Deployment strategies differ based on whether you choose to generate static cont

### Setting the SCD on build

Generating static content during the build phase with minified HTML is the optimal configuration for **zero-downtime** deployments, also known as the **ideal state**. Instead of copying files to a mounted drive, it creates a symlink from the `./init/pub/static` directory.
Generating static content during the build phase with minified HTML is the optimal configuration for [**zero-downtime** deployments]({{page.baseurl}}/cloud/deploy/reduce-downtime.html), also known as the **ideal state**. Instead of copying files to a mounted drive, it creates a symlink from the `./init/pub/static` directory.

By default, the [STATIC_CONTENT_SYMLINK environment variable]({{page.baseurl}}/cloud/env/variables-deploy.html#static_content_symlink) is set to `true`. After generating the static content during the build phase, it creates a symlink to the content folder.

Expand All @@ -51,13 +51,16 @@ Generating static content requires access to themes and locales. Magento stores

### Setting the SCD on demand

Generating SCD on demand is optimal for a development workflow. It decreases deployment time so that you can quickly review your implementations and run integration tests. Enable the [SCD_ON_DEMAND]({{page.baseurl}}/cloud/env/variables-global.html#scd_on_demand) environment variable in the global stage of the `.magento.env.yaml` file. The SCD_ON_DEMAND variable overrides all other configurations related to SCD and clears existing content from the `~/pub/static` directory.
Generating SCD on demand is optimal for a development workflow in the Integration environment. It decreases deployment time so that you can quickly review your implementations and run integration tests. Enable the [SCD_ON_DEMAND]({{page.baseurl}}/cloud/env/variables-global.html#scd_on_demand) environment variable in the global stage of the `.magento.env.yaml` file. The SCD_ON_DEMAND variable overrides all other configurations related to SCD and clears existing content from the `~/pub/static` directory.

When using the SCD on-demand strategy, it helps to preload the cache with pages you expect to request, such as the home page. Add your list of expected pages in the [WARM_UP_PAGES]({{page.baseurl}}/cloud/env/variables-post-deploy.html#warm_up_pages) environment variable in the post-deploy stage of the `.magento.env.yaml` file.

{: .bs-callout .bs-callout-warning}
Do not use the SCD on-demand strategy in the Production environment.

### Skipping SCD

In some cases you could choose to skip generating static content completely. You can set the [SKIP_SCD]({{page.baseurl}}/cloud/env/variables-build.html#skip_scd) environment variable in the global stage to ignore other configurations related to SCD. This does not affect existing content in the `~/pub/static` directory.

[SCD Load Comparison]: {{site.baseurl}}/common/images/cloud/scd-load-times.png
{: width="700px"}
{: width="700px"}
1 change: 1 addition & 0 deletions guides/v2.2/cloud/deploy/reduce-downtime.md
1 change: 1 addition & 0 deletions guides/v2.3/cloud/deploy/reduce-downtime.md