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

Update deployment flow steps #6439

Merged
merged 5 commits into from
Jan 30, 2020
Merged
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
70 changes: 54 additions & 16 deletions src/guides/v2.3/performance-best-practices/deployment-flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,14 @@ functional_areas:

The Magento production deployment flow helps a store reach maximum performance.

## Deploy static content
## Install dependencies

Deploying static content causes Magento 2 to perform the following actions:
The `composer.json` and `composer.lock` files manage Magento dependencies and install the appropriate version for each package. You must install dependencies before [preprocessing dependency injection instructions](#preprocess-dependency-injection-instructions) if you plan to update the [autoloader](#update-the-autoloader).

* Analyze all static resources
* Perform merge, minimization, and bundling of content
* Read and process theme data
* Analyze theme fallback
* Store all processed and materialized content to specific folder for further usage

If your static content is not deployed, Magento performs all listed operation on the fly, leading to a significant increase in response time.

You can use a variety of options to customize deployment operations based on store size and fulfillment needs. The most common is the compact deploy strategy. See [Static files deployment strategies]({{ page.baseurl }}/config-guide/cli/config-cli-subcommands-static-deploy-strategies.html)

Run the following command to deploy static content:
To install Magento dependencies:
jeff-matthews marked this conversation as resolved.
Show resolved Hide resolved

```bash
bin/magento setup:static-content:deploy
composer install
```

## Preprocess dependency injection instructions
Expand All @@ -38,22 +28,70 @@ When you preprocess and compile dependency injection (DI) instructions, Magento:
* Creates autogenerated files (including proxies, factories, etc.)
* Stores compiled data and configuration in a cache that saves up to 25% of time on requests processing

Run the following command to preprocess and compile DI:
To preprocess and compile DI instructions:

```bash
bin/magento setup:di:compile
```

After compilation completes, confirm that [APCu is enabled]({{ page.baseurl }}/performance-best-practices/software.html#php-settings), then run the following command:
## Update the autoloader

After compilation completes, confirm that [APCu is enabled]({{ page.baseurl }}/performance-best-practices/software.html#php-settings) and update the autoloader:

To update the autoloader:

{:.bs-callout-info}
The `-o` option converts PSR-0/4 autoloading to classmap to get a faster autoloader. The `--apcu` option uses APCu to cache found/not-found classes.

```bash
composer dump-autoload -o --apcu
```

If you plan on updating the autoloader, you must run the following commands in order:

```bash
composer install
```

```bash
bin/magento setup:di:compile
```

```bash
composer dump-autoload -o
```

```bash
bin/magento setup:static-content:deploy
```

## Deploy static content

Deploying static content causes Magento 2 to perform the following actions:

* Analyze all static resources
* Perform merge, minimization, and bundling of content
* Read and process theme data
* Analyze theme fallback
* Store all processed and materialized content to specific folder for further usage

If your static content is not deployed, Magento performs all listed operation on the fly, leading to a significant increase in response time.

You can use a variety of options to customize deployment operations based on store size and fulfillment needs. The most common is the compact deploy strategy. See [Static files deployment strategies]({{ page.baseurl }}/config-guide/cli/config-cli-subcommands-static-deploy-strategies.html)

To deploy static content:

```bash
bin/magento setup:static-content:deploy
```

This command allows Composer to rebuild the mapping to project files so that they load faster.

## Set production mode
jeff-matthews marked this conversation as resolved.
Show resolved Hide resolved

{:.bs-callout-info}
Setting the mode to production automatically runs `setup:di:compile` and `setup:static-content:deploy`.

Finally, you need to place your store in Production mode. Production mode is specifically optimized for maximum performance of your store. It also de-activates all developer-specific features. This can be done in your `.htaccess` or `nginx.conf` file:

`SetEnv MAGE_MODE production`
Expand Down