Merge pull request #2324 from coollabsio/next

v4.0.0-beta.292
This commit is contained in:
Andras Bacsai 2024-05-30 19:46:11 +02:00 committed by GitHub
commit 1092d00c7a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 19 additions and 20 deletions

View File

@ -14,7 +14,7 @@ class UpdateCoolify
public ?string $latestVersion = null; public ?string $latestVersion = null;
public ?string $currentVersion = null; public ?string $currentVersion = null;
public function handle() public function handle($manual_update = false)
{ {
try { try {
$settings = InstanceSettings::get(); $settings = InstanceSettings::get();
@ -26,17 +26,19 @@ class UpdateCoolify
CleanupDocker::run($this->server, false); CleanupDocker::run($this->server, false);
$this->latestVersion = get_latest_version_of_coolify(); $this->latestVersion = get_latest_version_of_coolify();
$this->currentVersion = config('version'); $this->currentVersion = config('version');
if (!$manual_update) {
if (!$settings->is_auto_update_enabled) { if (!$settings->is_auto_update_enabled) {
Log::info('Auto update is disabled'); Log::debug('Auto update is disabled');
throw new \Exception('Auto update is disabled'); return;
} }
if ($this->latestVersion === $this->currentVersion) { if ($this->latestVersion === $this->currentVersion) {
Log::info('Already on latest version'); Log::debug('Already on latest version');
throw new \Exception('Already on latest version'); return;
} }
if (version_compare($this->latestVersion, $this->currentVersion, '<')) { if (version_compare($this->latestVersion, $this->currentVersion, '<')) {
Log::info('Latest version is lower than current version?!'); Log::debug('Latest version is lower than current version?!');
throw new \Exception('Latest version is lower than current version?!'); return;
}
} }
Log::info("Updating from {$this->currentVersion} -> {$this->latestVersion}"); Log::info("Updating from {$this->currentVersion} -> {$this->latestVersion}");
$this->update(); $this->update();
@ -52,7 +54,7 @@ class UpdateCoolify
{ {
if (isDev()) { if (isDev()) {
instant_remote_process([ instant_remote_process([
"sleep 10" "sleep 1"
], $this->server); ], $this->server);
return; return;
} }

View File

@ -5,11 +5,9 @@ namespace App\Livewire;
use App\Actions\Server\UpdateCoolify; use App\Actions\Server\UpdateCoolify;
use Livewire\Component; use Livewire\Component;
use DanHarrin\LivewireRateLimiting\WithRateLimiting;
class Upgrade extends Component class Upgrade extends Component
{ {
use WithRateLimiting;
public bool $showProgress = false; public bool $showProgress = false;
public bool $updateInProgress = false; public bool $updateInProgress = false;
public bool $isUpgradeAvailable = false; public bool $isUpgradeAvailable = false;
@ -31,9 +29,8 @@ class Upgrade extends Component
if ($this->updateInProgress) { if ($this->updateInProgress) {
return; return;
} }
$this->rateLimit(1, 60);
$this->updateInProgress = true; $this->updateInProgress = true;
UpdateCoolify::run(); UpdateCoolify::run(manual_update: true);
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);
} }

View File

@ -7,7 +7,7 @@ return [
// The release version of your application // The release version of your application
// Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')) // Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD'))
'release' => '4.0.0-beta.291', 'release' => '4.0.0-beta.292',
// When left empty or `null` the Laravel environment will be used // When left empty or `null` the Laravel environment will be used
'environment' => config('app.env'), 'environment' => config('app.env'),

View File

@ -1,3 +1,3 @@
<?php <?php
return '4.0.0-beta.291'; return '4.0.0-beta.292';

View File

@ -1,7 +1,7 @@
{ {
"coolify": { "coolify": {
"v4": { "v4": {
"version": "4.0.0-beta.291" "version": "4.0.0-beta.292"
}, },
"sentinel": { "sentinel": {
"version": "0.0.4" "version": "0.0.4"