tshabatyn / magento2-deployer-plus
基于deployer.org的Magento 2部署工具
2.8.1
2020-12-03 09:10 UTC
Requires
- deployer/deployer: ^6.8
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.11
- nikic/php-parser: ^3.1
- phpmd/phpmd: ^2.6
- phpro/grumphp: ^0.14.0
- phpstan/phpstan: ^0.9.2
- squizlabs/php_codesniffer: ^3.2
README
- 为Magento 2提供可靠的全自动化部署工具。
- 对于版本 >= 2.2 的Magento,实现零停机部署
- 自动化部署就像定义您要部署到的服务器一样简单。
动机
此项目旨在为所有版本的Magento 2提供一个全自动化部署的通用解决方案。此工具使用广为人知的Deployer,并为每个Magento 2版本添加特定的配方。
重要功能
- Deployer代码语法
- 超级简单的设置
- 部署到多个服务器
- 零停机时间(仅限Magento >= 2.2)
- 构建和部署工件(仅限Magento >= 2.2)
- 安全的回滚(仅限Magento >= 2.2)
安装
composer require "jalogut/magento2-deployer-plus"
设置
Magento >= 2.1
cp <vendor_dir>/jalogut/magento2-deployer-plus/deploy.php.sample_2_1 deploy.php
Magento >= 2.2
cp <vendor_dir>/jalogut/magento2-deployer-plus/deploy.php.sample_2_2 deploy.php
Magento >= 2.2.5
cp <vendor_dir>/jalogut/magento2-deployer-plus/deploy.php.sample_2_2_5 deploy.php
使用方法
Git部署
<bin_dir>/dep deploy [<stage>]
构建工件部署:(仅限Magento >= 2.2)
<bin_dir>/dep build
<bin_dir>/dep deploy-artifact [<stage>]
免责声明
构建命令
构建命令只能在配置传播正确配置的情况下使用。请参阅Magento DevDocs
也请在此处查看app:config:dump
问题和解决方案
故障排除
Js翻译缺失(magento版本 >=2.1.3 <2.2.1)
-
问题:当执行多个语言的
setup:static-content:deploy
时,已知Magento问题。 -
Github问题:
-
解决方案:直到在
2.2.1
中修复,唯一的解决方案是分别为每种语言单独执行setup:static-content:deploy
。// deploy.php task('files:static_assets', ' {{bin/php}} {{magento_bin}} setup:static-content:deploy en_US {{static_deploy_options}} {{bin/php}} {{magento_bin}} setup:static-content:deploy de_CH {{static_deploy_options}} {{bin/php}} {{magento_bin}} setup:static-content:deploy fr_FR {{static_deploy_options}} ');
编译错误
- 解决方案:将php的
memory_limit
配置增加到728M或1024M。
设置新模板时静态部署错误(如果未使用配置传播)
-
问题:
[LogicException]无法通过指定键加载主题:'Template'
@variable
在该文件中未定义
-
原因:如果设置了新模板,则在执行
setup:static-content:deploy
之前需要先运行setup:upgrade
。 -
解决方案:第一次部署新模板时跳过
setup:static-content:deploy
。-
暂时禁用任务
files:static_assets
// deploy.php task('files:static_assets')->onRoles('Skip');
-
执行新版本发布
-
在您的
deploy.php
文件中启用files:static_assets
回退- 删除
task('files:static_assets')->onRoles('Skip');
- 删除
-
手动执行
files:static_assets
<bin_dir>/dep files:static_assets [<stage>]
之后,未来的部署将没有问题
-
先决条件
- PHP >= 7.0.8
- MAGENTO >= 2.1
变更日志
开发者
许可证
版权
(c) Juan Alonso juan.jalogut@gmail.com