feat: healthcheck for apps

This commit is contained in:
Andras Bacsai
2023-09-22 15:29:19 +02:00
parent 67078fdc71
commit 3fc544e0b9
13 changed files with 126 additions and 35 deletions

View File

@@ -1,8 +1,8 @@
@props([
'text' => 'Degraded',
'status' => 'Degraded',
])
<x-loading wire:loading.delay />
<div class="flex items-center gap-2" wire:loading.remove.delay.longer>
<div class="badge badge-warning badge-xs"></div>
<div class="text-xs font-medium tracking-wide text-warning">{{ $text }}</div>
<div class="text-xs font-medium tracking-wide text-warning">{{ Str::headline($status) }}</div>
</div>

View File

@@ -1,7 +1,7 @@
@if ($status === 'running')
<x-status.running />
@elseif($status === 'restarting')
<x-status.restarting />
@if (Str::of($status)->startsWith('running'))
<x-status.running :status="$status" />
@elseif(Str::of($status)->startsWith('restarting'))
<x-status.restarting :status="$status" />
@else
<x-status.stopped />
<x-status.stopped :status="$status" />
@endif

View File

@@ -1,8 +1,8 @@
@props([
'text' => 'Restarting',
'status' => 'Restarting',
])
<x-loading wire:loading.delay />
<div class="flex items-center gap-2" wire:loading.remove.delay.longer>
<div class="badge badge-warning badge-xs"></div>
<div class="text-xs font-medium tracking-wide text-warning">{{ $text }}</div>
<div class="text-xs font-medium tracking-wide text-warning">{{ Str::headline($status) }}</div>
</div>

View File

@@ -1,8 +1,8 @@
@props([
'text' => 'Running',
'status' => 'Running',
])
<x-loading wire:loading.delay.longer />
<div class="flex items-center gap-2 " wire:loading.remove.delay.longer>
<div class="badge badge-success badge-xs"></div>
<div class="text-xs font-medium tracking-wide text-success">{{ $text }}</div>
<div class="text-xs font-medium tracking-wide text-success">{{ Str::headline($status) }}</div>
</div>

View File

@@ -1,9 +1,9 @@
@if ($complexStatus === 'running')
<x-status.running />
@elseif($complexStatus === 'restarting')
<x-status.restarting />
@elseif($complexStatus === 'degraded')
<x-status.degraded />
@if (Str::of($complexStatus)->startsWith('running'))
<x-status.running :status="$complexStatus" />
@elseif(Str::of($complexStatus)->startsWith('restarting'))
<x-status.restarting :status="$complexStatus" />
@elseif(Str::of($complexStatus)->startsWith('degraded'))
<x-status.degraded :status="$complexStatus" />
@else
<x-status.stopped />
<x-status.stopped :status="$complexStatus" />
@endif

View File

@@ -1,8 +1,8 @@
@props([
'text' => 'Stopped',
'status' => 'Stopped',
])
<x-loading wire:loading.delay.longer />
<div class="flex items-center gap-2 " wire:loading.remove.delay.longer>
<div class="badge badge-error badge-xs"></div>
<div class="text-xs font-medium tracking-wide text-error">{{ $text }}</div>
<div class="text-xs font-medium tracking-wide text-error">{{ Str::headline($status) }}</div>
</div>

View File

@@ -53,12 +53,12 @@
@foreach ($application->previews as $preview)
<div class="flex flex-col p-4 bg-coolgray-200">
<div class="flex gap-2">PR #{{ data_get($preview, 'pull_request_id') }} |
@if (data_get($preview, 'status') === 'running')
<x-status.running />
@elseif (data_get($preview, 'status') === 'restarting')
<x-status.restarting />
@if (Str::of(data_get($preview, 'status'))->startsWith('running'))
<x-status.running :status="$status" />
@elseif(Str::of(data_get($preview, 'status'))->startsWith('restarting'))
<x-status.restarting :status="$status" />
@else
<x-status.stopped />
<x-status.stopped :status="$status" />
@endif
@if (data_get($preview, 'status') !== 'exited')
| <a target="_blank" href="{{ data_get($preview, 'fqdn') }}">Open Preview

View File

@@ -0,0 +1,28 @@
<form wire:submit.prevent='submit' class="flex flex-col">
<div class="flex items-center gap-2">
<h2>Health Checks</h2>
<x-forms.button type="submit">Save</x-forms.button>
</div>
<div class="pb-4">Define how your resource's health should be checked.</div>
<div class="flex flex-col gap-4">
<div class="flex gap-2">
<x-forms.input id="resource.health_check_method" placeholder="GET" label="Method" required />
<x-forms.input id="resource.health_check_scheme" placeholder="http" label="Scheme" required />
<x-forms.input id="resource.health_check_host" placeholder="localhost" label="Host" required />
<x-forms.input id="resource.health_check_port"
helper="If no port is defined, the first exposed port will be used." placeholder="80" label="Port" />
<x-forms.input id="resource.health_check_path" placeholder="/health" label="Path" required />
</div>
<div class="flex gap-2">
<x-forms.input id="resource.health_check_return_code" placeholder="200" label="Return Code" required />
<x-forms.input id="resource.health_check_response_text" placeholder="OK" label="Response Text" />
</div>
<div class="flex gap-2">
<x-forms.input id="resource.health_check_interval" placeholder="30" label="Interval" required />
<x-forms.input id="resource.health_check_timeout" placeholder="30" label="Timeout" required />
<x-forms.input id="resource.health_check_retries" placeholder="3" label="Retries" required />
<x-forms.input id="resource.health_check_start_period" placeholder="30" label="Start Period" required />
</div>
</div>
</form>

View File

@@ -26,6 +26,9 @@
Deployments
</a>
@endif
<a :class="activeTab === 'health' && 'text-white'"
@click.prevent="activeTab = 'health'; window.location.hash = 'health'" href="#">Health Checks
</a>
<a :class="activeTab === 'rollback' && 'text-white'"
@click.prevent="activeTab = 'rollback'; window.location.hash = 'rollback'" href="#">Rollback
</a>
@@ -58,6 +61,9 @@
<div x-cloak x-show="activeTab === 'previews'">
<livewire:project.application.previews :application="$application" />
</div>
<div x-cloak x-show="activeTab === 'health'">
<livewire:project.shared.health-checks :resource="$application" />
</div>
<div x-cloak x-show="activeTab === 'rollback'">
<livewire:project.application.rollback :application="$application" />
</div>