-
Notifications
You must be signed in to change notification settings - Fork 3
/
deploy.php
60 lines (49 loc) · 1.38 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
<?php
namespace Deployer;
require './vendor/deployer/deployer/recipe/laravel.php';
//set('branch', 'feature_track');
set('repository', 'git@github.com:akeinhell/redfoxbot.git');
add('shared_files', [
'.env',
]);
// Laravel shared dirs
set('shared_dirs', [
'storage',
'vendor',
'node_modules',
'bower_components'
]);
add('writable_dirs', [
'storage',
]);
// Servers
host('production')
->hostname('redfoxbot.ru')
->user('ubuntu')
->set('keep_releases', 5)
->set('deploy_path', '/var/www/telegram')
->identityFile('~/.ssh/id_rsa')
->addSshOption('UserKnownHostsFile', '/dev/null')
->addSshOption('StrictHostKeyChecking', 'no');
task('npm', function () {
run('cd ' . get('release_path'). ' && yarn install');
run('cd ' . get('release_path'). ' && npm run build');
});
desc('Update version');
task('env', function(){
run('cd ' . get('release_path'). ' && php artisan deploy:env');
});
desc('clear cache');
task('cache-clear', function(){
run('cd ' . get('release_path'). ' && php artisan config:clear');
});
// Tasks
desc('Restart PHP-FPM service');
task('php-fpm:restart', function () {
run('sudo systemctl restart php7.0-fpm.service');
run('sudo systemctl restart php7.1-fpm.service');
});
after('deploy:vendors', 'npm');
after('npm', 'env');
after('deploy:symlink', 'php-fpm:restart');
after('php-fpm:restart', 'cache-clear');