-
Notifications
You must be signed in to change notification settings - Fork 5
/
Envoy.blade.php
53 lines (45 loc) · 1.4 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
@servers(['web' => 'worker@95.85.32.232'])
@setup
$repository = 'git@gitlab.fullystudios.se:fullystudios/thelotterymachine';
$releases_dir = '/var/www/thelotterymachine/releases';
$app_dir = '/var/www/thelotterymachine';
$release = date('YmdHis');
$new_release_dir = $releases_dir .'/'. $release;
@endsetup
@story('deploy')
clone_repository
run_composer
run_npm
update_symlinks
update_migrations
@endstory
@task('clone_repository')
echo 'Cloning repository'
[ -d {{ $releases_dir }} ] || mkdir {{ $releases_dir }}
git clone --depth 1 {{ $repository }} {{ $new_release_dir }}
@endtask
@task('run_npm')
echo "Running front end production scripts"
cd {{ $new_release_dir }}
npm install
npm run production
@endtask
@task('run_composer')
echo "Running composer in ({{ $release }})"
cd {{ $new_release_dir }}
composer install --prefer-dist --no-scripts -q -o
@endtask
@task('update_migrations')
echo "Migrating database"
cd {{ $new_release_dir }}
php artisan migrate --force
@endtask
@task('update_symlinks')
echo "Linking storage directory"
rm -rf {{ $new_release_dir }}/storage
ln -nfs {{ $app_dir }}/storage {{ $new_release_dir }}/storage
echo 'Linking .env file'
ln -nfs {{ $app_dir }}/.env {{ $new_release_dir }}/.env
echo 'Linking current release'
ln -nfs {{ $new_release_dir }} {{ $app_dir }}/current
@endtask