-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
deploy.php
56 lines (42 loc) · 1.15 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
<?php
namespace Deployer;
require 'recipe/laravel.php';
// Config
set('repository', '[email protected]:rizkyilhampra/spdhtc.git');
// it will be override by laravel recipe. See https://deployer.org/docs/7.x/recipe/laravel
add('shared_files', []);
add('shared_dirs', []);
add('writable_dirs', []);
// Hosts
host('spdhtc.rizkyilhampra.me')
->set('hostname', getenv('HOSTNAME'))
->set('remote_user', getenv('REMOTE_USER'))
->set('deploy_path', getenv('DEPLOY_PATH'));
// Tasks
task('deploy:secrets', function () {
file_put_contents(__DIR__.'/.env', getenv('DOT_ENV'));
upload('.env', get('deploy_path').'/shared');
});
task('pm2', function() {
cd('{{release_path}}');
run('pm2 restart pm2-worker.yml');
});
task('re-caching', function() {
cd('{{release_path}}');
run('php artisan cache:provinces');
run('php artisan cache:cities');
});
task('deploy', [
'deploy:prepare',
'deploy:secrets',
'deploy:vendors',
'artisan:storage:link',
'artisan:optimize:clear',
're-caching',
'pm2',
'artisan:migrate',
'artisan:optimize',
'deploy:publish',
]);
// Hooks
after('deploy:failed', 'deploy:unlock');