fix: server stopped, service page not reachable
This commit is contained in:
parent
adf5c9bd46
commit
b39ac73cd8
@ -46,14 +46,14 @@ public function handle(Server $server, $fromUI = false)
|
||||
$port443 = is_resource($connection443) && fclose($connection443);
|
||||
if ($port80) {
|
||||
if ($fromUI) {
|
||||
throw new \Exception("Port 80 is in use.<br>You must stop the process using this port.<br>Docs: <a target='_blank' href='https://coolify.io/docs'>https://coolify.io/docs</a> <br> Discord: <a target='_blank' href='https://coollabs.io/discord'>https://coollabs.io/discord</a>");
|
||||
throw new \Exception("Port 80 is in use.<br>You must stop the process using this port.<br>Docs: <a target='_blank' href='https://coolify.io/docs'>https://coolify.io/docs</a><br>Discord: <a target='_blank' href='https://coollabs.io/discord'>https://coollabs.io/discord</a>");
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if ($port443) {
|
||||
if ($fromUI) {
|
||||
throw new \Exception("Port 443 is in use.<br>You must stop the process using this port.<br>Docs: <a target='_blank' href='https://coolify.io/docs'>https://coolify.io/docs</a> <br> Discord: <a target='_blank' href='https://coollabs.io/discord'>https://coollabs.io/discord</a>");
|
||||
throw new \Exception("Port 443 is in use.<br>You must stop the process using this port.<br>Docs: <a target='_blank' href='https://coolify.io/docs'>https://coolify.io/docs</a><br>Discord: <a target='_blank' href='https://coollabs.io/discord'>https://coollabs.io/discord</a>");
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -71,6 +71,9 @@ public function instantSave()
|
||||
}
|
||||
public function getLogs($refresh = false)
|
||||
{
|
||||
if (!$this->server->isFunctional()) {
|
||||
return;
|
||||
}
|
||||
if ($this->resource?->getMorphClass() === 'App\Models\Application') {
|
||||
if (str($this->container)->contains('-pr-')) {
|
||||
$this->pull_request = "Pull Request: " . str($this->container)->afterLast('-pr-')->beforeLast('_')->value();
|
||||
|
@ -29,6 +29,9 @@ public function loadContainers($server_id)
|
||||
{
|
||||
try {
|
||||
$server = $this->servers->firstWhere('id', $server_id);
|
||||
if (!$server->isFunctional()) {
|
||||
return;
|
||||
}
|
||||
if ($server->isSwarm()) {
|
||||
$containers = collect([
|
||||
[
|
||||
@ -96,7 +99,6 @@ public function mount()
|
||||
$this->resource->databases()->get()->each(function ($database) {
|
||||
$this->containers->push(data_get($database, 'name') . '-' . data_get($this->resource, 'uuid'));
|
||||
});
|
||||
|
||||
if ($this->resource->server->isFunctional()) {
|
||||
$this->servers = $this->servers->push($this->resource->server);
|
||||
}
|
||||
|
@ -7,16 +7,18 @@
|
||||
<div class="pt-2" wire:loading wire:target="loadContainers">
|
||||
Loading containers...
|
||||
</div>
|
||||
@foreach ($servers as $server)
|
||||
@forelse ($servers as $server)
|
||||
<h3 x-init="$wire.loadContainers({{ $server->id }})"></h3>
|
||||
<div wire:loading.remove wire:target="loadContainers">
|
||||
@forelse (data_get($server,'containers',[]) as $container)
|
||||
<livewire:project.shared.get-logs :server="$server" :resource="$resource" :container="data_get($container,'Names')" />
|
||||
<livewire:project.shared.get-logs :server="$server" :resource="$resource" :container="data_get($container, 'Names')" />
|
||||
@empty
|
||||
<div class="pt-2">No containers are not running on server: {{$server->name}}</div>
|
||||
<div class="pt-2">No containers are not running on server: {{ $server->name }}</div>
|
||||
@endforelse
|
||||
</div>
|
||||
@endforeach
|
||||
@empty
|
||||
<div>No functional server found for the application.</div>
|
||||
@endforelse
|
||||
</div>
|
||||
@elseif ($type === 'database')
|
||||
<h1>Logs</h1>
|
||||
@ -26,7 +28,11 @@
|
||||
@if ($loop->first)
|
||||
<h2 class="pb-4">Logs</h2>
|
||||
@endif
|
||||
<livewire:project.shared.get-logs :server="$servers[0]" :resource="$resource" :container="$container" />
|
||||
@if (data_get($servers, '0'))
|
||||
<livewire:project.shared.get-logs :server="data_get($servers, '0')" :resource="$resource" :container="$container" />
|
||||
@else
|
||||
<div> No functional server found for the database.</div>
|
||||
@endif
|
||||
@empty
|
||||
<div class="pt-2">No containers are not running.</div>
|
||||
@endforelse
|
||||
@ -37,7 +43,11 @@
|
||||
@if ($loop->first)
|
||||
<h2 class="pb-4">Logs</h2>
|
||||
@endif
|
||||
<livewire:project.shared.get-logs :server="$servers[0]" :resource="$resource" :container="$container" />
|
||||
@if (data_get($servers, '0'))
|
||||
<livewire:project.shared.get-logs :server="data_get($servers, '0')" :resource="$resource" :container="$container" />
|
||||
@else
|
||||
<div> No functional server found for the service.</div>
|
||||
@endif
|
||||
@empty
|
||||
<div class="pt-2">No containers are not running.</div>
|
||||
@endforelse
|
||||
|
Loading…
Reference in New Issue
Block a user