2018-03-05 20:22:30 +07:00
|
|
|
<?php
|
|
|
|
/* (c) Anton Medvedev <anton@medv.io>
|
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Deployer;
|
|
|
|
|
|
|
|
require_once 'recipe/common.php';
|
|
|
|
|
2018-04-18 11:37:43 +07:00
|
|
|
set('shared_dirs', ['var/log', 'var/sessions']);
|
2018-03-05 20:22:30 +07:00
|
|
|
set('shared_files', ['.env']);
|
|
|
|
set('writable_dirs', ['var']);
|
2018-10-13 16:02:35 +02:00
|
|
|
set('migrations_config', '');
|
2018-03-05 20:22:30 +07:00
|
|
|
|
|
|
|
set('bin/console', function () {
|
|
|
|
return parse('{{bin/php}} {{release_path}}/bin/console --no-interaction');
|
|
|
|
});
|
|
|
|
|
|
|
|
desc('Migrate database');
|
|
|
|
task('database:migrate', function () {
|
2018-10-13 16:02:35 +02:00
|
|
|
$options = '--allow-no-migration';
|
|
|
|
if (get('migrations_config') !== '') {
|
|
|
|
$options = sprintf('%s --configuration={{release_path}}/{{migrations_config}}', $options);
|
|
|
|
}
|
|
|
|
|
|
|
|
run(sprintf('{{bin/console}} doctrine:migrations:migrate %s', $options));
|
2018-03-05 20:22:30 +07:00
|
|
|
});
|
|
|
|
|
2018-04-18 06:13:53 +02:00
|
|
|
desc('Clear cache');
|
|
|
|
task('deploy:cache:clear', function () {
|
|
|
|
run('{{bin/console}} cache:clear --no-warmup');
|
|
|
|
});
|
|
|
|
|
|
|
|
desc('Warm up cache');
|
|
|
|
task('deploy:cache:warmup', function () {
|
|
|
|
run('{{bin/console}} cache:warmup');
|
|
|
|
});
|
|
|
|
|
2018-03-05 20:22:30 +07:00
|
|
|
desc('Deploy project');
|
|
|
|
task('deploy', [
|
|
|
|
'deploy:info',
|
|
|
|
'deploy:prepare',
|
|
|
|
'deploy:lock',
|
|
|
|
'deploy:release',
|
|
|
|
'deploy:update_code',
|
|
|
|
'deploy:shared',
|
|
|
|
'deploy:vendors',
|
2018-08-01 11:43:29 +01:00
|
|
|
'deploy:writable',
|
2018-04-18 06:13:53 +02:00
|
|
|
'deploy:cache:clear',
|
|
|
|
'deploy:cache:warmup',
|
2018-03-05 20:22:30 +07:00
|
|
|
'deploy:symlink',
|
|
|
|
'deploy:unlock',
|
|
|
|
'cleanup',
|
|
|
|
]);
|
|
|
|
|
|
|
|
after('deploy', 'success');
|