forked from OpenDominion/OpenDominion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.php
88 lines (70 loc) · 2.07 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
namespace Deployer;
require 'recipe/laravel.php';
// Config
set('repository', '[email protected]:WaveHack/OpenDominion.git');
set('branch', 'master');
set('ssh_multiplexing', false);
// Hosts
host('opendominion.net')
->set('deploy_path', '/var/www/opendominion.net')
->configFile('~/.ssh/config');
// Task definitions
desc('Installing NPM dependencies');
task('npm install', function () {
if (has('previous_release')) {
run('cp -R {{previous_release}}/node_modules {{release_path}}/node_modules');
}
run('cd {{release_path}} && npm install');
});
desc('Build frontend');
task('npm run prod', function () {
run('cd {{release_path}} && npm run prod');
});
desc('Syncing game data');
task('artisan:game:data:sync', function () {
run('cd {{release_path}} && {{bin/php}} artisan game:data:sync');
});
desc('Update version');
task('artisan:version:update', function () {
run('cd {{release_path}} && {{bin/php}} artisan version:update');
});
desc('Reload php-fpm');
task('php-fpm:reload', function () {
run('sudo service php7.3-fpm reload');
});
desc('Restart supervisor workers');
task('supervisorctl:restart', function () {
run('sudo supervisorctl restart all');
});
// Execute tasks
// Task list is based off the Laravel recipe
task('deploy', [
'deploy:info',
'deploy:prepare',
'deploy:lock',
'deploy:release',
'deploy:update_code',
'deploy:shared',
'deploy:vendors',
'npm install', // custom made
'npm run prod', // custom made
'deploy:writable',
'artisan:storage:link',
'artisan:down', // custom inserted
'artisan:view:clear',
'artisan:cache:clear',
'artisan:config:cache',
'artisan:migrate', // custom inserted
'artisan:game:data:sync', // custom made
'artisan:version:update', // custom made
'artisan:optimize',
'deploy:symlink',
'php-fpm:reload', // custom made
'supervisorctl:restart', // custom made
'artisan:up', // custom inserted
'deploy:unlock',
'cleanup',
]);
after('deploy:failed', 'deploy:unlock');
after('deploy:failed', 'artisan:up');