justbetter / magento2-deployer-plus
基于deployer.org的Magento 2部署工具
1.1.8
2024-03-07 10:53 UTC
Requires
- deployer/deployer: ^7.0
README
- Magento 2的可靠全自动化部署工具。
- Magento版本 >= 2.2 上的零停机部署
- 自动化部署就像定义要部署的服务器一样简单。
动机
本项目旨在为所有版本的Magento 2提供全自动化部署的通用解决方案。此工具使用广为人知的Deployer,并为每个Magento 2版本添加了特定配方。
重要特性
- Deployer代码语法
- 超级简单的设置
- 部署到多个服务器
- 零停机(仅限Magento >= 2.2)
- 构建和部署工件(仅限Magento >= 2.2)
- 安全的回滚(仅限Magento >= 2.2)
安装
composer require justbetter/magento2-deployer-plus
设置
Magento >= 2.1
cp <vendor_dir>/justbetter/magento2-deployer-plus/deploy.php.sample_2_1 deploy.php
Magento >= 2.2
cp <vendor_dir>/justbetter/magento2-deployer-plus/deploy.php.sample_2_2 deploy.php
Magento >= 2.2.5
cp <vendor_dir>/justbetter/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>]
故障排除
JavaScript翻译缺失(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', function () { run('{{bin/php}} {{magento_bin}} setup:static-content:deploy en_US {{static_deploy_options}}'); run('{{bin/php}} {{magento_bin}} setup:static-content:deploy de_CH {{static_deploy_options}}'); run('{{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 >= 8.0
- MAGENTO >= 2.1
变更日志
开发者
许可
版权
(c) JustBetter B.V. hello@justbetter.nl