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
fix(api): respect service_name query param in application logs endpoint
Furox-Arta9a9f0f30f95
diff --git a/app/Http/Controllers/Api/ApplicationsController.php b/app/Http/Controllers/Api/ApplicationsController.phpindex c45e03a281..6e82c01945 100644--- a/app/Http/Controllers/Api/ApplicationsController.php+++ b/app/Http/Controllers/Api/ApplicationsController.php@@ -2472,6 +2472,13 @@ class ApplicationsController extends Controllerrequired: false,schema: new OA\Schema(type: 'boolean', default: false),),+ new OA\Parameter(+ name: 'service_name',+ in: 'query',+ description: 'For Docker Compose applications, return logs only from the Compose service with this name. Returns 404 when no running container matches. Ignored for non-Compose applications.',+ required: false,+ schema: new OA\Schema(type: 'string'),+ ),],responses: [new OA\Response(@@ -2597,7 +2604,27 @@ class ApplicationsController extends Controller], 400);}- $container = $containers->first();+ $serviceName = $request->query('service_name');+ if (filled($serviceName)) {+ $matchingContainer = $containers->first(function ($container) use ($serviceName) {+ $labels = data_get($container, 'Labels');++ return $labels !== null && preg_match(+ '/(?:^|,)com\.docker\.compose\.service='.preg_quote($serviceName, '/').'(?:,|$)/',+ $labels+ ) === 1;+ });++ if (! $matchingContainer) {+ return response()->json([+ 'message' => "No running container found for service_name '{$serviceName}'.",+ ], 404);+ }++ $container = $matchingContainer;+ } else {+ $container = $containers->first();+ }$status = getContainerStatus($application->destination->server, $container['Names']);if ($status !== 'running') {