forked from re-connect/mpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.php
More file actions
57 lines (47 loc) · 1.5 KB
/
deploy.php
File metadata and controls
57 lines (47 loc) · 1.5 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
<?php
namespace Deployer;
require 'recipe/symfony.php';
// Config
set('repository', 'git@github.com:re-connect/mpp.git');
set('branch', 'prod');
set('symfony_env', 'prod');
set('env', [
'SYMFONY_ENV' => get('symfony_env'),
]);
add('shared_files', [
'.env',
'.env.local',
'.env.local.php',
'config/secrets/prod/prod.decrypt.private.php',
]);
add('shared_dirs', [
'var/oauth',
'var/log',
]);
add('writable_dirs', []);
// Hosts
host('155.133.130.39')
->set('remote_user', 'www-data')
->set('deploy_path', '~/mpp')
->set('flush_cache_file_name', 'flush-cache.php')
->set('flush_cache_file_path', '{{current_path}}/public/{{flush_cache_file_name}}')
->set('api_url', 'https://api.mpp.reconnect.fr');
// Tasks
task('deploy:install_frontend', function () {
run('cd {{release_path}}/client && npm install');
});
task('deploy:build_frontend', function () {
run('cd {{release_path}}/client && npm run build', ['timeout' => null]);
});
task('deploy:reset-opcache', function () {
run('sleep 5');
run('echo "<?php opcache_reset(); ?>" >> {{flush_cache_file_path}}');
run('sleep 5');
run('wget "{{api_url}}/{{flush_cache_file_name}}" --spider --retry-connrefused -t 5');
run('rm {{flush_cache_file_path}}');
});
before('deploy:build_frontend', 'deploy:install_frontend');
before('deploy:cache:clear', 'deploy:build_frontend');
before('deploy:symlink', 'deploy:reset-opcache');
after('deploy:reset-opcache', 'database:migrate');
after('deploy:failed', 'deploy:unlock');