From 58c6d066f2021046c9c1ecfe18b66c37ea484b10 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 8 Aug 2024 12:19:14 +0200 Subject: [PATCH 1/4] 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 2/4] 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 3/4] 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 4/4] 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