jalogut / magento2-deployer-plus
基于deployer.org的Magento 2部署工具
2.8.0
2020-05-04 10:01 UTC
Requires
- deployer/dist: ^6.0
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提供可靠的完全自动化部署工具。
- 对Magento版本>=2.2实现零停机部署
- 自动化部署就像定义你想要部署的服务器一样简单。
动机
本项目旨在为所有版本的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