magento2-deployer-plus
Tools
PHP
Magento 2 Deployer Plus
- Reliable fully-automated deployments tool for Magento 2.
- Zero downtime deployments on Magento versions >= 2.2
- Automating your deployments is as easy as defining the servers where you want to deploy to.
Motivation
This project aims to offer a common solution for fully-automated deployments on all versions of Magento 2.
This tool uses the well known Deployer and adds specific recipes for each Magento 2 version.
Important Features
- Deployer code syntax
- Super easy setup
- Deploy to multiple servers
- Zero Downtime (only Magento >= 2.2)
- Build and Deploy artifacts (only Magento >= 2.2)
- Secure rollbacks (only Magento >= 2.2)
Installation
composer require "jalogut/magento2-deployer-plus"
Setup
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
Usage
Git deploys:
<bin_dir>/dep deploy [<stage>]
Build artifact deploys: (only Magento >= 2.2)
<bin_dir>/dep build
<bin_dir>/dep deploy-artifact [<stage>]
Disclaimer
Build command
Build command can only be used if config propagation is properly configured. See Magento DevDocs:
Also check app:config:dump
issue and workaround here:
- PR #12410
- Gist workaround
Troubleshooting
Js translations missing (magento versions >=2.1.3 <2.2.1)
-
Problem: Known Magento issue when executing
setup:static-content:deploy
for several languages. -
Github Issues:
- 7862
- 10673
-
Solution: Until that gets fixed in
2.2.1
, the only workaround is to executesetup:static-content:deploy
individually for each language:// 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}} ');
Compilation error
-
Solution: Increase php
memory_limit
configuration to 728M o 1024M
Static deploy error when setting a new template (if config propagation is not used)
-
Problems:
-
[LogicException] Unable to load theme by specified key: 'Template'
-
@variable
is undefined in file
-
-
Reason: If a new template is set, running
setup:upgrade
is required before executingsetup:static-content:deploy
-
Solution: Skip
setup:static-content:deploy
first time you deploy the new template:-
Temporary disable task
files:static_assets
// deploy.php task('files:static_assets')->onRoles('Skip');
<li> Perform a new release </li> <li> Enable back <code>files:static_assets</code> on your <code>deploy.php</code> file</p> <ul dir="auto"> <li> Remove <code>task('files:static_assets')->onRoles('Skip');</code> </li> </ul> </li> <li> Manually execute <code>files:static_assets</code></p> <pre class="notranslate"><code><bin_dir>/dep files:static_assets [<stage>]
-
Temporary disable task
<p>
After that, future deployments will work without issues </li> </ul>
<h2 dir="auto">
<a rel="nofollow noopener" target="_blank" id="user-content-prerequisites" class="anchor" aria-hidden="true" href="#prerequisites"></a>Prerequisites
</h2>
<ul dir="auto">
<li>
PHP >= 7.0.8
</li>
<li>
MAGENTO >= 2.1
</li>
</ul>
<h2 dir="auto">
<a rel="nofollow noopener" target="_blank" id="user-content-changelog" class="anchor" aria-hidden="true" href="#changelog"></a>ChangeLog
</h2>
<p>
CHANGELOG.md
</p>
<h2 dir="auto">
<a rel="nofollow noopener" target="_blank" id="user-content-developers" class="anchor" aria-hidden="true" href="#developers"></a>Developers
</h2>
<ul dir="auto">
<li>
Juan Alonso
</li>
<li>
Oscar Recio
</li>
<li>
Contributors
</li>
</ul>
<h2 dir="auto">
<a rel="nofollow noopener" target="_blank" id="user-content-licence" class="anchor" aria-hidden="true" href="#licence"></a>Licence
</h2>
<p>
<a rel="nofollow noopener" target="_blank" href="http://opensource.org/licenses/gpl-3.0">GNU General Public License, version 3 (GPLv3)</a>
</p>
<h2 dir="auto">
<a rel="nofollow noopener" target="_blank" id="user-content-copyright" class="anchor" aria-hidden="true" href="#copyright"></a>Copyright
</h2>
<p>
(c) Juan Alonso juan.jalogut@gmail.com
</p>