deployer/recipe/magento2.php
Rudolph Gottesheim 25e0824cb1 Remove magento:enable from Magento 2 recipe (#1606)
* Remove magento:enable from Magento 2 recipe

Magento's module states are stored in app/etc/config.php. This task
ignored that and blindly enabled all installed modules.

* Mention the removal of magento:enable in the changelog
2018-08-27 13:33:45 +07:00

87 lines
2.1 KiB
PHP

<?php
namespace Deployer;
require_once __DIR__ . '/common.php';
// Configuration
set('shared_files', [
'app/etc/env.php',
'var/.maintenance.ip',
]);
set('shared_dirs', [
'var/log',
'var/backups',
'pub/media',
]);
set('writable_dirs', [
'var',
'pub/static',
'pub/media',
]);
set('clear_paths', [
'var/generation/*',
'var/cache/*',
]);
// Tasks
desc('Compile magento di');
task('magento:compile', function () {
run("{{bin/php}} {{release_path}}/bin/magento setup:di:compile");
run('cd {{release_path}} && {{bin/composer}} dump-autoload -o');
});
desc('Deploy assets');
task('magento:deploy:assets', function () {
run("{{bin/php}} {{release_path}}/bin/magento setup:static-content:deploy");
});
desc('Enable maintenance mode');
task('magento:maintenance:enable', function () {
run("if [ -d $(echo {{deploy_path}}/current) ]; then {{bin/php}} {{deploy_path}}/current/bin/magento maintenance:enable; fi");
});
desc('Disable maintenance mode');
task('magento:maintenance:disable', function () {
run("if [ -d $(echo {{deploy_path}}/current) ]; then {{bin/php}} {{deploy_path}}/current/bin/magento maintenance:disable; fi");
});
desc('Upgrade magento database');
task('magento:upgrade:db', function () {
run("{{bin/php}} {{release_path}}/bin/magento setup:upgrade --keep-generated");
});
desc('Flush Magento Cache');
task('magento:cache:flush', function () {
run("{{bin/php}} {{release_path}}/bin/magento cache:flush");
});
desc('Magento2 deployment operations');
task('deploy:magento', [
'magento:compile',
'magento:deploy:assets',
'magento:maintenance:enable',
'magento:upgrade:db',
'magento:cache:flush',
'magento:maintenance:disable'
]);
desc('Deploy your project');
task('deploy', [
'deploy:info',
'deploy:prepare',
'deploy:lock',
'deploy:release',
'deploy:update_code',
'deploy:shared',
'deploy:writable',
'deploy:vendors',
'deploy:clear_paths',
'deploy:magento',
'deploy:symlink',
'deploy:unlock',
'cleanup',
'success'
]);
after('deploy:failed', 'magento:maintenance:disable');