29.07.2016 Views

laravel-5

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Envoy Task Runner 343<br />

.<br />

1 @servers(['web-1' => '192.168.1.1', 'web-2' => '192.168.1.2'])<br />

2<br />

3 @task('deploy', ['on' => ['web-1', 'web-2']])<br />

4 cd site<br />

5 git pull origin {{ $branch }}<br />

6 php artisan migrate<br />

7 @endtask<br />

By default, the task will be executed on each server serially. Meaning, the task will finish running<br />

on the first server before proceeding to execute on the next server.<br />

Parallel Execution<br />

If you would like to run a task across multiple servers in parallel, add the parallel option to your<br />

task declaration:<br />

.<br />

1 @servers(['web-1' => '192.168.1.1', 'web-2' => '192.168.1.2'])<br />

2<br />

3 @task('deploy', ['on' => ['web-1', 'web-2'], 'parallel' => true])<br />

4 cd site<br />

5 git pull origin {{ $branch }}<br />

6 php artisan migrate<br />

7 @endtask<br />

Task Macros<br />

Macros allow you to define a set of tasks to be run in sequence using a single command. For instance,<br />

a deploy macro may run the git and composer tasks:<br />

.<br />

1 @servers(['web' => '192.168.1.1'])<br />

2<br />

3 @macro('deploy')<br />

4 git<br />

5 composer<br />

6 @endmacro<br />

7<br />

8 @task('git')<br />

9 git pull origin master<br />

10 @endtask

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!