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.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
refactor(api): modify service sub container retrieval filter to use coolify.name
Yanluis Ferminc239b8bbba07
diff --git a/app/Http/Controllers/Api/ServicesController.php b/app/Http/Controllers/Api/ServicesController.phpindex 299af54e0e..edec32db56 100644--- a/app/Http/Controllers/Api/ServicesController.php+++ b/app/Http/Controllers/Api/ServicesController.php@@ -536,14 +536,8 @@ class ServicesController extends Controllerreturn response()->json(['message' => 'Service not found.'], 404);}- $containers = getCurrentServiceSubContainerStatus($service->destination->server, $service->id, $subServiceName);-- if ($containers->count() == 0) {- return response()->json([- 'message' => 'Service is not running.',- ], 400);- }-+ $name = "{$subServiceName}-{$service->uuid}";+ $containers = getCurrentServiceSubContainerStatus($service->destination->server, $service->id, $name);$container = $containers->first();if (! $container) {diff --git a/bootstrap/helpers/docker.php b/bootstrap/helpers/docker.phpindex 26704060c4..87dc473362 100644--- a/bootstrap/helpers/docker.php+++ b/bootstrap/helpers/docker.php@@ -66,11 +66,11 @@ function getCurrentDatabaseContainerStatus(Server $server, int $id): Collectionreturn $containers;}-function getCurrentServiceSubContainerStatus(Server $server, int $id, string $subName): Collection+function getCurrentServiceSubContainerStatus(Server $server, int $id, string $name): Collection{$containers = collect([]);if (! $server->isSwarm()) {- $containers = instant_remote_process(["docker ps -a --filter='label=coolify.serviceId={$id}' --filter='label=coolify.service.subName={$subName}' --format '{{json .}}' "], $server);+ $containers = instant_remote_process(["docker ps -a --filter='label=coolify.serviceId={$id}' --filter='label=coolify.name={$name}' --format '{{json .}}' "], $server);$containers = format_docker_command_output_to_json($containers);return $containers->filter();