From 4888f4c40536335f008c99c83faa6aa1ee72de19 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 5 Sep 2024 10:15:22 +0200 Subject: [PATCH] refactor: upgrade process of Coolify --- app/Actions/Server/UpdateCoolify.php | 7 ------ app/Jobs/ApplicationRestartJob.php | 32 ---------------------------- app/Jobs/InstanceAutoUpdateJob.php | 28 ------------------------ app/Livewire/Upgrade.php | 10 ++------- 4 files changed, 2 insertions(+), 75 deletions(-) delete mode 100644 app/Jobs/ApplicationRestartJob.php delete mode 100644 app/Jobs/InstanceAutoUpdateJob.php diff --git a/app/Actions/Server/UpdateCoolify.php b/app/Actions/Server/UpdateCoolify.php index 5648de796..c4af6bb21 100644 --- a/app/Actions/Server/UpdateCoolify.php +++ b/app/Actions/Server/UpdateCoolify.php @@ -4,8 +4,6 @@ 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 @@ -27,11 +25,6 @@ class UpdateCoolify return; } CleanupDocker::dispatch($this->server)->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) { diff --git a/app/Jobs/ApplicationRestartJob.php b/app/Jobs/ApplicationRestartJob.php deleted file mode 100644 index 54c062197..000000000 --- a/app/Jobs/ApplicationRestartJob.php +++ /dev/null @@ -1,32 +0,0 @@ -applicationDeploymentQueueId = $applicationDeploymentQueueId; - } - - public function handle() - { - ray('Restarting application'); - } -} diff --git a/app/Jobs/InstanceAutoUpdateJob.php b/app/Jobs/InstanceAutoUpdateJob.php deleted file mode 100644 index 1bbfcf8cb..000000000 --- a/app/Jobs/InstanceAutoUpdateJob.php +++ /dev/null @@ -1,28 +0,0 @@ -get('https://cdn.coollabs.io/coolify/versions.json'); - if ($response->successful()) { - $versions = $response->json(); - $this->latestVersion = data_get($versions, 'coolify.v4.version'); - } - $this->isUpgradeAvailable = $settings->new_version_available; + $this->latestVersion = get_latest_version_of_coolify(); + $this->isUpgradeAvailable = data_get(InstanceSettings::get(), 'new_version_available', false); } catch (\Throwable $e) { return handleError($e, $this);