-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.php
More file actions
88 lines (72 loc) · 2.23 KB
/
Copy pathdeploy.php
File metadata and controls
88 lines (72 loc) · 2.23 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
/* If you make changes here please talk to an admin */
namespace Deployer;
require 'recipe/common.php';
require 'contrib/cachetool.php';
// Project name
set('application', 'foodsharing');
// Project repository
set('repository', 'git@gitlab.com:foodsharing-dev/foodsharing.git');
// Shared files/dirs between deploys
set('shared_files', ['config.inc.prod.php']);
set('shared_dirs', ['images', 'data', 'tmp', 'keys']);
// Writable dirs by web server
set('writable_dirs', ['tmp', 'cache', 'var']);
set('http_user', 'fs-php');
set('http_group', 'www-data');
set('remote_user', 'deploy');
set('deploy_path', '/var/www/{{alias}}');
set('cachetool', '/run/php-fpm-{{alias}}.sock');
// default timeout of 300 was failing sometimes
set('default_timeout', 600);
// Hosts
host('beta')
->setHostname('foodsharing.network');
host('production')
->setHostname('foodsharing.network');
// Tasks
desc('Create the revision information');
task('deploy:create_revision', function () {
$revision = input()->getOption('revision');
cd('{{release_path}}');
run("./scripts/deploy-generate_revision $revision");
});
task('deploy:update_code', function () {
upload(__DIR__ . '/', '{{release_path}}', [
'--exclude=.git',
'--exclude=client',
'--exclude=migrations',
'--exclude=deployer',
'--compress-level=9'
]);
});
task('deploy:cache:warmup', function () {
run('sudo -u {{http_user}} -g {{http_group}} FS_ENV=prod php-{{alias}} {{release_path}}/bin/console cache:warmup -e prod');
})->desc('Warmup symfony cache');
task('deploy:permissions', function () {
run('
sudo chgrp -R {{http_group}} {{release_path}};
chmod 750 {{release_path}};
');
})->desc('Allow only www-data to access the files');
desc('Deploy your project');
task('deploy', [
'deploy:info',
'deploy:setup',
'deploy:lock',
'deploy:release',
'deploy:update_code',
'deploy:writable',
'deploy:shared',
'deploy:clear_paths',
'deploy:permissions',
'deploy:create_revision',
'deploy:cache:warmup',
'deploy:symlink',
'cachetool:clear:opcache',
'deploy:unlock',
'deploy:cleanup',
'deploy:success'
]);
// [Optional] If deploy fails automatically unlock.
after('deploy:failed', 'deploy:unlock');