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
feat: add Hostinger VPS, multi-destination backups and maintenance pages
Andras Bacsai5cece6254564
diff --cc app/Actions/Server/CleanupDocker.phpindex 2ace4d7426,3c0e2ba7e0..888169be5b--- a/app/Actions/Server/CleanupDocker.php+++ b/app/Actions/Server/CleanupDocker.php@@@ -161,10 -158,11 +158,11 @@@ class CleanupDocker implements ShouldBe);$commands = [- 'docker container prune -f --filter "label=coolify.managed=true" --filter "label!=coolify.proxy=true" --filter "label!=coolify.type=database" --filter "label!=coolify.type=application" --filter "label!=coolify.type=service"',+ $this->buildContainerPruneCommand(),$imagePruneCmd,'docker builder prune -af',- "docker run --rm -v {$buildxMetadataVolume}:/root/.docker/buildx -v /var/run/docker.sock:/var/run/docker.sock {$helperImageWithVersion} docker buildx prune --builder coolify-railpack -af 2>/dev/null || true",+ // The prune fails on a stopped builder, so start it first.+ railpackBuilderHelperCommand(railpackBuildxMetadataVolume($server), $helperImageWithVersion, 'docker buildx inspect --bootstrap coolify-railpack >/dev/null 2>&1; docker buildx prune --builder coolify-railpack -af'),"docker images --filter before=$helperImageWithVersion --filter reference=$helperImage | grep $helperImage | awk '{print $3}' | xargs -r docker rmi -f","docker images --filter before=$helperImageWithoutPrefixVersion --filter reference=$helperImageWithoutPrefix | grep $helperImageWithoutPrefix | awk '{print $3}' | xargs -r docker rmi -f",];diff --cc app/Services/CoolifyUpgradeStatus.phpindex 3f274bb616,15f6c22ef2..9027d5bcd9--- a/app/Services/CoolifyUpgradeStatus.php+++ b/app/Services/CoolifyUpgradeStatus.php@@@ -85,30 -77,6 +85,30 @@@ class CoolifyUpgradeStatu];}+ public static function isRunning(string $content, ?DateTimeInterface $now = null): bool+ {+ $parts = explode('|', trim($content));+ if (count($parts) < 3) {+ return false;+ }++ [$step, , $timestamp] = $parts;- if (! in_array($step, ['1', '2', '3', '4', '5'], true)) {++ if (! in_array($step, ['1', '2', '3', '4', '5'], true) || trim($timestamp) === '') {+ return false;+ }++ try {+ $statusTime = new \DateTime($timestamp);+ } catch (\Throwable) {+ return false;+ }++ $now = $now ?? new \DateTime;+ $diffMinutes = ($now->getTimestamp() - $statusTime->getTimestamp()) / 60;++ return $diffMinutes <= self::RUNNING_LOCK_EXPIRES_AFTER_MINUTES;+ }+public static function hasReachedTargetVersion(string $runningVersion, string $targetVersion): bool{if ($runningVersion === '' || $targetVersion === '') {diff --cc config/constants.phpindex 6307bbfaeb,28b36469e2..58e709a213--- a/config/constants.php+++ b/config/constants.php@@@ -5,9 -5,9 +5,9 @@@ $sshCommandTimeout = (int) env('SSH_COMreturn ['coolify' => [- 'version' => env('COOLIFY_VERSION') ?: '4.4.3',+ 'version' => env('COOLIFY_VERSION') ?: '4.4.4',- 'helper_version' => '1.0.17',- 'railpack_version' => '0.23.0',+ 'helper_version' => '1.0.18',+ 'railpack_version' => '0.40.1','self_hosted' => env('SELF_HOSTED', true),'autoupdate' => env('AUTOUPDATE'),'base_config_path' => env('BASE_CONFIG_PATH', '/data/coolify'),diff --cc tests/Feature/DockerCleanupJobTest.phpindex 475a3a2da1,31b12bb7ac..ff2bee897e--- a/tests/Feature/DockerCleanupJobTest.php+++ b/tests/Feature/DockerCleanupJobTest.php@@@ -498,30 -498,3 +498,38 @@@ it('scans application images with a fixexpect($removal)->not->toContain($kept);}});+- it('removes stopped Coolify containers but keeps the proxy, databases, applications and services', function () {++it('removes stopped Coolify containers but keeps the proxy, databases, applications and services', function (bool $nonRoot) {+ $command = (new ReflectionMethod(CleanupDocker::class, 'buildContainerPruneCommand'))->invoke(new CleanupDocker);+ preg_match("/--format '([^']+)'/", $command, $format);+ $stoppedContainers = collect([+ ['proxy', 'true', ''],+ ['database', '', 'database'],+ ['application', '', 'application'],+ ['service', '', 'service'],+ ['helper', '', ''],+ ])->map(fn (array $container) => str_replace(['{{.ID}}', '{{.Label "coolify.proxy"}}', '{{.Label "coolify.type"}}'], $container, $format[1]));++ // Fake docker on PATH: `docker ps` prints the stopped containers, `docker rm` prints what it is asked to remove+ $bin = sys_get_temp_dir().'/docker-cleanup-'.bin2hex(random_bytes(4));+ mkdir($bin);+ file_put_contents("$bin/containers", $stoppedContainers->implode("\n")."\n");+ file_put_contents("$bin/docker", "#!/bin/sh\nif [ \"\$1\" = ps ]; then cat $bin/containers; else echo \"\$@\"; fi\n");+ chmod("$bin/docker", 0755);+++ if ($nonRoot) {++ $server = new Server;++ $server->user = 'coolify';++ $command = parseCommandsByLineForSudo(collect([$command]), $server)[0];++ file_put_contents("$bin/sudo", "#!/bin/sh\nexec \"\$@\"\n");++ chmod("$bin/sudo", 0755);++ }+++ $output = shell_exec('PATH='.escapeshellarg("$bin:".getenv('PATH')).' /bin/sh -c '.escapeshellarg($command));++ array_map('unlink', glob("$bin/*"));+ rmdir($bin);++ expect($command)->toContain('--filter label=coolify.managed=true')+ ->and(trim((string) $output))->toBe('rm helper');- });++})->with(['root' => false, 'non-root sudo parser' => true]);diff --cc tests/Unit/CoolifyUpgradeStatusTest.phpindex 1302e97370,f701a8a6d3..dcc074da7d--- a/tests/Unit/CoolifyUpgradeStatusTest.php+++ b/tests/Unit/CoolifyUpgradeStatusTest.php@@@ -128,24 -128,3 +128,26 @@@ it('reports whether the running versio'missing running version' => ['', '4.3.1', false],'missing target version' => ['4.3.1', '', false],]);++it('detects a running upgrade only for recent intermediate steps', function (string $step, int $minutesAgo, bool $expected) {+ $now = Carbon::parse('2026-08-13T12:00:00+00:00');+ $content = "{$step}|Some message|".$now->copy()->subMinutes($minutesAgo)->toIso8601String();++ expect(CoolifyUpgradeStatus::isRunning($content, $now))->toBe($expected);+})->with([+ 'recent step 1' => ['1', 0, true],+ 'step 5 at lock expiry' => ['5', 15, true],+ 'step 3 after lock expiry' => ['3', 16, false],+ 'complete' => ['6', 1, false],+ 'error' => ['error', 1, false],+]);++it('does not detect a running upgrade for empty or malformed status', function (string $content) {+ expect(CoolifyUpgradeStatus::isRunning($content))->toBeFalse();+})->with([+ 'empty' => '',+ 'missing fields' => '3|Pulling Docker images',++ 'blank timestamp' => '3|Pulling Docker images|',++ 'whitespace timestamp' => "3|Pulling Docker images| \t",+ 'invalid timestamp' => '3|Pulling Docker images|not-a-date',+]);