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.

hmm

Andras Bacsaie0227e7d1c18
diff --git a/app/Http/Livewire/ForceUpgrade.php b/app/Http/Livewire/ForceUpgrade.php
index dcbf98f1f6..9642a6af4d 100644
--- a/app/Http/Livewire/ForceUpgrade.php
+++ b/app/Http/Livewire/ForceUpgrade.php
@@ -7,10 +7,11 @@ use Livewire\Component;
class ForceUpgrade extends Component
{
+ public bool $visible = false;
public function upgrade()
{
try {
- $this->emit('updateInitiated');
+ $this->visible = true;
dispatch(new InstanceAutoUpdateJob(force: true));
} catch (\Exception $e) {
return general_error_handler($e, $this);
diff --git a/resources/views/components/layout-simple.blade.php b/resources/views/components/layout-simple.blade.php
index 53209d0f0e..5e9e344051 100644
--- a/resources/views/components/layout-simple.blade.php
+++ b/resources/views/components/layout-simple.blade.php
@@ -6,12 +6,12 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="preconnect" href="https://api.fonts.coollabs.io" crossorigin>
<link href="https://api.fonts.coollabs.io/css2?family=Inter&display=swap" rel="stylesheet">
- {{ dd(request()->schemeAndHttpHost(), str_starts_with(request()->schemeAndHttpHost(), 'https')) }}
+ {{-- {{ dd(request()->host()) }}
@if (str_starts_with(request()->schemeAndHttpHost(), 'https'))
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
@else
http
- @endif
+ @endif --}}
@env('local')
<title>Coolify - localhost</title>
@endenv
diff --git a/resources/views/components/layout.blade.php b/resources/views/components/layout.blade.php
index 283bff0cfe..f68ade2d31 100644
--- a/resources/views/components/layout.blade.php
+++ b/resources/views/components/layout.blade.php
@@ -6,11 +6,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="preconnect" href="https://api.fonts.coollabs.io" crossorigin>
<link href="https://api.fonts.coollabs.io/css2?family=Inter&display=swap" rel="stylesheet">
- @if (str_starts_with(request()->schemeAndHttpHost(), 'https'))
- <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
- @else
- http
- @endif
@env('local')
<title>Coolify - localhost</title>
<link rel="icon" href="{{ asset('favicon-dev.png') }}" type="image/x-icon" />
@@ -40,7 +35,6 @@
<main>
{{ $slot }}
</main>
- <livewire:upgrading />
<a
class="fixed text-xs cursor-pointer right-2 bottom-1 opacity-60 hover:opacity-100 hover:text-white">v{{ config('version') }}</a>
@auth
diff --git a/resources/views/components/navbar.blade.php b/resources/views/components/navbar.blade.php
index e1e0b4297a..6a6408b0e9 100644
--- a/resources/views/components/navbar.blade.php
+++ b/resources/views/components/navbar.blade.php
@@ -104,11 +104,6 @@
</svg> Team
</a>
</li>
- @if (auth()->user()->isPartOfRootTeam())
- <li>
- <livewire:force-upgrade />
- </li>
- @endif
<form action="/logout" method="POST">
<li>
@csrf
diff --git a/resources/views/livewire/force-upgrade.blade.php b/resources/views/livewire/force-upgrade.blade.php
index 7a563aecee..3aa54fc7da 100644
--- a/resources/views/livewire/force-upgrade.blade.php
+++ b/resources/views/livewire/force-upgrade.blade.php
@@ -1,12 +1,74 @@
-<button class="link link-hover hover:no-underline hover:bg-coollabs" wire:click='upgrade'>
- <svg xmlns="http://www.w3.org/2000/svg" class="icon" 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="M10 20.777a8.942 8.942 0 0 1 -2.48 -.969" />
- <path d="M14 3.223a9.003 9.003 0 0 1 0 17.554" />
- <path d="M4.579 17.093a8.961 8.961 0 0 1 -1.227 -2.592" />
- <path d="M3.124 10.5c.16 -.95 .468 -1.85 .9 -2.675l.169 -.305" />
- <path d="M6.907 4.579a8.954 8.954 0 0 1 3.093 -1.356" />
- <path d="M12 9l-2 3h4l-2 3" />
- </svg>Force Upgrade
-</button>
+<div class="flex gap-10 text-xs text-white" x-data="{ visible: @entangle('visible') }">
+ <button x-cloak x-show="!visible"
+ class="gap-2 text-white normal-case btn btn-ghost hover:no-underline hover:bg-coollabs" wire:click='upgrade'>
+ <svg xmlns="http://www.w3.org/2000/svg" class="icon" 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="M10 20.777a8.942 8.942 0 0 1 -2.48 -.969" />
+ <path d="M14 3.223a9.003 9.003 0 0 1 0 17.554" />
+ <path d="M4.579 17.093a8.961 8.961 0 0 1 -1.227 -2.592" />
+ <path d="M3.124 10.5c.16 -.95 .468 -1.85 .9 -2.675l.169 -.305" />
+ <path d="M6.907 4.579a8.954 8.954 0 0 1 3.093 -1.356" />
+ <path d="M12 9l-2 3h4l-2 3" />
+ </svg>Force Upgrade
+ </button>
+ <template x-if="visible">
+ <div class="bg-coollabs-gradient">
+ <svg xmlns="http://www.w3.org/2000/svg" class="w-10 h-10 mx-auto 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> Upgrading, please wait...
+ <script>
+ function checkHealth() {
+ console.log('Checking server\'s health...')
+ checkHealthInterval = setInterval(async () => {
+ try {
+ const res = await fetch('/api/health');
+ if (res.ok) {
+ console.log('Server is back online. Reloading...')
+ if (checkHealthInterval) clearInterval(checkHealthInterval);
+ window.location.reload();
+ }
+ } catch (error) {
+ console.log('Waiting for server to come back from dead...');
+ }
+
+ return;
+ }, 2000);
+ }
+
+ function checkIfIamDead() {
+ console.log('Checking server\'s pulse...')
+ checkIfIamDeadInterval = setInterval(async () => {
+ try {
+ const res = await fetch('/api/health');
+ if (res.ok) {
+ console.log('I\'m alive. Waiting for server to be dead...');
+ }
+ } catch (error) {
+ console.log('I\'m dead. Charging... Standby... Bzz... Bzz...')
+ checkHealth();
+ if (checkIfIamDeadInterval) clearInterval(checkIfIamDeadInterval);
+ }
+
+ return;
+ }, 2000);
+ }
+ let checkHealthInterval = null;
+ let checkIfIamDeadInterval = null;
+ console.log('Update initiated. Waiting for server to be dead...')
+ checkIfIamDead();
+ </script>
+ </div>
+ <svg xmlns="http://www.w3.org/2000/svg" class="w-8 h-8 mx-auto 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 12.572l-7.5 7.428l-7.5 -7.428a5 5 0 1 1 7.5 -6.566a5 5 0 1 1 7.5 6.572" />
+ <path d="M12 6l-2 4l4 3l-2 4v3" />
+ </svg>
+ </template>
+
+ {{-- <livewire:upgrading /> --}}
+</div>
diff --git a/resources/views/livewire/settings/form.blade.php b/resources/views/livewire/settings/form.blade.php
index 9af3340d6f..1b1eea4b6b 100644
--- a/resources/views/livewire/settings/form.blade.php
+++ b/resources/views/livewire/settings/form.blade.php
@@ -26,4 +26,7 @@
{{-- <x-forms.checkbox instantSave id="is_https_forced" label="Force https?" /> --}}
<x-forms.checkbox instantSave id="do_not_track" label="Do Not Track" />
</div>
+ @if (auth()->user()->isPartOfRootTeam())
+ <livewire:force-upgrade />
+ @endif
</div>
diff --git a/resources/views/livewire/upgrading.blade.php b/resources/views/livewire/upgrading.blade.php
index 8b1c82446d..48d8e2981a 100644
--- a/resources/views/livewire/upgrading.blade.php
+++ b/resources/views/livewire/upgrading.blade.php
@@ -1,4 +1,4 @@
-<div x-data="{ visible: @entangle('visible') }" class="fixed text-xs text-white top-3 right-28">
+<div x-data="{ visible: @entangle('visible') }" class="flex text-xs text-white">
<template x-if="visible">
<div class="bg-coollabs-gradient">
<svg xmlns="http://www.w3.org/2000/svg" class="w-10 h-10 mx-auto text-pink-500 lds-heart" viewBox="0 0 24 24"