2023-01-08 20:46:33 +00:00
<!-- DO NOT EDIT THIS FILE! -->
<!-- Instead edit recipe/magento2.php -->
<!-- Then run bin/docgen -->
# How to Deploy a Magento 2 Project
```php
require 'recipe/magento2.php';
```
[Source ](/recipe/magento2.php )
Deployer is a free and open source deployment tool written in PHP.
It helps you to deploy your Magento 2 application to a server.
It is very easy to use and has a lot of features.
Three main features of Deployer are:
- **Provisioning** - provision your server for you.
- **Zero downtime deployment** - deploy your application without a downtime.
- **Rollbacks** - rollback your application to a previous version, if something goes wrong.
Additionally, Deployer has a lot of other features, like:
- **Easy to use** - Deployer is very easy to use. It has a simple and intuitive syntax.
- **Fast** - Deployer is very fast. It uses parallel connections to deploy your application.
- **Secure** - Deployer uses SSH to connect to your server.
- **Supports all major PHP frameworks** - Deployer supports all major PHP frameworks.
You can read more about Deployer in [Getting Started ](/docs/getting-started.md ).
The [deploy ](#deploy ) task of **Magento 2** consists of:
* [deploy:prepare ](/docs/recipe/common.md#deployprepare ) – Prepares a new release
2023-10-27 12:32:05 +00:00
* [deploy:info ](/docs/recipe/deploy/info.md#deployinfo ) – Displays info about deployment
2023-01-08 20:46:33 +00:00
* [deploy:setup ](/docs/recipe/deploy/setup.md#deploysetup ) – Prepares host for deploy
* [deploy:lock ](/docs/recipe/deploy/lock.md#deploylock ) – Locks deploy
* [deploy:release ](/docs/recipe/deploy/release.md#deployrelease ) – Prepares release
2023-10-27 12:32:05 +00:00
* [deploy:update_code ](/docs/recipe/deploy/update_code.md#deployupdate_code ) – Updates code
2023-01-08 20:46:33 +00:00
* [deploy:shared ](/docs/recipe/deploy/shared.md#deployshared ) – Creates symlinks for shared files and dirs
* [deploy:writable ](/docs/recipe/deploy/writable.md#deploywritable ) – Makes writable dirs
* [deploy:vendors ](/docs/recipe/deploy/vendors.md#deployvendors ) – Installs vendors
* [deploy:clear_paths ](/docs/recipe/deploy/clear_paths.md#deployclear_paths ) – Cleanup files and/or directories
* [deploy:magento ](/docs/recipe/magento2.md#deploymagento ) – Magento2 deployment operations
* [magento:build ](/docs/recipe/magento2.md#magentobuild ) – Magento2 build operations
* [magento:compile ](/docs/recipe/magento2.md#magentocompile ) – Compiles magento di
* [magento:deploy:assets ](/docs/recipe/magento2.md#magentodeployassets ) – Deploys assets
2023-03-06 19:41:41 +01:00
* [magento:maintenance:enable-if-needed ](/docs/recipe/magento2.md#magentomaintenanceenable-if-needed ) – Set maintenance mode if needed
2023-01-08 20:46:33 +00:00
* [magento:config:import ](/docs/recipe/magento2.md#magentoconfigimport ) – Config Import
* [magento:upgrade:db ](/docs/recipe/magento2.md#magentoupgradedb ) – Upgrades magento database
2023-03-06 19:41:41 +01:00
* [magento:maintenance:disable ](/docs/recipe/magento2.md#magentomaintenancedisable ) – Disables maintenance mode
2023-01-08 20:46:33 +00:00
* [magento:cache:flush ](/docs/recipe/magento2.md#magentocacheflush ) – Flushes Magento Cache
* [deploy:publish ](/docs/recipe/common.md#deploypublish ) – Publishes the release
* [deploy:symlink ](/docs/recipe/deploy/symlink.md#deploysymlink ) – Creates symlink to release
* [deploy:unlock ](/docs/recipe/deploy/lock.md#deployunlock ) – Unlocks deploy
* [deploy:cleanup ](/docs/recipe/deploy/cleanup.md#deploycleanup ) – Cleanup old releases
* [deploy:success ](/docs/recipe/common.md#deploysuccess ) –
2023-03-06 12:49:42 +01:00
In addition the **Magento 2** recipe contains an artifact deployment.
This is a two step process where you first execute
```php
bin/dep artifact:build [options] [localhost]
```
to build an artifact, which then is deployed on a server with
```php
bin/dep artifact:deploy [host]
```
The `localhost` to build the artifact on has to be declared local, so either add
```php
localhost()
->set('local', true);
```
to your deploy.php or
```yaml
hosts:
localhost:
local: true
```
to your deploy yaml.
The [artifact:build ](#artifact:build ) command of **Magento 2** consists of: * [build:prepare ](/docs/recipe/magento2.md#buildprepare ) – Prepare local artifact build
* [build:remove-generated ](/docs/recipe/magento2.md#buildremove-generated ) – Clears generated files prior to building.
* [deploy:vendors ](/docs/recipe/deploy/vendors.md#deployvendors ) – Installs vendors
* [magento:compile ](/docs/recipe/magento2.md#magentocompile ) – Compiles magento di
* [magento:deploy:assets ](/docs/recipe/magento2.md#magentodeployassets ) – Deploys assets
* [artifact:package ](/docs/recipe/magento2.md#artifactpackage ) – Packages all relevant files in an artifact.
The [artifact:deploy ](#artifact:deploy ) command of **Magento 2** consists of:
* [artifact:prepare ](/docs/recipe/magento2.md#artifactprepare ) – Prepares an artifact on the target server
2023-10-27 12:32:05 +00:00
* [deploy:info ](/docs/recipe/deploy/info.md#deployinfo ) – Displays info about deployment
2023-03-06 12:49:42 +01:00
* [deploy:setup ](/docs/recipe/deploy/setup.md#deploysetup ) – Prepares host for deploy
* [deploy:lock ](/docs/recipe/deploy/lock.md#deploylock ) – Locks deploy
* [deploy:release ](/docs/recipe/deploy/release.md#deployrelease ) – Prepares release
* [artifact:upload ](/docs/recipe/magento2.md#artifactupload ) – Uploads artifact in release folder for extraction.
* [artifact:extract ](/docs/recipe/magento2.md#artifactextract ) – Extracts artifact in release path.
* [deploy:additional-shared ](/docs/recipe/magento2.md#deployadditional-shared ) – Adds additional files and dirs to the list of shared files and dirs
* [deploy:shared ](/docs/recipe/deploy/shared.md#deployshared ) – Creates symlinks for shared files and dirs
* [deploy:writable ](/docs/recipe/deploy/writable.md#deploywritable ) – Makes writable dirs
2023-03-06 19:41:41 +01:00
* [magento:maintenance:enable-if-needed ](/docs/recipe/magento2.md#magentomaintenanceenable-if-needed ) – Set maintenance mode if needed
2023-03-06 12:49:42 +01:00
* [magento:config:import ](/docs/recipe/magento2.md#magentoconfigimport ) – Config Import
2023-03-06 19:41:41 +01:00
* [magento:upgrade:db ](/docs/recipe/magento2.md#magentoupgradedb ) – Upgrades magento database
* [magento:maintenance:disable ](/docs/recipe/magento2.md#magentomaintenancedisable ) – Disables maintenance mode
2023-03-06 12:49:42 +01:00
* [deploy:symlink ](/docs/recipe/deploy/symlink.md#deploysymlink ) – Creates symlink to release
* [artifact:finish ](/docs/recipe/magento2.md#artifactfinish ) – Executes the tasks after artifact is released
* [magento:cache:flush ](/docs/recipe/magento2.md#magentocacheflush ) – Flushes Magento Cache
* [cachetool:clear:opcache ](/docs/contrib/cachetool.md#cachetoolclearopcache ) – Clears OPcode cache
* [deploy:cleanup ](/docs/recipe/deploy/cleanup.md#deploycleanup ) – Cleanup old releases
* [deploy:unlock ](/docs/recipe/deploy/lock.md#deployunlock ) – Unlocks deploy
2023-01-08 20:46:33 +00:00
The magento2 recipe is based on the [common ](/docs/recipe/common.md ) recipe.
## Configuration
### static_content_locales
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L25 )
2023-01-08 20:46:33 +00:00
By default setup:static-content:deploy uses `en_US` .
To change that, simply put `set('static_content_locales', 'en_US de_DE');`
in you deployer script.
```php title="Default value"
'en_US'
```
### magento_themes
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L42 )
2023-01-08 20:46:33 +00:00
You can also set the themes to run against. By default it'll deploy
all themes - `add('magento_themes', ['Magento/luma', 'Magento/backend']);`
2023-03-24 11:45:54 +01:00
If the themes are set as a simple list of strings, then all languages defined in [static_content_locales ](/docs/recipe/magento2.md#static_content_locales ) are
compiled for the given themes.
Alternatively The themes can be defined as an associative array, where the key represents the theme name and
the key contains the languages for the compilation (for this specific theme)
Example:
set('magento_themes', ['Magento/luma']); - Will compile this theme with every language from [static_content_locales ](/docs/recipe/magento2.md#static_content_locales )
set('magento_themes', [
'Magento/luma' => null, - Will compile all languages from [static_content_locales ](/docs/recipe/magento2.md#static_content_locales ) for Magento/luma
'Custom/theme' => 'en_US fr_FR' - Will compile only en_US and fr_FR for Custom/theme
'Custom/another' => '[static_content_locales ](/docs/recipe/magento2.md#static_content_locales ) it_IT' - Will compile all languages from [static_content_locales ](/docs/recipe/magento2.md#static_content_locales ) + it_IT for Custom/another
]); - Will compile this theme with every language
2023-01-08 20:46:33 +00:00
```php title="Default value"
[
]
```
2023-03-24 11:45:54 +01:00
### static_deploy_options
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L47 )
2023-03-24 11:45:54 +01:00
Static content deployment options, e.g. '--no-parent'
### split_static_deployment
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L50 )
2023-03-24 11:45:54 +01:00
Deploy frontend and adminhtml together as default
```php title="Default value"
false
```
### static_content_locales_backend
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L53 )
2023-03-24 11:45:54 +01:00
Use the default languages for the backend as default
```php title="Default value"
'{{static_content_locales}}'
```
### magento_themes_backend
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L57 )
2023-03-24 11:45:54 +01:00
backend themes to deploy. Only used if split_static_deployment=true
This setting supports the same options/structure as [magento_themes ](/docs/recipe/magento2.md#magento_themes )
```php title="Default value"
['Magento/backend' => null]
```
2023-01-08 20:46:33 +00:00
### static_content_jobs
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L63 )
2023-01-08 20:46:33 +00:00
2024-02-15 17:24:22 +00:00
Also set the number of conccurent jobs to run. The default is 1
2023-01-08 20:46:33 +00:00
Update using: `set('static_content_jobs', '1');`
```php title="Default value"
'1'
```
### content_version
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L65 )
2023-01-08 20:46:33 +00:00
```php title="Default value"
return time();
```
2023-02-09 14:17:39 +01:00
### magento_dir
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L70 )
2023-02-09 14:17:39 +01:00
Magento directory relative to repository root. Use "." (default) if it is not located in a subdirectory
```php title="Default value"
'.'
```
2023-01-08 20:46:33 +00:00
### shared_files
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L73 )
2023-01-08 20:46:33 +00:00
Overrides [shared_files ](/docs/recipe/deploy/shared.md#shared_files ) from `recipe/deploy/shared.php` .
```php title="Default value"
[
2023-02-09 14:17:39 +01:00
'{{magento_dir}}/app/etc/env.php',
'{{magento_dir}}/var/.maintenance.ip',
2023-01-08 20:46:33 +00:00
]
```
### shared_dirs
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L77 )
2023-01-08 20:46:33 +00:00
Overrides [shared_dirs ](/docs/recipe/deploy/shared.md#shared_dirs ) from `recipe/deploy/shared.php` .
```php title="Default value"
[
2023-02-09 14:17:39 +01:00
'{{magento_dir}}/var/composer_home',
'{{magento_dir}}/var/log',
'{{magento_dir}}/var/export',
'{{magento_dir}}/var/report',
'{{magento_dir}}/var/import',
'{{magento_dir}}/var/import_history',
'{{magento_dir}}/var/session',
'{{magento_dir}}/var/importexport',
'{{magento_dir}}/var/backups',
'{{magento_dir}}/var/tmp',
'{{magento_dir}}/pub/sitemap',
'{{magento_dir}}/pub/media',
'{{magento_dir}}/pub/static/_cache'
2023-01-08 20:46:33 +00:00
]
```
### writable_dirs
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L92 )
2023-01-08 20:46:33 +00:00
Overrides [writable_dirs ](/docs/recipe/deploy/writable.md#writable_dirs ) from `recipe/deploy/writable.php` .
```php title="Default value"
[
2023-02-09 14:17:39 +01:00
'{{magento_dir}}/var',
'{{magento_dir}}/pub/static',
'{{magento_dir}}/pub/media',
'{{magento_dir}}/generated',
'{{magento_dir}}/var/page_cache'
2023-01-08 20:46:33 +00:00
]
```
### clear_paths
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L99 )
2023-01-08 20:46:33 +00:00
Overrides [clear_paths ](/docs/recipe/deploy/clear_paths.md#clear_paths ) from `recipe/deploy/clear_paths.php` .
```php title="Default value"
[
2023-02-09 14:17:39 +01:00
'{{magento_dir}}/generated/*',
'{{magento_dir}}/pub/static/_cache/*',
'{{magento_dir}}/var/generation/*',
'{{magento_dir}}/var/cache/*',
'{{magento_dir}}/var/page_cache/*',
'{{magento_dir}}/var/view_preprocessed/*'
2023-01-08 20:46:33 +00:00
]
```
2023-02-09 14:17:39 +01:00
### bin/magento
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L108 )
2023-02-09 14:17:39 +01:00
```php title="Default value"
'{{release_or_current_path}}/{{magento_dir}}/bin/magento'
```
2023-01-08 20:46:33 +00:00
### magento_version
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L110 )
2023-01-08 20:46:33 +00:00
```php title="Default value"
// detect version
2023-02-09 14:17:39 +01:00
$versionOutput = run('{{bin/php}} {{bin/magento}} --version');
2023-01-08 20:46:33 +00:00
preg_match('/(\d+\.?)+(-p\d+)?$/', $versionOutput, $matches);
return $matches[0] ?? '2.0';
```
2023-03-06 19:41:41 +01:00
### config_import_needed
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L117 )
2023-01-08 20:46:33 +00:00
2023-03-06 19:41:41 +01:00
:::info Autogenerated
The value of this configuration is autogenerated on access.
:::
### database_upgrade_needed
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L131 )
2023-03-06 19:41:41 +01:00
:::info Autogenerated
The value of this configuration is autogenerated on access.
:::
2023-01-08 20:46:33 +00:00
### enable_zerodowntime
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L146 )
2023-01-08 20:46:33 +00:00
Deploy without setting maintenance mode if possible
```php title="Default value"
true
```
### artifact_file
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L332 )
2023-01-08 20:46:33 +00:00
2023-03-06 12:49:42 +01:00
The file the artifact is saved to
2023-01-08 20:46:33 +00:00
```php title="Default value"
'artifact.tar.gz'
```
### artifact_dir
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L335 )
2023-01-08 20:46:33 +00:00
2023-03-06 12:49:42 +01:00
The directory the artifact is saved in
2023-01-08 20:46:33 +00:00
```php title="Default value"
'artifacts'
```
### artifact_excludes_file
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L339 )
2023-01-08 20:46:33 +00:00
2023-03-06 12:49:42 +01:00
Points to a file with a list of files to exclude from packaging.
The format is as with the `tar --exclude-from=[file]` option
2023-01-08 20:46:33 +00:00
```php title="Default value"
'artifacts/excludes'
```
2023-01-30 21:14:51 +01:00
### build_from_repo
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L342 )
2023-01-08 20:46:33 +00:00
2023-01-30 21:14:51 +01:00
If set to true, the artifact is built from a clean copy of the project repository instead of the current working directory
```php title="Default value"
false
```
### repository
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L345 )
2023-01-30 21:14:51 +01:00
Overrides [repository ](/docs/recipe/common.md#repository ) from `recipe/common.php` .
Set this value if "build_from_repo" is set to true. The target to deploy must also be set with "--branch", "--tag" or "--revision"
```php title="Default value"
null
```
### artifact_path
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L348 )
2023-01-08 20:46:33 +00:00
2023-03-06 12:49:42 +01:00
The relative path to the artifact file. If the directory does not exist, it will be created
2023-01-08 20:46:33 +00:00
```php title="Default value"
2023-01-30 21:15:09 +01:00
if (!testLocally('[ -d {{artifact_dir}} ]')) {
runLocally('mkdir -p {{artifact_dir}}');
2023-01-08 20:46:33 +00:00
}
return get('artifact_dir') . '/' . get('artifact_file');
```
### bin/tar
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L356 )
2023-01-08 20:46:33 +00:00
2023-03-06 12:49:42 +01:00
The location of the tar command. On MacOS you should have installed gtar, as it supports the required settings
2023-01-08 20:46:33 +00:00
:::info Autogenerated
The value of this configuration is autogenerated on access.
:::
### additional_shared_files
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L428 )
2023-01-08 20:46:33 +00:00
Array of shared files that will be added to the default shared_files without overriding
### additional_shared_dirs
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L430 )
2023-01-08 20:46:33 +00:00
Array of shared directories that will be added to the default shared_dirs without overriding
## Tasks
### magento:compile
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L156 )
2023-01-08 20:46:33 +00:00
Compiles magento di.
2023-03-06 12:49:42 +01:00
To work correctly with artifact deployment, it is necessary to set the MAGE_MODE correctly in `app/etc/config.php`
e.g.
```php
'MAGE_MODE' => 'production'
```
2023-01-08 20:46:33 +00:00
### magento:deploy:assets
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L182 )
2023-01-08 20:46:33 +00:00
Deploys assets.
2023-03-06 12:49:42 +01:00
To work correctly with artifact deployment it is necessary to set `system/dev/js` , `system/dev/css` and `system/dev/template`
in `app/etc/config.php` , e.g.:
```php
'system' => [
'default' => [
'dev' => [
'js' => [
'merge_files' => '1',
'minify_files' => '1'
],
'css' => [
'merge_files' => '1',
'minify_files' => '1'
],
'template' => [
'minify_html' => '1'
]
]
]
```
2023-01-08 20:46:33 +00:00
2023-03-24 11:45:54 +01:00
### magento:deploy:assets:adminhtml
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L198 )
2023-03-24 11:45:54 +01:00
Deploys assets for backend only.
### magento:deploy:assets:frontend
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L203 )
2023-03-24 11:45:54 +01:00
Deploys assets for frontend only.
2023-01-08 20:46:33 +00:00
### magento:sync:content_version
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L251 )
2023-01-08 20:46:33 +00:00
Syncs content version.
### magento:maintenance:enable
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L261 )
2023-01-08 20:46:33 +00:00
Enables maintenance mode.
### magento:maintenance:disable
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L267 )
2023-01-08 20:46:33 +00:00
Disables maintenance mode.
2023-03-06 19:41:41 +01:00
### magento:maintenance:enable-if-needed
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L273 )
2023-03-06 19:41:41 +01:00
Set maintenance mode if needed.
2023-01-08 20:46:33 +00:00
### magento:config:import
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L280 )
2023-01-08 20:46:33 +00:00
Config Import.
### magento:upgrade:db
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L289 )
2023-01-08 20:46:33 +00:00
Upgrades magento database.
### magento:cache:flush
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L298 )
2023-01-08 20:46:33 +00:00
Flushes Magento Cache.
### deploy:magento
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L303 )
2023-01-08 20:46:33 +00:00
Magento2 deployment operations.
This task is group task which contains next tasks:
* [magento:build ](/docs/recipe/magento2.md#magentobuild )
2023-03-06 19:41:41 +01:00
* [magento:maintenance:enable-if-needed ](/docs/recipe/magento2.md#magentomaintenanceenable-if-needed )
2023-01-08 20:46:33 +00:00
* [magento:config:import ](/docs/recipe/magento2.md#magentoconfigimport )
* [magento:upgrade:db ](/docs/recipe/magento2.md#magentoupgradedb )
2023-03-06 19:41:41 +01:00
* [magento:maintenance:disable ](/docs/recipe/magento2.md#magentomaintenancedisable )
2023-01-08 20:46:33 +00:00
* [magento:cache:flush ](/docs/recipe/magento2.md#magentocacheflush )
### magento:build
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L313 )
2023-01-08 20:46:33 +00:00
Magento2 build operations.
This task is group task which contains next tasks:
* [magento:compile ](/docs/recipe/magento2.md#magentocompile )
* [magento:deploy:assets ](/docs/recipe/magento2.md#magentodeployassets )
### deploy
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L319 )
2023-01-08 20:46:33 +00:00
Deploys your project.
This task is group task which contains next tasks:
* [deploy:prepare ](/docs/recipe/common.md#deployprepare )
* [deploy:vendors ](/docs/recipe/deploy/vendors.md#deployvendors )
* [deploy:clear_paths ](/docs/recipe/deploy/clear_paths.md#deployclear_paths )
* [deploy:magento ](/docs/recipe/magento2.md#deploymagento )
* [deploy:publish ](/docs/recipe/common.md#deploypublish )
### artifact:package
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L367 )
2023-01-08 20:46:33 +00:00
Packages all relevant files in an artifact.
2023-03-06 12:49:42 +01:00
2023-01-08 20:46:33 +00:00
### artifact:upload
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L377 )
2023-01-08 20:46:33 +00:00
Uploads artifact in release folder for extraction.
### artifact:extract
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L382 )
2023-01-08 20:46:33 +00:00
Extracts artifact in release path.
### build:remove-generated
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L388 )
2023-01-08 20:46:33 +00:00
Clears generated files prior to building.
### build:prepare
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L393 )
2023-01-08 20:46:33 +00:00
Prepare local artifact build.
2023-03-06 12:49:42 +01:00
### artifact:build
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L418 )
2023-03-06 12:49:42 +01:00
Builds an artifact.
This task is group task which contains next tasks:
* [build:prepare ](/docs/recipe/magento2.md#buildprepare )
* [build:remove-generated ](/docs/recipe/magento2.md#buildremove-generated )
* [deploy:vendors ](/docs/recipe/deploy/vendors.md#deployvendors )
* [magento:compile ](/docs/recipe/magento2.md#magentocompile )
* [magento:deploy:assets ](/docs/recipe/magento2.md#magentodeployassets )
* [artifact:package ](/docs/recipe/magento2.md#artifactpackage )
2023-01-08 20:46:33 +00:00
### deploy:additional-shared
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L434 )
2023-01-08 20:46:33 +00:00
Adds additional files and dirs to the list of shared files and dirs.
2023-03-30 16:34:07 +01:00
### magento:set_cache_prefix
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L449 )
2023-03-30 16:34:07 +01:00
Update cache id_prefix.
Update cache id_prefix on deploy so that you are compiling against a fresh cache
Reference Issue: https://github.com/davidalger/capistrano-magento2/issues/151
2023-07-04 09:57:38 +01:00
To use this feature, add the following to your deployer scripts:
```php
after('deploy:shared', 'magento:set_cache_prefix');
after('deploy:magento', 'magento:cleanup_cache_prefix');
```
2023-03-30 16:34:07 +01:00
### magento:cleanup_cache_prefix
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L489 )
2023-03-30 16:34:07 +01:00
Cleanup cache id_prefix env files.
After successful deployment, move the tmp_env.php file to env.php ready for next deployment
2023-03-06 12:49:42 +01:00
### artifact:prepare
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L499 )
2023-03-06 12:49:42 +01:00
Prepares an artifact on the target server.
This task is group task which contains next tasks:
2023-10-27 12:32:05 +00:00
* [deploy:info ](/docs/recipe/deploy/info.md#deployinfo )
2023-03-06 12:49:42 +01:00
* [deploy:setup ](/docs/recipe/deploy/setup.md#deploysetup )
* [deploy:lock ](/docs/recipe/deploy/lock.md#deploylock )
* [deploy:release ](/docs/recipe/deploy/release.md#deployrelease )
* [artifact:upload ](/docs/recipe/magento2.md#artifactupload )
* [artifact:extract ](/docs/recipe/magento2.md#artifactextract )
* [deploy:additional-shared ](/docs/recipe/magento2.md#deployadditional-shared )
* [deploy:shared ](/docs/recipe/deploy/shared.md#deployshared )
* [deploy:writable ](/docs/recipe/deploy/writable.md#deploywritable )
### artifact:finish
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L512 )
2023-03-06 12:49:42 +01:00
Executes the tasks after artifact is released.
This task is group task which contains next tasks:
* [magento:cache:flush ](/docs/recipe/magento2.md#magentocacheflush )
* [cachetool:clear:opcache ](/docs/contrib/cachetool.md#cachetoolclearopcache )
* [deploy:cleanup ](/docs/recipe/deploy/cleanup.md#deploycleanup )
* [deploy:unlock ](/docs/recipe/deploy/lock.md#deployunlock )
### artifact:deploy
2023-08-04 15:36:47 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L521 )
2023-03-06 12:49:42 +01:00
Actually releases the artifact deployment.
This task is group task which contains next tasks:
* [artifact:prepare ](/docs/recipe/magento2.md#artifactprepare )
2023-03-06 19:41:41 +01:00
* [magento:maintenance:enable-if-needed ](/docs/recipe/magento2.md#magentomaintenanceenable-if-needed )
2023-03-06 12:49:42 +01:00
* [magento:config:import ](/docs/recipe/magento2.md#magentoconfigimport )
2023-03-06 19:41:41 +01:00
* [magento:upgrade:db ](/docs/recipe/magento2.md#magentoupgradedb )
* [magento:maintenance:disable ](/docs/recipe/magento2.md#magentomaintenancedisable )
2023-03-06 12:49:42 +01:00
* [deploy:symlink ](/docs/recipe/deploy/symlink.md#deploysymlink )
* [artifact:finish ](/docs/recipe/magento2.md#artifactfinish )