-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.php
74 lines (59 loc) · 1.96 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
72
73
74
<?php
namespace Deployer;
require 'recipe/laravel.php';
require 'contrib/rsync.php';
// Config
set('application', 'Homebuka Server');
set('ssh_multiplexing', true); // Speeds up deployments
set('rsync_src', function () {
return __DIR__;
});
set('repository', 'git@github.com:Homebuka-Limited/homebuka-server.git');
add('shared_files', []);
add('shared_dirs', []);
add('writable_dirs', []);
// Configuring the rsync exclusions.
// You'll want to exclude anything that you don't want on the production server.
add('rsync', [
'exclude' => [
'.git',
'.env',
'/node_modules/',
'.github',
'deploy.php',
],
]);
// Set up a deployer task to copy secrets to the server.
// Since our secrets are stored in Github Secrets, we can access them as env vars.
task('deploy:secrets', function () {
file_put_contents(__DIR__ . '/.env', getenv('DOT_ENV'));
upload('.env', get('deploy_path') . '/shared');
});
// Hosts
host('server','staging')
->setHostname('ec2-18-206-121-142.compute-1.amazonaws.com')
//->set('identity_file','~/Desktop/Topazdom/Clients/HomeBuka/SSH/HomeBuka Key.pem') //comment before push.
->set('remote_user', 'ubuntu')
->setDeployPath('/var/www/{{alias}}.homebuka.com')
->set('branch','production');
/* host('staging')
->setHostname('18.206.121.142')
->set('remote_user', 'root')
->setDeployPath('/var/www/{{alias}}.homebuka.com')
->set('branch','staging'); */
// Hooks
desc('Deploy the Server Application');
task('deploy', [
'deploy:prepare',
'rsync', // Deploy code & built assets
'deploy:secrets', // Deploy secrets
'artisan:storage:link', // |
'artisan:view:cache', // |
'artisan:config:cache', // | Laravel Specific steps
'artisan:route:cache', // |
'artisan:migrate', // |
'artisan:queue:restart',// |
'deploy:publish',
]);
after('deploy:failed', 'deploy:unlock'); // Unlock after failed deploy
//Include Changelog in Deployment Push