Issues (13)

deploy.php (6 issues)

1
<?php
2
namespace Deployer;
3
4
require 'recipe/symfony4.php';
5
require 'vendor/deployer/recipes/recipe/slack.php';
6
7
require_once __DIR__.'/vendor/autoload.php';
8
(new \Symfony\Component\Dotenv\Dotenv())->load('.env');
9
10
// Project name
11
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

11
/** @scrutinizer ignore-call */ 
12
set('application', 'ual-payments');
Loading history...
12
13
// Project repository
14
set('repository', 'ssh://[email protected]/ualibraries/ual-payments.git');
15
16
// [Optional] Allocate tty for git clone. Default value is false.
17
set('git_tty', true);
18
19
// Keep last 30 releases
20
set('keep_releases', 30);
21
22
// Default branch to deploy from
23
set('branch', 'master');
24
25
// Shared files/dirs between deploys
26
set('shared_files', ['.env']);
27
set('shared_dirs', ['var/log', 'var/sessions', 'backups']);
28
// Writable dirs by web server
29
set('writable_dirs', ['var']);
30
31
// We're not allowing anonymous stats
32
set('allow_anonymous_stats', false);
33
34
set('slack_webhook', getenv('SLACK_WEBHOOK'));
35
36
// Hosts
37
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

37
/** @scrutinizer ignore-call */ 
38
host('production')
Loading history...
38
    ->user('deploy')
39
    ->hostname('payments.library.arizona.edu')
40
    ->set('deploy_path', '/var/www')
41
    ->stage('prd');
42
43
host('stage')
44
    ->user('deploy')
45
    ->hostname('pay-stg.library.arizona.edu')
46
    ->set('deploy_path', '/var/www')
47
    ->stage('stg');
48
49
// Tasks
50
task('assets-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

50
/** @scrutinizer ignore-call */ 
51
task('assets-build', function () {
Loading history...
51
    run('cd {{release_path}} && composer assets:build');
52
});
53
54
// Backup remote database
55
task('backup-remote-db', function () {
56
    cd('{{release_path}}');
57
    run('source .env && mysqldump -u $DB_USER -p$DB_PASSWORD $DB_NAME | gzip > ./backups/$DB_NAME-`date +%s`.sql.gz');
58
    // Remove database backup files older than 30 days
59
    run('find ./backups -name *sql.gz -mtime 30 -type f -delete');
60
});
61
62
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

62
/** @scrutinizer ignore-call */ 
63
desc('Deploy project');
Loading history...
63
task('deploy', [
64
    'deploy:info',
65
    'deploy:prepare',
66
    'deploy:lock',
67
    'deploy:release',
68
    'deploy:update_code',
69
    'deploy:shared',
70
    'deploy:writable',
71
    'deploy:vendors',
72
    'deploy:cache:clear',
73
    'deploy:cache:warmup',
74
    'backup-remote-db',
75
    'database:migrate',
76
    'assets-build',
77
    'deploy:symlink',
78
    'deploy:unlock',
79
    'cleanup',
80
]);
81
82
// [Optional] if deploy fails automatically unlock.
83
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

83
/** @scrutinizer ignore-call */ 
84
after('deploy:failed', 'deploy:unlock');
Loading history...
84
85
// Slack notifications
86
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

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