-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy.php
75 lines (60 loc) · 2.08 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
<?php
namespace Deployer;
require 'recipe/laravel.php';
require 'recipe/npm.php';
// Configuration
set('ssh_type', 'native');
set('ssh_multiplexing', true);
set('repository', 'git@github.com:UMN-LATIS/ServiceLater.git');
set('writable_use_sudo', true);
add('shared_files', []);
add('shared_dirs', []);
add('writable_dirs', []);
// Servers
host('dev')
->hostname("cla-svclater-dev.oit.umn.edu")
->user('mcfa0086')
->stage('development')
// ->identityFile()
->set('bin/php', '/opt/rh/rh-php73/root/usr/bin/php')
->set('deploy_path', '/swadm/var/www/html/');
host('stage')
->hostname("cla-svclater-tst.oit.umn.edu")
->user('mcfa0086')
->stage('stage')
// ->identityFile()
->set('bin/php', '/opt/rh/rh-php73/root/usr/bin/php')
->set('deploy_path', '/swadm/var/www/html/');
host('prod')
->hostname("cla-svclater-prd.oit.umn.edu")
->user('mcfa0086')
->stage('production')
// ->identityFile()
->set('bin/php', '/opt/rh/rh-php73/root/usr/bin/php')
->set('deploy_path', '/swadm/var/www/html/');
task('assets:generate', function() {
cd('{{release_path}}');
run('npm run production');
})->desc('Assets generation');
task('fix_storage_perms', '
touch storage/logs/laravel.log
sudo chown apache storage/logs/laravel.log
sudo chgrp apache storage/logs/laravel.log
')->desc("Fix Apache Logs");
after('artisan:migrate', 'fix_storage_perms');
// $result = run("scl enable rh-php56 'php -v'");
// Tasks
// desc('Restart PHP-FPM service');
// task('php-fpm:restart', function () {
// // The user must have rights for restart service
// // /etc/sudoers: username ALL=NOPASSWD:/bin/systemctl restart php-fpm.service
// run('sudo systemctl restart php-fpm.service');
// });
// after('deploy:symlink', 'php-fpm:restart');
// [Optional] if deploy fails automatically unlock.
after('deploy:failed', 'deploy:unlock');
// Migrate database before symlink new release.
before('deploy:symlink', 'artisan:migrate');
after('deploy:update_code', 'npm:install');
after('npm:install', 'assets:generate');
after('artisan:migrate', 'artisan:queue:restart');