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(healthcheck): keep the Dockerfile HEALTHCHECK of existing applications
Andras Bacsaiafe8fc05ea8a
diff --git a/database/migrations/2026_10_28_124421_keep_dockerfile_healthcheck_for_existing_applications.php b/database/migrations/2026_10_28_124421_keep_dockerfile_healthcheck_for_existing_applications.phpnew file mode 100644index 0000000000..e9c3d8f13b--- /dev/null+++ b/database/migrations/2026_10_28_124421_keep_dockerfile_healthcheck_for_existing_applications.php@@ -0,0 +1,25 @@+<?php++use Illuminate\Database\Migrations\Migration;+use Illuminate\Support\Facades\DB;++return new class extends Migration+{+ /**+ * Until v4.5.0, a HEALTHCHECK in the Dockerfile was used even when the Coolify healthcheck was enabled.+ * Since v4.5.1 an enabled Coolify healthcheck replaces it. Existing applications with a Dockerfile+ * HEALTHCHECK get the Coolify healthcheck disabled, so their deployments keep the Dockerfile healthcheck.+ */+ public function up(): void+ {+ DB::table('applications')+ ->where('custom_healthcheck_found', true)+ ->where('health_check_enabled', true)+ ->update(['health_check_enabled' => false]);+ }++ public function down(): void+ {+ // This data migration cannot identify which applications had the Coolify healthcheck enabled.+ }+};diff --git a/resources/views/livewire/project/shared/health-checks.blade.php b/resources/views/livewire/project/shared/health-checks.blade.phpindex 6b02c0bf31..0a0cba98d1 100644--- a/resources/views/livewire/project/shared/health-checks.blade.php+++ b/resources/views/livewire/project/shared/health-checks.blade.php@@ -26,9 +26,16 @@@if ($customHealthcheckFound)<div class="mb-4">- <x-callout type="warning" title="Custom healthcheck detected">- Enabling this configuration replaces the custom healthcheck currently defined by the application.- </x-callout>+ @if ($healthCheckEnabled)+ <x-callout type="warning" title="Dockerfile HEALTHCHECK replaced">+ This healthcheck replaces the HEALTHCHECK from the Dockerfile. Disable it to use the+ Dockerfile HEALTHCHECK again.+ </x-callout>+ @else+ <x-callout type="info" title="Dockerfile HEALTHCHECK in use">+ The application uses the HEALTHCHECK from its Dockerfile. Enabling this healthcheck replaces it.+ </x-callout>+ @endif</div>@endifdiff --git a/tests/Feature/KeepDockerfileHealthcheckMigrationTest.php b/tests/Feature/KeepDockerfileHealthcheckMigrationTest.phpnew file mode 100644index 0000000000..d994272c16--- /dev/null+++ b/tests/Feature/KeepDockerfileHealthcheckMigrationTest.php@@ -0,0 +1,69 @@+<?php++use App\Livewire\Project\Shared\HealthChecks;+use App\Models\Application;+use App\Models\InstanceSettings;+use App\Models\Project;+use App\Models\Server;+use App\Models\StandaloneDocker;+use App\Models\Team;+use App\Models\User;+use Illuminate\Foundation\Testing\RefreshDatabase;+use Livewire\Livewire;++uses(RefreshDatabase::class);++beforeEach(function () {+ Server::flushIdentityMap();+ InstanceSettings::forceCreate(['id' => 0]);++ $team = Team::factory()->create();+ $this->healthcheckMigrationOwner = User::factory()->create();+ $team->members()->attach($this->healthcheckMigrationOwner->id, ['role' => 'owner']);+ $project = Project::factory()->create(['team_id' => $team->id]);+ $server = Server::factory()->create(['team_id' => $team->id]);+ $this->healthcheckMigrationEnvironment = $project->environments()->firstOrFail();+ $this->healthcheckMigrationDestination = StandaloneDocker::query()->where('server_id', $server->id)->firstOrFail();+});++function keepDockerfileHealthcheckApplication(bool $healthCheckEnabled, bool $customHealthcheckFound): Application+{+ return Application::factory()->create([+ 'environment_id' => test()->healthcheckMigrationEnvironment->id,+ 'destination_id' => test()->healthcheckMigrationDestination->id,+ 'destination_type' => StandaloneDocker::class,+ 'build_pack' => 'dockerfile',+ 'health_check_enabled' => $healthCheckEnabled,+ 'custom_healthcheck_found' => $customHealthcheckFound,+ ])->fresh();+}++test('disables the Coolify healthcheck only for applications with a Dockerfile HEALTHCHECK', function () {+ $dockerfileAndCoolify = keepDockerfileHealthcheckApplication(healthCheckEnabled: true, customHealthcheckFound: true);+ $dockerfileOnly = keepDockerfileHealthcheckApplication(healthCheckEnabled: false, customHealthcheckFound: true);+ $coolifyOnly = keepDockerfileHealthcheckApplication(healthCheckEnabled: true, customHealthcheckFound: false);+ $none = keepDockerfileHealthcheckApplication(healthCheckEnabled: false, customHealthcheckFound: false);++ (require database_path('migrations/2026_10_28_124421_keep_dockerfile_healthcheck_for_existing_applications.php'))->up();++ expect($dockerfileAndCoolify->fresh()->health_check_enabled)->toBeFalse()+ ->and($dockerfileAndCoolify->fresh()->custom_healthcheck_found)->toBeTrue()+ ->and($dockerfileOnly->fresh()->health_check_enabled)->toBeFalse()+ ->and($coolifyOnly->fresh()->health_check_enabled)->toBeTrue()+ ->and($none->fresh()->health_check_enabled)->toBeFalse();+});++test('the healthcheck page says whether the Dockerfile HEALTHCHECK is in use or replaced', function () {+ $this->actingAs($this->healthcheckMigrationOwner);++ Livewire::test(HealthChecks::class, ['resource' => keepDockerfileHealthcheckApplication(healthCheckEnabled: false, customHealthcheckFound: true)])+ ->assertSee('Dockerfile HEALTHCHECK in use')+ ->assertDontSee('Dockerfile HEALTHCHECK replaced');++ Livewire::test(HealthChecks::class, ['resource' => keepDockerfileHealthcheckApplication(healthCheckEnabled: true, customHealthcheckFound: true)])+ ->assertSee('Dockerfile HEALTHCHECK replaced')+ ->assertDontSee('Dockerfile HEALTHCHECK in use');++ Livewire::test(HealthChecks::class, ['resource' => keepDockerfileHealthcheckApplication(healthCheckEnabled: true, customHealthcheckFound: false)])+ ->assertDontSee('Dockerfile HEALTHCHECK');+});