-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.php
More file actions
63 lines (55 loc) · 1.38 KB
/
deploy.php
File metadata and controls
63 lines (55 loc) · 1.38 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
58
59
60
61
62
63
<?php
namespace Deployer;
require 'recipe/laravel.php';
// Configuration
set('repository', 'https://github.com/JoshuaHassler/hackboston.git');
set('http_user', 'ec2-user');
set('branch', 'jhassler_dev');
set('keep_releases', 3);
// Servers
server('production', '34.223.240.196')
->user('ec2-user')
->identityFile()
->forwardAgent()
->set('deploy_path', '/var/www');
// Tasks
/**
* Deploy start, prepare deploy directory
*/
task('deploy:start', function() {
cd('~');
run("if [ ! -d {{deploy_path}} ]; then mkdir -p {{deploy_path}}; fi");
cd('{{deploy_path}}');
run("eval \"$(ssh-agent)\"");
})->setPrivate();
/**Set Storage chmod*/
task('deploy:storage', function() {
cd('{{deploy_path}}');
run('chmod -R 777 current/storage');
})->setPrivate();
/**
* Migrate laravel
*/
task('deploy:laravel', function() {
cd('{{deploy_path}}/current');
run("cp /var/www/.env ./.env");
run("php artisan key:generate");
run("php artisan migrate");
// run("php artisan passport:install");
})->setPrivate();
/**
* Main task
*/
task('deploy', [
'deploy:prepare',
'deploy:release',
'deploy:update_code',
'deploy:vendors',
'deploy:symlink',
'deploy:storage',
'deploy:laravel',
'cleanup',
])->desc('Deploy your project');
before('deploy:prepare', 'deploy:start');
after('deploy:shared', 'deploy:writable');
after('deploy', 'success');