Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v4.0.0-beta.390 #4941

Merged
merged 47 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
cf361e0
FIX: trigger.dev templates - wrong key length issue
Winne4r Jan 2, 2025
5fcf3aa
FIX: trigger.dev template - missing ports and wrong env usage
Winne4r Jan 3, 2025
87d3241
FIX: trigger.dev template - fixed otel config
Winne4r Jan 3, 2025
f0ea389
FIX: trigger.dev template - fixed otel config
Winne4r Jan 3, 2025
fe2d070
Merge remote-tracking branch 'origin/main'
Winne4r Jan 3, 2025
350fd52
FIX: trigger.dev template - fixed port config
Winne4r Jan 17, 2025
c4bf91e
fix: remove quotes in COOLIFY_CONTAINER_NAME
nktnet1 Jan 23, 2025
071cabd
fix(proxy) update traefik proxy config for docker swarm
hederson Jan 23, 2025
8b6b1b6
fix(storage): Hetzner storage buckets not working
peaklabs-dev Jan 23, 2025
9184d0b
chore(versions): update coolify versions to v4.0.0-beta.3909
peaklabs-dev Jan 23, 2025
31ec952
Merge branch 'main' into next
peaklabs-dev Jan 23, 2025
4790d00
hide expand button if no additional lines to show
ari-party Jan 23, 2025
db8f0de
fix(ui): update database control UI to check server functionality bef…
andrasbacsai Jan 24, 2025
a55d199
feat(env): added COOLIFY_RESOURCE_UUID environment variable
nktnet1 Jan 24, 2025
23f803b
fix(ui): typo in upgrade message
peaklabs-dev Jan 24, 2025
91d90cc
fix(ui): Cloudflare tunnel configuration should be an info, not a war…
peaklabs-dev Jan 24, 2025
76ad3ee
Update change.blade.php
O-Hammam Jan 24, 2025
70bdb8d
Update change.blade.php
O-Hammam Jan 24, 2025
12c7ee2
fix(s3): DigitalOcean storage buckets do not work
peaklabs-dev Jan 25, 2025
d5504ea
refactor(s3): improve S3 bucket endpoint formatting
peaklabs-dev Jan 25, 2025
d1613fc
Fixing authentik creating providers wizzard bug by bumping up to a ne…
DmitryBoiadji Jan 26, 2025
50750eb
fix(ui): correct typo in container label helper text
andrasbacsai Jan 26, 2025
2d3ac5a
refactor(vite): improve environment variable handling in Vite configu…
andrasbacsai Jan 27, 2025
fddaf91
fix: disable certain parts if readonly label is turned off
andrasbacsai Jan 27, 2025
26ae104
feat(template): add Open Web UI
ItsTarikBTW Jan 27, 2025
01bffc4
Merge branch 'next' into services
ItsTarikBTW Jan 27, 2025
01b9cbd
fix: validate cron expression in Scheduled Task update
esarbanis Jan 27, 2025
bfe4200
fix: cleanup old scheduled_task_executions
andrasbacsai Jan 28, 2025
ff55ef6
Merge pull request #4953 from O-Hammam/patch-1
andrasbacsai Jan 28, 2025
f283e9f
Merge pull request #4942 from ari-party/main
andrasbacsai Jan 28, 2025
497a7ac
Merge pull request #4990 from esarbanis/cron-validation-on-update
andrasbacsai Jan 28, 2025
8f1bde2
fix(core): check cron expression on save
andrasbacsai Jan 28, 2025
e049559
fix(database): detect more postgres database image types
andrasbacsai Jan 28, 2025
bd324c3
Merge pull request #4968 from DmitryBoiadji/next
andrasbacsai Jan 28, 2025
bf37ad3
fix(templates): update service templates
andrasbacsai Jan 28, 2025
cd0320f
Merge pull request #4938 from hederson/fix-swarm-proxy
andrasbacsai Jan 28, 2025
d887788
Merge pull request #4933 from nktnet1/fix-coolify-env-quotes
andrasbacsai Jan 28, 2025
36d1ce6
Merge pull request #4989 from ItsTarikBTW/services
andrasbacsai Jan 28, 2025
04e8a2b
feat(templates): add Open Web UI service template
andrasbacsai Jan 28, 2025
06adb41
feat(ui): update GitHub source creation advanced section label
andrasbacsai Jan 28, 2025
53feec8
Merge pull request #4724 from Winne4r/main
andrasbacsai Jan 28, 2025
6e01444
refactor(ui): simplify GitHub App registration UI and layout
andrasbacsai Jan 28, 2025
cd8330d
fix(templates): update Trigger.dev service templates with v3 configur…
andrasbacsai Jan 28, 2025
1ec15af
fix(database): adjust MongoDB restore command and import view styling
andrasbacsai Jan 28, 2025
e9fd2d8
feat(core): add dynamic label reset for application settings
andrasbacsai Jan 28, 2025
e9efbce
feat(ui): conditionally enable advanced application settings based on…
andrasbacsai Jan 28, 2025
55fb4e5
Merge pull request #4945 from nktnet1/feat-env-coolify-resource-uuid
andrasbacsai Jan 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/Actions/Proxy/StartProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ public function handle(Server $server, bool $async = true, bool $force = false):
$docker_compose_yml_base64 = base64_encode($configuration);
$server->proxy->last_applied_settings = str($docker_compose_yml_base64)->pipe('md5')->value();
$server->save();
if ($server->isSwarm()) {
if ($server->isSwarmManager()) {
$commands = $commands->merge([
"mkdir -p $proxy_path/dynamic",
"cd $proxy_path",
"echo 'Creating required Docker Compose file.'",
"echo 'Starting coolify-proxy.'",
'docker stack deploy -c docker-compose.yml coolify-proxy',
'docker stack deploy --detach=true -c docker-compose.yml coolify-proxy',
"echo 'Successfully started coolify-proxy.'",
]);
} else {
Expand Down
8 changes: 8 additions & 0 deletions app/Console/Commands/CleanupDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ public function handle()
$application_deployment_queues->delete();
}

// Cleanup scheduled_task_executions table
$scheduled_task_executions = DB::table('scheduled_task_executions')->where('created_at', '<', now()->subDays($keep_days))->orderBy('created_at', 'desc');
$count = $scheduled_task_executions->count();
echo "Delete $count entries from scheduled_task_executions.\n";
if ($this->option('yes')) {
$scheduled_task_executions->delete();
}

// Cleanup webhooks table
$webhooks = DB::table('webhooks')->where('created_at', '<', now()->subDays($keep_days));
$count = $webhooks->count();
Expand Down
12 changes: 9 additions & 3 deletions app/Jobs/ApplicationDeploymentJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -923,8 +923,11 @@ private function save_environment_variables()
if ($this->application->environment_variables_preview->where('key', 'COOLIFY_BRANCH')->isEmpty()) {
$envs->push("COOLIFY_BRANCH=\"{$local_branch}\"");
}
if ($this->application->environment_variables_preview->where('key', 'COOLIFY_RESOURCE_UUID')->isEmpty()) {
$envs->push("COOLIFY_RESOURCE_UUID={$this->application->uuid}");
}
if ($this->application->environment_variables_preview->where('key', 'COOLIFY_CONTAINER_NAME')->isEmpty()) {
$envs->push("COOLIFY_CONTAINER_NAME=\"{$this->container_name}\"");
$envs->push("COOLIFY_CONTAINER_NAME={$this->container_name}");
}
}

Expand Down Expand Up @@ -982,8 +985,11 @@ private function save_environment_variables()
if ($this->application->environment_variables->where('key', 'COOLIFY_BRANCH')->isEmpty()) {
$envs->push("COOLIFY_BRANCH=\"{$local_branch}\"");
}
if ($this->application->environment_variables->where('key', 'COOLIFY_RESOURCE_UUID')->isEmpty()) {
$envs->push("COOLIFY_RESOURCE_UUID={$this->application->uuid}");
}
if ($this->application->environment_variables->where('key', 'COOLIFY_CONTAINER_NAME')->isEmpty()) {
$envs->push("COOLIFY_CONTAINER_NAME=\"{$this->container_name}\"");
$envs->push("COOLIFY_CONTAINER_NAME={$this->container_name}");
}
}

Expand Down Expand Up @@ -1145,7 +1151,7 @@ private function rolling_update()
$this->application_deployment_queue->addLogEntry('Rolling update started.');
$this->execute_remote_command(
[
executeInDocker($this->deployment_uuid, "docker stack deploy --with-registry-auth -c {$this->workdir}{$this->docker_compose_location} {$this->application->uuid}"),
executeInDocker($this->deployment_uuid, "docker stack deploy --detach=true --with-registry-auth -c {$this->workdir}{$this->docker_compose_location} {$this->application->uuid}"),
],
);
$this->application_deployment_queue->addLogEntry('Rolling update completed.');
Expand Down
7 changes: 1 addition & 6 deletions app/Jobs/DatabaseBackupJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -495,12 +495,7 @@ private function upload_to_s3(): void
} else {
$commands[] = "docker run -d --network {$network} --name backup-of-{$this->backup->uuid} --rm -v $this->backup_location:$this->backup_location:ro {$fullImageName}";
}
if ($this->s3->isHetzner()) {
$endpointWithoutBucket = 'https://'.str($endpoint)->after('https://')->after('.')->value();
$commands[] = "docker exec backup-of-{$this->backup->uuid} mc alias set --path=off --api=S3v4 temporary {$endpointWithoutBucket} $key $secret";
} else {
$commands[] = "docker exec backup-of-{$this->backup->uuid} mc config host add temporary {$endpoint} $key $secret";
}
$commands[] = "docker exec backup-of-{$this->backup->uuid} mc config host add temporary {$endpoint} $key $secret";
$commands[] = "docker exec backup-of-{$this->backup->uuid} mc cp $this->backup_location temporary/$bucket{$this->backup_dir}/";
instant_remote_process($commands, $this->server);

Expand Down
18 changes: 17 additions & 1 deletion app/Livewire/Project/Application/Advanced.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,20 @@ public function syncData(bool $toModel = false)
}
}

private function resetDefaultLabels()
{
if ($this->application->settings->is_container_label_readonly_enabled === false) {
return;
}
$customLabels = str(implode('|coolify|', generateLabelsApplication($this->application)))->replace('|coolify|', "\n");
$this->application->custom_labels = base64_encode($customLabels);
$this->application->save();
}

public function instantSave()
{
try {
$reset = false;
if ($this->isLogDrainEnabled) {
if (! $this->application->destination->server->isLogDrainEnabled()) {
$this->isLogDrainEnabled = false;
Expand All @@ -140,7 +151,7 @@ public function instantSave()
$this->application->isGzipEnabled() !== $this->isGzipEnabled ||
$this->application->isStripprefixEnabled() !== $this->isStripprefixEnabled
) {
$this->dispatch('resetDefaultLabels', false);
$reset = true;
}

if ($this->application->settings->is_raw_compose_deployment_enabled) {
Expand All @@ -149,6 +160,11 @@ public function instantSave()
$this->application->parse();
}
$this->syncData(true);

if ($reset) {
$this->resetDefaultLabels();
}

$this->dispatch('success', 'Settings saved.');
$this->dispatch('configurationChanged');
} catch (\Throwable $e) {
Expand Down
3 changes: 3 additions & 0 deletions app/Livewire/Project/Application/General.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ public function instantSave()
});
}
}
if ($this->application->settings->is_container_label_readonly_enabled) {
$this->resetDefaultLabels(false);
}
}

public function loadComposeFile($isInit = false)
Expand Down
2 changes: 1 addition & 1 deletion app/Livewire/Project/Database/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public function runImport()
case \App\Models\StandaloneMongodb::class:
$restoreCommand = $this->mongodbRestoreCommand;
if ($this->dumpAll === false) {
$restoreCommand .= " {$tmpPath}";
$restoreCommand .= "{$tmpPath}";
}
break;
}
Expand Down
7 changes: 6 additions & 1 deletion app/Livewire/Project/Shared/ScheduledTask/Show.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ public function syncData(bool $toModel = false)
{
if ($toModel) {
$this->validate();
$isValid = validate_cron_expression($this->frequency);
if (! $isValid) {
$this->frequency = $this->task->frequency;
throw new \Exception('Invalid Cron / Human expression.');
}
$this->task->enabled = $this->isEnabled;
$this->task->name = str($this->name)->trim()->value();
$this->task->command = str($this->command)->trim()->value();
Expand Down Expand Up @@ -109,7 +114,7 @@ public function submit()
$this->syncData(true);
$this->dispatch('success', 'Scheduled task updated.');
} catch (\Exception $e) {
return handleError($e);
return handleError($e, $this);
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/Livewire/Server/ConfigureCloudflareTunnels.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function submit()
$server->ip = $this->ssh_domain;
$server->save();
$server->settings->save();
$this->dispatch('warning', 'Cloudflare Tunnels configuration started.');
$this->dispatch('info', 'Cloudflare Tunnels configuration started.');
} catch (\Throwable $e) {
return handleError($e, $this);
}
Expand Down
28 changes: 19 additions & 9 deletions app/Livewire/Storage/Create.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Livewire\Storage;

use App\Models\S3Storage;
use Illuminate\Support\Uri;
use Livewire\Component;

class Create extends Component
Expand Down Expand Up @@ -45,15 +46,24 @@ class Create extends Component

public function updatedEndpoint($value)
{
if (! str($value)->startsWith('https://') && ! str($value)->startsWith('http://')) {
$this->endpoint = 'https://'.$value;
$value = $this->endpoint;
}

if (str($value)->contains('your-objectstorage.com') && ! isset($this->bucket)) {
$this->bucket = str($value)->after('//')->before('.');
} elseif (str($value)->contains('your-objectstorage.com')) {
$this->bucket = $this->bucket ?: str($value)->after('//')->before('.');
try {
if (empty($value)) {
return;
}
if (str($value)->contains('digitaloceanspaces.com')) {
$uri = Uri::of($value);
$host = $uri->host();

if (preg_match('/^(.+)\.([^.]+\.digitaloceanspaces\.com)$/', $host, $matches)) {
$host = $matches[2];
$value = "https://{$host}";
}
}
} finally {
if (! str($value)->startsWith('https://') && ! str($value)->startsWith('http://')) {
$value = 'https://'.$value;
}
$this->endpoint = $value;
}
}

Expand Down
10 changes: 0 additions & 10 deletions app/Models/S3Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,6 @@ public function awsUrl()
return "{$this->endpoint}/{$this->bucket}";
}

public function isHetzner()
{
return str($this->endpoint)->contains('your-objectstorage.com');
}

public function isDigitalOcean()
{
return str($this->endpoint)->contains('digitaloceanspaces.com');
}

public function testConnection(bool $shouldSave = false)
{
try {
Expand Down
2 changes: 1 addition & 1 deletion app/Models/ServiceDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function serviceType()
public function databaseType()
{
$image = str($this->image)->before(':');
if ($image->value() === 'postgres') {
if ($image->contains('postgres') || $image->contains('postgis')) {
$image = 'postgresql';
}

Expand Down
1 change: 0 additions & 1 deletion bootstrap/helpers/databases.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ function deleteBackupsS3(string|array|null $filenames, S3Storage $s3): void
'bucket' => $s3->bucket,
'endpoint' => $s3->endpoint,
'use_path_style_endpoint' => true,
'bucket_endpoint' => $s3->isHetzner() || $s3->isDigitalOcean(),
'aws_url' => $s3->awsUrl(),
]);

Expand Down
5 changes: 3 additions & 2 deletions bootstrap/helpers/proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ function generate_default_proxy_configuration(Server $server)
'--entryPoints.https.http2.maxConcurrentStreams=50',
'--entrypoints.https.http3',
'--providers.file.directory=/traefik/dynamic/',
'--providers.docker.exposedbydefault=false',
'--providers.file.watch=true',
'--certificatesresolvers.letsencrypt.acme.httpchallenge=true',
'--certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=http',
Expand All @@ -212,7 +211,8 @@ function generate_default_proxy_configuration(Server $server)
data_forget($config, 'services.traefik.restart');
data_forget($config, 'services.traefik.labels');

$config['services']['traefik']['command'][] = '--providers.docker.swarmMode=true';
$config['services']['traefik']['command'][] = '--providers.swarm.endpoint=unix:///var/run/docker.sock';
$config['services']['traefik']['command'][] = '--providers.swarm.exposedbydefault=false';
$config['services']['traefik']['deploy'] = [
'labels' => $labels,
'placement' => [
Expand All @@ -223,6 +223,7 @@ function generate_default_proxy_configuration(Server $server)
];
} else {
$config['services']['traefik']['command'][] = '--providers.docker=true';
$config['services']['traefik']['command'][] = '--providers.docker.exposedbydefault=false';
}
} elseif ($proxy_type === 'CADDY') {
$config = [
Expand Down
3 changes: 0 additions & 3 deletions bootstrap/helpers/s3.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

function set_s3_target(S3Storage $s3)
{
$is_digital_ocean = false;

config()->set('filesystems.disks.custom-s3', [
'driver' => 's3',
'region' => $s3['region'],
Expand All @@ -14,7 +12,6 @@ function set_s3_target(S3Storage $s3)
'bucket' => $s3['bucket'],
'endpoint' => $s3['endpoint'],
'use_path_style_endpoint' => true,
'bucket_endpoint' => $s3->isHetzner() || $s3->isDigitalOcean(),
'aws_url' => $s3->awsUrl(),
]);
}
8 changes: 7 additions & 1 deletion bootstrap/helpers/shared.php
Original file line number Diff line number Diff line change
Expand Up @@ -2115,6 +2115,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
$parsedServiceVariables->put($key, $value);
}
}
$parsedServiceVariables->put('COOLIFY_RESOURCE_UUID', "{$resource->uuid}");
$parsedServiceVariables->put('COOLIFY_CONTAINER_NAME', "$serviceName-{$resource->uuid}");

// TODO: move this in a shared function
Expand Down Expand Up @@ -3606,9 +3607,14 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
}
}

// Add COOLIFY_RESOURCE_UUID to environment
if ($resource->environment_variables->where('key', 'COOLIFY_RESOURCE_UUID')->isEmpty()) {
$coolifyEnvironments->put('COOLIFY_RESOURCE_UUID', "{$resource->uuid}");
}

// Add COOLIFY_CONTAINER_NAME to environment
if ($resource->environment_variables->where('key', 'COOLIFY_CONTAINER_NAME')->isEmpty()) {
$coolifyEnvironments->put('COOLIFY_CONTAINER_NAME', "\"{$containerName}\"");
$coolifyEnvironments->put('COOLIFY_CONTAINER_NAME', "{$containerName}");
}

if ($isApplication) {
Expand Down
2 changes: 1 addition & 1 deletion config/constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

return [
'coolify' => [
'version' => '4.0.0-beta.389',
'version' => '4.0.0-beta.390',
'helper_version' => '1.0.6',
'realtime_version' => '1.0.5',
'self_hosted' => env('SELF_HOSTED', true),
Expand Down
Loading
Loading