forked from spatie/dashboard.spatie.be
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Envoy.blade.php
94 lines (78 loc) · 1.96 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
@setup
$server = 'dashboard.spatie.be';
$userAndServer = "forge@{$server}";
$siteName = 'dashboard.spatie.be';
$pathOnServer = '/home/forge/' . $siteName;
$deploymentId = 'Deployment of ' . $siteName . ':' . $pathOnServer . ' by ' . get_current_user(). ':';
@endsetup
@servers(['web' => $userAndServer, 'localhost' => '127.0.0.1'])
@task('display start message', ['on' => 'localhost'])
echo 'start deploying on {{ $server }}. Path: {{ $pathOnServer }}'
@endtask
@task('checkout master branch', ['on' => 'localhost'])
echo 'checking out the master branch'
git checkout master
@endtask
@task('bring app down', ['on' => 'web'])
echo 'bringing app down'
cd '{{ $pathOnServer }}'
php artisan down
@endtask
@task('pull changes on server', ['on' => 'web'])
cd '{{ $pathOnServer }}'
git pull origin master
@endtask
@task('run composer install', ['on' => 'web'])
echo 'running composer install'
cd '{{ $pathOnServer }}'
composer install
php artisan cache:clear
@endtask
@task('run yarn', ['on' => 'web'])
echo 'running yarn'
cd '{{ $pathOnServer }}'
yarn config set ignore-engines true
yarn
@endtask
@task('generate assets', ['on' => 'web'])
echo 'generating assets'
cd '{{ $pathOnServer }}'
yarn run production
@endtask
@task('bring app up', ['on' => 'web'])
cd '{{ $pathOnServer }}'
echo 'bringing app up'
php artisan up
@endtask
@task('reload php', ['on' => 'web'])
sudo service php7.1-fpm restart
sudo supervisorctl restart all
@endtask
@task('display success message', ['on' => 'localhost'])
echo "application successfully deployed"
@endtask
@task('restart pi', ['on' => 'localhost'])
ssh pi 'sudo reboot'
@endtask
@task('deployOnlyCode',['on' => 'web'])
cd {{ $pathOnServer }}
git pull origin master
@endtask
@macro('deploy')
display start message
checkout master branch
bring app down
pull changes on server
run composer install
run yarn
generate assets
reload php
bring app up
restart pi
display success message
@endmacro
@macro('deploy-code')
deployOnlyCode
reload php
restart pi
@endmacro