fix: server is functional check

This commit is contained in:
Andras Bacsai 2023-09-12 13:14:01 +02:00
parent c76a1b1ba5
commit ab021ee535
7 changed files with 11 additions and 8 deletions

View File

@ -58,7 +58,7 @@ public function submit()
{
$this->validate();
try {
if (!$this->private_key_id) {
if (is_null($this->private_key_id)) {
return $this->emit('error', 'You must select a private key');
}
$server = Server::create([

View File

@ -17,7 +17,7 @@ public function proxyStatusUpdated()
public function getProxyStatus()
{
try {
if (data_get($this->server, 'settings.is_usable') && data_get($this->server, 'settings.is_reachable')) {
if ($this->server->isFunctional()) {
$container = getContainerStatus(server: $this->server, container_id: 'coolify-proxy');
$this->server->proxy->status = $container;
$this->server->save();

View File

@ -36,11 +36,11 @@ public function handle(): void
return;
}
try {
ray()->showQueries()->color('orange');
// ray()->showQueries()->color('orange');
$servers = Server::all();
foreach ($servers as $server) {
if (
!$server->settings->is_reachable && !$server->settings->is_usable
!$server->isFunctional()
) {
continue;
}

View File

@ -153,4 +153,7 @@ public function isProxyShouldRun()
}
return $shouldRun;
}
public function isFunctional() {
return $this->settings->is_reachable && $this->settings->is_usable;
}
}

View File

@ -1,5 +1,5 @@
<div>
@if ($server->settings->is_usable)
@if ($server->isFunctional())
<div class="flex items-end gap-2">
<h2>Destinations</h2>
<a href="{{ route('destination.new', ['server_id' => $server->id]) }}">

View File

@ -20,7 +20,7 @@
@endif
</div>
@if (!$server->settings->is_reachable || !$server->settings->is_usable)
@if (!$server->isFunctional())
You can't use this server until it is validated.
@else
Server validated.
@ -57,7 +57,7 @@
Install Docker Engine 24.0
</x-forms.button>
@endif
@if ($server->settings->is_usable)
@if ($server->isFunctional())
<h3 class="py-4">Settings</h3>
<x-forms.input id="cleanup_after_percentage" label="Disk Cleanup threshold (%)" required
helper="Disk cleanup job will be executed if disk usage is more than this number." />

View File

@ -1,5 +1,5 @@
<div>
@if (data_get($server,'settings.is_usable'))
@if ($server->isFunctional())
@if (data_get($server,'proxy.type'))
<x-modal submitWireAction="proxyStatusUpdated" modalId="startProxy">
<x-slot:modalBody>