From 11fb0c240fdef8196bfbca2998ad844f52262a78 Mon Sep 17 00:00:00 2001 From: ShadowArcanist <162910371+ShadowArcanist@users.noreply.github.com> Date: Tue, 21 Jan 2025 02:12:26 +0530 Subject: [PATCH 01/50] fix(service): Add healthcheck to Cloudflared service (#4859) --- templates/compose/cloudflared.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/templates/compose/cloudflared.yaml b/templates/compose/cloudflared.yaml index 0d08fb24a..1769932dd 100644 --- a/templates/compose/cloudflared.yaml +++ b/templates/compose/cloudflared.yaml @@ -11,3 +11,8 @@ services: command: tunnel --no-autoupdate run environment: - 'TUNNEL_TOKEN=${CLOUDFLARE_TUNNEL_TOKEN}' + healthcheck: + test: ["CMD", "cloudflared", "--version"] + interval: 5s + timeout: 20s + retries: 10 From d41c874d2a6c9e21b270c22f5f9637a46cde82fe Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 21 Jan 2025 11:16:03 +0100 Subject: [PATCH 02/50] version++ --- config/constants.php | 2 +- versions.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/constants.php b/config/constants.php index fc2d92c56..ce37915b3 100644 --- a/config/constants.php +++ b/config/constants.php @@ -2,7 +2,7 @@ return [ 'coolify' => [ - 'version' => '4.0.0-beta.383', + 'version' => '4.0.0-beta.384', 'self_hosted' => env('SELF_HOSTED', true), 'autoupdate' => env('AUTOUPDATE'), 'base_config_path' => env('BASE_CONFIG_PATH', '/data/coolify'), diff --git a/versions.json b/versions.json index a1a01432c..c0e8d950f 100644 --- a/versions.json +++ b/versions.json @@ -1,10 +1,10 @@ { "coolify": { "v4": { - "version": "4.0.0-beta.383" + "version": "4.0.0-beta.384" }, "nightly": { - "version": "4.0.0-beta.384" + "version": "4.0.0-beta.385" }, "helper": { "version": "1.0.4" From 8e587965e199a8c5fb3ac0eea989e7da4844381c Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 21 Jan 2025 11:16:16 +0100 Subject: [PATCH 03/50] fix: remove wire:navigate from import backups --- .../views/livewire/project/database/configuration.blade.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/views/livewire/project/database/configuration.blade.php b/resources/views/livewire/project/database/configuration.blade.php index 4ea3be105..d3649f94a 100644 --- a/resources/views/livewire/project/database/configuration.blade.php +++ b/resources/views/livewire/project/database/configuration.blade.php @@ -20,8 +20,8 @@ href="{{ route('project.database.persistent-storage', ['project_uuid' => $project->uuid, 'environment_uuid' => $environment->uuid, 'database_uuid' => $database->uuid]) }}" wire:navigate>Persistent Storage Import Backups + href="{{ route('project.database.import-backups', ['project_uuid' => $project->uuid, 'environment_uuid' => $environment->uuid, 'database_uuid' => $database->uuid]) }}">Import + Backups Webhooks From 8fa59f5ade2e4e71d906467705d20ffc873cce5b Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Tue, 21 Jan 2025 12:32:35 +0100 Subject: [PATCH 04/50] fix(ui): Backups link should not redirected to general --- resources/views/livewire/project/service/index.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/livewire/project/service/index.blade.php b/resources/views/livewire/project/service/index.blade.php index 2e31d7499..8796be966 100644 --- a/resources/views/livewire/project/service/index.blade.php +++ b/resources/views/livewire/project/service/index.blade.php @@ -13,7 +13,7 @@ @if ($serviceDatabase?->isBackupSolutionAvailable()) Backups + wire:navigate href="#backups">Backups @endif
From e83164e537b82f489144b50624c30a26463b721c Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 21 Jan 2025 13:04:43 +0100 Subject: [PATCH 05/50] fix: envs with special chars during build --- app/Jobs/ApplicationDeploymentJob.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index 37c73d10f..c25325ad4 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -2287,7 +2287,10 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf"); private function generate_build_env_variables() { $variables = collect($this->nixpacks_plan_json->get('variables')); + $this->build_args = $variables->map(function ($value, $key) { + $value = escapeshellarg($value); + return "--build-arg {$key}={$value}"; }); } From 1c39b133d395884517fba0bb331e87c8ca9374c8 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 21 Jan 2025 13:18:02 +0100 Subject: [PATCH 06/50] version++ --- config/constants.php | 2 +- versions.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/constants.php b/config/constants.php index ce37915b3..dddaebbb5 100644 --- a/config/constants.php +++ b/config/constants.php @@ -2,7 +2,7 @@ return [ 'coolify' => [ - 'version' => '4.0.0-beta.384', + 'version' => '4.0.0-beta.385', 'self_hosted' => env('SELF_HOSTED', true), 'autoupdate' => env('AUTOUPDATE'), 'base_config_path' => env('BASE_CONFIG_PATH', '/data/coolify'), diff --git a/versions.json b/versions.json index c0e8d950f..dd64cc010 100644 --- a/versions.json +++ b/versions.json @@ -1,10 +1,10 @@ { "coolify": { "v4": { - "version": "4.0.0-beta.384" + "version": "4.0.0-beta.385" }, "nightly": { - "version": "4.0.0-beta.385" + "version": "4.0.0-beta.386" }, "helper": { "version": "1.0.4" From 7e58cb9125b118ef42a054c5fe7bcda46dec2ffc Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 21 Jan 2025 13:39:53 +0100 Subject: [PATCH 07/50] fix: load service templates on cloud --- app/Jobs/PullTemplatesFromCDN.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Jobs/PullTemplatesFromCDN.php b/app/Jobs/PullTemplatesFromCDN.php index 45c536e06..9a4c991bc 100644 --- a/app/Jobs/PullTemplatesFromCDN.php +++ b/app/Jobs/PullTemplatesFromCDN.php @@ -25,7 +25,7 @@ class PullTemplatesFromCDN implements ShouldBeEncrypted, ShouldQueue public function handle(): void { try { - if (isDev() || isCloud()) { + if (isDev()) { return; } $response = Http::retry(3, 1000)->get(config('constants.services.official')); From 419710402657ceb0c4c870dae8a708f1c8b60ba2 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Tue, 21 Jan 2025 14:02:29 +0100 Subject: [PATCH 08/50] fix(db): `finished_at` timestamps are not set for existing deployments --- ...date_finished_at_timestamps_if_not_set.php | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 database/migrations/2025_01_21_125205_update_finished_at_timestamps_if_not_set.php diff --git a/database/migrations/2025_01_21_125205_update_finished_at_timestamps_if_not_set.php b/database/migrations/2025_01_21_125205_update_finished_at_timestamps_if_not_set.php new file mode 100644 index 000000000..050e8f1ae --- /dev/null +++ b/database/migrations/2025_01_21_125205_update_finished_at_timestamps_if_not_set.php @@ -0,0 +1,37 @@ +whereNull('finished_at') + ->update(['finished_at' => DB::raw('updated_at')]); + } catch (\Exception $e) { + \Log::error('Failed to update not set finished_at timestamps for application_deployment_queues: '.$e->getMessage()); + } + + try { + DB::table('scheduled_database_backup_executions') + ->whereNull('finished_at') + ->update(['finished_at' => DB::raw('updated_at')]); + } catch (\Exception $e) { + \Log::error('Failed to update not set finished_at timestamps for scheduled_database_backup_executions: '.$e->getMessage()); + } + + try { + DB::table('scheduled_task_executions') + ->whereNull('finished_at') + ->update(['finished_at' => DB::raw('updated_at')]); + } catch (\Exception $e) { + \Log::error('Failed to update not set finished_at timestamps for scheduled_task_executions: '.$e->getMessage()); + } + } +}; From 7321c0b3db8dc5348dbbfc816310f69e38f010a1 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Tue, 21 Jan 2025 14:02:42 +0100 Subject: [PATCH 09/50] Update service-templates.json --- templates/service-templates.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/service-templates.json b/templates/service-templates.json index c703f9bdc..b95f9a032 100644 --- a/templates/service-templates.json +++ b/templates/service-templates.json @@ -449,7 +449,7 @@ "cloudflared": { "documentation": "https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/?utm_source=coolify.io", "slogan": "Client for Cloudflare Tunnel, a daemon that exposes private services through the Cloudflare edge.", - "compose": "c2VydmljZXM6CiAgY2xvdWRmbGFyZWQ6CiAgICBjb250YWluZXJfbmFtZTogY2xvdWRmbGFyZS10dW5uZWwKICAgIGltYWdlOiAnY2xvdWRmbGFyZS9jbG91ZGZsYXJlZDpsYXRlc3QnCiAgICByZXN0YXJ0OiB1bmxlc3Mtc3RvcHBlZAogICAgbmV0d29ya19tb2RlOiBob3N0CiAgICBjb21tYW5kOiAndHVubmVsIC0tbm8tYXV0b3VwZGF0ZSBydW4nCiAgICBlbnZpcm9ubWVudDoKICAgICAgLSAnVFVOTkVMX1RPS0VOPSR7Q0xPVURGTEFSRV9UVU5ORUxfVE9LRU59Jwo=", + "compose": "c2VydmljZXM6CiAgY2xvdWRmbGFyZWQ6CiAgICBjb250YWluZXJfbmFtZTogY2xvdWRmbGFyZS10dW5uZWwKICAgIGltYWdlOiAnY2xvdWRmbGFyZS9jbG91ZGZsYXJlZDpsYXRlc3QnCiAgICByZXN0YXJ0OiB1bmxlc3Mtc3RvcHBlZAogICAgbmV0d29ya19tb2RlOiBob3N0CiAgICBjb21tYW5kOiAndHVubmVsIC0tbm8tYXV0b3VwZGF0ZSBydW4nCiAgICBlbnZpcm9ubWVudDoKICAgICAgLSAnVFVOTkVMX1RPS0VOPSR7Q0xPVURGTEFSRV9UVU5ORUxfVE9LRU59JwogICAgaGVhbHRoY2hlY2s6CiAgICAgIHRlc3Q6CiAgICAgICAgLSBDTUQKICAgICAgICAtIGNsb3VkZmxhcmVkCiAgICAgICAgLSAnLS12ZXJzaW9uJwogICAgICBpbnRlcnZhbDogNXMKICAgICAgdGltZW91dDogMjBzCiAgICAgIHJldHJpZXM6IDEwCg==", "tags": null, "logo": "svgs/cloudflared.svg", "minversion": "0.0.0" From 4b74ca56c387ee469797e3217ae1d4f55e20fd92 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 21 Jan 2025 14:09:07 +0100 Subject: [PATCH 10/50] feat(core): wip version of coolify.json --- app/Livewire/Project/Application/General.php | 1 + app/Models/Application.php | 45 ++-- app/Services/ConfigurationGenerator.php | 194 ++++++++++++++++++ app/Traits/HasConfiguration.php | 42 ++++ .../project/application/general.blade.php | 11 +- 5 files changed, 263 insertions(+), 30 deletions(-) create mode 100644 app/Services/ConfigurationGenerator.php create mode 100644 app/Traits/HasConfiguration.php diff --git a/app/Livewire/Project/Application/General.php b/app/Livewire/Project/Application/General.php index 576f87801..f8e28d216 100644 --- a/app/Livewire/Project/Application/General.php +++ b/app/Livewire/Project/Application/General.php @@ -442,6 +442,7 @@ class General extends Component { $config = GenerateConfig::run($this->application, true); $fileName = str($this->application->name)->slug()->append('_config.json'); + dd($config); return response()->streamDownload(function () use ($config) { echo $config; diff --git a/app/Models/Application.php b/app/Models/Application.php index 289ef5b0f..3913ce37a 100644 --- a/app/Models/Application.php +++ b/app/Models/Application.php @@ -3,6 +3,8 @@ namespace App\Models; use App\Enums\ApplicationDeploymentStatus; +use App\Services\ConfigurationGenerator; +use App\Traits\HasConfiguration; use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Relations\HasMany; @@ -105,7 +107,7 @@ use Visus\Cuid2\Cuid2; class Application extends BaseModel { - use HasFactory, SoftDeletes; + use HasConfiguration, HasFactory, SoftDeletes; private static $parserVersion = '4'; @@ -1640,35 +1642,28 @@ class Application extends BaseModel } } + public function getLimits(): array + { + return [ + 'limits_memory' => $this->limits_memory, + 'limits_memory_swap' => $this->limits_memory_swap, + 'limits_memory_swappiness' => $this->limits_memory_swappiness, + 'limits_memory_reservation' => $this->limits_memory_reservation, + 'limits_cpus' => $this->limits_cpus, + 'limits_cpuset' => $this->limits_cpuset, + 'limits_cpu_shares' => $this->limits_cpu_shares, + ]; + } + public function generateConfig($is_json = false) { - $config = collect([]); - if ($this->build_pack = 'nixpacks') { - $config = collect([ - 'build_pack' => 'nixpacks', - 'docker_registry_image_name' => $this->docker_registry_image_name, - 'docker_registry_image_tag' => $this->docker_registry_image_tag, - 'install_command' => $this->install_command, - 'build_command' => $this->build_command, - 'start_command' => $this->start_command, - 'base_directory' => $this->base_directory, - 'publish_directory' => $this->publish_directory, - 'custom_docker_run_options' => $this->custom_docker_run_options, - 'ports_exposes' => $this->ports_exposes, - 'ports_mappings' => $this->ports_mapping, - 'settings' => collect([ - 'is_static' => $this->settings->is_static, - ]), - ]); - } - $config = $config->filter(function ($value) { - return str($value)->isNotEmpty(); - }); + $generator = new ConfigurationGenerator($this); + if ($is_json) { - return json_encode($config, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); + return $generator->toJson(); } - return $config; + return $generator->toArray(); } public function setConfig($config) diff --git a/app/Services/ConfigurationGenerator.php b/app/Services/ConfigurationGenerator.php new file mode 100644 index 000000000..a7e4b31be --- /dev/null +++ b/app/Services/ConfigurationGenerator.php @@ -0,0 +1,194 @@ +generateConfig(); + } + + protected function generateConfig(): void + { + if ($this->resource instanceof Application) { + $this->config = [ + 'id' => $this->resource->id, + 'name' => $this->resource->name, + 'uuid' => $this->resource->uuid, + 'description' => $this->resource->description, + 'coolify_details' => [ + 'project_uuid' => $this->resource->project()->uuid, + 'environment_uuid' => $this->resource->environment->uuid, + + 'destination_type' => $this->resource->destination_type, + 'destination_id' => $this->resource->destination_id, + 'source_type' => $this->resource->source_type, + 'source_id' => $this->resource->source_id, + 'private_key_id' => $this->resource->private_key_id, + ], + + 'post_deployment_command' => $this->resource->post_deployment_command, + 'post_deployment_command_container' => $this->resource->post_deployment_command_container, + 'pre_deployment_command' => $this->resource->pre_deployment_command, + 'pre_deployment_command_container' => $this->resource->pre_deployment_command_container, + 'build' => [ + 'type' => $this->resource->build_pack, + 'static_image' => $this->resource->static_image, + 'base_directory' => $this->resource->base_directory, + 'publish_directory' => $this->resource->publish_directory, + 'dockerfile' => $this->resource->dockerfile, + 'dockerfile_location' => $this->resource->dockerfile_location, + 'dockerfile_target_build' => $this->resource->dockerfile_target_build, + 'custom_docker_run_options' => $this->resource->custom_docker_options, + 'compose_parsing_version' => $this->resource->compose_parsing_version, + 'docker_compose' => $this->resource->docker_compose, + 'docker_compose_location' => $this->resource->docker_compose_location, + 'docker_compose_raw' => $this->resource->docker_compose_raw, + 'docker_compose_domains' => $this->resource->docker_compose_domains, + 'docker_compose_custom_start_command' => $this->resource->docker_compose_custom_start_command, + 'docker_compose_custom_build_command' => $this->resource->docker_compose_custom_build_command, + 'install_command' => $this->resource->install_command, + 'build_command' => $this->resource->build_command, + 'start_command' => $this->resource->start_command, + 'watch_paths' => $this->resource->watch_paths, + ], + 'source' => [ + 'git_repository' => $this->resource->git_repository, + 'git_branch' => $this->resource->git_branch, + 'git_commit_sha' => $this->resource->git_commit_sha, + 'repository_project_id' => $this->resource->repository_project_id, + ], + 'docker_registry_image' => $this->getDockerRegistryImage(), + 'domains' => [ + 'fqdn' => $this->resource->fqdn, + 'ports_exposes' => $this->resource->ports_exposes, + 'ports_mappings' => $this->resource->ports_mappings, + 'redirect' => $this->resource->redirect, + 'custom_nginx_configuration' => $this->resource->custom_nginx_configuration, + ], + 'environment_variables' => [ + 'production' => $this->getEnvironmentVariables(), + 'preview' => $this->getPreviewEnvironmentVariables(), + ], + 'settings' => $this->getApplicationSettings(), + 'preview' => $this->getPreview(), + 'limits' => $this->resource->getLimits(), + 'health_check' => [ + 'health_check_path' => $this->resource->health_check_path, + 'health_check_port' => $this->resource->health_check_port, + 'health_check_host' => $this->resource->health_check_host, + 'health_check_method' => $this->resource->health_check_method, + 'health_check_return_code' => $this->resource->health_check_return_code, + 'health_check_scheme' => $this->resource->health_check_scheme, + 'health_check_response_text' => $this->resource->health_check_response_text, + 'health_check_interval' => $this->resource->health_check_interval, + 'health_check_timeout' => $this->resource->health_check_timeout, + 'health_check_retries' => $this->resource->health_check_retries, + 'health_check_start_period' => $this->resource->health_check_start_period, + 'health_check_enabled' => $this->resource->health_check_enabled, + ], + 'webhooks_secrets' => [ + 'manual_webhook_secret_github' => $this->resource->manual_webhook_secret_github, + 'manual_webhook_secret_gitlab' => $this->resource->manual_webhook_secret_gitlab, + 'manual_webhook_secret_bitbucket' => $this->resource->manual_webhook_secret_bitbucket, + 'manual_webhook_secret_gitea' => $this->resource->manual_webhook_secret_gitea, + ], + 'swarm' => [ + 'swarm_replicas' => $this->resource->swarm_replicas, + 'swarm_placement_constraints' => $this->resource->swarm_placement_constraints, + ], + ]; + } + } + + protected function getPreview(): array + { + return [ + 'preview_url_template' => $this->resource->preview_url_template, + ]; + } + + protected function getDockerRegistryImage(): array + { + return [ + 'image' => $this->resource->docker_registry_image_name, + 'tag' => $this->resource->docker_registry_image_tag, + ]; + } + + protected function getEnvironmentVariables(): array + { + $variables = collect([]); + foreach ($this->resource->environment_variables as $env) { + $variables->push([ + 'key' => $env->key, + 'value' => $env->value, + 'is_build_time' => $env->is_build_time, + 'is_preview' => $env->is_preview, + 'is_multiline' => $env->is_multiline, + ]); + } + + return $variables->toArray(); + } + + protected function getPreviewEnvironmentVariables(): array + { + $variables = collect([]); + foreach ($this->resource->environment_variables_preview as $env) { + $variables->push([ + 'key' => $env->key, + 'value' => $env->value, + 'is_build_time' => $env->is_build_time, + 'is_preview' => $env->is_preview, + 'is_multiline' => $env->is_multiline, + ]); + } + + return $variables->toArray(); + } + + protected function getApplicationSettings(): array + { + $removedKeys = ['id', 'application_id', 'created_at', 'updated_at']; + $settings = $this->resource->settings->attributesToArray(); + $settings = collect($settings)->filter(function ($value, $key) use ($removedKeys) { + return ! in_array($key, $removedKeys); + })->sortBy(function ($value, $key) { + return $key; + })->toArray(); + + return $settings; + } + + public function saveJson(string $path): void + { + file_put_contents($path, json_encode($this->config, JSON_PRETTY_PRINT)); + } + + public function saveYaml(string $path): void + { + file_put_contents($path, Yaml::dump($this->config, 6, 2)); + } + + public function toArray(): array + { + return $this->config; + } + + public function toJson(): string + { + return json_encode($this->config, JSON_PRETTY_PRINT); + } + + public function toYaml(): string + { + return Yaml::dump($this->config, 6, 2); + } +} diff --git a/app/Traits/HasConfiguration.php b/app/Traits/HasConfiguration.php new file mode 100644 index 000000000..e572c45ea --- /dev/null +++ b/app/Traits/HasConfiguration.php @@ -0,0 +1,42 @@ +uuid}"; + if (! is_dir($configDir)) { + mkdir($configDir, 0755, true); + } + + $generator->saveJson($configDir.'/coolify.json'); + $generator->saveYaml($configDir.'/coolify.yaml'); + + // Generate a README file with basic information + file_put_contents( + $configDir.'/README.md', + generate_readme_file($this->name, now()->toIso8601String()) + ); + } + + public function getConfigurationAsJson(): string + { + return (new ConfigurationGenerator($this))->toJson(); + } + + public function getConfigurationAsYaml(): string + { + return (new ConfigurationGenerator($this))->toYaml(); + } + + public function getConfigurationAsArray(): array + { + return (new ConfigurationGenerator($this))->toArray(); + } +} diff --git a/resources/views/livewire/project/application/general.blade.php b/resources/views/livewire/project/application/general.blade.php index 62acda056..026b3b579 100644 --- a/resources/views/livewire/project/application/general.blade.php +++ b/resources/views/livewire/project/application/general.blade.php @@ -5,13 +5,14 @@ Save - {{-- - + + {{-- Download Config - + --}} + {{-- - - --}} + --}} +
General configuration for your application.
From a230a425993903b410201b5de2edf93f5796afbe Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Tue, 21 Jan 2025 14:53:44 +0100 Subject: [PATCH 11/50] fix(email): transactional email sending --- app/Notifications/Channels/EmailChannel.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Notifications/Channels/EmailChannel.php b/app/Notifications/Channels/EmailChannel.php index 6ffe5c4d7..98536d346 100644 --- a/app/Notifications/Channels/EmailChannel.php +++ b/app/Notifications/Channels/EmailChannel.php @@ -53,6 +53,7 @@ class EmailChannel if (! $type) { throw new Exception('No email settings found.'); } + config()->set('mail.default', $type); return; } From 2844c6ce36667d1e5e025df600c2a7a56e92186c Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Tue, 21 Jan 2025 17:03:58 +0100 Subject: [PATCH 12/50] fix(ui): add missing save button for new Docker Cleanup page --- .../livewire/server/docker-cleanup.blade.php | 123 +++++++++--------- 1 file changed, 63 insertions(+), 60 deletions(-) diff --git a/resources/views/livewire/server/docker-cleanup.blade.php b/resources/views/livewire/server/docker-cleanup.blade.php index cdf48c6aa..8151b5358 100644 --- a/resources/views/livewire/server/docker-cleanup.blade.php +++ b/resources/views/livewire/server/docker-cleanup.blade.php @@ -6,72 +6,75 @@
-
-
-

Docker Cleanup

+
+
+
+

Docker Cleanup

+ Save +
+
Configure Docker cleanup settings for your server.
-
Configure Docker cleanup settings for your server.
-
-
-
-

Docker Cleanup

- -
-
- - @if (!$forceDockerCleanup) - - @endif +
+
+

Docker Cleanup

+ +
+
+ + @if (!$forceDockerCleanup) + + @endif +
+ +
+
+

+ Warning: Enable these + options only if you fully understand their implications and + consequences!
Improper use will result in data loss and could cause + functional issues. +

- +
  • Volumes not attached to running containers will be deleted and data will be permanently lost (stopped containers are affected).
  • +
  • Data from stopped containers volumes will be permanently lost.
  • +
  • No way to recover deleted volume data.
  • + " /> +
    -

    - Warning: Enable these - options only if you fully understand their implications and - consequences!
    Improper use will result in data loss and could cause - functional issues. -

    -
    - - -
    -
    +

    Recent executions (click to check output)

    From 43a4d9b467787a85cc64dfaa585fabac740d9dd1 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Tue, 21 Jan 2025 17:09:03 +0100 Subject: [PATCH 13/50] fix(ui): show preview deployment environment variables --- .../project/shared/environment-variable/all.blade.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/views/livewire/project/shared/environment-variable/all.blade.php b/resources/views/livewire/project/shared/environment-variable/all.blade.php index 3be31ba55..8723f926b 100644 --- a/resources/views/livewire/project/shared/environment-variable/all.blade.php +++ b/resources/views/livewire/project/shared/environment-variable/all.blade.php @@ -55,10 +55,10 @@

    Preview Deployments Environment Variables

    Environment (secrets) variables for Preview Deployments.
    - {{-- @foreach ($resource->environment_variables_preview as $env) + @foreach ($resource->environment_variables_preview as $env) - @endforeach --}} + @endforeach @endif @else
    From 31992f4d02a13feeeca0529405fbea436ac1bbd6 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Tue, 21 Jan 2025 18:36:38 +0100 Subject: [PATCH 14/50] fix(ui):show error on terminal if container has no shell (bash/sh) --- .../Shared/ExecuteContainerCommand.php | 18 +++++ .../execute-container-command.blade.php | 77 +++++++++++-------- .../project/shared/terminal.blade.php | 5 -- 3 files changed, 64 insertions(+), 36 deletions(-) diff --git a/app/Livewire/Project/Shared/ExecuteContainerCommand.php b/app/Livewire/Project/Shared/ExecuteContainerCommand.php index d12d8e26a..f993480c7 100644 --- a/app/Livewire/Project/Shared/ExecuteContainerCommand.php +++ b/app/Livewire/Project/Shared/ExecuteContainerCommand.php @@ -27,6 +27,8 @@ class ExecuteContainerCommand extends Component public Collection $servers; + public bool $hasShell = true; + protected $rules = [ 'server' => 'required', 'container' => 'required', @@ -141,6 +143,16 @@ class ExecuteContainerCommand extends Component } } + private function checkShellAvailability(Server $server, string $container): bool + { + $escapedContainer = escapeshellarg($container); + $result = instant_remote_process([ + "docker exec {$escapedContainer} which bash || docker exec {$escapedContainer} which sh", + ], $server, false); + + return ! empty($result); + } + #[On('connectToServer')] public function connectToServer() { @@ -148,6 +160,7 @@ class ExecuteContainerCommand extends Component if ($this->server->isForceDisabled()) { throw new \RuntimeException('Server is disabled.'); } + $this->hasShell = true; $this->dispatch( 'send-terminal-command', false, @@ -201,6 +214,11 @@ class ExecuteContainerCommand extends Component throw new \RuntimeException('Server ownership verification failed.'); } + $this->hasShell = $this->checkShellAvailability($server, data_get($container, 'container.Names')); + if (! $this->hasShell) { + return; + } + $this->dispatch( 'send-terminal-command', true, diff --git a/resources/views/livewire/project/shared/execute-container-command.blade.php b/resources/views/livewire/project/shared/execute-container-command.blade.php index f9760ed65..b6a559927 100644 --- a/resources/views/livewire/project/shared/execute-container-command.blade.php +++ b/resources/views/livewire/project/shared/execute-container-command.blade.php @@ -16,43 +16,58 @@ @elseif ($type === 'server') @endif - @if ($type === 'server') - - Reconnect - -
    - + + @if(!$hasShell) +
    +
    +
    + + + +
    +

    Terminal Not Available

    +

    No shell (bash/sh) is available in this container. Please ensure either bash or sh is installed to use the terminal.

    +
    +
    +
    @else - @if (count($containers) > 0) - @if (count($containers) === 1) -
    - Reconnect -
    - @else -
    - - @foreach ($containers as $container) - @if ($loop->first) - - @endif - - @endforeach - - - Connect - -
    - @endif + @if ($type === 'server') +
    + Reconnect +
    @else -
    No containers are running.
    + @if (count($containers) === 0) +
    No containers are running.
    + @else + @if (count($containers) === 1) +
    + Reconnect +
    + @else +
    + + @foreach ($containers as $container) + @if ($loop->first) + + @endif + + @endforeach + + Connect +
    + @endif +
    + +
    + @endif @endif @endif
    diff --git a/resources/views/livewire/project/shared/terminal.blade.php b/resources/views/livewire/project/shared/terminal.blade.php index 26388cc0d..edf870ca7 100644 --- a/resources/views/livewire/project/shared/terminal.blade.php +++ b/resources/views/livewire/project/shared/terminal.blade.php @@ -1,9 +1,4 @@
    - {{--
    -
    - -
    -
    --}}
    From 1799081ebd7dc7f4ba429098a82e6e6e9d3c8689 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Tue, 21 Jan 2025 18:55:07 +0100 Subject: [PATCH 15/50] fix(parser): resource URL should only be parsed if there is one --- app/Services/DockerImageParser.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Services/DockerImageParser.php b/app/Services/DockerImageParser.php index 4987f953d..1fd6625b3 100644 --- a/app/Services/DockerImageParser.php +++ b/app/Services/DockerImageParser.php @@ -43,7 +43,11 @@ class DockerImageParser public function getFullImageNameWithoutTag(): string { - return $this->registryUrl.'/'.$this->imageName; + if ($this->registryUrl) { + return $this->registryUrl.'/'.$this->imageName; + } + + return $this->imageName; } public function getRegistryUrl(): string From 8c937156c544ed01b14542b24d6460e61010cb20 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 21 Jan 2025 20:00:05 +0100 Subject: [PATCH 16/50] fix(core): compose parsing for apps --- bootstrap/helpers/shared.php | 1 - 1 file changed, 1 deletion(-) diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php index ff2933f72..330f2627a 100644 --- a/bootstrap/helpers/shared.php +++ b/bootstrap/helpers/shared.php @@ -2872,7 +2872,6 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal data_forget($service, 'volumes.*.is_directory'); data_forget($service, 'exclude_from_hc'); data_set($service, 'environment', $serviceVariables->toArray()); - updateCompose($service); return $service; }); From ac4c1496a64e36108a21d23d80c7c78e0559111c Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Tue, 21 Jan 2025 21:15:28 +0100 Subject: [PATCH 17/50] chore(dep): bump nixpacks version --- docker/coolify-helper/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/coolify-helper/Dockerfile b/docker/coolify-helper/Dockerfile index acc44d02a..91954b4a7 100644 --- a/docker/coolify-helper/Dockerfile +++ b/docker/coolify-helper/Dockerfile @@ -11,7 +11,7 @@ ARG DOCKER_BUILDX_VERSION=0.19.3 # https://github.com/buildpacks/pack/releases ARG PACK_VERSION=0.36.2 # https://github.com/railwayapp/nixpacks/releases -ARG NIXPACKS_VERSION=1.30.0 +ARG NIXPACKS_VERSION=1.32.0 # https://github.com/minio/mc/releases ARG MINIO_VERSION=RELEASE.2024-11-21T17-21-54Z From 5e1b07e1e09c08bcd043589e5981ac4c860c781b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Jan 2025 20:58:44 +0000 Subject: [PATCH 18/50] chore(deps-dev): bump vite from 6.0.7 to 6.0.11 Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 6.0.7 to 6.0.11. - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v6.0.11/packages/vite) --- updated-dependencies: - dependency-name: vite dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 56cfa1586..fed13e28a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,7 +22,7 @@ "pusher-js": "8.4.0-rc2", "tailwind-scrollbar": "^3.1.0", "tailwindcss": "3.4.17", - "vite": "6.0.7", + "vite": "6.0.11", "vue": "3.5.13" } }, @@ -2784,9 +2784,9 @@ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" }, "node_modules/vite": { - "version": "6.0.7", - "resolved": "https://registry.npmjs.org/vite/-/vite-6.0.7.tgz", - "integrity": "sha512-RDt8r/7qx9940f8FcOIAH9PTViRrghKaK2K1jY3RaAURrEUbm9Du1mJ72G+jlhtG3WwodnfzY8ORQZbBavZEAQ==", + "version": "6.0.11", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.0.11.tgz", + "integrity": "sha512-4VL9mQPKoHy4+FE0NnRE/kbY51TOfaknxAjt3fJbGJxhIpBZiqVzlZDEesWWsuREXHwNdAoOFZ9MkPEVXczHwg==", "dev": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 7220e55a5..4e2cf6700 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "pusher-js": "8.4.0-rc2", "tailwind-scrollbar": "^3.1.0", "tailwindcss": "3.4.17", - "vite": "6.0.7", + "vite": "6.0.11", "vue": "3.5.13" }, "dependencies": { From 185ddd48f2259a5e7c428b10e8d991d020cec660 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 22 Jan 2025 10:20:52 +0100 Subject: [PATCH 19/50] chore(dep): version++ --- config/constants.php | 2 +- versions.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/constants.php b/config/constants.php index dddaebbb5..6ca262fa6 100644 --- a/config/constants.php +++ b/config/constants.php @@ -2,7 +2,7 @@ return [ 'coolify' => [ - 'version' => '4.0.0-beta.385', + 'version' => '4.0.0-beta.386', 'self_hosted' => env('SELF_HOSTED', true), 'autoupdate' => env('AUTOUPDATE'), 'base_config_path' => env('BASE_CONFIG_PATH', '/data/coolify'), diff --git a/versions.json b/versions.json index dd64cc010..8321fad00 100644 --- a/versions.json +++ b/versions.json @@ -1,10 +1,10 @@ { "coolify": { "v4": { - "version": "4.0.0-beta.385" + "version": "4.0.0-beta.386" }, "nightly": { - "version": "4.0.0-beta.386" + "version": "4.0.0-beta.387" }, "helper": { "version": "1.0.4" From 085103708ceba47f9383fc6e289cd1bb4396bda7 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 22 Jan 2025 10:21:41 +0100 Subject: [PATCH 20/50] fix(core): v1 parser versions trying to access application_id, while it is resourceable_id fix(db): remove wrongly created, empty environmentvariables --- bootstrap/helpers/shared.php | 21 ++++++++++++------- ..._22_101105_remove_wrongly_created_envs.php | 19 +++++++++++++++++ 2 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 database/migrations/2025_01_22_101105_remove_wrongly_created_envs.php diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php index 330f2627a..791e2eb09 100644 --- a/bootstrap/helpers/shared.php +++ b/bootstrap/helpers/shared.php @@ -2645,7 +2645,8 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal if ($value?->startsWith('$')) { $foundEnv = EnvironmentVariable::where([ 'key' => $key, - 'application_id' => $resource->id, + 'resourceable_type' => get_class($resource), + 'resourceable_id' => $resource->id, 'is_preview' => false, ])->first(); $value = replaceVariables($value); @@ -2653,7 +2654,8 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal if ($value->startsWith('SERVICE_')) { $foundEnv = EnvironmentVariable::where([ 'key' => $key, - 'application_id' => $resource->id, + 'resourceable_type' => get_class($resource), + 'resourceable_id' => $resource->id, ])->first(); ['command' => $command, 'forService' => $forService, 'generatedValue' => $generatedValue, 'port' => $port] = parseEnvVariable($value); if (! is_null($command)) { @@ -2676,7 +2678,8 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal 'key' => $key, 'value' => $fqdn, 'is_build_time' => false, - 'application_id' => $resource->id, + 'resourceable_type' => get_class($resource), + 'resourceable_id' => $resource->id, 'is_preview' => false, ]); } @@ -2687,7 +2690,8 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal 'key' => $key, 'value' => $generatedValue, 'is_build_time' => false, - 'application_id' => $resource->id, + 'resourceable_type' => get_class($resource), + 'resourceable_id' => $resource->id, 'is_preview' => false, ]); } @@ -2712,7 +2716,8 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal } $foundEnv = EnvironmentVariable::where([ 'key' => $key, - 'application_id' => $resource->id, + 'resourceable_type' => get_class($resource), + 'resourceable_id' => $resource->id, 'is_preview' => false, ])->first(); if ($foundEnv) { @@ -2722,7 +2727,8 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal if ($foundEnv) { $foundEnv->update([ 'key' => $key, - 'application_id' => $resource->id, + 'resourceable_type' => get_class($resource), + 'resourceable_id' => $resource->id, 'is_build_time' => $isBuildTime, 'value' => $defaultValue, ]); @@ -2731,7 +2737,8 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal 'key' => $key, 'value' => $defaultValue, 'is_build_time' => $isBuildTime, - 'application_id' => $resource->id, + 'resourceable_type' => get_class($resource), + 'resourceable_id' => $resource->id, 'is_preview' => false, ]); } diff --git a/database/migrations/2025_01_22_101105_remove_wrongly_created_envs.php b/database/migrations/2025_01_22_101105_remove_wrongly_created_envs.php new file mode 100644 index 000000000..cb1b3cbe6 --- /dev/null +++ b/database/migrations/2025_01_22_101105_remove_wrongly_created_envs.php @@ -0,0 +1,19 @@ +each(function (EnvironmentVariable $environmentVariable) { + $environmentVariable->delete(); + }); + } catch (\Exception $e) { + Log::error('Failed to delete wrongly created environment variables: '.$e->getMessage()); + } + } +}; From 6feb7bd18ef06d800a6efe939e3319fc9ec3c905 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 22 Jan 2025 11:27:28 +0100 Subject: [PATCH 21/50] chore(dep): bump helper version to 1.0.5 --- versions.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions.json b/versions.json index 8321fad00..e92cbb5e4 100644 --- a/versions.json +++ b/versions.json @@ -7,7 +7,7 @@ "version": "4.0.0-beta.387" }, "helper": { - "version": "1.0.4" + "version": "1.0.5" }, "realtime": { "version": "1.0.5" From bb08504db5e2f77d9d9e3bcdf3051b675fb64650 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 22 Jan 2025 11:29:27 +0100 Subject: [PATCH 22/50] chore(docker): add blank line for readability in Dockerfile --- docker/coolify-helper/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/coolify-helper/Dockerfile b/docker/coolify-helper/Dockerfile index 91954b4a7..bda538bca 100644 --- a/docker/coolify-helper/Dockerfile +++ b/docker/coolify-helper/Dockerfile @@ -1,5 +1,6 @@ # Versions + # https://hub.docker.com/_/alpine ARG BASE_IMAGE=alpine:3.21 # https://download.docker.com/linux/static/stable/ From f8f361a2b76499e880395e7ee669e209c909ee9b Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 22 Jan 2025 11:54:39 +0100 Subject: [PATCH 23/50] chore(versions): update coolify versions to v4.0.0-beta.388 --- config/constants.php | 2 +- versions.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/constants.php b/config/constants.php index 6ca262fa6..526fdcdfb 100644 --- a/config/constants.php +++ b/config/constants.php @@ -2,7 +2,7 @@ return [ 'coolify' => [ - 'version' => '4.0.0-beta.386', + 'version' => '4.0.0-beta.387', 'self_hosted' => env('SELF_HOSTED', true), 'autoupdate' => env('AUTOUPDATE'), 'base_config_path' => env('BASE_CONFIG_PATH', '/data/coolify'), diff --git a/versions.json b/versions.json index e92cbb5e4..25ad52088 100644 --- a/versions.json +++ b/versions.json @@ -1,10 +1,10 @@ { "coolify": { "v4": { - "version": "4.0.0-beta.386" + "version": "4.0.0-beta.387" }, "nightly": { - "version": "4.0.0-beta.387" + "version": "4.0.0-beta.388" }, "helper": { "version": "1.0.5" From 52a38f238b146a7bd06eff25e40e00dc237fc367 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 22 Jan 2025 11:54:53 +0100 Subject: [PATCH 24/50] fix(redis): update environment variable keys from standalone_redis_id to resourceable_id --- app/Livewire/Project/Database/Redis/General.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Livewire/Project/Database/Redis/General.php b/app/Livewire/Project/Database/Redis/General.php index 25a96b292..05babeaec 100644 --- a/app/Livewire/Project/Database/Redis/General.php +++ b/app/Livewire/Project/Database/Redis/General.php @@ -88,12 +88,12 @@ class General extends Component if (version_compare($this->redis_version, '6.0', '>=')) { $this->database->runtime_environment_variables()->updateOrCreate( ['key' => 'REDIS_USERNAME'], - ['value' => $this->redis_username, 'standalone_redis_id' => $this->database->id] + ['value' => $this->redis_username, 'resourceable_id' => $this->database->id] ); } $this->database->runtime_environment_variables()->updateOrCreate( ['key' => 'REDIS_PASSWORD'], - ['value' => $this->redis_password, 'standalone_redis_id' => $this->database->id] + ['value' => $this->redis_password, 'resourceable_id' => $this->database->id] ); $this->database->save(); From a8b5f6befcf10e3029b9aa3fde2756a9551735f1 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Wed, 22 Jan 2025 12:51:46 +0100 Subject: [PATCH 25/50] fix(routes): local API docs not available on domain or IP --- routes/web.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routes/web.php b/routes/web.php index 618e4e090..8876824d3 100644 --- a/routes/web.php +++ b/routes/web.php @@ -81,7 +81,7 @@ use Symfony\Component\HttpFoundation\StreamedResponse; use ThreeSidedCube\LaravelRedoc\Http\Controllers\DefinitionController; use ThreeSidedCube\LaravelRedoc\Http\Controllers\DocumentationController; -Route::group(['middleware' => ['auth:sanctum', ApiAllowed::class]], function () { +Route::middleware(['auth', ApiAllowed::class])->group(function () { Route::get('/docs/api', DocumentationController::class)->name('redoc.documentation'); Route::get('/docs/api/definition', DefinitionController::class)->name('redoc.definition'); }); From 1f498f8595bfb84b27b1b17abd0f59d9b735256e Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Wed, 22 Jan 2025 13:04:35 +0100 Subject: [PATCH 26/50] Revert "fix(routes): local API docs not available on domain or IP" This reverts commit a8b5f6befcf10e3029b9aa3fde2756a9551735f1. --- routes/web.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routes/web.php b/routes/web.php index 8876824d3..618e4e090 100644 --- a/routes/web.php +++ b/routes/web.php @@ -81,7 +81,7 @@ use Symfony\Component\HttpFoundation\StreamedResponse; use ThreeSidedCube\LaravelRedoc\Http\Controllers\DefinitionController; use ThreeSidedCube\LaravelRedoc\Http\Controllers\DocumentationController; -Route::middleware(['auth', ApiAllowed::class])->group(function () { +Route::group(['middleware' => ['auth:sanctum', ApiAllowed::class]], function () { Route::get('/docs/api', DocumentationController::class)->name('redoc.documentation'); Route::get('/docs/api/definition', DefinitionController::class)->name('redoc.definition'); }); From 168618f131451aed50dcfa51311f0bd07c735084 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Wed, 22 Jan 2025 13:30:10 +0100 Subject: [PATCH 27/50] fix(routes): local API docs not available on domain or IP --- docker/production/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/production/Dockerfile b/docker/production/Dockerfile index 10bd80c2b..3032d3ef7 100644 --- a/docker/production/Dockerfile +++ b/docker/production/Dockerfile @@ -119,6 +119,7 @@ COPY --chown=www-data:www-data storage ./storage COPY --chown=www-data:www-data templates ./templates COPY --chown=www-data:www-data resources/views ./resources/views COPY --chown=www-data:www-data artisan artisan +COPY --chown=www-data:www-data openapi.yaml ./openapi.yaml RUN composer dump-autoload From 6a03bb369ef8e68f1215fe3eafa94c8e198fe0ef Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 22 Jan 2025 14:01:05 +0100 Subject: [PATCH 28/50] chore(versions): update coolify versions to v4.0.0-beta.389 and add helper version retrieval script --- .github/workflows/coolify-helper-next.yml | 2 +- .github/workflows/coolify-helper.yml | 2 +- bootstrap/getHelperVersion.php | 10 ++++++++++ config/constants.php | 3 ++- versions.json | 4 ++-- 5 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 bootstrap/getHelperVersion.php diff --git a/.github/workflows/coolify-helper-next.yml b/.github/workflows/coolify-helper-next.yml index 4354294b1..e8962582f 100644 --- a/.github/workflows/coolify-helper-next.yml +++ b/.github/workflows/coolify-helper-next.yml @@ -38,7 +38,7 @@ jobs: - name: Get Version id: version run: | - echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app ghcr.io/jqlang/jq:latest '.coolify.helper.version' versions.json)"|xargs >> $GITHUB_OUTPUT + echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app php:8.2-alpine3.16 php bootstrap/getHelperVersion.php)"|xargs >> $GITHUB_OUTPUT - name: Build and Push Image uses: docker/build-push-action@v6 diff --git a/.github/workflows/coolify-helper.yml b/.github/workflows/coolify-helper.yml index 6d852a2b3..05fd6b259 100644 --- a/.github/workflows/coolify-helper.yml +++ b/.github/workflows/coolify-helper.yml @@ -38,7 +38,7 @@ jobs: - name: Get Version id: version run: | - echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app ghcr.io/jqlang/jq:latest '.coolify.helper.version' versions.json)"|xargs >> $GITHUB_OUTPUT + echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app php:8.2-alpine3.16 php bootstrap/getHelperVersion.php)"|xargs >> $GITHUB_OUTPUT - name: Build and Push Image uses: docker/build-push-action@v6 diff --git a/bootstrap/getHelperVersion.php b/bootstrap/getHelperVersion.php new file mode 100644 index 000000000..766af8db2 --- /dev/null +++ b/bootstrap/getHelperVersion.php @@ -0,0 +1,10 @@ + [ - 'version' => '4.0.0-beta.387', + 'version' => '4.0.0-beta.388', + 'helper_version' => '1.0.5', 'self_hosted' => env('SELF_HOSTED', true), 'autoupdate' => env('AUTOUPDATE'), 'base_config_path' => env('BASE_CONFIG_PATH', '/data/coolify'), diff --git a/versions.json b/versions.json index 25ad52088..ecc443965 100644 --- a/versions.json +++ b/versions.json @@ -1,10 +1,10 @@ { "coolify": { "v4": { - "version": "4.0.0-beta.387" + "version": "4.0.0-beta.388" }, "nightly": { - "version": "4.0.0-beta.388" + "version": "4.0.0-beta.389" }, "helper": { "version": "1.0.5" From c9869e13e06f5fdb499bedc83ceb2be882da5dcc Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 22 Jan 2025 14:05:29 +0100 Subject: [PATCH 29/50] refactor(workflows): replace jq with PHP script for version retrieval in workflows --- .github/workflows/coolify-helper-next.yml | 4 ++-- .github/workflows/coolify-helper.yml | 4 ++-- .github/workflows/coolify-realtime-next.yml | 6 +++--- .github/workflows/coolify-realtime.yml | 6 +++--- bootstrap/getRealtimeVersion.php | 10 ++++++++++ config/constants.php | 1 + 6 files changed, 21 insertions(+), 10 deletions(-) create mode 100644 bootstrap/getRealtimeVersion.php diff --git a/.github/workflows/coolify-helper-next.yml b/.github/workflows/coolify-helper-next.yml index e8962582f..a4a2a21f6 100644 --- a/.github/workflows/coolify-helper-next.yml +++ b/.github/workflows/coolify-helper-next.yml @@ -77,7 +77,7 @@ jobs: - name: Get Version id: version run: | - echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app ghcr.io/jqlang/jq:latest '.coolify.helper.version' versions.json)"|xargs >> $GITHUB_OUTPUT + echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app php:8.2-alpine3.16 php bootstrap/getHelperVersion.php)"|xargs >> $GITHUB_OUTPUT - name: Build and Push Image uses: docker/build-push-action@v6 @@ -119,7 +119,7 @@ jobs: - name: Get Version id: version run: | - echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app ghcr.io/jqlang/jq:latest '.coolify.helper.version' versions.json)"|xargs >> $GITHUB_OUTPUT + echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app php:8.2-alpine3.16 php bootstrap/getHelperVersion.php)"|xargs >> $GITHUB_OUTPUT - name: Create & publish manifest on ${{ env.GITHUB_REGISTRY }} run: | diff --git a/.github/workflows/coolify-helper.yml b/.github/workflows/coolify-helper.yml index 05fd6b259..78c888a01 100644 --- a/.github/workflows/coolify-helper.yml +++ b/.github/workflows/coolify-helper.yml @@ -77,7 +77,7 @@ jobs: - name: Get Version id: version run: | - echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app ghcr.io/jqlang/jq:latest '.coolify.helper.version' versions.json)"|xargs >> $GITHUB_OUTPUT + echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app php:8.2-alpine3.16 php bootstrap/getHelperVersion.php)"|xargs >> $GITHUB_OUTPUT - name: Build and Push Image uses: docker/build-push-action@v6 @@ -119,7 +119,7 @@ jobs: - name: Get Version id: version run: | - echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app ghcr.io/jqlang/jq:latest '.coolify.helper.version' versions.json)"|xargs >> $GITHUB_OUTPUT + echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app php:8.2-alpine3.16 php bootstrap/getHelperVersion.php)"|xargs >> $GITHUB_OUTPUT - name: Create & publish manifest on ${{ env.GITHUB_REGISTRY }} run: | diff --git a/.github/workflows/coolify-realtime-next.yml b/.github/workflows/coolify-realtime-next.yml index ef247170f..ad590146b 100644 --- a/.github/workflows/coolify-realtime-next.yml +++ b/.github/workflows/coolify-realtime-next.yml @@ -42,7 +42,7 @@ jobs: - name: Get Version id: version run: | - echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app ghcr.io/jqlang/jq:latest '.coolify.realtime.version' versions.json)"|xargs >> $GITHUB_OUTPUT + echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app php:8.2-alpine3.16 php bootstrap/getRealtimeVersion.php)"|xargs >> $GITHUB_OUTPUT - name: Build and Push Image uses: docker/build-push-action@v6 @@ -82,7 +82,7 @@ jobs: - name: Get Version id: version run: | - echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app ghcr.io/jqlang/jq:latest '.coolify.realtime.version' versions.json)"|xargs >> $GITHUB_OUTPUT + echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app php:8.2-alpine3.16 php bootstrap/getRealtimeVersion.php)"|xargs >> $GITHUB_OUTPUT - name: Build and Push Image uses: docker/build-push-action@v6 @@ -125,7 +125,7 @@ jobs: - name: Get Version id: version run: | - echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app ghcr.io/jqlang/jq:latest '.coolify.realtime.version' versions.json)"|xargs >> $GITHUB_OUTPUT + echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app php:8.2-alpine3.16 php bootstrap/getRealtimeVersion.php)"|xargs >> $GITHUB_OUTPUT - name: Create & publish manifest on ${{ env.GITHUB_REGISTRY }} run: | diff --git a/.github/workflows/coolify-realtime.yml b/.github/workflows/coolify-realtime.yml index 9654a21b0..d3af14144 100644 --- a/.github/workflows/coolify-realtime.yml +++ b/.github/workflows/coolify-realtime.yml @@ -42,7 +42,7 @@ jobs: - name: Get Version id: version run: | - echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app ghcr.io/jqlang/jq:latest '.coolify.realtime.version' versions.json)"|xargs >> $GITHUB_OUTPUT + echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app php:8.2-alpine3.16 php bootstrap/getRealtimeVersion.php)"|xargs >> $GITHUB_OUTPUT - name: Build and Push Image uses: docker/build-push-action@v6 @@ -82,7 +82,7 @@ jobs: - name: Get Version id: version run: | - echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app ghcr.io/jqlang/jq:latest '.coolify.realtime.version' versions.json)"|xargs >> $GITHUB_OUTPUT + echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app php:8.2-alpine3.16 php bootstrap/getRealtimeVersion.php)"|xargs >> $GITHUB_OUTPUT - name: Build and Push Image uses: docker/build-push-action@v6 @@ -125,7 +125,7 @@ jobs: - name: Get Version id: version run: | - echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app ghcr.io/jqlang/jq:latest '.coolify.realtime.version' versions.json)"|xargs >> $GITHUB_OUTPUT + echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app php:8.2-alpine3.16 php bootstrap/getRealtimeVersion.php)"|xargs >> $GITHUB_OUTPUT - name: Create & publish manifest on ${{ env.GITHUB_REGISTRY }} run: | diff --git a/bootstrap/getRealtimeVersion.php b/bootstrap/getRealtimeVersion.php new file mode 100644 index 000000000..1af56f09e --- /dev/null +++ b/bootstrap/getRealtimeVersion.php @@ -0,0 +1,10 @@ + [ 'version' => '4.0.0-beta.388', 'helper_version' => '1.0.5', + 'realtime_version' => '1.0.5', 'self_hosted' => env('SELF_HOSTED', true), 'autoupdate' => env('AUTOUPDATE'), 'base_config_path' => env('BASE_CONFIG_PATH', '/data/coolify'), From fda1fdc43566af2e92e10609525f98dde593ecc3 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 22 Jan 2025 14:15:42 +0100 Subject: [PATCH 30/50] fix(core): update application_id references to resourable_id and resourable_type for Nixpacks configuration --- app/Jobs/ApplicationDeploymentJob.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index c25325ad4..6114478da 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -1122,7 +1122,8 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue $nixpacks_php_fallback_path->key = 'NIXPACKS_PHP_FALLBACK_PATH'; $nixpacks_php_fallback_path->value = '/index.php'; $nixpacks_php_fallback_path->is_build_time = false; - $nixpacks_php_fallback_path->application_id = $this->application->id; + $nixpacks_php_fallback_path->resourable_id = $this->application->id; + $nixpacks_php_fallback_path->resourable_type = 'App\Models\Application'; $nixpacks_php_fallback_path->save(); } if (! $nixpacks_php_root_dir) { @@ -1130,7 +1131,8 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue $nixpacks_php_root_dir->key = 'NIXPACKS_PHP_ROOT_DIR'; $nixpacks_php_root_dir->value = '/app/public'; $nixpacks_php_root_dir->is_build_time = false; - $nixpacks_php_root_dir->application_id = $this->application->id; + $nixpacks_php_root_dir->resourable_id = $this->application->id; + $nixpacks_php_root_dir->resourable_type = 'App\Models\Application'; $nixpacks_php_root_dir->save(); } From 3cf21d440eabc37150a2b6ac42b24ee5544b2b7b Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 22 Jan 2025 14:16:48 +0100 Subject: [PATCH 31/50] fix(core): correct spelling of 'resourable' to 'resourceable' in Nixpacks configuration for ApplicationDeploymentJob --- app/Jobs/ApplicationDeploymentJob.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index 6114478da..d1a0b9d6a 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -1122,8 +1122,8 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue $nixpacks_php_fallback_path->key = 'NIXPACKS_PHP_FALLBACK_PATH'; $nixpacks_php_fallback_path->value = '/index.php'; $nixpacks_php_fallback_path->is_build_time = false; - $nixpacks_php_fallback_path->resourable_id = $this->application->id; - $nixpacks_php_fallback_path->resourable_type = 'App\Models\Application'; + $nixpacks_php_fallback_path->resourceable_id = $this->application->id; + $nixpacks_php_fallback_path->resourceable_type = 'App\Models\Application'; $nixpacks_php_fallback_path->save(); } if (! $nixpacks_php_root_dir) { @@ -1131,8 +1131,8 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue $nixpacks_php_root_dir->key = 'NIXPACKS_PHP_ROOT_DIR'; $nixpacks_php_root_dir->value = '/app/public'; $nixpacks_php_root_dir->is_build_time = false; - $nixpacks_php_root_dir->resourable_id = $this->application->id; - $nixpacks_php_root_dir->resourable_type = 'App\Models\Application'; + $nixpacks_php_root_dir->resourceable_id = $this->application->id; + $nixpacks_php_root_dir->resourceable_type = 'App\Models\Application'; $nixpacks_php_root_dir->save(); } From 18be6deab745b9e4e0f4d5683b20dd57baec4d70 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Wed, 22 Jan 2025 14:40:23 +0100 Subject: [PATCH 32/50] fix(ui): Traefik dashboard url not working --- resources/views/livewire/server/proxy/deploy.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/livewire/server/proxy/deploy.blade.php b/resources/views/livewire/server/proxy/deploy.blade.php index 85de1bee7..5be8d36a5 100644 --- a/resources/views/livewire/server/proxy/deploy.blade.php +++ b/resources/views/livewire/server/proxy/deploy.blade.php @@ -14,7 +14,7 @@ $traefikDashboardAvailable && $server->proxyType() === ProxyTypes::TRAEFIK->value)