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
Merge remote-tracking branch 'origin/release/v4.5' into automation/sync-main-to-release-v4.5
Andras Bacsai83384a7b958d
diff --cc app/Actions/Server/UpdateCoolify.phpindex 3c60c34379,52c37743ec..ddfc6578e4--- a/app/Actions/Server/UpdateCoolify.php+++ b/app/Actions/Server/UpdateCoolify.php@@@ -2,7 -2,11 +2,9 @@@namespace App\Actions\Server;+ use App\Jobs\DatabaseBackupJob;use App\Models\Server;+ use App\Models\StandalonePostgresql;-use App\Notifications\Server\UpgradeSkippedLowDiskSpace;-use App\Services\CoolifyUpgradeDiskSpace;use App\Services\CoolifyUpgradeStatus;use Illuminate\Support\Facades\Http;use Illuminate\Support\Facades\Log;@@@ -19,9 -23,10 +21,10 @@@ class UpdateCoolifpublic ?string $currentVersion = null;- public function handle($manual_update = false, bool $skipDiskSpaceCheck = false)+ public function handle($manual_update = false){if (isDev()) {+ $this->backupDatabase();Sleep::for(10)->seconds();return;@@@ -110,12 -115,33 +113,29 @@@);}- if (! $skipDiskSpaceCheck && ! $this->ensureEnoughDiskSpace($manual_update)) {- return;- }-+ $this->backupDatabase();- $this->update($skipDiskSpaceCheck);+ $this->update();$settings->new_version_available = false;$settings->save();}+ private function backupDatabase(): void+ {+ $backup = StandalonePostgresql::find(0)?->scheduledBackups()->first();+ if (! $backup || ! instanceSettings()->is_backup_before_update_enabled) {+ return;+ }++ // Runs inline so the update waits for the result. dispatchSync() would go through the job's+ // WithoutOverlapping middleware, which silently drops the run while the scheduled backup is running.+ $job = new DatabaseBackupJob($backup);+ $job->handle();+ if ($job->backup_log?->status !== 'success') {+ throw new \Exception('The database backup failed, so the update was not started.');+ }+ }+- private function update(bool $skipDiskSpaceCheck)+ private function update(){$this->ensureNoUpgradeIsRunning();diff --cc app/Livewire/Server/Proxy.phpindex 13a3f21381,6b7a3859e5..42b802ba5a--- a/app/Livewire/Server/Proxy.php+++ b/app/Livewire/Server/Proxy.php@@@ -27,10 -26,10 +27,12 @@@ class Proxy extends Componenpublic ?string $redirectUrl = null;+ public ?string $customErrorPage = null;+public bool $generateExactLabels = false;+ public ?string $certificateResolver = null;+/*** Cache the versions.json file data in memory for this component instance.* This avoids multiple file reads during a single request/render cycle.@@@ -52,7 -51,7 +54,8 @@@return ['generateExactLabels' => 'required|boolean','redirectUrl' => ['nullable', new SafeExternalUrl],+ 'certificateResolver' => ['nullable', 'string', 'max:255', 'regex:'.ServerSetting::TRAEFIK_CERTIFICATE_RESOLVER_PATTERN],+ 'customErrorPage' => ['nullable', 'string', proxyPageSizeRule('custom error page')],];}@@@ -211,8 -212,8 +229,9 @@@$this->validate();SaveProxyConfiguration::run($this->server, $this->proxySettings);$this->server->proxy->redirect_url = $this->redirectUrl;+ $this->server->proxy_error_page = filled($this->customErrorPage) ? $this->customErrorPage : null;$this->server->save();+ $this->saveSettings();auditLog('ui.server.proxy.configuration_saved', $this->proxyAuditContext());$this->server->setupDefaultRedirect();$this->dispatch('refreshServerShow');diff --cc app/Models/Server.phpindex 340d4d2bcc,3e5797fd55..e460a08294--- a/app/Models/Server.php+++ b/app/Models/Server.php@@@ -646,70 -689,358 +689,356 @@@ class Server extends BaseModeif ($redirect_enabled === false) {instant_remote_process(["rm -f $default_redirect_file"], $this);} else {- if ($proxy_type === ProxyTypes::CADDY->value) {- if (filled($redirect_url)) {- $conf = ":80, :443 {+ $conf = $banner.$this->defaultRedirectConfiguration();+ $base64 = base64_encode($conf);+ instant_remote_process([+ "echo '$base64' | base64 -d | tee $default_redirect_file > /dev/null",+ ], $this);+ }++ if ($proxy_type === 'CADDY') {+ $this->reloadCaddy();+ }+ }++ /**+ * Catch-all proxy configuration (without the banner) for an enabled default redirect.+ */+ public function defaultRedirectConfiguration(): string+ {+ $redirect_url = $this->proxy->redirect_url;+ $usesErrorPage = $this->usesProxyErrorPage();++ if ($this->proxyType() === ProxyTypes::CADDY->value) {+ if (filled($redirect_url)) {+ return ":80, :443 {redir $redirect_url}";- } else {- $conf = ':80, :443 {+ }+ if ($usesErrorPage) {+ // busybox httpd answers 200, so copy_response sets the 503 status.+ return ':80, :443 {+ reverse_proxy '.self::PROXY_ERROR_PAGE_CONTAINER.':80 {+ rewrite /503.html+ handle_response {+ copy_response 503+ }+ }+ }';+ }++ return ':80, :443 {respond 503}';- }- } elseif ($proxy_type === ProxyTypes::TRAEFIK->value) {- $dynamic_conf = [- 'http' => [- 'routers' => [- 'catchall' => [- 'entryPoints' => [- 0 => 'http',- 1 => 'https',- ],- 'service' => 'noop',- 'rule' => 'PathPrefix(`/`)',- 'tls' => $this->traefikCertificateResolver() ? ['certResolver' => $this->traefikCertificateResolver()] : [],- 'priority' => -1000,- ],+ }++ $dynamic_conf = [+ 'http' => [+ 'routers' => [+ 'catchall' => [+ 'entryPoints' => [+ 0 => 'http',+ 1 => 'https',],- 'services' => [- 'noop' => [- 'loadBalancer' => [- 'servers' => [],- ],- ],+ 'service' => 'noop',+ 'rule' => 'PathPrefix(`/`)',- 'tls' => [- 'certResolver' => 'letsencrypt',- ],++ 'tls' => $this->traefikCertificateResolver() ? ['certResolver' => $this->traefikCertificateResolver()] : [],+ 'priority' => -1000,+ ],+ ],+ 'services' => [+ 'noop' => [+ 'loadBalancer' => [+ 'servers' => [],],],- ];- if (filled($redirect_url)) {- $dynamic_conf['http']['routers']['catchall']['middlewares'] = [- 0 => 'redirect-regexp',- ];+ ],+ ],+ ];+ if (filled($redirect_url)) {+ $dynamic_conf['http']['routers']['catchall']['middlewares'] = [+ 0 => 'redirect-regexp',+ ];++ $dynamic_conf['http']['services']['noop']['loadBalancer']['servers'][0] = [+ 'url' => '',+ ];+ $dynamic_conf['http']['middlewares'] = [+ 'redirect-regexp' => [+ 'redirectRegex' => [+ 'regex' => '(.*)',+ 'replacement' => $redirect_url,+ 'permanent' => false,+ ],+ ],+ ];+ } elseif ($usesErrorPage) {+ // The noop service (no servers) keeps the 503; the errors middleware only replaces the body.+ $dynamic_conf['http']['routers']['catchall']['middlewares'] = [+ 0 => 'error-pages',+ ];+ $dynamic_conf['http']['middlewares'] = [+ 'error-pages' => [+ 'errors' => [+ 'status' => ['503'],+ 'service' => 'error-pages',+ 'query' => '/503.html',+ ],+ ],+ ];+ $dynamic_conf['http']['services']['error-pages'] = [+ 'loadBalancer' => [+ 'servers' => [+ ['url' => 'http://'.self::PROXY_ERROR_PAGE_CONTAINER.':80'],+ ],+ ],+ ];+ }- $dynamic_conf['http']['services']['noop']['loadBalancer']['servers'][0] = [- 'url' => '',- ];- $dynamic_conf['http']['middlewares'] = [- 'redirect-regexp' => [- 'redirectRegex' => [- 'regex' => '(.*)',- 'replacement' => $redirect_url,- 'permanent' => false,- ],- ],- ];+ // A router with `tls` matches only HTTPS, so plain HTTP needs its own catch-all router.+ if (! $this->isSwarm()) {+ $catchall = $dynamic_conf['http']['routers']['catchall'];+ $dynamic_conf['http']['routers']['catchall']['entryPoints'] = ['https'];+ unset($catchall['tls']);+ $dynamic_conf['http']['routers']['catchall-http'] = array_merge($catchall, ['entryPoints' => ['http']]);+ }++ return Yaml::dump($dynamic_conf, 12, 2);+ }++ /**+ * True when the catch-all shows the error page: a standalone Traefik or Caddy proxy with+ * the default redirect enabled and no redirect URL. Swarm servers keep the plain 503.+ */+ public function usesProxyErrorPage(): bool+ {+ return ! $this->isSwarm()+ && in_array($this->proxyType(), [ProxyTypes::TRAEFIK->value, ProxyTypes::CADDY->value], true)+ && ($this->proxy->redirect_enabled ?? true) !== false+ && blank($this->proxy->redirect_url);+ }++ public function proxyErrorPagesPath(): string+ {+ return base_configuration_dir().'/proxy/error-pages';+ }++ /**+ * The custom error page HTML, or the Coolify default page.+ */+ public function proxyErrorPageHtml(): string+ {+ return filled($this->proxy_error_page) ? $this->proxy_error_page : view('proxy.error-page')->render();+ }++ /**+ * Applications and services on this server that are in maintenance mode.+ *+ * @return Collection<int, Application|Service>+ */+ public function maintenanceResources(): Collection+ {+ if ($this->isSwarm() || ! in_array($this->proxyType(), [ProxyTypes::TRAEFIK->value, ProxyTypes::CADDY->value], true)) {+ return collect();+ }++ return $this->applications()->where('is_maintenance_enabled', true)->values()+ ->concat($this->services()->where('is_maintenance_enabled', true)->get());+ }++ /**+ * Writes 503.html and starts the error page container, or removes the container when+ * neither the catch-all nor a maintenance page uses it. Swarm servers are not supported.+ */+ public function setupProxyErrorPageContainer(): void+ {+ if ($this->isSwarm()) {+ return;+ }++ $container = self::PROXY_ERROR_PAGE_CONTAINER;+ if (! $this->usesProxyErrorPage() && $this->maintenanceResources()->isEmpty()) {+ instant_remote_process(["docker rm -f $container >/dev/null 2>&1 || true"], $this);++ return;+ }++ $path = $this->proxyErrorPagesPath();+ $mount = devHostDockerPath($this, $path);+ $restart = RESTART_MODE;++ instant_remote_process(["mkdir -p $path"], $this);+ $this->uploadProxyFile("$path/503.html", $this->proxyErrorPageHtml());+ instant_remote_process([+ dockerNetworkEnsureCommand('coolify'),+ "docker start $container >/dev/null 2>&1 || docker run -d --name $container --network coolify --restart $restart --label coolify.managed=true -v $mount:/www:ro ".self::PROXY_ERROR_PAGE_IMAGE.' httpd -f -p 80 -h /www',+ // A proxy on custom networks only must still reach the error page container.+ 'docker network connect coolify coolify-proxy >/dev/null 2>&1 || true',+ ], $this);+ }++ /**+ * Writes $contents to $path on this server with scp. A shell command is limited to 128 KiB,+ * so large pages and proxy files cannot go inside one command.+ */+ public function uploadProxyFile(string $path, string $contents): void+ {+ $uploadPath = '/tmp/coolify-upload-'.bin2hex(random_bytes(8));+ $localPath = tempnam(sys_get_temp_dir(), 'coolify-proxy-file-');+ try {+ file_put_contents($localPath, $contents);+ instant_scp($localPath, $uploadPath, $this);+ } finally {+ @unlink($localPath);+ }++ // The proxy and the page container read the file as root, other users do not need it.+ instant_remote_process(["mv -f $uploadPath $path", "chmod 644 $path"], $this);+ }++ /**+ * Writes the maintenance pages and the proxy configuration that shows them instead of the+ * applications and services in maintenance mode. Swarm servers are not supported.+ */+ public function setupMaintenancePages(): void+ {+ $proxyType = $this->proxyType();+ if ($this->isSwarm() || ! in_array($proxyType, [ProxyTypes::TRAEFIK->value, ProxyTypes::CADDY->value], true)) {+ return;+ }++ $resources = $this->maintenanceResources();+ $path = $this->proxyErrorPagesPath();+ $keep = $resources->map(fn ($resource) => "! -name '{$resource->maintenancePageFile()}' ")->implode('');++ instant_remote_process([+ "mkdir -p $path",+ "find $path -maxdepth 1 -name 'maintenance-*.html' {$keep}-delete",+ ], $this);+ $this->setupProxyErrorPageContainer();++ foreach ($resources as $resource) {+ $this->uploadProxyFile("$path/{$resource->maintenancePageFile()}", $resource->maintenancePageHtml());+ }++ $dynamicPath = $this->proxyPath().'/dynamic';+ instant_remote_process(["mkdir -p $dynamicPath"], $this);+ if ($proxyType === ProxyTypes::TRAEFIK->value) {+ $file = "$dynamicPath/coolify-maintenance.yaml";+ $configuration = $this->maintenanceTraefikConfiguration($resources);+ if ($configuration === null) {+ instant_remote_process(["rm -f $file"], $this);+ } else {+ $this->uploadProxyFile($file, $configuration);+ }+ } else {+ // caddy-docker-proxy reads the base Caddyfile again on its next poll.+ $this->uploadProxyFile("$dynamicPath/Caddyfile", $this->caddyBaseCaddyfile($resources));+ }+ }++ /**+ * Traefik routers that use the same rule as the resource routers, with a priority one+ * higher. Traefik uses the rule length as the default priority, so a resource on a longer+ * path of the same host keeps its own router.+ *+ * @param Collection<int, Application|Service> $resources+ */+ public function maintenanceTraefikConfiguration(Collection $resources): ?string+ {+ $routers = [];+ $middlewares = [];+ foreach ($resources as $resource) {+ $routes = $resource->maintenanceRoutes();+ if ($routes->isEmpty()) {+ continue;+ }+ $middleware = "coolify-maintenance-{$resource->uuid}";+ $middlewares[$middleware] = [+ 'errors' => [+ 'status' => ['503'],+ 'service' => 'coolify-maintenance-pages',+ 'query' => '/'.$resource->maintenancePageFile(),+ ],+ ];+ foreach ($routes as $index => $route) {+ $rule = "Host(`{$route['host']}`) && PathPrefix(`{$route['path']}`)";+ $router = [+ 'entryPoints' => ['http'],+ 'rule' => $rule,+ 'service' => 'coolify-maintenance-noop',+ 'middlewares' => ['coolify-maintenance-headers', $middleware],+ 'priority' => strlen($rule) + 1,+ ];+ $routers["coolify-maintenance-{$resource->uuid}-{$index}-http"] = $router;+ if ($route['scheme'] === 'https') {+ $routers["coolify-maintenance-{$resource->uuid}-{$index}-https"] = array_merge($router, [+ 'entryPoints' => ['https'],+ 'tls' => ['certResolver' => 'letsencrypt'],+ ]);}- $conf = Yaml::dump($dynamic_conf, 12, 2);}- $conf = $banner.$conf;- $base64 = base64_encode($conf);- instant_remote_process([- "echo '$base64' | base64 -d | tee $default_redirect_file > /dev/null",- ], $this);}- if ($proxy_type === 'CADDY') {- $this->reloadCaddy();+ if ($routers === []) {+ return null;+ }++ $middlewares['coolify-maintenance-headers'] = [+ 'headers' => ['customResponseHeaders' => ['Retry-After' => '300']],+ ];++ return "# This file is generated by Coolify, do not edit it manually.\n\n".Yaml::dump([+ 'http' => [+ 'routers' => $routers,+ 'middlewares' => $middlewares,+ 'services' => [+ // No servers: Traefik answers 503 and the errors middleware adds the page.+ 'coolify-maintenance-noop' => ['loadBalancer' => ['servers' => []]],+ 'coolify-maintenance-pages' => [+ 'loadBalancer' => ['servers' => [['url' => 'http://'.self::PROXY_ERROR_PAGE_CONTAINER.':80']]],+ ],+ ],+ ],+ ], 12, 2);+ }++ /**+ * The base Caddyfile of caddy-docker-proxy. A maintenance block uses the same site address+ * as the resource labels, so caddy-docker-proxy merges both into one site block. Its named+ * matcher has the same path as the resource handle, so Caddy runs it first.+ *+ * @param Collection<int, Application|Service>|null $resources+ */+ public function caddyBaseCaddyfile(?Collection $resources = null): string+ {+ $resources ??= $this->maintenanceResources();+ $sites = [];+ foreach ($resources as $resource) {+ foreach ($resource->maintenanceRoutes() as $index => $route) {+ $address = caddySiteAddress($route['scheme'], $route['host'], $route['force_https']);+ $matcher = "@coolify-maintenance-{$resource->uuid}-{$index}";+ $sites[$address][] = implode("\n", [+ "\t{$matcher} path {$route['path']}*",+ "\thandle {$matcher} {",+ "\t\treverse_proxy ".self::PROXY_ERROR_PAGE_CONTAINER.':80 {',+ "\t\t\trewrite /{$resource->maintenancePageFile()}",+ "\t\t\theader_down Retry-After 300",+ "\t\t\thandle_response {",+ "\t\t\t\tcopy_response 503",+ "\t\t\t}",+ "\t\t}",+ "\t}",+ ]);+ }+ }++ $caddyfile = 'import /dynamic/*.caddy';+ foreach ($sites as $address => $blocks) {+ $caddyfile .= "\n\n{$address} {\n".implode("\n", $blocks)."\n}";}++ return $caddyfile."\n";}public function setupDynamicProxyConfiguration()diff --cc bootstrap/helpers/docker.phpindex 3e047b2079,9793336698..a8f8ebee5a--- a/bootstrap/helpers/docker.php+++ b/bootstrap/helpers/docker.php@@@ -924,7 -939,7 +939,7 @@@ function traefikHostRulesWithoutIpv6Bra) : $label);}- function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_https_enabled = false, $onlyPort = null, ?Collection $serviceLabels = null, ?bool $is_gzip_enabled = true, ?bool $is_stripprefix_enabled = true, ?string $service_name = null, bool $generate_unique_uuid = false, ?string $image = null, string $redirect_direction = 'both', bool $is_http_basic_auth_enabled = false, ?string $http_basic_auth_username = null, ?string $http_basic_auth_password = null, ?Collection $noindex_domains = null, bool $escape_redirect_replacement_for_compose = true, array $domainPortOverrides = [], ?string $certificate_resolver = 'letsencrypt')-function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_https_enabled = false, $onlyPort = null, ?Collection $serviceLabels = null, ?bool $is_gzip_enabled = true, ?bool $is_stripprefix_enabled = true, ?string $service_name = null, bool $generate_unique_uuid = false, ?string $image = null, string $redirect_direction = 'both', bool $is_http_basic_auth_enabled = false, ?string $http_basic_auth_username = null, ?string $http_basic_auth_password = null, ?Collection $noindex_domains = null, bool $escape_redirect_replacement_for_compose = true, array $domainPortOverrides = [], ?int $http_basic_auth_bcrypt_cost = null)++function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_https_enabled = false, $onlyPort = null, ?Collection $serviceLabels = null, ?bool $is_gzip_enabled = true, ?bool $is_stripprefix_enabled = true, ?string $service_name = null, bool $generate_unique_uuid = false, ?string $image = null, string $redirect_direction = 'both', bool $is_http_basic_auth_enabled = false, ?string $http_basic_auth_username = null, ?string $http_basic_auth_password = null, ?Collection $noindex_domains = null, bool $escape_redirect_replacement_for_compose = true, array $domainPortOverrides = [], ?string $certificate_resolver = 'letsencrypt', ?int $http_basic_auth_bcrypt_cost = null){$labels = collect([]);$labels->push('traefik.enable=true');@@@ -1226,9 -1243,9 +1245,10 @@@ function generateLabelsApplication(Applis_http_basic_auth_enabled: $application->is_http_basic_auth_enabled,http_basic_auth_username: $application->http_basic_auth_username,http_basic_auth_password: $application->http_basic_auth_password,+ http_basic_auth_bcrypt_cost: $application->http_basic_auth_bcrypt_cost,noindex_domains: $noindexDomains,domainPortOverrides: $application->domain_port_overrides ?? [],+ certificate_resolver: $application->destination->server->traefikCertificateResolver($application->settings?->traefik_certificate_resolver),));break;case ProxyTypes::CADDY->value:diff --cc config/constants.phpindex 0c4d9c7834,58e709a213..ed674133e8--- a/config/constants.php+++ b/config/constants.php@@@ -5,8 -5,9 +5,9 @@@ $sshCommandTimeout = (int) env('SSH_COMreturn ['coolify' => [- 'version' => env('COOLIFY_VERSION') ?: '4.4.4',+ 'version' => env('COOLIFY_VERSION') ?: '4.4.6',- 'helper_version' => '1.0.17',+ '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 resources/views/livewire/project/new/github-private-repository-deploy-key.blade.phpindex 86eb652392,7b89efcb21..6ee5dfe990--- a/resources/views/livewire/project/new/github-private-repository-deploy-key.blade.php+++ b/resources/views/livewire/project/new/github-private-repository-deploy-key.blade.php@@@ -76,33 -76,10 +76,14 @@@@endif</div>+ @if ($build_pack === 'nixpacks')+ <x-nixpacks-deprecated-callout />+ @endif+@if ($build_pack === 'dockercompose')- <div x-data="{- baseDir: @js($base_directory),- composeLocation: @js($docker_compose_location),- normalize(path) {- if (!path || path.trim() === '') return '/';- const normalized = path.trim().replace(/\/+$/, '');- return normalized.startsWith('/') ? normalized : '/' + normalized;- },- }" class="grid gap-4 sm:grid-cols-2">- <x-forms.input placeholder="/" wire:model.defer="base_directory"- label="Base directory" helper="Repository directory used as the build root."- x-model="baseDir" @blur="baseDir = normalize(baseDir)" />- <x-forms.input placeholder="/docker-compose.yaml"- wire:model.defer="docker_compose_location" label="Compose file"- helper="Path relative to the base directory." x-model="composeLocation"- @blur="composeLocation = normalize(composeLocation)" />- <p class="sm:col-span-2 text-xs text-neutral-500 dark:text-fg-dim">- Resolved file:- <code class="font-mono text-coollabs dark:text-warning"- x-text='(baseDir === "/" ? "" : baseDir) + (composeLocation.startsWith("/") ? composeLocation : "/" + composeLocation)'></code>- </p>- </div>+ <x-forms.repository-paths class="sm:grid-cols-2" base="base_directory"+ file="docker_compose_location" fileLabel="Compose file"+ defaultFile="/docker-compose.yaml" />@else<x-forms.input wire:model="base_directory" label="Base directory"helper="Repository directory used as the build root." />diff --cc resources/views/livewire/project/new/github-private-repository.blade.phpindex e2b691f929,638ea322cf..c89472dd7a--- a/resources/views/livewire/project/new/github-private-repository.blade.php+++ b/resources/views/livewire/project/new/github-private-repository.blade.php@@@ -134,33 -136,27 +136,31 @@@@endif</div>+ @if ($build_pack === 'nixpacks')+ <x-nixpacks-deprecated-callout />+ @endif++ {{-- Dockerfile: pick a detected file or type a path --}}+ @if ($build_pack === 'dockerfile')+ <x-forms.listbox id="selectedDockerfile" label="Dockerfile" live searchable allowCustom placeholder="/Dockerfile"+ emptyText="No Dockerfiles detected. Type a path in the search field."+ searchPlaceholder="Search or type a path…"+ helper="Select a detected Dockerfile, or type a path relative to the base directory."+ :options="collect($detectedDockerfiles)->map(fn ($file) => ['value' => $file, 'label' => $file])->all()" />+ @endif++ {{-- Docker Compose file selector: pick a detected file or type a path --}}+ @if ($build_pack === 'dockercompose' && count($detectedDockerComposeFiles) > 0)+ <x-forms.listbox id="selectedDockerComposeFile" label="Docker Compose File" live searchable allowCustom+ searchPlaceholder="Search or type a path…"+ helper="Select a detected Docker Compose file, or type a path relative to the base directory."+ :options="collect($detectedDockerComposeFiles)->map(fn ($file) => ['value' => $file, 'label' => $file])->all()" />+ @endif+@if ($build_pack === 'dockercompose')- <div x-data="{- baseDir: @js($base_directory),- composeLocation: @js($docker_compose_location),- normalize(path) {- if (!path || path.trim() === '') return '/';- const normalized = path.trim().replace(/\/+$/, '');- return normalized.startsWith('/') ? normalized : '/' + normalized;- },- }" class="grid gap-4 sm:grid-cols-2">- <x-forms.input placeholder="/" wire:model.defer="base_directory"- label="Base directory" helper="Repository directory used as the build root."- x-model="baseDir" @blur="baseDir = normalize(baseDir)" />- <x-forms.input placeholder="/docker-compose.yaml"- wire:model.defer="docker_compose_location" label="Compose file"- helper="Path relative to the base directory." x-model="composeLocation"- @blur="composeLocation = normalize(composeLocation)" />- <p class="sm:col-span-2 text-xs text-neutral-500 dark:text-fg-dim">- Resolved file:- <code class="font-mono text-coollabs dark:text-warning"- x-text='(baseDir === "/" ? "" : baseDir) + (composeLocation.startsWith("/") ? composeLocation : "/" + composeLocation)'></code>- </p>- </div>+ <x-forms.repository-paths class="sm:grid-cols-2" base="base_directory"+ file="docker_compose_location" fileLabel="Compose file"+ defaultFile="/docker-compose.yaml" />@else<x-forms.input wire:model="base_directory" label="Base directory"helper="Repository directory used as the build root." />diff --cc resources/views/livewire/project/new/gitlab-private-repository.blade.phpindex a088844ec0,30e87ee35e..0a0e7e152d--- a/resources/views/livewire/project/new/gitlab-private-repository.blade.php+++ b/resources/views/livewire/project/new/gitlab-private-repository.blade.php@@@ -130,33 -130,10 +130,14 @@@@endif</div>+ @if ($build_pack === 'nixpacks')+ <x-nixpacks-deprecated-callout />+ @endif+@if ($build_pack === 'dockercompose')- <div x-data="{- baseDir: @js($base_directory),- composeLocation: @js($docker_compose_location),- normalize(path) {- if (!path || path.trim() === '') return '/';- const normalized = path.trim().replace(/\/+$/, '');- return normalized.startsWith('/') ? normalized : '/' + normalized;- },- }" class="grid gap-4 sm:grid-cols-2">- <x-forms.input placeholder="/" wire:model.defer="base_directory"- label="Base directory" helper="Repository directory used as the build root."- x-model="baseDir" @blur="baseDir = normalize(baseDir)" />- <x-forms.input placeholder="/docker-compose.yaml"- wire:model.defer="docker_compose_location" label="Compose file"- helper="Path relative to the base directory." x-model="composeLocation"- @blur="composeLocation = normalize(composeLocation)" />- <p class="sm:col-span-2 text-xs text-neutral-500 dark:text-fg-dim">- Resolved file:- <code class="font-mono text-coollabs dark:text-warning"- x-text='(baseDir === "/" ? "" : baseDir) + (composeLocation.startsWith("/") ? composeLocation : "/" + composeLocation)'></code>- </p>- </div>+ <x-forms.repository-paths class="sm:grid-cols-2" base="base_directory"+ file="docker_compose_location" fileLabel="Compose file"+ defaultFile="/docker-compose.yaml" />@else<x-forms.input wire:model="base_directory" label="Base directory"helper="Repository directory used as the build root." />diff --cc resources/views/livewire/project/new/public-git-repository.blade.phpindex 8e0b7a1bfe,b8ce0747e3..8825ea3ee5--- a/resources/views/livewire/project/new/public-git-repository.blade.php+++ b/resources/views/livewire/project/new/public-git-repository.blade.php@@@ -83,33 -85,27 +85,31 @@@@endif</div>+ @if ($build_pack === 'nixpacks')+ <x-nixpacks-deprecated-callout />+ @endif++ {{-- Dockerfile: pick a detected file or type a path --}}+ @if ($build_pack === 'dockerfile')+ <x-forms.listbox id="selectedDockerfile" label="Dockerfile" live searchable allowCustom placeholder="/Dockerfile"+ emptyText="No Dockerfiles detected. Type a path in the search field."+ searchPlaceholder="Search or type a path…"+ helper="Select a detected Dockerfile, or type a path relative to the base directory."+ :options="collect($detectedDockerfiles)->map(fn ($file) => ['value' => $file, 'label' => $file])->all()" />+ @endif++ {{-- Docker Compose file selector: pick a detected file or type a path --}}+ @if ($build_pack === 'dockercompose' && count($detectedDockerComposeFiles) > 0)+ <x-forms.listbox id="selectedDockerComposeFile" label="Docker Compose File" live searchable allowCustom+ searchPlaceholder="Search or type a path…"+ helper="Select a detected Docker Compose file, or type a path relative to the base directory."+ :options="collect($detectedDockerComposeFiles)->map(fn ($file) => ['value' => $file, 'label' => $file])->all()" />+ @endif+@if ($build_pack === 'dockercompose')- <div x-data="{- baseDir: @js($base_directory),- composeLocation: @js($docker_compose_location),- normalize(path) {- if (!path || path.trim() === '') return '/';- const normalized = path.trim().replace(/\/+$/, '');- return normalized.startsWith('/') ? normalized : '/' + normalized;- },- }" class="grid gap-4 sm:grid-cols-2">- <x-forms.input placeholder="/" wire:model.defer="base_directory"- label="Base directory" helper="Repository directory used as the build root."- x-model="baseDir" @blur="baseDir = normalize(baseDir)" />- <x-forms.input placeholder="/docker-compose.yaml"- wire:model.defer="docker_compose_location" label="Compose file"- helper="Path relative to the base directory." x-model="composeLocation"- @blur="composeLocation = normalize(composeLocation)" />- <p class="sm:col-span-2 text-xs text-neutral-500 dark:text-fg-dim">- Resolved file:- <code class="font-mono text-coollabs dark:text-warning"- x-text='(baseDir === "/" ? "" : baseDir) + (composeLocation.startsWith("/") ? composeLocation : "/" + composeLocation)'></code>- </p>- </div>+ <x-forms.repository-paths class="sm:grid-cols-2" base="base_directory"+ file="docker_compose_location" fileLabel="Compose file"+ defaultFile="/docker-compose.yaml" />@else<x-forms.input wire:model="base_directory" label="Base directory"helper="Repository directory used as the build root." />diff --cc resources/views/livewire/server/proxy.blade.phpindex d83ab48f9b,0be3fbd86e..40daa6c48b--- a/resources/views/livewire/server/proxy.blade.php+++ b/resources/views/livewire/server/proxy.blade.php@@@ -78,14 -78,23 +78,28 @@@<x-forms.input canGate="update" :canResource="$server"placeholder="https://app.coolify.io" id="redirectUrl"label="Redirect URL"- helper="Leave empty to keep a custom 503 response without redirecting." />+ helper="Leave empty to return a 503 response instead of redirecting." />@endif+ @if ($server->proxyType() === ProxyTypes::TRAEFIK->value)+ <x-forms.input canGate="update" :canResource="$server" placeholder="letsencrypt"+ id="certificateResolver" label="Certificate resolver"+ helper="Traefik certificate resolver for generated HTTPS routes. Leave empty if Traefik uses your own certificates (for example Cloudflare Origin CA certificates in a dynamic configuration). Redeploy resources to apply the change." />+ @endif</div>+ @if ($redirectEnabled && ! $server->isSwarm())+ <div class="mt-4 flex flex-col gap-2">+ <x-forms.textarea canGate="update" :canResource="$server" id="customErrorPage" rows="10"+ monospace label="Custom error page (HTML)"+ placeholder="Leave empty to use the Coolify default error page."+ helper="One self-contained HTML file (max {{ \App\Models\Server::PROXY_ERROR_PAGE_MAX_BYTES / 1024 }} KB) with inline CSS and images. Visitors see it with a 503 status for unknown domains and for stopped, deploying or unhealthy resources. A Redirect URL takes priority over this page." />+ @can('update', $server)+ <div class="flex gap-2">+ <x-forms.button type="button" wire:click="resetCustomErrorPage">Reset to+ default</x-forms.button>+ </div>+ @endcan+ </div>+ @endif</x-application.settings-section>@phpdiff --cc tests/Unit/UpdateCoolifyTest.phpindex ddc8c2546b,8b604a042f..73f0ae6619--- a/tests/Unit/UpdateCoolifyTest.php+++ b/tests/Unit/UpdateCoolifyTest.php@@@ -3,9 -3,14 +3,13 @@@use App\Actions\Server\UpdateCoolify;use App\Livewire\Settings\Updates;use App\Models\InstanceSettings;+ use App\Models\PrivateKey;+ use App\Models\ScheduledDatabaseBackup;use App\Models\Server;+ use App\Models\StandaloneDocker;+ use App\Models\StandalonePostgresql;use App\Models\Team;use App\Models\User;-use App\Notifications\Server\UpgradeSkippedLowDiskSpace;use App\Support\RemoteProcessCommand;use Illuminate\Foundation\Testing\RefreshDatabase;use Illuminate\Support\Facades\Cache;@@@ -53,6 -60,76 +59,58 @@@ function updateCoolifyTestActionWithSta};}-function updateCoolifyTestActionWithDiskSpace(?float $availableGb): UpdateCoolify-{- return new class($availableGb) extends UpdateCoolify- {- public function __construct(private ?float $availableGb) {}-- protected function readUpgradeStatus(): ?string- {- return '';- }-- protected function availableDiskSpaceGb(): ?float- {- return $this->availableGb;- }- };-}-+ function updateCoolifyTestCreateInstanceBackup(): void+ {+ Storage::fake('ssh-keys');+ Notification::fake();+ Server::query()->whereKey(0)->update(['private_key_id' => PrivateKey::factory()->create(['team_id' => 0])->id]);+ Server::flushIdentityMap();+ StandalonePostgresql::forceCreate([+ 'id' => 0,+ 'name' => 'coolify-db',+ 'postgres_password' => 'password',+ 'destination_type' => StandaloneDocker::class,+ 'destination_id' => 0,+ ]);+ ScheduledDatabaseBackup::create([+ 'frequency' => '0 0 * * *',+ 'database_id' => 0,+ 'database_type' => StandalonePostgresql::class,+ 'team_id' => 0,+ ]);+ }++ function updateCoolifyTestPrepareUpgrade(): void+ {+ Queue::fake();+ config([+ 'app.env' => 'testing',+ 'constants.coolify.version' => '4.0.9',+ 'constants.coolify.helper_version' => '1.0.14',+ 'constants.coolify.upgrade_script_url' => 'https://cdn.example.com/upgrade.sh',+ 'constants.ssh.mux_enabled' => false,+ ]);++ updateCoolifyTestCreateRootServerAndSettings([+ 'is_auto_update_enabled' => true,+ 'new_version_available' => true,+ 'docker_registry_url' => 'docker.io',+ ]);++ Http::fake([+ '*' => Http::response([+ 'coolify' => ['v4' => ['version' => '4.0.10']],+ ], 200),+ ]);+ }++ function updateCoolifyTestPrepareUpdate(array $settings = []): void+ {+ updateCoolifyTestPrepareUpgrade();+ InstanceSettings::findOrFail(0)->update($settings);+ updateCoolifyTestCreateInstanceBackup();+ }+afterEach(function () {Mockery::close();});@@@ -363,3 -440,80 +421,33 @@@ it('starts an upgrade when the previouexpect(RemoteProcessCommand::read(Activity::query()->latest('id')->first()))->toContain("bash /data/coolify/source/upgrade.sh '4.0.10'");});+-it('skips an automatic update and notifies the root team when the disk is almost full', function () {- updateCoolifyTestPrepareUpgrade();- Notification::fake();- Team::findOrFail(0)->discordNotificationSettings()->update(['discord_enabled' => true, 'server_disk_usage_discord_notifications' => true]);-- updateCoolifyTestActionWithDiskSpace(3.2)->handle();-- expect(Activity::query()->count())->toBe(0)- ->and((bool) InstanceSettings::findOrFail(0)->new_version_available)->toBeTrue();- Notification::assertSentTo(- Team::findOrFail(0),- UpgradeSkippedLowDiskSpace::class,- fn (UpgradeSkippedLowDiskSpace $notification) => $notification->version === '4.0.10'- && $notification->availableGb === 3.2- && str_contains((string) $notification->toMail()->render(), '3.2 GB free'),- );-});--it('fails a manual update when the disk is almost full', function () {- updateCoolifyTestPrepareUpgrade();- Notification::fake();-- expect(fn () => updateCoolifyTestActionWithDiskSpace(3.2)->handle(manual_update: true))- ->toThrow(Exception::class, 'Not enough free disk space to upgrade: 3.2 GB free, 5 GB required.');-- expect(Activity::query()->count())->toBe(0);- Notification::assertNothingSent();-});--it('upgrades when the free disk space cannot be measured', function () {- updateCoolifyTestPrepareUpgrade();-- updateCoolifyTestActionWithDiskSpace(null)->handle();-- expect(RemoteProcessCommand::read(Activity::query()->latest('id')->first()))- ->toEndWith("bash /data/coolify/source/upgrade.sh '4.0.10' '1.0.14' 'docker.io'");-});--it('upgrades and tells the upgrade script to skip its disk space check when the user overrides it', function () {- updateCoolifyTestPrepareUpgrade();-- updateCoolifyTestActionWithDiskSpace(3.2)->handle(manual_update: true, skipDiskSpaceCheck: true);-- expect(RemoteProcessCommand::read(Activity::query()->latest('id')->first()))- ->toEndWith("bash /data/coolify/source/upgrade.sh '4.0.10' '1.0.14' 'docker.io' 'false' 'true'");-});-+ it('backs up the instance database before the update', function () {+ updateCoolifyTestPrepareUpdate();+ Process::fake(['*du -b*' => '128', '*' => '']);++ (new UpdateCoolify)->handle(manual_update: true);++ Process::assertRan(fn ($process) => str_contains($process->command, 'pg_dump'));+ expect(RemoteProcessCommand::read(Activity::query()->latest('id')->first()))+ ->toContain("bash /data/coolify/source/upgrade.sh '4.0.10'");+ });++ it('skips the backup before the update when it is disabled', function () {+ updateCoolifyTestPrepareUpdate(['is_backup_before_update_enabled' => false]);+ Process::fake();++ (new UpdateCoolify)->handle(manual_update: true);++ Process::assertNotRan(fn ($process) => str_contains($process->command, 'pg_dump'));+ expect(Activity::query()->count())->toBe(1);+ });++ it('does not start the update when the instance backup fails', function () {+ updateCoolifyTestPrepareUpdate();+ Process::fake(['*pg_dump*' => Process::result(exitCode: 1), '*' => '']);++ expect(fn () => (new UpdateCoolify)->handle(manual_update: true))+ ->toThrow(Exception::class, 'The database backup failed, so the update was not started.')+ ->and(Activity::query()->count())->toBe(0);+ });