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

Andras Bacsaicdf6e600bd7e
diff --git a/app/Http/Livewire/CheckUpdate.php b/app/Http/Livewire/CheckUpdate.php
deleted file mode 100644
index 5c0cee39b1..0000000000
--- a/app/Http/Livewire/CheckUpdate.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-namespace App\Http\Livewire;
-
-use Livewire\Component;
-
-class CheckUpdate extends Component
-{
- public $updateAvailable = false;
- public $latestVersion = 'latest';
- protected $currentVersion;
- protected $image = 'ghcr.io/coollabsio/coolify';
-
- public function checkUpdate()
- {
- $this->latestVersion = get_latest_version_of_coolify();
- $this->currentVersion = config('version');
- if ($this->latestVersion === 'latest') {
- $this->updateAvailable = true;
- return;
- }
- version_compare($this->currentVersion, $this->latestVersion, '<') ? $this->updateAvailable = true : $this->updateAvailable = false;
- }
-}
diff --git a/app/Http/Livewire/Upgrade.php b/app/Http/Livewire/Upgrade.php
index 7c1fc8556b..f6097efac3 100644
--- a/app/Http/Livewire/Upgrade.php
+++ b/app/Http/Livewire/Upgrade.php
@@ -9,6 +9,18 @@ use Livewire\Component;
class Upgrade extends Component
{
public bool $showProgress = false;
+ public bool $isUpgradeAvailable = false;
+
+ public function checkUpdate()
+ {
+ $latestVersion = get_latest_version_of_coolify();
+ $currentVersion = config('version');
+ version_compare($currentVersion, $latestVersion, '<') ? $this->isUpgradeAvailable = true : $this->isUpgradeAvailable = false;
+ if (config('app.env') === 'local') {
+ $this->isUpgradeAvailable = true;
+ }
+ ray($this->isUpgradeAvailable);
+ }
public function upgrade()
{
try {
diff --git a/resources/views/components/navbar.blade.php b/resources/views/components/navbar.blade.php
index 07b4d9adbf..0f66081a56 100644
--- a/resources/views/components/navbar.blade.php
+++ b/resources/views/components/navbar.blade.php
@@ -67,9 +67,7 @@
</svg>
</a>
</li>
- <li title="New version available">
- <livewire:upgrade />
- </li>
+ <livewire:upgrade />
@endif
</ul>
</nav>
diff --git a/resources/views/livewire/check-update.blade.php b/resources/views/livewire/check-update.blade.php
deleted file mode 100644
index 2e38d87121..0000000000
--- a/resources/views/livewire/check-update.blade.php
+++ /dev/null
@@ -1,7 +0,0 @@
-<div>
- <x-forms.button wire:click='checkUpdate' type="submit">
- Check Update</x-forms.button>
- @if ($updateAvailable)
- Update available
- @endif
-</div>
diff --git a/resources/views/livewire/upgrade.blade.php b/resources/views/livewire/upgrade.blade.php
index 11171a2488..d8bfd8b4f1 100644
--- a/resources/views/livewire/upgrade.blade.php
+++ b/resources/views/livewire/upgrade.blade.php
@@ -1,64 +1,69 @@
-<div x-data wire:click='upgrade' x-on:click="upgrade" @class([
- 'bg-gradient-to-r from-purple-500 via-pink-500 to-red-500' => !$showProgress,
- 'hover:bg-transparent focus:bg-transparent' => $showProgress,
-])>
- <button>
- @if ($showProgress)
- <svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6 text-pink-500 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>
- @else
- <svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6 text-white " 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>
- @endif
- </button>
- <script>
- let checkHealthInterval = null;
- let checkIfIamDeadInterval = null;
+<li title="New version available" x-init="$wire.checkUpdate">
+ @if ($isUpgradeAvailable)
+ <div x-data wire:click='upgrade' class=" hover:bg-transparent focus:bg-transparent" x-on:click="upgrade" <button>
+ @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>
+ @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>
+ @endif
+ </button>
- function revive() {
- console.log('Checking server\'s health...')
- checkHealthInterval = setInterval(() => {
- fetch('/api/health')
- .then(response => {
- if (response.ok) {
- Toaster.success('Coolify is back online. Reloading...')
- if (checkHealthInterval) clearInterval(checkHealthInterval);
- setTimeout(() => {
- window.location.reload();
- }, 5000)
- } else {
- console.log('Waiting for server to come back from dead...');
- }
- })
- return;
- }, 2000);
- }
+ <script>
+ let checkHealthInterval = null;
+ let checkIfIamDeadInterval = null;
- function upgrade() {
- console.log('Update initiated.')
- checkIfIamDeadInterval = setInterval(() => {
- fetch('/api/health')
- .then(response => {
- if (response.ok) {
- console.log('It\'s alive. Waiting for server to be dead...');
- } else {
- Toaster.success('Update done, restarting Coolify!')
- console.log('It\'s dead. Reviving... Standby... Bzz... Bzz...')
- if (checkIfIamDeadInterval) clearInterval(checkIfIamDeadInterval);
- revive();
- }
- })
- return;
- }, 2000);
- }
- </script>
-</div>
+ function revive() {
+ console.log('Checking server\'s health...')
+ checkHealthInterval = setInterval(() => {
+ fetch('/api/health')
+ .then(response => {
+ if (response.ok) {
+ Toaster.success('Coolify is back online. Reloading...')
+ if (checkHealthInterval) clearInterval(checkHealthInterval);
+ setTimeout(() => {
+ window.location.reload();
+ }, 5000)
+ } else {
+ console.log('Waiting for server to come back from dead...');
+ }
+ })
+ return;
+ }, 2000);
+ }
+
+ function upgrade() {
+ console.log('Update initiated.')
+ checkIfIamDeadInterval = setInterval(() => {
+ fetch('/api/health')
+ .then(response => {
+ if (response.ok) {
+ console.log('It\'s alive. Waiting for server to be dead...');
+ } else {
+ Toaster.success('Update done, restarting Coolify!')
+ console.log('It\'s dead. Reviving... Standby... Bzz... Bzz...')
+ if (checkIfIamDeadInterval) clearInterval(checkIfIamDeadInterval);
+ revive();
+ }
+ })
+ return;
+ }, 2000);
+ }
+ </script>
+ </div>
+ @endif
+</li>