forked from ChristopherDosin/laravel-cloud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WebServer.php
53 lines (46 loc) · 1.06 KB
/
WebServer.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
<?php
namespace App;
use Carbon\Carbon;
use Illuminate\Support\Str;
use App\Jobs\ProvisionWebServer;
class WebServer extends HttpServer
{
/**
* Determine if this server will run a given deployment command.
*
* @param string $command
* @return bool
*/
public function runsCommand($command)
{
return ! Str::startsWith($command, 'worker:');
}
/**
* Determine if this server is the "master" server for the stack.
*
* @return bool
*/
public function isMaster()
{
return $this->is($this->stack->masterServer());
}
/**
* Dispatch the job to provision the server.
*
* @return void
*/
public function provision()
{
ProvisionWebServer::dispatch($this);
$this->update(['provisioning_job_dispatched_at' => Carbon::now()]);
}
/**
* Get the provisioning script for the server.
*
* @return \App\Scripts\Script
*/
public function provisioningScript()
{
return new Scripts\ProvisionWebServer($this);
}
}