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: show defined resources in server tab, so you will know what you need to delete before you can delete the server.

Andras Bacsaid396f649dfc6
diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php
index 73cf55fcdd..58d0dbb6af 100644
--- a/app/Http/Controllers/ProjectController.php
+++ b/app/Http/Controllers/ProjectController.php
@@ -137,7 +137,7 @@ class ProjectController extends Controller
}
$service->parse(isNew: true);
- return redirect()->route('project.service', [
+ return redirect()->route('project.service.configuration', [
'service_uuid' => $service->uuid,
'environment_name' => $environment->name,
'project_uuid' => $project->uuid,
diff --git a/app/Http/Livewire/Project/New/DockerCompose.php b/app/Http/Livewire/Project/New/DockerCompose.php
index 81c487ccfc..cd0d86c088 100644
--- a/app/Http/Livewire/Project/New/DockerCompose.php
+++ b/app/Http/Livewire/Project/New/DockerCompose.php
@@ -129,7 +129,7 @@ class DockerCompose extends Component
$service->parse(isNew: true);
- return redirect()->route('project.service', [
+ return redirect()->route('project.service.configuration', [
'service_uuid' => $service->uuid,
'environment_name' => $environment->name,
'project_uuid' => $project->uuid,
diff --git a/app/Http/Livewire/Project/Service/Application.php b/app/Http/Livewire/Project/Service/Application.php
index 14fd3d5ab4..622b1e0e21 100644
--- a/app/Http/Livewire/Project/Service/Application.php
+++ b/app/Http/Livewire/Project/Service/Application.php
@@ -41,7 +41,7 @@ class Application extends Component
try {
$this->application->delete();
$this->emit('success', 'Application deleted successfully.');
- return redirect()->route('project.service', $this->parameters);
+ return redirect()->route('project.service.configuration', $this->parameters);
} catch (\Throwable $e) {
return handleError($e, $this);
}
diff --git a/app/Models/Application.php b/app/Models/Application.php
index ee7ccf60bb..20f61ed39f 100644
--- a/app/Models/Application.php
+++ b/app/Models/Application.php
@@ -47,7 +47,14 @@ class Application extends BaseModel
$application->environment_variables_preview()->delete();
});
}
-
+ public function link()
+ {
+ return route('project.application.configuration', [
+ 'project_uuid' => $this->environment->project->uuid,
+ 'environment_name' => $this->environment->name,
+ 'application_uuid' => $this->uuid
+ ]);
+ }
public function settings()
{
return $this->hasOne(ApplicationSetting::class);
diff --git a/app/Models/Server.php b/app/Models/Server.php
index 8df4c1e3f3..5aa5714524 100644
--- a/app/Models/Server.php
+++ b/app/Models/Server.php
@@ -194,6 +194,12 @@ class Server extends BaseModel
{
return instant_remote_process(["df /| tail -1 | awk '{ print $5}' | sed 's/%//g'"], $this, false);
}
+ public function definedResources() {
+ $applications = $this->applications();
+ $databases = $this->databases();
+ $services = $this->services();
+ return $applications->concat($databases)->concat($services->get());
+ }
public function hasDefinedResources()
{
$applications = $this->applications()->count() > 0;
diff --git a/app/Models/Service.php b/app/Models/Service.php
index a05c989b8e..345e4db921 100644
--- a/app/Models/Service.php
+++ b/app/Models/Service.php
@@ -361,6 +361,14 @@ class Service extends BaseModel
}
}
}
+ public function link()
+ {
+ return route('project.service.configuration', [
+ 'project_uuid' => $this->environment->project->uuid,
+ 'environment_name' => $this->environment->name,
+ 'service_uuid' => $this->uuid
+ ]);
+ }
public function documentation()
{
$services = getServiceTemplates();
diff --git a/app/Models/StandaloneMariadb.php b/app/Models/StandaloneMariadb.php
index cb9fa9aa28..ca7221d7cf 100644
--- a/app/Models/StandaloneMariadb.php
+++ b/app/Models/StandaloneMariadb.php
@@ -41,6 +41,14 @@ class StandaloneMariadb extends BaseModel
$database->environment_variables()->delete();
});
}
+ public function link()
+ {
+ return route('project.database.configuration', [
+ 'project_uuid' => $this->environment->project->uuid,
+ 'environment_name' => $this->environment->name,
+ 'database_uuid' => $this->uuid
+ ]);
+ }
public function isLogDrainEnabled()
{
return data_get($this, 'is_log_drain_enabled', false);
diff --git a/app/Models/StandaloneMongodb.php b/app/Models/StandaloneMongodb.php
index 3a5b7a52a8..598719acf1 100644
--- a/app/Models/StandaloneMongodb.php
+++ b/app/Models/StandaloneMongodb.php
@@ -48,6 +48,14 @@ class StandaloneMongodb extends BaseModel
{
return data_get($this, 'is_log_drain_enabled', false);
}
+ public function link()
+ {
+ return route('project.database.configuration', [
+ 'project_uuid' => $this->environment->project->uuid,
+ 'environment_name' => $this->environment->name,
+ 'database_uuid' => $this->uuid
+ ]);
+ }
public function mongoInitdbRootPassword(): Attribute
{
return Attribute::make(
diff --git a/app/Models/StandaloneMysql.php b/app/Models/StandaloneMysql.php
index 6de57cb738..4cbee006e3 100644
--- a/app/Models/StandaloneMysql.php
+++ b/app/Models/StandaloneMysql.php
@@ -41,6 +41,14 @@ class StandaloneMysql extends BaseModel
$database->environment_variables()->delete();
});
}
+ public function link()
+ {
+ return route('project.database.configuration', [
+ 'project_uuid' => $this->environment->project->uuid,
+ 'environment_name' => $this->environment->name,
+ 'database_uuid' => $this->uuid
+ ]);
+ }
public function type(): string
{
return 'standalone-mysql';
diff --git a/app/Models/StandalonePostgresql.php b/app/Models/StandalonePostgresql.php
index 1bef3b6c99..0056f9b511 100644
--- a/app/Models/StandalonePostgresql.php
+++ b/app/Models/StandalonePostgresql.php
@@ -41,7 +41,14 @@ class StandalonePostgresql extends BaseModel
$database->environment_variables()->delete();
});
}
-
+ public function link()
+ {
+ return route('project.database.configuration', [
+ 'project_uuid' => $this->environment->project->uuid,
+ 'environment_name' => $this->environment->name,
+ 'database_uuid' => $this->uuid
+ ]);
+ }
public function isLogDrainEnabled()
{
return data_get($this, 'is_log_drain_enabled', false);
diff --git a/app/Models/StandaloneRedis.php b/app/Models/StandaloneRedis.php
index fe1281c22b..b2038d8af1 100644
--- a/app/Models/StandaloneRedis.php
+++ b/app/Models/StandaloneRedis.php
@@ -36,7 +36,14 @@ class StandaloneRedis extends BaseModel
$database->environment_variables()->delete();
});
}
-
+ public function link()
+ {
+ return route('project.database.configuration', [
+ 'project_uuid' => $this->environment->project->uuid,
+ 'environment_name' => $this->environment->name,
+ 'database_uuid' => $this->uuid
+ ]);
+ }
public function isLogDrainEnabled()
{
return data_get($this, 'is_log_drain_enabled', false);
diff --git a/resources/views/components/services/navbar.blade.php b/resources/views/components/services/navbar.blade.php
index 6c9af5f076..83facccec1 100644
--- a/resources/views/components/services/navbar.blade.php
+++ b/resources/views/components/services/navbar.blade.php
@@ -1,6 +1,6 @@
<div class="navbar-main">
- <a class="{{ request()->routeIs('project.service') ? 'text-white' : '' }}"
- href="{{ route('project.service', $parameters) }}">
+ <a class="{{ request()->routeIs('project.service.configuration') ? 'text-white' : '' }}"
+ href="{{ route('project.service.configuration', $parameters) }}">
<button>Configuration</button>
</a>
<x-services.links />
diff --git a/resources/views/livewire/project/service/show.blade.php b/resources/views/livewire/project/service/show.blade.php
index 4279045952..f556d6df82 100644
--- a/resources/views/livewire/project/service/show.blade.php
+++ b/resources/views/livewire/project/service/show.blade.php
@@ -2,8 +2,8 @@
<livewire:project.service.navbar :service="$service" :parameters="$parameters" :query="$query" />
<div class="flex h-full pt-6">
<div class="flex flex-col gap-4 min-w-fit">
- <a class="{{ request()->routeIs('project.service') ? 'text-white' : '' }}"
- href="{{ route('project.service', [...$parameters, 'service_name' => null]) }}">
+ <a class="{{ request()->routeIs('project.service.configuration') ? 'text-white' : '' }}"
+ href="{{ route('project.service.configuration', [...$parameters, 'service_name' => null]) }}">
<button><- Back</button>
</a>
<a :class="activeTab === 'general' && 'text-white'"
diff --git a/resources/views/livewire/server/delete.blade.php b/resources/views/livewire/server/delete.blade.php
index 1cf2e1d741..bc33f02331 100644
--- a/resources/views/livewire/server/delete.blade.php
+++ b/resources/views/livewire/server/delete.blade.php
@@ -11,12 +11,24 @@
<div class="pb-4">This will remove this server from Coolify. Beware! There is no coming
back!
</div>
- @if ($server->hasDefinedResources())
- <div class="text-warning">Please delete all resources before deleting this server.</div>
+ @if ($server->definedResources()->count() > 0)
+ <x-forms.button disabled isError isModal modalId="deleteServer">
+ Delete
+ </x-forms.button>
@else
<x-forms.button isError isModal modalId="deleteServer">
Delete
</x-forms.button>
@endif
+ @forelse ($server->definedResources() as $resource)
+ @if ($loop->first)
+ <div class="text-warning">Please delete all resources before deleting this server.</div>
+ @endif
+ <div class="flex gap-2">
+ <div class="w-64">{{ str($resource->type())->headline() }}</div>
+ <a class="text-white underline" href="{{ $resource->link() }}">{{ $resource->name }}</a>
+ </div>
+ @empty
+ @endforelse
@endif
</div>
diff --git a/resources/views/project/resources.blade.php b/resources/views/project/resources.blade.php
index a81982ec73..8e97bf3240 100644
--- a/resources/views/project/resources.blade.php
+++ b/resources/views/project/resources.blade.php
@@ -79,7 +79,7 @@
@endforeach
@foreach ($environment->services->sortBy('name') as $service)
<a class="relative box group"
- href="{{ route('project.service', [$project->uuid, $environment->name, $service->uuid]) }}">
+ href="{{ route('project.service.configuration', [$project->uuid, $environment->name, $service->uuid]) }}">
<div class="flex flex-col mx-6">
<div class="font-bold text-white">{{ $service->name }}</div>
<div class="description">{{ $service->description }}</div>
diff --git a/routes/web.php b/routes/web.php
index 18bad3bf59..1e276e738c 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -120,7 +120,7 @@ Route::middleware(['auth', 'verified'])->group(function () {
// Services
- Route::get('/project/{project_uuid}/{environment_name}/service/{service_uuid}', ServiceIndex::class)->name('project.service');
+ Route::get('/project/{project_uuid}/{environment_name}/service/{service_uuid}', ServiceIndex::class)->name('project.service.configuration');
Route::get('/project/{project_uuid}/{environment_name}/service/{service_uuid}/{service_name}', ServiceShow::class)->name('project.service.show');
Route::get('/project/{project_uuid}/{environment_name}/service/{service_uuid}/{service_name}/logs', Logs::class)->name('project.service.logs');
});