-
Notifications
You must be signed in to change notification settings - Fork 8
/
Envoy.blade.php
executable file
·76 lines (61 loc) · 1.74 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
@setup
$user = 'acorn2';
$timezone = 'Europe/Kiev';
$path = '/var/www/telegrambot';
$current = $path . '/current';
$repo = '[email protected]:2222k/bot-kicker-freekassa.git';
$branch = 'master';
$chmods = [
'storage/logs'
];
$date = new DateTime('now', new DateTimeZone($timezone));
$release = $path . '/releases/' . $date->format('YmdHis');
@endsetup
@servers(['production' => $user . '@77.222.63.44', 'localhost' => $user . '@127.0.0.1'])
@task('clone', ['on' => $on])
mkdir -p {{ $release }}
git clone --depth 1 -b {{ $branch }} "{{ $repo }}" {{ $release }}
echo "#1 - Repository has been cloned";
@endtask
@task('composer', ['on' => $on])
cd {{ $release }}
composer install --no-interaction --no-dev --prefer-dist
echo "#2 - Composer dependencies have been instaled";
@endtask
@task('artisan', ['on' => $on])
cd {{ $release }}
ln -nfs {{ $path }}/.env .env;
chgrp -h www-data .env;
php artisan config:clear
php artisan migrate
echo "#3 - Artisan commands have been run"
@endtask
@task('npm', ['on' => $on])
cd {{ $release }}
npm install
npm run prod
echo "#4 - Npm commands have been run"
@endtask
@task('chmod', ['on' => $on])
chgrp -R www-data {{ $release }};
chmod -R ug+rwx {{ $release }};
@foreach ($chmods as $file)
chmod -R 775 {{ $release }}/{{ $file }}
chown -R {{ $user }}:www-data {{ $release }}/{{ $file }}
echo "Permissions have been set for {{ $file }}"
@endforeach
echo "#5 - Permissions have been set"
@endtask
@task('update_symlinks')
ln -nfs {{ $release }} {{ $current }};
chgrp -h www-data {{ $current }};
echo "#6 - Symlink has been set"
@endtask
@macro('deploy', ['on' => 'production'])
clone
composer
artisan
npm
chmod
update_symlinks
@endmacro