-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.php
64 lines (50 loc) · 1.45 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
<?php
require_once 'recipe/common.php';
server('production', 'laravel.co.kr', '1013')
->user('deploy')
->path('/var/www/laravel.co.kr');
set('shared_dirs',['app/storage']);
set('shared_files',[]);
set('repository', 'https://github.com/laravel-kor/laravel.co.kr.git');
set('writeable_dirs', ['app/storage']);
task('database:migrate', function() {
run("php current/artisan migrate");
});
/**
* Make writeable dirs
*/
task('deploy:writeable_dirs', function () {
$user = config()->getUser();
$wwwUser = config()->getWwwUser();
$releasePath = env()->getReleasePath();
cd($releasePath);
// User specified writeable dirs
$dirs = (array)get('writeable_dirs', []);
foreach ($dirs as $dir) {
run("chmod 0777 $dir");
run("chmod g+w $dir");
}
})->desc('Make writeable dirs');
task('laravel:create_storage_dirs', function() {
$dirs = ['sessions','views','meta','logs','cache'];
foreach ($dirs as $dir) {
$path = 'current/app/storage/' . $dir;
run("if [ ! -d \"$path\" ]; then mkdir -p $path; fi", true);
}
});
task('deploy', [
'deploy:start',
'deploy:prepare',
'deploy:update_code',
'deploy:shared',
'deploy:writeable_dirs',
'laravel:create_storage_dirs',
'deploy:vendors',
'deploy:symlink',
'database:migrate',
'cleanup',
'deploy:end'
])->desc('Deploy your project');
// after('deploy', function() {
// run('sudo service php5-fpm restart');
// });