-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdeploy.php.dist
64 lines (46 loc) · 1.59 KB
/
deploy.php.dist
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
namespace Deployer;
require 'recipe/yii2-app-advanced.php';
// Project name
set('application', 'tt-dev');
// Project repository
set('repository', 'https://bitbucket.org/4938x8_tes-team/tt_backend.git');
// [Optional] Allocate tty for git clone. Default value is false.
set('git_tty', true);
// Shared files/dirs between deploys
add('shared_files', [
'api/config/main-local.php',
'api/config/params-local.php',
]);
add('shared_dirs', [
'api/runtime',
]);
// Writable dirs by web server
add('writable_dirs', []);
// Hosts
host('tt-dev.local')
// ->user('koputo')
// ->set('deploy_path', '~/{{application}}');
->set('deploy_path', '/media/www/api.tt.tehnosber.ru');
// Tasks
task('build', function () {
run('cd {{release_path}} && build');
});
task('changeright', function() {
run('cd {{deploy_path}} && sudo chown -R -h -L www-data\: html && sudo chmod -R g+w html');
});
task('run_migration_content', function() {
run('{{bin/php}} {{release_path}}/yii migrate-content/up --interactive=0');
});
task('run_migration_rbac_init', function() {
run('{{bin/php}} {{release_path}}/yii migrate/up --interactive=0 --migrationPath=@yii/rbac/migrations');
});
task('run_migration_rbac', function() {
run('{{bin/php}} {{release_path}}/yii migrate-rbac/up --interactive=0');
});
// [Optional] if deploy fails automatically unlock.
after('deploy:failed', 'deploy:unlock');
after('success', 'changeright');
after('deploy:run_migrations', 'run_migration_content');
after('deploy:run_migrations', 'run_migration_rbac_init');
after('deploy:run_migrations', 'run_migration_rbac');