Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: server stopped, service page not reachable

Andras Bacsaib39ac73cd80d
diff --git a/app/Actions/Proxy/CheckProxy.php b/app/Actions/Proxy/CheckProxy.php
index 41f961b592..5a1ae56cfa 100644
--- a/app/Actions/Proxy/CheckProxy.php
+++ b/app/Actions/Proxy/CheckProxy.php
@@ -46,14 +46,14 @@ class CheckProxy
$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;
}
diff --git a/app/Livewire/Project/Shared/GetLogs.php b/app/Livewire/Project/Shared/GetLogs.php
index 5a2053fc47..0d7510ef1e 100644
--- a/app/Livewire/Project/Shared/GetLogs.php
+++ b/app/Livewire/Project/Shared/GetLogs.php
@@ -71,6 +71,9 @@ class GetLogs extends Component
}
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();
diff --git a/app/Livewire/Project/Shared/Logs.php b/app/Livewire/Project/Shared/Logs.php
index 2958a31fd0..d200ca69e7 100644
--- a/app/Livewire/Project/Shared/Logs.php
+++ b/app/Livewire/Project/Shared/Logs.php
@@ -29,6 +29,9 @@ class Logs extends Component
{
try {
$server = $this->servers->firstWhere('id', $server_id);
+ if (!$server->isFunctional()) {
+ return;
+ }
if ($server->isSwarm()) {
$containers = collect([
[
@@ -96,7 +99,6 @@ class Logs extends Component
$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);
}
diff --git a/resources/views/livewire/project/shared/logs.blade.php b/resources/views/livewire/project/shared/logs.blade.php
index a505361ddf..d681d06172 100644
--- a/resources/views/livewire/project/shared/logs.blade.php
+++ b/resources/views/livewire/project/shared/logs.blade.php
@@ -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