forked from maartenbode/now-inzichtelijk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.php
71 lines (59 loc) · 1.52 KB
/
deploy.php
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
<?php
declare(strict_types=1);
namespace Deployer;
require 'recipe/symfony.php';
set('ssh_type', 'native');
set('ssh_multiplexing', true);
set('repository', '[email protected]:ansien/now-inzichtelijk.git');
set('shared_dirs', ['var/log', 'var/sessions']);
set('shared_files', ['.env.local']);
set('writable_dirs', ['var']);
set('clear_paths', [
'./README.md',
'./.gitignore',
'./.git',
'./.php_cs',
'./.env',
'./.eslintrc',
'/assets',
'/tests',
'./package.json',
'./package-lock.json',
'./symfony.lock',
'./webpack.config.js',
'./phpunit.xml',
'./phpunit.xml.dist',
'./deploy.php',
'./psalm.xml',
'./composer.phar',
'./composer.lock',
]);
set('default_stage', 'production');
set('http_user', 'www-data');
// Servers
host('production')
->setHostname('now-inzichtelijk.nl')
->setRemoteUser('deploy')
->set('branch', 'master')
->setForwardAgent(true)
->set('deploy_path', '/home/deploy/now-inzichtelijk.nl');
set('bin/yarn', function () {
return (string) run('which yarn');
});
desc('Build assets on server');
task('deploy:assets:build', function () {
run('cd {{release_path}} && {{bin/yarn}} install && {{bin/yarn}} encore production');
});
desc('Clean redis');
task('deploy:redis:clear', static function () {
run('redis-cli FLUSHALL');
});
task('deploy', [
'deploy:prepare',
'deploy:vendors',
'deploy:assets:build',
'deploy:cache:clear',
'deploy:redis:clear',
'deploy:cache:warmup',
'deploy:publish',
])->desc('Deploy');