Skip to content

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.

Merge remote-tracking branch 'origin/next' into jean/port-exposes-improvement

Andras Bacsai07f381b88c0b
diff --cc app/Console/Commands/Init.php
index 66cb77838b,e95c29f72f..4783df0727
--- a/app/Console/Commands/Init.php
+++ b/app/Console/Commands/Init.php
@@@ -252,7 -253,7 +253,7 @@@ class Init extends Comman
'save_s3' => false,
'frequency' => '0 0 * * *',
'database_id' => $database->id,
-- 'database_type' => \App\Models\StandalonePostgresql::class,
++ 'database_type' => StandalonePostgresql::class,
'team_id' => 0,
]);
}
diff --cc app/Http/Controllers/Api/ApplicationsController.php
index 6b57d8f5f0,0bef2dc0fa..5e5405a7ae
--- a/app/Http/Controllers/Api/ApplicationsController.php
+++ b/app/Http/Controllers/Api/ApplicationsController.php
@@@ -1833,9 -1791,9 +1791,9 @@@ class ApplicationsController extends Co
]))->setStatusCode(201);
} elseif ($type === 'dockerimage') {
$validationRules = [
- 'docker_registry_image_name' => 'string|required',
- 'docker_registry_image_tag' => 'string',
+ 'docker_registry_image_name' => ['required', 'string', 'max:255', new DockerImageFormat],
+ 'docker_registry_image_tag' => ValidationPatterns::dockerImageTagRules(),
- 'ports_exposes' => 'string|regex:/^(\d+)(,\d+)*$/|required',
+ 'ports_exposes' => 'string|regex:/^(\d+)(,\d+)*$/|nullable',
];
$validationRules = array_merge(sharedDataApplications(), $validationRules);
$validator = customApiValidator($request->all(), $validationRules);
diff --cc app/Jobs/ApplicationDeploymentJob.php
index 41eb81453e,d6a8423973..811d0c9bdd
--- a/app/Jobs/ApplicationDeploymentJob.php
+++ b/app/Jobs/ApplicationDeploymentJob.php
@@@ -2585,7 -3138,7 +3138,7 @@@ COPY ./nginx.conf /etc/nginx/conf.d/def
'image' => $this->production_image_name,
'container_name' => $this->container_name,
'restart' => RESTART_MODE,
- ...(!empty($ports) ? ['expose' => $ports] : []),
- 'expose' => $ports,
++ ...(! empty($ports) ? ['expose' => $ports] : []),
'networks' => [
$this->destination->network => [
'aliases' => array_merge(
diff --cc app/Jobs/SendWebhookJob.php
index 607fda3fe2,9d2a946068..17517cebb1
--- a/app/Jobs/SendWebhookJob.php
+++ b/app/Jobs/SendWebhookJob.php
@@@ -2,6 -2,6 +2,7 @@@
namespace App\Jobs;
++use App\Rules\SafeWebhookUrl;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeEncrypted;
use Illuminate\Contracts\Queue\ShouldQueue;
@@@ -40,6 -42,20 +43,20 @@@ class SendWebhookJob implements ShouldB
*/
public function handle(): void
{
+ $validator = Validator::make(
+ ['webhook_url' => $this->webhookUrl],
- ['webhook_url' => ['required', 'url', new \App\Rules\SafeWebhookUrl]]
++ ['webhook_url' => ['required', 'url', new SafeWebhookUrl]]
+ );
+
+ if ($validator->fails()) {
+ Log::warning('SendWebhookJob: blocked unsafe webhook URL', [
+ 'url' => $this->webhookUrl,
+ 'errors' => $validator->errors()->all(),
+ ]);
+
+ return;
+ }
+
if (isDev()) {
ray('Sending webhook notification', [
'url' => $this->webhookUrl,
diff --cc app/Livewire/Project/Application/General.php
index 885c9dbac9,0295aa5fca..89b1b4217f
--- a/app/Livewire/Project/Application/General.php
+++ b/app/Livewire/Project/Application/General.php
@@@ -153,12 -154,12 +154,12 @@@ class General extends Componen
'staticImage' => 'required',
'baseDirectory' => array_merge(['required'], array_slice(ValidationPatterns::directoryPathRules(), 1)),
'publishDirectory' => ValidationPatterns::directoryPathRules(),
- 'portsExposes' => 'nullable',
- 'portsMappings' => 'nullable',
- 'portsExposes' => ['required', 'string', 'regex:/^(\d+)(,\d+)*$/'],
++ 'portsExposes' => ['nullable', 'string', 'regex:/^(\d+)(,\d+)*$/'],
+ 'portsMappings' => ValidationPatterns::portMappingRules(),
'customNetworkAliases' => 'nullable',
'dockerfile' => 'nullable',
- 'dockerRegistryImageName' => 'nullable',
- 'dockerRegistryImageTag' => 'nullable',
+ 'dockerRegistryImageName' => ValidationPatterns::dockerImageNameRules(),
+ 'dockerRegistryImageTag' => ValidationPatterns::dockerImageTagRules(),
'dockerfileLocation' => ValidationPatterns::filePathRules(),
'dockerComposeLocation' => ValidationPatterns::filePathRules(),
'dockerCompose' => 'nullable',
@@@ -208,6 -212,9 +212,8 @@@
'buildPack.required' => 'The Build Pack field is required.',
'staticImage.required' => 'The Static Image field is required.',
'baseDirectory.required' => 'The Base Directory field is required.',
- 'portsExposes.required' => 'The Exposed Ports field is required.',
+ 'portsExposes.regex' => 'Ports exposes must be a comma-separated list of port numbers (e.g. 3000,3001).',
+ ...ValidationPatterns::portMappingMessages(),
'isStatic.required' => 'The Static setting is required.',
'isStatic.boolean' => 'The Static setting must be true or false.',
'isSpa.required' => 'The SPA setting is required.',
@@@ -751,6 -759,12 +758,12 @@@
$this->authorize('update', $this->application);
$this->resetErrorBag();
+
- $this->portsExposes = str($this->portsExposes)->replace(' ', '')->trim()->toString();
++ $this->portsExposes = str($this->portsExposes)->replace(' ', '')->trim()->toString() ?: null;
+ if ($this->portsMappings) {
+ $this->portsMappings = str($this->portsMappings)->replace(' ', '')->trim()->toString();
+ }
+
$this->validate();
$oldPortsExposes = $this->application->ports_exposes;
diff --cc bootstrap/helpers/docker.php
index 5905ed3c1b,e97bc3732d..2cf159bfd5
--- a/bootstrap/helpers/docker.php
+++ b/bootstrap/helpers/docker.php
@@@ -86,7 -86,7 +86,7 @@@ function format_docker_command_output_t
return $outputLines
->reject(fn ($line) => empty($line))
->map(fn ($outputLine) => json_decode($outputLine, true, flags: JSON_THROW_ON_ERROR));
-- } catch (\Throwable) {
++ } catch (Throwable) {
return collect([]);
}
}
@@@ -123,7 -123,7 +123,7 @@@ function format_docker_envs_to_json($ra
return [$env[0] => $env[1]];
});
-- } catch (\Throwable) {
++ } catch (Throwable) {
return collect([]);
}
}
@@@ -255,12 -255,12 +255,12 @@@ function defaultLabels($id, $name, stri
function generateServiceSpecificFqdns(ServiceApplication|Application $resource)
{
-- if ($resource->getMorphClass() === \App\Models\ServiceApplication::class) {
++ if ($resource->getMorphClass() === ServiceApplication::class) {
$uuid = data_get($resource, 'uuid');
$server = data_get($resource, 'service.server');
$environment_variables = data_get($resource, 'service.environment_variables');
$type = $resource->serviceType();
-- } elseif ($resource->getMorphClass() === \App\Models\Application::class) {
++ } elseif ($resource->getMorphClass() === Application::class) {
$uuid = data_get($resource, 'uuid');
$server = data_get($resource, 'destination.server');
$environment_variables = data_get($resource, 'environment_variables');
@@@ -641,7 -641,7 +641,7 @@@ function fqdnLabelsForTraefik(string $u
}
}
}
-- } catch (\Throwable) {
++ } catch (Throwable) {
continue;
}
}
@@@ -1219,7 -1221,7 +1221,7 @@@ function validateComposeFile(string $co
$server = Server::ownedByCurrentTeam()->find($server_id);
try {
if (! $server) {
-- throw new \Exception('Server not found');
++ throw new Exception('Server not found');
}
$yaml_compose = Yaml::parse($compose);
@@@ -1235,7 -1237,7 +1237,7 @@@
], $server);
return 'OK';
-- } catch (\Throwable $e) {
++ } catch (Throwable $e) {
return $e->getMessage();
} finally {
if (filled($server)) {
@@@ -1351,10 -1353,10 +1353,10 @@@ function escapeBashDoubleQuoted(?strin
* Generate Docker build arguments from environment variables collection
* Returns only keys (no values) since values are sourced from environment via export
*
-- * @param \Illuminate\Support\Collection|array $variables Collection of variables with 'key', 'value', and optionally 'is_multiline'
-- * @return \Illuminate\Support\Collection Collection of formatted --build-arg strings (keys only)
++ * @param Collection|array $variables Collection of variables with 'key', 'value', and optionally 'is_multiline'
++ * @return Collection Collection of formatted --build-arg strings (keys only)
*/
--function generateDockerBuildArgs($variables): \Illuminate\Support\Collection
++function generateDockerBuildArgs($variables): Collection
{
$variables = collect($variables);
@@@ -1369,7 -1371,7 +1371,7 @@@
/**
* Generate Docker environment flags from environment variables collection
*
-- * @param \Illuminate\Support\Collection|array $variables Collection of variables with 'key', 'value', and optionally 'is_multiline'
++ * @param Collection|array $variables Collection of variables with 'key', 'value', and optionally 'is_multiline'
* @return string Space-separated environment flags
*/
function generateDockerEnvFlags($variables): string
diff --cc bootstrap/helpers/proxy.php
index cf9f648bbc,d443c84a4b..6997043937
--- a/bootstrap/helpers/proxy.php
+++ b/bootstrap/helpers/proxy.php
@@@ -4,6 -4,6 +4,7 @@@ use App\Actions\Proxy\SaveProxyConfigur
use App\Enums\ProxyTypes;
use App\Models\Application;
use App\Models\Server;
++use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Symfony\Component\Yaml\Yaml;
@@@ -133,7 -137,7 +138,7 @@@ function connectProxyToNetworks(Server
* This must be called BEFORE docker compose up since the compose file declares networks as external.
*
* @param Server $server The server to ensure networks on
-- * @return \Illuminate\Support\Collection Commands to create networks if they don't exist
++ * @return Collection Commands to create networks if they don't exist
*/
function ensureProxyNetworksExist(Server $server)
{
@@@ -207,7 -215,7 +216,7 @@@ function extractCustomProxyCommands(Ser
$custom_commands[] = $command;
}
}
-- } catch (\Exception $e) {
++ } catch (Exception $e) {
// If we can't parse the config, return empty array
// Silently fail to avoid breaking the proxy regeneration
}
@@@ -428,7 -436,7 +437,7 @@@ function getExactTraefikVersionFromCont
Log::debug("getExactTraefikVersionFromContainer: Server '{$server->name}' (ID: {$server->id}) - Could not detect exact version");
return null;
-- } catch (\Exception $e) {
++ } catch (Exception $e) {
Log::error("getExactTraefikVersionFromContainer: Server '{$server->name}' (ID: {$server->id}) - Error: ".$e->getMessage());
return null;
@@@ -475,7 -483,7 +484,7 @@@ function getTraefikVersionFromDockerCom
Log::debug("getTraefikVersionFromDockerCompose: Server '{$server->name}' (ID: {$server->id}) - Image format doesn't match expected pattern: {$image}");
return null;
-- } catch (\Exception $e) {
++ } catch (Exception $e) {
Log::error("getTraefikVersionFromDockerCompose: Server '{$server->name}' (ID: {$server->id}) - Error: ".$e->getMessage());
return null;
diff --cc bootstrap/helpers/remoteProcess.php
index f819df380e,bd76893351..3a516378f8
--- a/bootstrap/helpers/remoteProcess.php
+++ b/bootstrap/helpers/remoteProcess.php
@@@ -222,8 -241,14 +241,14 @@@ function decode_remote_command_output(?
return $formatted
->sortBy(fn ($i) => data_get($i, 'order'))
- ->map(function ($i) {
- data_set($i, 'timestamp', Carbon::parse(data_get($i, 'timestamp'))->format('Y-M-d H:i:s.u'));
+ ->map(function ($i) use ($serverTimezone) {
+ $timestamp = Carbon::parse(data_get($i, 'timestamp'));
+ try {
+ $timestamp->setTimezone($serverTimezone);
- } catch (\Exception) {
++ } catch (Exception) {
+ $timestamp->setTimezone('UTC');
+ }
+ data_set($i, 'timestamp', $timestamp->format('Y-M-d H:i:s.u'));
return $i;
})
diff --cc config/purify.php
index 66dbbb5683,a5dcabb927..3d181d6ebc
--- a/config/purify.php
+++ b/config/purify.php
@@@ -1,5 -1,5 +1,6 @@@
<?php
++use Stevebauman\Purify\Cache\CacheDefinitionCache;
use Stevebauman\Purify\Definitions\Html5Definition;
return [
@@@ -103,7 -114,7 +115,7 @@@
'serializer' => [
'driver' => env('CACHE_STORE', env('CACHE_DRIVER', 'file')),
-- 'cache' => \Stevebauman\Purify\Cache\CacheDefinitionCache::class,
++ 'cache' => CacheDefinitionCache::class,
],
// 'serializer' => [
diff --cc database/seeders/SharedEnvironmentVariableSeeder.php
index 54643fe3b9,7a17fbd10c..cfd2a3fefb
--- a/database/seeders/SharedEnvironmentVariableSeeder.php
+++ b/database/seeders/SharedEnvironmentVariableSeeder.php
@@@ -32,5 -33,29 +33,29 @@@ class SharedEnvironmentVariableSeeder e
'project_id' => 1,
'team_id' => 0,
]);
+
+ // Add predefined server variables to all existing servers
- $servers = \App\Models\Server::all();
++ $servers = Server::all();
+ foreach ($servers as $server) {
+ SharedEnvironmentVariable::firstOrCreate([
+ 'key' => 'COOLIFY_SERVER_UUID',
+ 'type' => 'server',
+ 'server_id' => $server->id,
+ 'team_id' => $server->team_id,
+ ], [
+ 'value' => $server->uuid,
+ 'is_literal' => true,
+ ]);
+
+ SharedEnvironmentVariable::firstOrCreate([
+ 'key' => 'COOLIFY_SERVER_NAME',
+ 'type' => 'server',
+ 'server_id' => $server->id,
+ 'team_id' => $server->team_id,
+ ], [
+ 'value' => $server->name,
+ 'is_literal' => true,
+ ]);
+ }
}
}
diff --cc openapi.json
index aec5a28430,f3bda9ab83..ca445ade00
--- a/openapi.json
+++ b/openapi.json
@@@ -79,8 -79,8 +79,7 @@@
"environment_uuid",
"git_repository",
"git_branch",
-- "build_pack",
-- "ports_exposes"
++ "build_pack"
],
"properties": {
"project_uuid": {
@@@ -520,8 -526,8 +525,7 @@@
"github_app_uuid",
"git_repository",
"git_branch",
-- "build_pack",
-- "ports_exposes"
++ "build_pack"
],
"properties": {
"project_uuid": {
@@@ -965,8 -977,8 +975,7 @@@
"private_key_uuid",
"git_repository",
"git_branch",
-- "build_pack",
-- "ports_exposes"
++ "build_pack"
],
"properties": {
"project_uuid": {
@@@ -1760,8 -1775,8 +1772,7 @@@
"server_uuid",
"environment_name",
"environment_uuid",
-- "docker_registry_image_name",
-- "ports_exposes"
++ "docker_registry_image_name"
],
"properties": {
"project_uuid": {
diff --cc openapi.yaml
index 93038ce806,fae8d7110b..6182cacd37
--- a/openapi.yaml
+++ b/openapi.yaml
@@@ -59,7 -59,7 +59,6 @@@ paths
- git_repository
- git_branch
- build_pack
-- - ports_exposes
properties:
project_uuid:
type: string
@@@ -340,7 -344,7 +343,6 @@@
- git_repository
- git_branch
- build_pack
-- - ports_exposes
properties:
project_uuid:
type: string
@@@ -624,7 -632,7 +630,6 @@@
- git_repository
- git_branch
- build_pack
-- - ports_exposes
properties:
project_uuid:
type: string
@@@ -1129,7 -1141,7 +1138,6 @@@
- environment_name
- environment_uuid
- docker_registry_image_name
-- - ports_exposes
properties:
project_uuid:
type: string
diff --cc templates/service-templates-latest.json
index 51cb39de0a,92685d8bf3..7df83fcc81
--- a/templates/service-templates-latest.json
+++ b/templates/service-templates-latest.json
@@@ -3508,7 -3640,7 +3640,7 @@@
"owncloud": {
"documentation": "https://owncloud.com/docs-guides/?utm_source=coolify.io",
"slogan": "OwnCloud with Open Web UI integrates file management with a powerful, user-friendly interface.",
-- "compose": "c2VydmljZXM6CiAgb3duY2xvdWQ6CiAgICBpbWFnZTogJ293bmNsb3VkL3NlcnZlcjpsYXRlc3QnCiAgICBkZXBlbmRzX29uOgogICAgICBtYXJpYWRiOgogICAgICAgIGNvbmRpdGlvbjogc2VydmljZV9oZWFsdGh5CiAgICAgIHJlZGlzOgogICAgICAgIGNvbmRpdGlvbjogc2VydmljZV9oZWFsdGh5CiAgICBlbnZpcm9ubWVudDoKICAgICAgLSBTRVJWSUNFX1VSTF9PV05DTE9VRF84MDgwCiAgICAgIC0gJ09XTkNMT1VEX0RPTUFJTj0ke1NFUlZJQ0VfVVJMX09XTkNMT1VEfScKICAgICAgLSAnT1dOQ0xPVURfVFJVU1RFRF9ET01BSU5TPSR7U0VSVklDRV9VUkxfT1dOQ0xPVUR9JwogICAgICAtIE9XTkNMT1VEX0RCX1RZUEU9bXlzcWwKICAgICAgLSBPV05DTE9VRF9EQl9IT1NUPW1hcmlhZGIKICAgICAgLSAnT1dOQ0xPVURfREJfTkFNRT0ke0RCX05BTUU6LW93bmNsb3VkfScKICAgICAgLSAnT1dOQ0xPVURfREJfVVNFUk5BTUU9JHtTRVJWSUNFX1VTRVJfTUFSSUFEQn0nCiAgICAgIC0gJ09XTkNMT1VEX0RCX1BBU1NXT1JEPSR7U0VSVklDRV9QQVNTV09SRF9NQVJJQURCfScKICAgICAgLSAnT1dOQ0xPVURfQURNSU5fVVNFUk5BTUU9JHtTRVJWSUNFX1VTRVJfT1dOQ0xPVUR9JwogICAgICAtICdPV05DTE9VRF9BRE1JTl9QQVNTV09SRD0ke1NFUlZJQ0VfUEFTU1dPUkRfT1dOQ0xPVUR9JwogICAgICAtICdPV05DTE9VRF9NWVNRTF9VVEY4TUI0PSR7TVlTUUxfVVRGOE1CNDotdHJ1ZX0nCiAgICAgIC0gJ09XTkNMT1VEX1JFRElTX0VOQUJMRUQ9JHtSRURJU19FTkFCTEVEOi10cnVlfScKICAgICAgLSBPV05DTE9VRF9SRURJU19IT1NUPXJlZGlzCiAgICBoZWFsdGhjaGVjazoKICAgICAgdGVzdDoKICAgICAgICAtIENNRAogICAgICAgIC0gL3Vzci9iaW4vaGVhbHRoY2hlY2sKICAgICAgaW50ZXJ2YWw6IDMwcwogICAgICB0aW1lb3V0OiAxMHMKICAgICAgcmV0cmllczogNQogICAgdm9sdW1lczoKICAgICAgLSAnb3duY2xvdWQtZGF0YTovbW50L2RhdGEnCiAgbWFyaWFkYjoKICAgIGltYWdlOiAnbWFyaWFkYjpsYXRlc3QnCiAgICBlbnZpcm9ubWVudDoKICAgICAgLSAnTVlTUUxfUk9PVF9QQVNTV09SRD0ke1NFUlZJQ0VfUEFTU1dPUkRfTUFSSUFEQlJPT1R9JwogICAgICAtICdNWVNRTF9VU0VSPSR7U0VSVklDRV9VU0VSX01BUklBREJ9JwogICAgICAtICdNWVNRTF9QQVNTV09SRD0ke1NFUlZJQ0VfUEFTU1dPUkRfTUFSSUFEQn0nCiAgICAgIC0gJ01ZU1FMX0RBVEFCQVNFPSR7REJfTkFNRTotb3duY2xvdWR9JwogICAgICAtIFRaPWF1dG8KICAgIGNvbW1hbmQ6CiAgICAgIC0gJy0tY2hhcmFjdGVyLXNldC1zZXJ2ZXI9dXRmOG1iNCcKICAgICAgLSAnLS1jb2xsYXRpb24tc2VydmVyPXV0ZjhtYjRfYmluJwogICAgICAtICctLW1heC1hbGxvd2VkLXBhY2tldD0xMjhNJwogICAgICAtICctLWlubm9kYi1sb2ctZmlsZS1zaXplPTY0TScKICAgIGhlYWx0aGNoZWNrOgogICAgICB0ZXN0OgogICAgICAgIC0gQ01ECiAgICAgICAgLSBoZWFsdGhjaGVjay5zaAogICAgICAgIC0gJy0tY29ubmVjdCcKICAgICAgICAtICctLWlubm9kYl9pbml0aWFsaXplZCcKICAgICAgaW50ZXJ2YWw6IDVzCiAgICAgIHRpbWVvdXQ6IDIwcwogICAgICByZXRyaWVzOiAxMAogICAgdm9sdW1lczoKICAgICAgLSAnb3duY2xvdWQtbXlzcWwtZGF0YTovdmFyL2xpYi9teXNxbCcKICByZWRpczoKICAgIGltYWdlOiAncmVkaXM6NicKICAgIGNvbW1hbmQ6CiAgICAgIC0gJy0tZGF0YWJhc2VzJwogICAgICAtICcxJwogICAgaGVhbHRoY2hlY2s6CiAgICAgIHRlc3Q6CiAgICAgICAgLSBDTUQKICAgICAgICAtIHJlZGlzLWNsaQogICAgICAgIC0gcGluZwogICAgICBpbnRlcnZhbDogMTBzCiAgICAgIHRpbWVvdXQ6IDVzCiAgICAgIHJldHJpZXM6IDUK",
++ "compose": "c2VydmljZXM6CiAgb3duY2xvdWQ6CiAgICBpbWFnZTogJ293bmNsb3VkL3NlcnZlcjpsYXRlc3QnCiAgICBkZXBlbmRzX29uOgogICAgICBtYXJpYWRiOgogICAgICAgIGNvbmRpdGlvbjogc2VydmljZV9oZWFsdGh5CiAgICAgIHJlZGlzOgogICAgICAgIGNvbmRpdGlvbjogc2VydmljZV9oZWFsdGh5CiAgICBlbnZpcm9ubWVudDoKICAgICAgLSBTRVJWSUNFX1VSTF9PV05DTE9VRF84MDgwCiAgICAgIC0gJ09XTkNMT1VEX0RPTUFJTj0ke1NFUlZJQ0VfRlFETl9PV05DTE9VRH0nCiAgICAgIC0gJ09XTkNMT1VEX1RSVVNURURfRE9NQUlOUz0ke1NFUlZJQ0VfRlFETl9PV05DTE9VRH0nCiAgICAgIC0gT1dOQ0xPVURfREJfVFlQRT1teXNxbAogICAgICAtIE9XTkNMT1VEX0RCX0hPU1Q9bWFyaWFkYgogICAgICAtICdPV05DTE9VRF9EQl9OQU1FPSR7REJfTkFNRTotb3duY2xvdWR9JwogICAgICAtICdPV05DTE9VRF9EQl9VU0VSTkFNRT0ke1NFUlZJQ0VfVVNFUl9NQVJJQURCfScKICAgICAgLSAnT1dOQ0xPVURfREJfUEFTU1dPUkQ9JHtTRVJWSUNFX1BBU1NXT1JEX01BUklBREJ9JwogICAgICAtICdPV05DTE9VRF9BRE1JTl9VU0VSTkFNRT0ke1NFUlZJQ0VfVVNFUl9PV05DTE9VRH0nCiAgICAgIC0gJ09XTkNMT1VEX0FETUlOX1BBU1NXT1JEPSR7U0VSVklDRV9QQVNTV09SRF9PV05DTE9VRH0nCiAgICAgIC0gJ09XTkNMT1VEX01ZU1FMX1VURjhNQjQ9JHtNWVNRTF9VVEY4TUI0Oi10cnVlfScKICAgICAgLSAnT1dOQ0xPVURfUkVESVNfRU5BQkxFRD0ke1JFRElTX0VOQUJMRUQ6LXRydWV9JwogICAgICAtIE9XTkNMT1VEX1JFRElTX0hPU1Q9cmVkaXMKICAgIGhlYWx0aGNoZWNrOgogICAgICB0ZXN0OgogICAgICAgIC0gQ01ECiAgICAgICAgLSAvdXNyL2Jpbi9oZWFsdGhjaGVjawogICAgICBpbnRlcnZhbDogMzBzCiAgICAgIHRpbWVvdXQ6IDEwcwogICAgICByZXRyaWVzOiA1CiAgICB2b2x1bWVzOgogICAgICAtICdvd25jbG91ZC1kYXRhOi9tbnQvZGF0YScKICBtYXJpYWRiOgogICAgaW1hZ2U6ICdtYXJpYWRiOmxhdGVzdCcKICAgIGVudmlyb25tZW50OgogICAgICAtICdNWVNRTF9ST09UX1BBU1NXT1JEPSR7U0VSVklDRV9QQVNTV09SRF9NQVJJQURCUk9PVH0nCiAgICAgIC0gJ01ZU1FMX1VTRVI9JHtTRVJWSUNFX1VTRVJfTUFSSUFEQn0nCiAgICAgIC0gJ01ZU1FMX1BBU1NXT1JEPSR7U0VSVklDRV9QQVNTV09SRF9NQVJJQURCfScKICAgICAgLSAnTVlTUUxfREFUQUJBU0U9JHtEQl9OQU1FOi1vd25jbG91ZH0nCiAgICAgIC0gVFo9YXV0bwogICAgY29tbWFuZDoKICAgICAgLSAnLS1jaGFyYWN0ZXItc2V0LXNlcnZlcj11dGY4bWI0JwogICAgICAtICctLWNvbGxhdGlvbi1zZXJ2ZXI9dXRmOG1iNF9iaW4nCiAgICAgIC0gJy0tbWF4LWFsbG93ZWQtcGFja2V0PTEyOE0nCiAgICAgIC0gJy0taW5ub2RiLWxvZy1maWxlLXNpemU9NjRNJwogICAgaGVhbHRoY2hlY2s6CiAgICAgIHRlc3Q6CiAgICAgICAgLSBDTUQKICAgICAgICAtIGhlYWx0aGNoZWNrLnNoCiAgICAgICAgLSAnLS1jb25uZWN0JwogICAgICAgIC0gJy0taW5ub2RiX2luaXRpYWxpemVkJwogICAgICBpbnRlcnZhbDogNXMKICAgICAgdGltZW91dDogMjBzCiAgICAgIHJldHJpZXM6IDEwCiAgICB2b2x1bWVzOgogICAgICAtICdvd25jbG91ZC1teXNxbC1kYXRhOi92YXIvbGliL215c3FsJwogIHJlZGlzOgogICAgaW1hZ2U6ICdyZWRpczo2JwogICAgY29tbWFuZDoKICAgICAgLSAnLS1kYXRhYmFzZXMnCiAgICAgIC0gJzEnCiAgICBoZWFsdGhjaGVjazoKICAgICAgdGVzdDoKICAgICAgICAtIENNRAogICAgICAgIC0gcmVkaXMtY2xpCiAgICAgICAgLSBwaW5nCiAgICAgIGludGVydmFsOiAxMHMKICAgICAgdGltZW91dDogNXMKICAgICAgcmV0cmllczogNQo=",
"tags": [
"owncloud",
"file-management",
diff --cc tests/Feature/OauthControllerTest.php
index 0000000000,af5fb0658f..1388e29808
mode 000000,100644..100644
--- a/tests/Feature/OauthControllerTest.php
+++ b/tests/Feature/OauthControllerTest.php
@@@ -1,0 -1,79 +1,79 @@@
+ <?php
+
+ use App\Models\InstanceSettings;
+ use App\Models\OauthSetting;
+ use App\Models\User;
+ use Illuminate\Foundation\Testing\RefreshDatabase;
+ use Laravel\Socialite\Facades\Socialite;
+
+ uses(RefreshDatabase::class);
+
+ beforeEach(function () {
+ InstanceSettings::create([
+ 'id' => 0,
+ 'is_registration_enabled' => false,
+ ]);
+
+ OauthSetting::create([
+ 'provider' => 'google',
+ 'client_id' => 'client-id',
+ 'client_secret' => 'client-secret',
+ 'redirect_uri' => 'https://coolify.example.com/auth/google/callback',
+ 'tenant' => 'example.com',
+ ]);
+ });
+
+ it('logs in an existing user when the oauth provider returns a mixed-case email', function () {
+ config()->set('app.maintenance.driver', 'file');
+
+ $user = User::factory()->create([
+ 'email' => '[email protected]',
+ ]);
+
- $provider = \Mockery::mock();
++ $provider = Mockery::mock();
+ $provider->shouldReceive('setConfig')->once()->andReturnSelf();
+ $provider->shouldReceive('with')->once()->with(['hd' => 'example.com'])->andReturnSelf();
+ $provider->shouldReceive('user')->once()->andReturn((object) [
+ 'email' => '[email protected]',
+ 'name' => 'Example User',
+ 'id' => 'google-user-id',
+ ]);
+
+ Socialite::shouldReceive('driver')->once()->with('google')->andReturn($provider);
+
+ $response = $this->get(route('auth.callback', 'google'));
+
+ $response->assertRedirect('/');
+ $this->assertAuthenticatedAs($user);
+ expect(User::count())->toBe(1);
+ });
+
+ it('rejects oauth logins when the provider does not return an email address', function (?string $providerEmail) {
+ config()->set('app.maintenance.driver', 'file');
+ InstanceSettings::firstOrCreate([
+ 'id' => 0,
+ ], [
+ 'is_registration_enabled' => false,
+ ])->update([
+ 'is_registration_enabled' => true,
+ ]);
+
- $provider = \Mockery::mock();
++ $provider = Mockery::mock();
+ $provider->shouldReceive('setConfig')->once()->andReturnSelf();
+ $provider->shouldReceive('with')->once()->with(['hd' => 'example.com'])->andReturnSelf();
+ $provider->shouldReceive('user')->once()->andReturn((object) [
+ 'email' => $providerEmail,
+ 'name' => 'Example User',
+ 'id' => 'google-user-id',
+ ]);
+
+ Socialite::shouldReceive('driver')->once()->with('google')->andReturn($provider);
+
+ $response = $this->from('/login')->get(route('auth.callback', 'google'));
+
+ $response->assertRedirect('/login');
+ expect(User::count())->toBe(0);
+ })->with([
+ 'null email' => [null],
+ 'blank email' => [' '],
+ ]);
diff --cc tests/Feature/UpgradeComponentTest.php
index 0000000000,896e0fa3bb..aae32a7f75
mode 000000,100644..100644
--- a/tests/Feature/UpgradeComponentTest.php
+++ b/tests/Feature/UpgradeComponentTest.php
@@@ -1,0 -1,100 +1,100 @@@
+ <?php
+
+ use App\Livewire\Upgrade;
+ use App\Models\InstanceSettings;
+ use Illuminate\Foundation\Testing\RefreshDatabase;
+ use Illuminate\Support\Facades\Cache;
+ use Livewire\Livewire;
+
+ uses(RefreshDatabase::class);
+
+ it('initializes latest version during mount from cached versions data', function () {
+ config(['constants.coolify.version' => '4.0.0-beta.998']);
+ InstanceSettings::create([
+ 'id' => 0,
+ 'new_version_available' => true,
+ ]);
+
+ Cache::shouldReceive('remember')
+ ->once()
- ->with('coolify:versions:all', 3600, Mockery::type(\Closure::class))
++ ->with('coolify:versions:all', 3600, Mockery::type(Closure::class))
+ ->andReturn([
+ 'coolify' => [
+ 'v4' => [
+ 'version' => '4.0.0-beta.999',
+ ],
+ ],
+ ]);
+
+ Livewire::test(Upgrade::class)
+ ->assertSet('currentVersion', '4.0.0-beta.998')
+ ->assertSet('latestVersion', '4.0.0-beta.999')
+ ->assertSet('isUpgradeAvailable', true)
+ ->assertSee('4.0.0-beta.998')
+ ->assertSee('4.0.0-beta.999');
+ });
+
+ it('falls back to 0.0.0 during mount when cached versions data is unavailable', function () {
+ InstanceSettings::create([
+ 'id' => 0,
+ 'new_version_available' => false,
+ ]);
+
+ Cache::shouldReceive('remember')
+ ->once()
- ->with('coolify:versions:all', 3600, Mockery::type(\Closure::class))
++ ->with('coolify:versions:all', 3600, Mockery::type(Closure::class))
+ ->andReturn(null);
+
+ Livewire::test(Upgrade::class)
+ ->assertSet('latestVersion', '0.0.0');
+ });
+
+ it('clears stale upgrade availability when current version already matches latest version', function () {
+ config(['constants.coolify.version' => '4.0.0-beta.999']);
+ InstanceSettings::create([
+ 'id' => 0,
+ 'new_version_available' => true,
+ ]);
+
+ Cache::shouldReceive('remember')
+ ->once()
- ->with('coolify:versions:all', 3600, Mockery::type(\Closure::class))
++ ->with('coolify:versions:all', 3600, Mockery::type(Closure::class))
+ ->andReturn([
+ 'coolify' => [
+ 'v4' => [
+ 'version' => '4.0.0-beta.999',
+ ],
+ ],
+ ]);
+
+ Livewire::test(Upgrade::class)
+ ->assertSet('latestVersion', '4.0.0-beta.999')
+ ->assertSet('isUpgradeAvailable', false);
+
+ expect(InstanceSettings::findOrFail(0)->new_version_available)->toBeFalse();
+ });
+
+ it('clears stale upgrade availability when current version is newer than cached latest version', function () {
+ config(['constants.coolify.version' => '4.0.0-beta.1000']);
+ InstanceSettings::create([
+ 'id' => 0,
+ 'new_version_available' => true,
+ ]);
+
+ Cache::shouldReceive('remember')
+ ->once()
- ->with('coolify:versions:all', 3600, Mockery::type(\Closure::class))
++ ->with('coolify:versions:all', 3600, Mockery::type(Closure::class))
+ ->andReturn([
+ 'coolify' => [
+ 'v4' => [
+ 'version' => '4.0.0-beta.999',
+ ],
+ ],
+ ]);
+
+ Livewire::test(Upgrade::class)
+ ->assertSet('latestVersion', '4.0.0-beta.999')
+ ->assertSet('isUpgradeAvailable', false);
+
+ expect(InstanceSettings::findOrFail(0)->new_version_available)->toBeFalse();
+ });
diff --cc tests/Unit/ProxyConfigRecoveryTest.php
index e10d899fee,682407bdfe..0d6a04aa51
--- a/tests/Unit/ProxyConfigRecoveryTest.php
+++ b/tests/Unit/ProxyConfigRecoveryTest.php
@@@ -1,6 -1,6 +1,7 @@@
<?php
use App\Actions\Proxy\GetProxyConfiguration;
++use Illuminate\Log\LogManager;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Log;
use Spatie\SchemalessAttributes\SchemalessAttributes;
@@@ -83,7 -83,7 +84,7 @@@ YAML
});
it('logs warning when regenerating defaults', function () {
-- Log::swap(new \Illuminate\Log\LogManager(app()));
++ Log::swap(new LogManager(app()));
Log::spy();
// No DB config, no disk config — will try to regenerate
@@@ -94,7 -94,7 +95,7 @@@
// the force regenerate path instead
try {
GetProxyConfiguration::run($server, forceRegenerate: true);
-- } catch (\Throwable $e) {
++ } catch (Throwable $e) {
// generateDefaultProxyConfiguration may fail without full server setup
}
@@@ -115,7 -115,7 +116,7 @@@ it('does not read from disk when DB con
});
it('rejects stored Traefik config when proxy type is CADDY', function () {
-- Log::swap(new \Illuminate\Log\LogManager(app()));
++ Log::swap(new LogManager(app()));
Log::spy();
$traefikConfig = "services:\n traefik:\n image: traefik:v3.6\n";
@@@ -126,7 -126,7 +127,7 @@@
// Both will fail in test env, but the warning log proves mismatch was detected.
try {
GetProxyConfiguration::run($server);
-- } catch (\Throwable $e) {
++ } catch (Throwable $e) {
// Expected — regeneration requires SSH/full server setup
}
@@@ -136,7 -136,7 +137,7 @@@
});
it('rejects stored Caddy config when proxy type is TRAEFIK', function () {
-- Log::swap(new \Illuminate\Log\LogManager(app()));
++ Log::swap(new LogManager(app()));
Log::spy();
$caddyConfig = "services:\n caddy:\n image: lucaslorentz/caddy-docker-proxy:2.8-alpine\n";
@@@ -144,7 -144,7 +145,7 @@@
try {
GetProxyConfiguration::run($server);
-- } catch (\Throwable $e) {
++ } catch (Throwable $e) {
// Expected — regeneration requires SSH/full server setup
}