1 | <?php |
||
2 | namespace Deployer; |
||
3 | |||
4 | require_once __DIR__ . '/common.php'; |
||
5 | |||
6 | set('shared_dirs', ['var/log', 'var/sessions']); |
||
7 | set('shared_files', ['.env.local.php', '.env.local']); |
||
8 | set('writable_dirs', ['var']); |
||
9 | set('migrations_config', ''); |
||
10 | |||
11 | set('bin/console', function () { |
||
12 | return parse('{{release_path}}/bin/console'); |
||
13 | }); |
||
14 | |||
15 | set('console_options', function () { |
||
16 | return '--no-interaction'; |
||
17 | }); |
||
18 | |||
19 | desc('Migrate database'); |
||
20 | task('database:migrate', function () { |
||
21 | $options = '--allow-no-migration'; |
||
22 | if (get('migrations_config') !== '') { |
||
23 | $options = sprintf('%s --configuration={{release_path}}/{{migrations_config}}', $options); |
||
24 | } |
||
25 | |||
26 | run(sprintf('{{bin/php}} {{bin/console}} doctrine:migrations:migrate %s {{console_options}}', $options)); |
||
27 | }); |
||
28 | |||
29 | desc('Clear cache'); |
||
30 | task('deploy:cache:clear', function () { |
||
31 | run('{{bin/php}} {{bin/console}} cache:clear {{console_options}} --no-warmup'); |
||
32 | }); |
||
33 | |||
34 | desc('Warm up cache'); |
||
35 | task('deploy:cache:warmup', function () { |
||
36 | run('{{bin/php}} {{bin/console}} cache:warmup {{console_options}}'); |
||
37 | }); |
||
38 | |||
39 | desc('Deploy project'); |
||
40 | task('deploy', [ |
||
41 | 'deploy:info', |
||
42 | 'deploy:setup', |
||
43 | 'deploy:lock', |
||
44 | 'deploy:release', |
||
45 | 'deploy:update_code', |
||
46 | 'deploy:shared', |
||
47 | 'deploy:vendors', |
||
48 | 'deploy:writable', |
||
49 | 'deploy:cache:clear', |
||
50 | 'deploy:cache:warmup', |
||
51 | 'deploy:symlink', |
||
52 | 'deploy:unlock', |
||
53 | 'deploy:cleanup', |
||
54 | ]); |
||
55 | |||
56 | after('deploy', 'success'); |
||
57 |