-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.php
73 lines (58 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
<?php
namespace Deployer;
// require 'contrib/laravel.php';
require 'contrib/yarn.php';
require 'recipe/laravel.php';
// Configuration
set('ssh_type', 'native');
set('ssh_multiplexing', true);
set('git_ssh_command', 'ssh -o StrictHostKeyChecking=no');
set('update_code_strategy', 'clone');
set('repository', '[email protected]:umn-latis/bluesheet.git');
add('shared_files', []);
add('shared_dirs', []);
add('writable_dirs', []);
// Servers
$devHost = 'cla-groups-dev.oit.umn.edu';
$tstHost = 'cla-groups-tst.oit.umn.edu';
$prodHost = 'cla-groups-prd.oit.umn.edu';
$phpPath = '/opt/remi/php81/root/usr/bin/php';
host('dev')
->set('hostname', $devHost)
->set('remote_user', 'swadm')
->set('labels', ['stage' => 'development'])
// ->identityFile()
->set('bin/php', $phpPath)
->set('deploy_path', '/swadm/var/www/html/');
host('stage')
->set('hostname', $tstHost)
->set('remote_user', 'swadm')
->set('labels', ['stage' => 'stage'])
// ->identityFile()
->set('bin/php', $phpPath)
->set('deploy_path', '/swadm/var/www/html/');
host('prod')
->set('hostname', $prodHost)
->set('remote_user', 'swadm')
->set('labels', ['stage' => 'production'])
->set('bin/php', $phpPath)
->set('deploy_path', '/swadm/var/www/html/');
task('assets:generate', function() {
cd('{{release_path}}');
run('yarn build');
})->desc('Assets generation');
// [Optional] if deploy fails automatically unlock.
after('deploy:failed', 'deploy:unlock');
after('deploy:update_code', 'deploy:git:submodules');
task('deploy:git:submodules', function () {
$git = get('bin/git');
cd('{{release_path}}');
run("$git submodule update --init");
});
// Migrate database before symlink new release.
before('deploy:symlink', 'artisan:migrate');
after('deploy:update_code', 'yarn:install');
after('yarn:install', 'assets:generate');
after('artisan:migrate', 'artisan:queue:restart');
// clear any cached data, like cached instructor info,
before('artisan:config:cache', 'artisan:cache:clear');