forked from spatie/dashboard.spatie.be
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Envoy.blade.php
97 lines (81 loc) · 2.2 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
94
95
96
97
@setup
$server = 'spatie.be';
$siteName = 'dashboard.spatie.be';
$pathOnServer = '/home/forge/' . $siteName;
$deploymentId = 'Deployment of ' . $siteName . ':' . $pathOnServer . ' by ' . get_current_user(). ':';
@endsetup
@servers(['web' => $server, 'localhost' => '127.0.0.1'])
@task('display start message', ['on' => 'localhost'])
echo 'start deploying on {{ $server }}. Path: {{ $pathOnServer }}'
php artisan slack "{{ $deploymentId }} starting"
@endtask
@task('checkout master branch', ['on' => 'localhost'])
echo 'checking out the master branch'
git checkout master
@endtask
@task('generate assets', ['on' => 'localhost'])
echo 'generating assets'
gulp
@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('clear assets on server', ['on' => 'web'])
echo 'clearing assets on server'
rm -rf '{{ $pathOnServer }}/public/assets'
@endtask
@task('upload generated assets', ['on' => 'localhost'])
echo 'uploading generated assets'
scp -r public/build {{ $server }}:{{$pathOnServer}}/public
@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.0-fpm restart
sudo supervisorctl restart all
@endtask
@task('display success message', ['on' => 'localhost'])
echo "application successfully deployed"
php artisan slack "{{ $deploymentId }} :thumbsup: 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
generate assets
bring app down
pull changes on server
run composer install
clear assets on server
upload generated assets
reload php
bring app up
restart pi
display success message
@endmacro
@macro('deploy-code')
deployOnlyCode
reload php
restart pi
@endmacro