Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Magento: allow subdirectory and create variable for bin/magento #3460

Merged
merged 11 commits into from
Feb 9, 2023
142 changes: 81 additions & 61 deletions docs/recipe/magento2.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,111 +101,131 @@ return time();
```


### magento_dir
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L44)

Magento directory relative to repository root. Use "." (default) if it is not located in a subdirectory

```php title="Default value"
'.'
```


### shared_files
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L43)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L47)

Overrides [shared_files](/docs/recipe/deploy/shared.md#shared_files) from `recipe/deploy/shared.php`.



```php title="Default value"
[
'app/etc/env.php',
'var/.maintenance.ip',
'{{magento_dir}}/app/etc/env.php',
'{{magento_dir}}/var/.maintenance.ip',
]
```


### shared_dirs
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L47)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L51)

Overrides [shared_dirs](/docs/recipe/deploy/shared.md#shared_dirs) from `recipe/deploy/shared.php`.



```php title="Default value"
[
'var/composer_home',
'var/log',
'var/export',
'var/report',
'var/import',
'var/import_history',
'var/session',
'var/importexport',
'var/backups',
'var/tmp',
'pub/sitemap',
'pub/media',
'pub/static/_cache'
'{{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'
]
```


### writable_dirs
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L62)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L66)

Overrides [writable_dirs](/docs/recipe/deploy/writable.md#writable_dirs) from `recipe/deploy/writable.php`.



```php title="Default value"
[
'var',
'pub/static',
'pub/media',
'generated',
'var/page_cache'
'{{magento_dir}}/var',
'{{magento_dir}}/pub/static',
'{{magento_dir}}/pub/media',
'{{magento_dir}}/generated',
'{{magento_dir}}/var/page_cache'
]
```


### clear_paths
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L69)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L73)

Overrides [clear_paths](/docs/recipe/deploy/clear_paths.md#clear_paths) from `recipe/deploy/clear_paths.php`.



```php title="Default value"
[
'generated/*',
'pub/static/_cache/*',
'var/generation/*',
'var/cache/*',
'var/page_cache/*',
'var/view_preprocessed/*'
'{{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/*'
]
```


### bin/magento
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L82)



```php title="Default value"
'{{release_or_current_path}}/{{magento_dir}}/bin/magento'
```


### magento_version
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L78)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L84)



```php title="Default value"
// detect version
$versionOutput = run('{{bin/php}} {{release_or_current_path}}/bin/magento --version');
$versionOutput = run('{{bin/php}} {{bin/magento}} --version');
preg_match('/(\d+\.?)+(-p\d+)?$/', $versionOutput, $matches);
return $matches[0] ?? '2.0';
```


### maintenance_mode_status_active
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L85)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L91)



```php title="Default value"
// detect maintenance mode active
$maintenanceModeStatusOutput = run("{{bin/php}} {{release_or_current_path}}/bin/magento maintenance:status");
$maintenanceModeStatusOutput = run("{{bin/php}} {{bin/magento}} maintenance:status");
return strpos($maintenanceModeStatusOutput, MAINTENANCE_MODE_ACTIVE_OUTPUT_MSG) !== false;
```


### enable_zerodowntime
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L92)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L98)

Deploy without setting maintenance mode if possible

Expand All @@ -215,7 +235,7 @@ true


### artifact_file
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L229)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L236)

artifact deployment section
settings section
Expand All @@ -226,7 +246,7 @@ settings section


### artifact_dir
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L230)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L237)



Expand All @@ -236,7 +256,7 @@ settings section


### artifact_excludes_file
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L231)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L238)



Expand All @@ -246,7 +266,7 @@ settings section


### build_from_repo
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L233)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L240)

If set to true, the artifact is built from a clean copy of the project repository instead of the current working directory

Expand All @@ -256,7 +276,7 @@ false


### repository
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L235)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L242)

Overrides [repository](/docs/recipe/common.md#repository) from `recipe/common.php`.

Expand All @@ -268,7 +288,7 @@ null


### artifact_path
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L237)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L244)



Expand All @@ -281,7 +301,7 @@ return get('artifact_dir') . '/' . get('artifact_file');


### bin/tar
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L244)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L251)


:::info Autogenerated
Expand All @@ -292,14 +312,14 @@ The value of this configuration is autogenerated on access.


### additional_shared_files
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L318)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L325)

Array of shared files that will be added to the default shared_files without overriding



### additional_shared_dirs
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L320)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L327)

Array of shared directories that will be added to the default shared_dirs without overriding

Expand All @@ -309,71 +329,71 @@ Array of shared directories that will be added to the default shared_dirs withou
## Tasks

### magento:compile
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L96)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L102)

Compiles magento di.

Tasks


### magento:deploy:assets
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L103)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L108)

Deploys assets.




### magento:sync:content_version
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L116)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L121)

Syncs content version.




### magento:maintenance:enable
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L126)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L131)

Enables maintenance mode.




### magento:maintenance:disable
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L131)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L137)

Disables maintenance mode.




### magento:config:import
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L136)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L143)

Config Import.




### magento:upgrade:db
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L171)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L178)

Upgrades magento database.




### magento:cache:flush
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L198)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L205)

Flushes Magento Cache.




### deploy:magento
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L203)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L210)

Magento2 deployment operations.

Expand All @@ -388,7 +408,7 @@ This task is group task which contains next tasks:


### magento:build
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L211)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L218)

Magento2 build operations.

Expand All @@ -401,7 +421,7 @@ This task is group task which contains next tasks:


### deploy
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L217)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L224)

Deploys your project.

Expand All @@ -417,47 +437,47 @@ This task is group task which contains next tasks:


### artifact:package
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L254)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L261)

Packages all relevant files in an artifact.

tasks section


### artifact:upload
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L264)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L271)

Uploads artifact in release folder for extraction.




### artifact:extract
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L269)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L276)

Extracts artifact in release path.




### build:remove-generated
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L275)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L282)

Clears generated files prior to building.




### build:prepare
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L280)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L287)

Prepare local artifact build.




### deploy:additional-shared
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L324)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L331)

Adds additional files and dirs to the list of shared files and dirs.

Expand Down
Loading