Refactor healthcheck configurations in Docker Compose files
This commit is contained in:
@@ -32,6 +32,7 @@ const DATABASE_DOCKER_IMAGES = [
|
||||
];
|
||||
const SPECIFIC_SERVICES = [
|
||||
'quay.io/minio/minio',
|
||||
'svhd/logto'
|
||||
];
|
||||
|
||||
// Based on /etc/os-release
|
||||
|
||||
@@ -169,7 +169,7 @@ function defaultLabels($id, $name, $pull_request_id = 0, string $type = 'applica
|
||||
}
|
||||
return $labels;
|
||||
}
|
||||
function generateServiceSpecificFqdns(ServiceApplication|Application $resource, $forTraefik = false)
|
||||
function generateServiceSpecificFqdns(ServiceApplication|Application $resource)
|
||||
{
|
||||
if ($resource->getMorphClass() === 'App\Models\ServiceApplication') {
|
||||
$uuid = $resource->uuid;
|
||||
@@ -204,17 +204,31 @@ function generateServiceSpecificFqdns(ServiceApplication|Application $resource,
|
||||
"value" => generateFqdn($server, 'minio-' . $uuid)
|
||||
]);
|
||||
}
|
||||
if ($forTraefik) {
|
||||
$payload = collect([
|
||||
$MINIO_BROWSER_REDIRECT_URL->value . ':9001',
|
||||
$MINIO_SERVER_URL->value . ':9000',
|
||||
]);
|
||||
} else {
|
||||
$payload = collect([
|
||||
$MINIO_BROWSER_REDIRECT_URL->value,
|
||||
$MINIO_SERVER_URL->value,
|
||||
$payload = collect([
|
||||
$MINIO_BROWSER_REDIRECT_URL->value . ':9001',
|
||||
$MINIO_SERVER_URL->value . ':9000',
|
||||
]);
|
||||
break;
|
||||
case $type?->contains('logto'):
|
||||
$LOGTO_ENDPOINT = $variables->where('key', 'LOGTO_ENDPOINT')->first();
|
||||
$LOGTO_ADMIN_ENDPOINT = $variables->where('key', 'LOGTO_ADMIN_ENDPOINT')->first();
|
||||
if (is_null($LOGTO_ENDPOINT) || is_null($LOGTO_ADMIN_ENDPOINT)) {
|
||||
return $payload;
|
||||
}
|
||||
if (is_null($LOGTO_ENDPOINT?->value)) {
|
||||
$LOGTO_ENDPOINT?->update([
|
||||
"value" => generateFqdn($server, 'logto-' . $uuid)
|
||||
]);
|
||||
}
|
||||
if (is_null($LOGTO_ADMIN_ENDPOINT?->value)) {
|
||||
$LOGTO_ADMIN_ENDPOINT?->update([
|
||||
"value" => generateFqdn($server, 'logto-admin-' . $uuid)
|
||||
]);
|
||||
}
|
||||
$payload = collect([
|
||||
$LOGTO_ENDPOINT->value . ':3001',
|
||||
$LOGTO_ADMIN_ENDPOINT->value . ':3002',
|
||||
]);
|
||||
break;
|
||||
}
|
||||
return $payload;
|
||||
|
||||
@@ -1121,10 +1121,9 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add labels to the service
|
||||
if ($savedService->serviceType()) {
|
||||
$fqdns = generateServiceSpecificFqdns($savedService, forTraefik: true);
|
||||
$fqdns = generateServiceSpecificFqdns($savedService);
|
||||
} else {
|
||||
$fqdns = collect(data_get($savedService, 'fqdns'))->filter();
|
||||
}
|
||||
@@ -1578,7 +1577,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
||||
}
|
||||
// Add labels to the service
|
||||
if ($resource->serviceType()) {
|
||||
$fqdns = generateServiceSpecificFqdns($resource, forTraefik: true);
|
||||
$fqdns = generateServiceSpecificFqdns($resource);
|
||||
} else {
|
||||
$domains = collect(json_decode($resource->docker_compose_domains)) ?? [];
|
||||
if ($domains) {
|
||||
|
||||
Reference in New Issue
Block a user