forked from appkr/l5essential
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Envoy.blade.php
72 lines (57 loc) · 2.3 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
#--------------------------------------------------------------------------
# List of tasks, that you can run...
# e.g. envoy release
#--------------------------------------------------------------------------
#
# hello Check ssh connection
# release Publish new release
# provision Server provision
# init Initialize Laravel environment
#
@servers(['aws' => 'ec2-52-192-13-191.ap-northeast-1.compute.amazonaws.com'])
@setup
$projectName = 'l5essential';
$userName = 'vagrant';
$homePath = '/home/' . $userName;
$codePath = $homePath . '/code';
$basePath = $codePath . '/' . $projectName;
$repoUrl = 'git@github.com:appkr/l5essential.git';
$domainName = 'l5essential.appkr.kr';
@endsetup
@task('hello_envoy', ['on' => 'aws'])
echo "Hello Envoy!";
@endtask
@task('release', ['on' => 'aws', 'confirm' => true])
# pull code from the repository.
cd {{ $basePath }} && git pull;
@endtask
@task('provision', ['on' => 'aws', 'confirm' => true])
# curl https://raw.githubusercontent.com/appkr/l5essential/master/provision.sh -O {{ $homePath }}/provision.sh
# curl https://raw.githubusercontent.com/appkr/l5essential/master/serve.sh -O {{ $homePath }}/serve.sh
# Install and set required server packages... e.g. php, mysql, ...
{{ $homePath }}/provision.sh {{ $userName }};
# Configure nginx for domain endpoint and server path.
{{ $homePath }}/serve.sh {{ $domainName }} {{$basePath}}/public;
@endtask
@task('init', ['on' => 'aws', 'confirm' => true])
# Make a directory at server, which will house the codes.
if [ ! -d {{ $codePath }} ]; then
mkdir {{ $codePath}};
fi;
# Clone the source from the git repository.
cd {{ $codePath }} && git clone -b master {{ $repoUrl }} {{ $projectName }};
# Run composer.
cd {{ $basePath }} && composer install;
# Make application key.
php {{ $basePath }}/artisan key:generate;
# Make 'attachments' direcotry, whil will hold file uploads from users.
if [ ! -d {{ $basePath }}/public/attachments ]; then
mkdir {{ $basePath }}/public/attachments;
fi;
# Set directory permission.
chmod -R 777 {{ $basePath }}/storage {{ $basePath }}/bootstrap/cache {{ $basePath }}/public/attachments;
# Run migration.
php {{ $basePath }}/artisan migrate;
# Run seeding.
php {{ $basePath }}/artisan db:seed;
@endtask