fix: errors

This commit is contained in:
Andras Bacsai
2023-09-18 11:49:26 +02:00
parent df433efe62
commit 9646969107
8 changed files with 58 additions and 16 deletions

View File

@@ -15,6 +15,7 @@ class Form extends Component
public $dockerVersion;
public string|null $wildcard_domain = null;
public int $cleanup_after_percentage;
public bool $dockerInstallationStarted = false;
protected $rules = [
'server.name' => 'required|min:6',
@@ -44,6 +45,7 @@ class Form extends Component
public function installDocker()
{
$this->dockerInstallationStarted = true;
$activity = resolve(InstallDocker::class)($this->server);
$this->emit('newMonitorActivity', $activity->id);
}
@@ -56,7 +58,10 @@ class Form extends Component
$this->uptime = $uptime;
$this->emit('success', 'Server is reachable.');
} else {
ray($this->uptime);
$this->emit('error', 'Server is not reachable.');
return;
}
if ($dockerVersion) {

View File

@@ -2,6 +2,7 @@
namespace App\Http\Livewire\Server\Proxy;
use App\Jobs\ContainerStatusJob;
use App\Models\Server;
use Livewire\Component;
@@ -18,9 +19,7 @@ class Status extends Component
{
try {
if ($this->server->isFunctional()) {
$container = getContainerStatus(server: $this->server, container_id: 'coolify-proxy');
$this->server->proxy->status = $container;
$this->server->save();
dispatch_sync(new ContainerStatusJob($this->server));
$this->emit('proxyStatusUpdated');
}
} catch (\Throwable $e) {

View File

@@ -37,14 +37,27 @@ class ShowPrivateKey extends Component
try {
['uptime' => $uptime, 'dockerVersion' => $dockerVersion] = validateServer($this->server, true);
if ($uptime) {
$this->server->settings->update([
'is_reachable' => true
]);
$this->emit('success', 'Server is reachable with this private key.');
} else {
$this->server->settings->update([
'is_reachable' => false,
'is_usable' => false
]);
$this->emit('error', 'Server is not reachable with this private key.');
return;
}
if ($dockerVersion) {
$this->server->settings->update([
'is_usable' => true
]);
$this->emit('success', 'Server is usable for Coolify.');
} else {
$this->server->settings->update([
'is_usable' => false
]);
$this->emit('error', 'Old (lower than 23) or no Docker version detected. Install Docker Engine on the General tab.');
}
} catch (\Throwable $e) {