mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-06 13:10:37 -04:00
fix(healthcheck): replace the Dockerfile HEALTHCHECK when the healthcheck is enabled
Closes #10974 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
7ca08d87f9
commit
e200927ffd
@@ -2922,14 +2922,14 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
||||
|
||||
return;
|
||||
}
|
||||
if ($this->application->custom_healthcheck_found) {
|
||||
$this->application_deployment_queue->addLogEntry('Custom healthcheck found in Dockerfile.');
|
||||
if ($this->application->isHealthcheckDisabled()) {
|
||||
$this->application_deployment_queue->addLogEntry('Using the custom healthcheck from the Dockerfile.');
|
||||
}
|
||||
if ($this->container_name) {
|
||||
$escapedContainerName = escapeshellarg($this->container_name);
|
||||
$counter = 1;
|
||||
$this->application_deployment_queue->addLogEntry('Waiting for healthcheck to pass on the new container.');
|
||||
if ($this->full_healthcheck_url && ! $this->application->custom_healthcheck_found) {
|
||||
if ($this->full_healthcheck_url) {
|
||||
$healthcheckLabel = $this->application->health_check_type === 'cmd' ? 'Healthcheck command' : 'Healthcheck URL';
|
||||
$this->application_deployment_queue->addLogEntry("{$healthcheckLabel} (inside the container): {$this->full_healthcheck_url}");
|
||||
}
|
||||
@@ -4445,10 +4445,9 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
|
||||
$docker_compose['services'][$this->container_name]['stop_grace_period'] = $this->application->settings->stopGracePeriodSeconds().'s';
|
||||
}
|
||||
|
||||
// Only add Coolify healthcheck if no custom HEALTHCHECK found in Dockerfile
|
||||
// If custom_healthcheck_found is true, the Dockerfile's HEALTHCHECK will be used
|
||||
// If healthcheck is disabled, no healthcheck will be added
|
||||
if (! $this->application->custom_healthcheck_found && ! $this->application->isHealthcheckDisabled()) {
|
||||
// An enabled Coolify healthcheck replaces any HEALTHCHECK from the image or Dockerfile.
|
||||
// When it is disabled, the container keeps the HEALTHCHECK of the image (if any).
|
||||
if (! $this->application->isHealthcheckDisabled()) {
|
||||
$healthcheck_command = $this->generate_healthcheck_commands();
|
||||
if ($healthcheck_command !== null) {
|
||||
$docker_compose['services'][$this->container_name]['healthcheck'] = [
|
||||
|
||||
@@ -292,6 +292,8 @@ class Application extends BaseModel
|
||||
'container_present' => 'boolean',
|
||||
'last_restart_at' => 'datetime',
|
||||
'is_maintenance_enabled' => 'boolean',
|
||||
'health_check_enabled' => 'boolean',
|
||||
'custom_healthcheck_found' => 'boolean',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user