feat: services

This commit is contained in:
Andras Bacsai
2023-09-25 15:48:43 +02:00
parent 58522b59b7
commit 0b11093d18
27 changed files with 314 additions and 87 deletions

View File

@@ -130,7 +130,7 @@ function get_port_from_dockerfile($dockerfile): int
return 80;
}
function defaultLabels($id, $name, $pull_request_id = 0, string $type = 'application')
function defaultLabels($id, $name, $pull_request_id = 0, string $type = 'application', $subType = null, $subId = null)
{
$labels = collect([]);
$labels->push('coolify.managed=true');
@@ -141,6 +141,10 @@ function defaultLabels($id, $name, $pull_request_id = 0, string $type = 'applica
if ($pull_request_id !== 0) {
$labels->push('coolify.pullRequestId=' . $pull_request_id);
}
if ($type === 'service') {
$labels->push('coolify.service.subId=' . $subId);
$labels->push('coolify.service.subType=' . $subType);
}
return $labels;
}
function fqdnLabelsForTraefik(Collection $domains, $container_name, $is_force_https_enabled)

View File

@@ -25,6 +25,9 @@ function serviceStatus(Service $service)
$applications = $service->applications;
$databases = $service->databases;
foreach ($applications as $application) {
if ($application->ignore_from_status) {
continue;
}
if (Str::of($application->status)->startsWith('running')) {
$foundRunning = true;
} else {
@@ -32,6 +35,9 @@ function serviceStatus(Service $service)
}
}
foreach ($databases as $database) {
if ($database->ignore_from_status) {
continue;
}
if (Str::of($database->status)->startsWith('running')) {
$foundRunning = true;
} else {

View File

@@ -100,8 +100,7 @@ function handleError(?Throwable $error = null, ?Livewire\Component $livewire = n
return "Too many requests. Please try again in {$error->secondsUntilAvailable} seconds.";
}
if (isset($livewire)) {
$livewire->emit('error', $message);
throw new RuntimeException($message);
return $livewire->emit('error', $message);
}
throw new RuntimeException($message);