-
Notifications
You must be signed in to change notification settings - Fork 13
/
deploy.php
67 lines (50 loc) · 1.58 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
<?php
namespace Deployer;
require 'recipe/laravel.php';
// Project name
set('application', 'kbframe');
// Project repository
set('repository', 'https://gitee.com/kbdxbt/kbframe');
// [Optional] Allocate tty for git clone. Default value is false.
set('git_tty', false);
// Allow anonymous stats
set('allow_anonymous_stats', false);
// Shared files/dirs between deploys keep_releases
add('shared_files', []);
add('shared_dirs', []);
// Writable dirs by web server
add('writable_dirs', []);
// 根据操作系统设置 ssh_multiplexing
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
// 在 Windows 下禁用 ssh_multiplexing
set('ssh_multiplexing', false);
desc('Upload .env file');
task('env:upload', function (): void {
run("cp -f {{release_path}}/.env.example {{deploy_path}}/shared/.env");
});
} else {
set('ssh_multiplexing', true);
desc('Upload .env file');
task('env:upload', function (): void {
upload('.env', '{{release_path}}/.env');
});
}
host('kbframe')
->setHostname('127.0.0.1')
->set('labels', ['stage' => 'develop'])
->set('branch', '10.x')
->set('remote_user', 'deployer')
->set('deploy_path', '/var/www/html/{{application}}')
->setIdentityFile('~/.ssh/deployerkey');
task('deploy', [
'deploy:prepare',
'deploy:vendors',
'artisan:storage:link',
'artisan:view:cache',
'artisan:config:cache',
'deploy:publish',
]);
// Migrate database before symlink new release.
before('deploy:symlink', 'artisan:migrate');
after('deploy:shared', 'env:upload');
after('deploy:failed', 'deploy:unlock');