Skip to content

Commit 88e0c5c

Browse files
authored
Merge pull request #223 from laravel/feat/unhealthy-solution
[1.x] Provides users to relevent log when environment detected as unhealthy
2 parents 77f86c2 + b9432ce commit 88e0c5c

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

src/Models/Deployment.php

+1
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ public function solutions()
154154
Solutions\ResourceUpdateInProgress::class,
155155
Solutions\RunDeploymentHooksTimedOut::class,
156156
Solutions\EnvironmentVariableLimitReached::class,
157+
Solutions\EnvironmentIsUnhealthy::class,
157158
])->map(function ($solutionsClass) {
158159
return new $solutionsClass($this);
159160
})->filter
+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
3+
namespace Laravel\VaporCli\Solutions;
4+
5+
use Illuminate\Support\Str;
6+
use Laravel\VaporCli\Deployment;
7+
8+
class EnvironmentIsUnhealthy
9+
{
10+
/**
11+
* The deployment that have failed.
12+
*
13+
* @var \Laravel\VaporCli\Deployment
14+
*/
15+
protected $deployment;
16+
17+
/**
18+
* Create a new solution instance.
19+
*
20+
* @param \Laravel\VaporCli\Deployment $deployment
21+
* @return void
22+
*/
23+
public function __construct($deployment)
24+
{
25+
$this->deployment = $deployment;
26+
}
27+
28+
/**
29+
* Checks if the solution is applicable.
30+
*
31+
* @return bool
32+
*/
33+
public function applicable()
34+
{
35+
return Str::contains($this->deployment->status_message, [
36+
'Unable to obtain a healthy response from the environment being deployed.',
37+
]);
38+
}
39+
40+
/**
41+
* Returns the list of solutions based on the deployment.
42+
*
43+
* @return array
44+
*/
45+
public function all()
46+
{
47+
return [
48+
'Review "CLI" environment logs: https://vapor.laravel.com/app/projects/'.$this->deployment->project_id.'/environments/'.$this->deployment->environment['name'].'/logs?period=5m&type=cli',
49+
];
50+
}
51+
}

0 commit comments

Comments
 (0)