Passed
Push — master ( 4e140d...2b7bb3 )
by Clint A
04:41
created

deploy.php (6 issues)

Labels
Severity
1
<?php
2
namespace Deployer;
3
4
require 'recipe/symfony4.php';
5
require 'vendor/deployer/recipes/recipe/slack.php';
6
7
// Project name
8
set('application', 'ual-payments');
0 ignored issues
show
The function set was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

8
/** @scrutinizer ignore-call */ 
9
set('application', 'ual-payments');
Loading history...
9
10
// Project repository
11
set('repository', 'ssh://[email protected]/ualibraries/ual-payments.git');
12
13
// [Optional] Allocate tty for git clone. Default value is false.
14
set('git_tty', true); 
15
16
// Keep all releases
17
set('keep_releases', -1);
18
19
// Default branch to deploy from
20
set('branch', 'master');
21
22
// Shared files/dirs between deploys
23
set('shared_files', ['.env']);
24
set('shared_dirs', ['var/log', 'var/sessions', 'backups']);
25
// Writable dirs by web server
26
set('writable_dirs', ['var']);
27
28
// We're not allowing anonymous stats
29
set('allow_anonymous_stats', false);
30
31
set('slack_webhook', 'https://hooks.slack.com/services/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');
32
33
// Hosts
34
host('production')
0 ignored issues
show
The function host was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

34
/** @scrutinizer ignore-call */ 
35
host('production')
Loading history...
35
    ->user('deploy')
36
    ->hostname('pay-prd.library.arizona.edu')
37
    ->set('deploy_path', '/var/www')
38
    ->stage('prd'); 
39
    
40
41
host('stage')
42
    ->user('deploy')
43
    ->hostname('pay-stg.library.arizona.edu')
44
    ->set('deploy_path', '/var/www')
45
    ->stage('stg');
46
// Tasks
47
48
task('build', function () {
0 ignored issues
show
The function task was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

48
/** @scrutinizer ignore-call */ 
49
task('build', function () {
Loading history...
49
    run('cd {{release_path}} && build');
50
});
51
52
53
task('assets-build', function () {
54
    run('cd {{release_path}} && composer assets:build');
55
});
56
57
// Backup remote database
58
task('backup-remote-db', function () {
59
    cd('{{release_path}}');
60
    run('source .env && mysqldump -u $DB_USER -p$DB_PASSWORD $DB_NAME | gzip > ./backups/$DB_NAME-`date +%s`.sql.gz');
61
    // Remove database backup files older than 30 days
62
    run('find ./backups -name *sql.gz -mtime 30 -type f -delete');
63
});
64
65
desc('Deploy project');
0 ignored issues
show
The function desc was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

65
/** @scrutinizer ignore-call */ 
66
desc('Deploy project');
Loading history...
66
task('deploy', [
67
    'deploy:info',
68
    'deploy:prepare',
69
    'deploy:lock',
70
    'deploy:release',
71
    'deploy:update_code',
72
    'deploy:shared',
73
    'deploy:writable',
74
    'deploy:vendors',
75
    'deploy:cache:clear',
76
    'deploy:cache:warmup',
77
    'backup-remote-db',
78
    'database:migrate',
79
    'assets-build',
80
    'deploy:symlink',
81
    'deploy:unlock',
82
    'cleanup',
83
]);
84
85
// [Optional] if deploy fails automatically unlock.
86
after('deploy:failed', 'deploy:unlock');
0 ignored issues
show
The function after was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

86
/** @scrutinizer ignore-call */ 
87
after('deploy:failed', 'deploy:unlock');
Loading history...
87
88
// Slack notifications
89
before('deploy', 'slack:notify');
0 ignored issues
show
The function before was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

89
/** @scrutinizer ignore-call */ 
90
before('deploy', 'slack:notify');
Loading history...
90
after('deploy', 'slack:notify:success');
91
after('deploy:failed', 'slack:notify:failure');
92