From 58c6d066f2021046c9c1ecfe18b66c37ea484b10 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 8 Aug 2024 12:19:14 +0200 Subject: [PATCH 01/10] chore: Update version to 4.0.0-beta.321 --- config/sentry.php | 2 +- config/version.php | 2 +- versions.json | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/sentry.php b/config/sentry.php index a27a18d30..bd1f35f45 100644 --- a/config/sentry.php +++ b/config/sentry.php @@ -7,7 +7,7 @@ return [ // The release version of your application // Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')) - 'release' => '4.0.0-beta.320', + 'release' => '4.0.0-beta.321', // When left empty or `null` the Laravel environment will be used 'environment' => config('app.env'), diff --git a/config/version.php b/config/version.php index 05acb11ca..51743745b 100644 --- a/config/version.php +++ b/config/version.php @@ -1,3 +1,3 @@ Date: Thu, 8 Aug 2024 12:19:27 +0200 Subject: [PATCH 02/10] fix: scheduledbackup not found --- app/Livewire/SettingsBackup.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/Livewire/SettingsBackup.php b/app/Livewire/SettingsBackup.php index da3aee491..73e106688 100644 --- a/app/Livewire/SettingsBackup.php +++ b/app/Livewire/SettingsBackup.php @@ -54,8 +54,15 @@ class SettingsBackup extends Component } $this->settings = $settings; $this->s3s = $s3s; - $this->backup = $this->database?->scheduledBackups?->first() ?? null; - $this->executions = $this->backup?->executions ?? []; + + $scheduledBackups = data_get($this->database, 'scheduledBackups'); + if ($scheduledBackups) { + $this->backup = $scheduledBackups->first(); + } + $executions = data_get($this->backup, 'executions'); + if ($executions) { + $this->executions = $executions; + } } else { return redirect()->route('dashboard'); } From c2e431d6310c41d61c7ec74459737c97828227bc Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 8 Aug 2024 12:44:47 +0200 Subject: [PATCH 03/10] refactor: Update StandalonePostgresql database initialization and backup handling --- app/Livewire/SettingsBackup.php | 23 +++++++------------ .../views/livewire/settings-backup.blade.php | 9 ++++---- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/app/Livewire/SettingsBackup.php b/app/Livewire/SettingsBackup.php index 73e106688..99b8f8d49 100644 --- a/app/Livewire/SettingsBackup.php +++ b/app/Livewire/SettingsBackup.php @@ -16,7 +16,7 @@ class SettingsBackup extends Component public $s3s; - public StandalonePostgresql|null|array $database = []; + public ?StandalonePostgresql $database = null; public ScheduledDatabaseBackup|null|array $backup = []; @@ -43,26 +43,19 @@ class SettingsBackup extends Component { if (isInstanceAdmin()) { $settings = InstanceSettings::get(); - $database = StandalonePostgresql::whereName('coolify-db')->first(); + $this->database = StandalonePostgresql::whereName('coolify-db')->first(); $s3s = S3Storage::whereTeamId(0)->get() ?? []; - if ($database) { - if ($database->status !== 'running') { - $database->status = 'running'; - $database->save(); + if ($this->database) { + if ($this->database->status !== 'running') { + $this->database->status = 'running'; + $this->database->save(); } - $this->database = $database; + $this->backup = $this->database->scheduledBackups->first(); + $this->executions = $this->backup->executions; } $this->settings = $settings; $this->s3s = $s3s; - $scheduledBackups = data_get($this->database, 'scheduledBackups'); - if ($scheduledBackups) { - $this->backup = $scheduledBackups->first(); - } - $executions = data_get($this->backup, 'executions'); - if ($executions) { - $this->executions = $executions; - } } else { return redirect()->route('dashboard'); } diff --git a/resources/views/livewire/settings-backup.blade.php b/resources/views/livewire/settings-backup.blade.php index bf29481cc..9eb34e8b7 100644 --- a/resources/views/livewire/settings-backup.blade.php +++ b/resources/views/livewire/settings-backup.blade.php @@ -14,7 +14,7 @@
Backup configuration for Coolify instance.
- @if (isset($database)) + @if (isset($database) && isset($backup))
@@ -27,14 +27,15 @@
+
+ +
@else To configure automatic backup for your Coolify instance, you first need to add a database resource into Coolify. Add Database @endif
-
- -
+ From fa28e952dee01c13bc17cbc139f8a8651c0151a7 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 8 Aug 2024 12:50:49 +0200 Subject: [PATCH 04/10] refactor: Update cron expressions and add helper text for scheduled tasks --- bootstrap/helpers/constants.php | 5 +++++ .../project/database/create-scheduled-backup.blade.php | 4 +++- .../livewire/project/shared/scheduled-task/add.blade.php | 4 +++- resources/views/livewire/settings/index.blade.php | 4 ++-- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/bootstrap/helpers/constants.php b/bootstrap/helpers/constants.php index 24e596a0f..f94c9bc20 100644 --- a/bootstrap/helpers/constants.php +++ b/bootstrap/helpers/constants.php @@ -9,6 +9,11 @@ const VALID_CRON_STRINGS = [ 'weekly' => '0 0 * * 0', 'monthly' => '0 0 1 * *', 'yearly' => '0 0 1 1 *', + '@hourly' => '0 * * * *', + '@daily' => '0 0 * * *', + '@weekly' => '0 0 * * 0', + '@monthly' => '0 0 1 * *', + '@yearly' => '0 0 1 1 *', ]; const RESTART_MODE = 'unless-stopped'; diff --git a/resources/views/livewire/project/database/create-scheduled-backup.blade.php b/resources/views/livewire/project/database/create-scheduled-backup.blade.php index 3b7c9e74d..1569d62e0 100644 --- a/resources/views/livewire/project/database/create-scheduled-backup.blade.php +++ b/resources/views/livewire/project/database/create-scheduled-backup.blade.php @@ -1,5 +1,7 @@
- + @if ($s3s->count() === 0) diff --git a/resources/views/livewire/project/shared/scheduled-task/add.blade.php b/resources/views/livewire/project/shared/scheduled-task/add.blade.php index 9e9af07bf..24b89c519 100644 --- a/resources/views/livewire/project/shared/scheduled-task/add.blade.php +++ b/resources/views/livewire/project/shared/scheduled-task/add.blade.php @@ -1,7 +1,9 @@ - + @if ($type === 'application') @if ($containerNames->count() > 1) diff --git a/resources/views/livewire/settings/index.blade.php b/resources/views/livewire/settings/index.blade.php index 906ac1aad..d53db6a98 100644 --- a/resources/views/livewire/settings/index.blade.php +++ b/resources/views/livewire/settings/index.blade.php @@ -60,13 +60,13 @@
+ helper="Cron expression for update check frequency (check for new Coolify versions and pull new Service Templates from CDN).
You can use every_minute, hourly, daily, weekly, monthly, yearly.

Default is every hour." /> Check Manually
@if (is_null(env('AUTOUPDATE', null)) && $is_auto_update_enabled) + helper="Cron expression for auto update frequency (automatically update coolify).
You can use every_minute, hourly, daily, weekly, monthly, yearly.

Default is every day at 00:00" /> @endif From 8fa1fcf96eb0160ade26c9d20d78ab4eff4b61c3 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 8 Aug 2024 13:20:10 +0200 Subject: [PATCH 05/10] refactor: Update Server model getContainers method to use collect() for containers and containerReplicates --- app/Models/Server.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Models/Server.php b/app/Models/Server.php index 99dca3ecf..8a7325beb 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -715,8 +715,8 @@ $schema://$host { } return [ - 'containers' => $containers ?? collect([]), - 'containerReplicates' => $containerReplicates ?? collect([]), + 'containers' => collect($containers) ?? collect([]), + 'containerReplicates' => collect($containerReplicates) ?? collect([]), ]; } From d75ed0b20885b48ea4b79732e96bfc493779de7b Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 8 Aug 2024 13:20:24 +0200 Subject: [PATCH 06/10] refactor: Import ProxyTypes enum and use TRAEFIK instead of TRAEFIK_V2 --- bootstrap/helpers/proxy.php | 1 + 1 file changed, 1 insertion(+) diff --git a/bootstrap/helpers/proxy.php b/bootstrap/helpers/proxy.php index f18b09f56..e50983535 100644 --- a/bootstrap/helpers/proxy.php +++ b/bootstrap/helpers/proxy.php @@ -1,6 +1,7 @@ Date: Thu, 8 Aug 2024 13:20:38 +0200 Subject: [PATCH 07/10] chore: Update version to 4.0.0-beta.322 --- config/sentry.php | 2 +- config/version.php | 2 +- versions.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/sentry.php b/config/sentry.php index bd1f35f45..9f31246ba 100644 --- a/config/sentry.php +++ b/config/sentry.php @@ -7,7 +7,7 @@ return [ // The release version of your application // Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')) - 'release' => '4.0.0-beta.321', + 'release' => '4.0.0-beta.322', // When left empty or `null` the Laravel environment will be used 'environment' => config('app.env'), diff --git a/config/version.php b/config/version.php index 51743745b..fe0491e33 100644 --- a/config/version.php +++ b/config/version.php @@ -1,3 +1,3 @@ Date: Thu, 8 Aug 2024 13:32:15 +0200 Subject: [PATCH 08/10] fix: manual update process --- app/Actions/Server/UpdateCoolify.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/Actions/Server/UpdateCoolify.php b/app/Actions/Server/UpdateCoolify.php index 72ce80b6b..8910d6e97 100644 --- a/app/Actions/Server/UpdateCoolify.php +++ b/app/Actions/Server/UpdateCoolify.php @@ -4,6 +4,8 @@ namespace App\Actions\Server; use App\Models\InstanceSettings; use App\Models\Server; +use Illuminate\Support\Facades\File; +use Illuminate\Support\Facades\Http; use Lorisleiva\Actions\Concerns\AsAction; class UpdateCoolify @@ -25,6 +27,11 @@ class UpdateCoolify return; } CleanupDocker::dispatch($this->server, false)->onQueue('high'); + $response = Http::retry(3, 1000)->get('https://cdn.coollabs.io/coolify/versions.json'); + if ($response->successful()) { + $versions = $response->json(); + File::put(base_path('versions.json'), json_encode($versions, JSON_PRETTY_PRINT)); + } $this->latestVersion = get_latest_version_of_coolify(); $this->currentVersion = config('version'); if (! $manual_update) { @@ -39,6 +46,8 @@ class UpdateCoolify } } $this->update(); + $settings->new_version_available = false; + $settings->save(); } catch (\Throwable $e) { throw $e; } From d635799b80d6e6fc49e2e2cb5591884f249a30ea Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 8 Aug 2024 14:02:07 +0200 Subject: [PATCH 09/10] chore: Update version to 4.0.0-beta.323 --- config/sentry.php | 2 +- config/version.php | 2 +- versions.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/sentry.php b/config/sentry.php index 9f31246ba..7b48b96b0 100644 --- a/config/sentry.php +++ b/config/sentry.php @@ -7,7 +7,7 @@ return [ // The release version of your application // Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')) - 'release' => '4.0.0-beta.322', + 'release' => '4.0.0-beta.323', // When left empty or `null` the Laravel environment will be used 'environment' => config('app.env'), diff --git a/config/version.php b/config/version.php index fe0491e33..73f3e1263 100644 --- a/config/version.php +++ b/config/version.php @@ -1,3 +1,3 @@ Date: Thu, 8 Aug 2024 14:02:21 +0200 Subject: [PATCH 10/10] servercheckjob should not overlap --- app/Jobs/ServerCheckJob.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/Jobs/ServerCheckJob.php b/app/Jobs/ServerCheckJob.php index 3976477e7..1db15cfd4 100644 --- a/app/Jobs/ServerCheckJob.php +++ b/app/Jobs/ServerCheckJob.php @@ -43,15 +43,15 @@ class ServerCheckJob implements ShouldBeEncrypted, ShouldQueue public function __construct(public Server $server) {} - public function middleware(): array - { - return [(new WithoutOverlapping($this->server->uuid))]; - } + // public function middleware(): array + // { + // return [(new WithoutOverlapping($this->server->uuid))]; + // } - public function uniqueId(): int - { - return $this->server->uuid; - } + // public function uniqueId(): int + // { + // return $this->server->uuid; + // } public function handle() {