-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeploy.php
More file actions
66 lines (53 loc) · 1.58 KB
/
deploy.php
File metadata and controls
66 lines (53 loc) · 1.58 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
<?php
namespace Deployer;
require 'recipe/symfony4.php';
set('ssh_type', 'native');
set('ssh_multiplexing', true);
// Configuration
inventory('deploy/servers.yml');
set('env', function () {
return [
'APP_ENV' => 'prod',
'GA_TRACKING_ID' => '0',
'DATABASE_URL' => 'null',
'MAILER_URL' => 'null',
'RECAPTCHA_ID' => '0',
'RECAPTCHA_SECRET' => '0',
];
});
set('http_user', 'www-data');
set('default_stage', 'production');
set('repository', 'git@github.com:ecole-thot/website.git');
set('shared_dirs', ['var/log', 'var/sessions', 'public/uploads']);
set('writable_dirs', ['var', 'public/uploads']);
set('clear_paths', [
'./README.md',
'./.gitignore',
'./.git',
'./deploy',
'./.php_cs',
'./deploy.php',
]);
desc('Build bundle assets');
task('deploy:build_assets', function () {
cd('{{release_path}}');
run('npm install --no-optional --no-progress');
run('npm run build');
});
desc('Restart PHP-FPM service');
task('php-fpm:restart', function () {
// The user must have rights for restart service
// /etc/sudoers: username ALL=NOPASSWD:/bin/systemctl restart php-fpm.service
run('sudo systemctl restart php8.1-fpm.service');
});
desc('Correct translations folder rights');
task('folder:rights', function () {
cd('{{deploy_path}}/current');
run('sudo chgrp -R www-data .');
run('sudo chmod -R g+w ./translations');
});
// Hooks
after('deploy:update_code', 'deploy:build_assets');
after('deploy:symlink', 'folder:rights');
after('deploy:symlink', 'php-fpm:restart');
after('deploy:failed', 'deploy:unlock');