Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: manual update should be executed only once + better UX

Andras Bacsai704e25100a0e
diff --git a/app/Actions/Server/UpdateCoolify.php b/app/Actions/Server/UpdateCoolify.php
index 3185c22b74..454c88135b 100644
--- a/app/Actions/Server/UpdateCoolify.php
+++ b/app/Actions/Server/UpdateCoolify.php
@@ -4,6 +4,7 @@ namespace App\Actions\Server;
use App\Jobs\PullHelperImageJob;
use App\Models\Server;
+use Illuminate\Support\Sleep;
use Lorisleiva\Actions\Concerns\AsAction;
class UpdateCoolify
@@ -18,6 +19,11 @@ class UpdateCoolify
public function handle($manual_update = false)
{
+ if (isDev()) {
+ Sleep::for(10)->seconds();
+
+ return;
+ }
$settings = instanceSettings();
$this->server = Server::find(0);
if (! $this->server) {
@@ -44,19 +50,8 @@ class UpdateCoolify
private function update()
{
- if (isDev()) {
- remote_process([
- 'sleep 10',
- ], $this->server);
- return;
- }
-
- $all_servers = Server::all();
- $servers = $all_servers->where('settings.is_usable', true)->where('settings.is_reachable', true)->where('ip', '!=', '1.2.3.4');
- foreach ($servers as $server) {
- PullHelperImageJob::dispatch($server);
- }
+ PullHelperImageJob::dispatch($this->server);
instant_remote_process(["docker pull -q ghcr.io/coollabsio/coolify:{$this->latestVersion}"], $this->server, false);
diff --git a/app/Livewire/Upgrade.php b/app/Livewire/Upgrade.php
index 88ed88cb72..e50085c64e 100644
--- a/app/Livewire/Upgrade.php
+++ b/app/Livewire/Upgrade.php
@@ -23,6 +23,9 @@ class Upgrade extends Component
try {
$this->latestVersion = get_latest_version_of_coolify();
$this->isUpgradeAvailable = data_get(InstanceSettings::get(), 'new_version_available', false);
+ if (isDev()) {
+ $this->isUpgradeAvailable = true;
+ }
} catch (\Throwable $e) {
return handleError($e, $this);
}
diff --git a/resources/views/livewire/upgrade.blade.php b/resources/views/livewire/upgrade.blade.php
index 59b3d718d7..009eb22936 100644
--- a/resources/views/livewire/upgrade.blade.php
+++ b/resources/views/livewire/upgrade.blade.php
@@ -2,31 +2,29 @@
x-init="$wire.checkUpdate" x-data="upgradeModal">
@if ($isUpgradeAvailable)
<div :class="{ 'z-40': modalOpen }" class="relative w-auto h-auto">
- <button class="menu-item" @click="modalOpen=true">
- @if ($showProgress)
- <svg xmlns="http://www.w3.org/2000/svg"
- class="w-6 h-6 text-pink-500 transition-colors hover:text-pink-300 lds-heart" viewBox="0 0 24 24"
- stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round"
- stroke-linejoin="round">
- <path stroke="none" d="M0 0h24v24H0z" fill="none" />
- <path d="M19.5 13.572l-7.5 7.428l-7.5 -7.428m0 0a5 5 0 1 1 7.5 -6.566a5 5 0 1 1 7.5 6.572" />
- </svg>
- In progress
- @else
- <svg xmlns="http://www.w3.org/2000/svg"
- class="w-6 h-6 text-pink-500 transition-colors hover:text-pink-300" viewBox="0 0 24 24"
- stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round"
- stroke-linejoin="round">
- <path stroke="none" d="M0 0h24v24H0z" fill="none" />
- <path
- d="M9 12h-3.586a1 1 0 0 1 -.707 -1.707l6.586 -6.586a1 1 0 0 1 1.414 0l6.586 6.586a1 1 0 0 1 -.707 1.707h-3.586v3h-6v-3z" />
- <path d="M9 21h6" />
- <path d="M9 18h6" />
- </svg>
- Upgrade
- @endif
+ <button class="menu-item" @click="modalOpen=true" x-show="showProgress">
+ <svg xmlns="http://www.w3.org/2000/svg"
+ class="w-6 h-6 text-pink-500 transition-colors hover:text-pink-300 lds-heart" viewBox="0 0 24 24"
+ stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round"
+ stroke-linejoin="round">
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
+ <path d="M19.5 13.572l-7.5 7.428l-7.5 -7.428m0 0a5 5 0 1 1 7.5 -6.566a5 5 0 1 1 7.5 6.572" />
+ </svg>
+ In progress
+ </button>
+ <button class="menu-item" @click="modalOpen=true" x-show="!showProgress">
+ <svg xmlns="http://www.w3.org/2000/svg"
+ class="w-6 h-6 text-pink-500 transition-colors hover:text-pink-300" viewBox="0 0 24 24"
+ stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round"
+ stroke-linejoin="round">
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
+ <path
+ d="M9 12h-3.586a1 1 0 0 1 -.707 -1.707l6.586 -6.586a1 1 0 0 1 1.414 0l6.586 6.586a1 1 0 0 1 -.707 1.707h-3.586v3h-6v-3z" />
+ <path d="M9 21h6" />
+ <path d="M9 18h6" />
+ </svg>
+ Upgrade
</button>
-
<template x-teleport="body">
<div x-show="modalOpen"
class="fixed top-0 lg:pt-10 left-0 z-[99] flex items-start justify-center w-screen h-screen"
@@ -45,15 +43,13 @@
class="relative w-full py-6 border rounded min-w-full lg:min-w-[36rem] max-w-fit bg-neutral-100 border-neutral-400 dark:bg-base px-7 dark:border-coolgray-300">
<div class="flex items-center justify-between pb-3">
<h3 class="text-lg font-semibold">Upgrade confirmation</h3>
- @if (!$showProgress)
- <button @click="modalOpen=false"
- class="absolute top-0 right-0 flex items-center justify-center w-8 h-8 mt-5 mr-5 text-gray-600 rounded-full hover:text-gray-800 hover:bg-gray-50">
- <svg class="w-5 h-5" xmlns="http://www.w3.org/2000/svg" fill="none"
- viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
- <path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
- </svg>
- </button>
- @endif
+ <button x-show="!showProgress" @click="modalOpen=false"
+ class="absolute top-0 right-0 flex items-center justify-center w-8 h-8 mt-5 mr-5 text-gray-600 rounded-full hover:text-gray-800 hover:bg-gray-50">
+ <svg class="w-5 h-5" xmlns="http://www.w3.org/2000/svg" fill="none"
+ viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
+ <path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
+ </svg>
+ </button>
</div>
<div class="relative w-auto pb-8">
<p>Are you sure you would like to upgrade your instance to {{ $latestVersion }}?</p>
@@ -65,22 +61,18 @@
<a class="font-bold underline dark:text-white" href="https://coolify.io/docs/upgrade"
target="_blank">guide</a> on what to do.
</p>
- @if ($showProgress)
- <div class="flex flex-col pt-4">
- <h2>Progress <x-loading /></h2>
- <div x-html="currentStatus"></div>
- </div>
- @endif
+ <div class="flex flex-col pt-4" x-show="showProgress">
+ <h2>Progress <x-loading /></h2>
+ <div x-html="currentStatus"></div>
+ </div>
</div>
- <div class="flex gap-4">
- @if (!$showProgress)
- <x-forms.button @click="modalOpen=false"
- class="w-24 dark:bg-coolgray-200 dark:hover:bg-coolgray-300">Cancel
- </x-forms.button>
- <div class="flex-1"></div>
- <x-forms.button @click="confirmed" class="w-24" isHighlighted type="button">Continue
- </x-forms.button>
- @endif
+ <div class="flex gap-4" x-show="!showProgress">
+ <x-forms.button @click="modalOpen=false"
+ class="w-24 dark:bg-coolgray-200 dark:hover:bg-coolgray-300">Cancel
+ </x-forms.button>
+ <div class="flex-1"></div>
+ <x-forms.button @click="confirmed" class="w-24" isHighlighted type="button">Continue
+ </x-forms.button>
</div>
</div>
</div>
@@ -93,12 +85,12 @@
document.addEventListener('alpine:init', () => {
Alpine.data('upgradeModal', () => ({
modalOpen: false,
- showProgress: @js($showProgress),
+ showProgress: false,
currentStatus: '',
confirmed() {
+ this.showProgress = true;
this.$wire.$call('upgrade')
this.upgrade();
- this.$wire.showProgress = true;
window.addEventListener('beforeunload', (event) => {
event.preventDefault();
event.returnValue = '';