-
Notifications
You must be signed in to change notification settings - Fork 0
/
Envoy.blade.php
93 lines (75 loc) · 1.93 KB
/
Envoy.blade.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
89
90
91
92
93
@servers(['web' => '[email protected]'])
@setup
$server = 'web';
$serverConfigs = ['[email protected]'];
$repository = 'https://github.com/otusteamedu/Laravel.git';
$branch = 'VMeshavkin/hw17';
$path = '/var/www/';
$projectPath = '/var/www/'.date('Ymdhis') ;
$dirName = date('Ymdhis');
$slackWebhookUrl = 'https://hooks.slack.com/services/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';
$slackRoom = '#general';
@endsetup
@story('init', ['on' => 'web'])
init
@endstory
@story('deploy', ['on' => 'web'])
git:pull
composer:install
semLink:make
config:cache
queue:restart
app:cache:warm
app:phpunit
@endstory
@story('rollback', ['on' => 'web'])
semLink:rollback
@endstory
@task('semLink:rollback')
unlink {{$path}}current
mv -T {{$path}}previous {{$path}}current
@endtask
@task('init')
cd {{$path}}
git clone --branch {{$branch}} {{$repository}} {{$dirName}}
ln -s {{$projectPath}} {{$path}}previous
ln -s {{$projectPath}} {{$path}}current
@endtask
@task('git:pull')
cd {{$path}}
git clone --branch {{$branch}} {{$repository}} {{$dirName}}
@endtask
@task('semLink:make')
unlink {{$path}}previous
mv -T {{$path}}current {{$path}}previous
ln -s {{$projectPath}} {{$path}}current
@endtask
@task('app:migrate')
cd {{$projectPath}}
php artisan migrate
@endtask
@task('config:cache')
cd {{$projectPath}}
php artisan config:cache
@endtask
@task('queue:restart')
cd {{$projectPath}}
php artisan queue:restart
@endtask
@task('app:cache:warm')
cd {{$projectPath}}
php artisan cache:clear
php artisan cache:warm
@endtask
@task('composer:install', ['on' => 'web'])
cd {{$projectPath}}
rm composer.lock
composer install
@endtask
@task('app:phpunit', ['on' => 'web'])
cd {{$projectPath}}
php vendor/bin/phpunit
@endtask
@finished
@slack($slackWebhookUrl, $slackRoom, 'deploy OK')
@endfinished