-
Notifications
You must be signed in to change notification settings - Fork 1
/
Envoy.blade.php
72 lines (61 loc) · 1.67 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
@servers(['production' => '[email protected]'])
@setup
$repo = 'https://github.com/zack6849/website-laravel.git';
$appDir = '/srv/www/zack6849.com';
$branch = 'master';
date_default_timezone_set('America/New_York');
$date = date('Y-m-d_H-i-s');
$builds = $appDir . '/sources';
$deployment = $builds . '/' . $date;
$serve = $appDir . '/source';
$env = $appDir . '/.env';
$storage = $appDir . '/storage';
$use_fpm = true;
$fpm_service = 'php8.2-fpm';
@endsetup
@story('deploy')
git
install
live
@if ($use_fpm)
restart-fpm
@endif
@endstory
@task('git', ['on' => 'production'])
echo "Cloning..."
git clone -b {{ $branch }} "{{ $repo }}" {{ $deployment }}
@endtask
@task('install', ['on' => 'production'])
echo "Installing new version"
cd {{ $deployment }}
rm -rf {{ $deployment }}/storage
ln -nfs {{ $env }} {{ $deployment }}/.env
ln -nfs {{ $storage }} {{ $deployment }}/storage
echo "Installing NPM dependencies"
npm install
echo "Installing PHP dependencies"
composer install --no-interaction --quiet --no-dev --prefer-dist --optimize-autoloader
echo "Compiling SCSS & JS"
npm run build
echo "Running migrations"
php ./artisan migrate --force
@endtask
@task('live', ['on' => 'production'])
echo "Making current deployment live"
cd {{ $deployment }}
ln -nfs {{ $deployment }} {{ $serve }}
echo "Clearing caches"
php artisan view:clear --quiet
php artisan cache:clear --quiet
php artisan config:clear --quiet
echo "Deployment complete!"
@endtask
@task('restart-fpm', ['on' => 'production', 'confirm' => 'Restart PHP-FPM?'])
sudo service {{$fpm_service}} restart
@endtask
@task('debug', ['on' => 'production'])
echo $PATH
echo $SHELL
whatis composer
whereis composer
@endtask