deployer/recipe/magento2.php

90 lines
2.1 KiB
PHP
Raw Normal View History

2016-11-28 11:11:23 +01:00
<?php
namespace Deployer;
require_once __DIR__ . '/common.php';
// Configuration
2017-01-19 11:38:37 +07:00
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/*',
]);
2016-11-28 11:11:23 +01:00
// Tasks
2017-01-19 11:38:37 +07:00
desc('Enable all modules');
task('magento:enable', function () {
2016-11-28 11:11:23 +01:00
run("{{bin/php}} {{release_path}}/bin/magento module:enable --all");
});
desc('Compile magento di');
task('magento:compile', function () {
run("{{bin/php}} {{release_path}}/bin/magento setup:di:compile");
});
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("{{bin/php}} {{deploy_path}}/current/bin/magento maintenance:enable");
});
desc('Disable maintenance mode');
task('magento:maintenance:disable', function () {
run("{{bin/php}} {{deploy_path}}/current/bin/magento maintenance:disable");
});
desc('Upgrade magento database');
task('magento:upgrade:db', function () {
run("{{bin/php}} {{release_path}}/bin/magento setup:db-schema:upgrade");
run("{{bin/php}} {{release_path}}/bin/magento setup:db-data:upgrade");
});
desc('Flush Magento Cache');
task('magento:cache:flush', function () {
run("{{bin/php}} {{release_path}}/bin/magento cache:flush");
});
2017-01-19 11:38:37 +07:00
desc('Magento2 deployment operations');
task('deploy:magento', [
'magento:enable',
'magento:compile',
'magento:deploy:assets',
'magento:maintenance:enable',
'magento:upgrade:db',
'magento:cache:flush',
'magento:maintenance:disable'
]);
2016-11-28 11:11:23 +01:00
desc('Deploy your project');
task('deploy', [
'deploy:prepare',
'deploy:lock',
'deploy:release',
'deploy:update_code',
'deploy:shared',
'deploy:writable',
'deploy:vendors',
'deploy:clear_paths',
2017-01-19 11:38:37 +07:00
'deploy:magento',
2016-11-28 11:11:23 +01:00
'deploy:symlink',
'deploy:unlock',
'cleanup',
'success'
]);