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: realtime connection check

Andras Bacsaid077e0c83c97
diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php
index ac17f66403..5cc398aa54 100644
--- a/app/Console/Kernel.php
+++ b/app/Console/Kernel.php
@@ -70,13 +70,13 @@ class Kernel extends ConsoleKernel
$containerServers = $servers->where('settings.is_swarm_worker', false)->where('settings.is_build_server', false);
}
foreach ($containerServers as $server) {
- $schedule->job(new ContainerStatusJob($server))->everyMinute()->onOneServer();
+ $schedule->job(new ContainerStatusJob($server))->everyTwoMinutes()->onOneServer();
if ($server->isLogDrainEnabled()) {
- $schedule->job(new CheckLogDrainContainerJob($server))->everyMinute()->onOneServer();
+ $schedule->job(new CheckLogDrainContainerJob($server))->everyTwoMinutes()->onOneServer();
}
}
foreach ($servers as $server) {
- $schedule->job(new ServerStatusJob($server))->everyMinute()->onOneServer();
+ $schedule->job(new ServerStatusJob($server))->everyTwoMinutes()->onOneServer();
}
// Delayed Jobs
// foreach ($containerServers as $server) {
diff --git a/app/Livewire/RealtimeConnection.php b/app/Livewire/RealtimeConnection.php
deleted file mode 100644
index 89b6802776..0000000000
--- a/app/Livewire/RealtimeConnection.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-namespace App\Livewire;
-
-use Livewire\Component;
-
-class RealtimeConnection extends Component
-{
- public $checkConnection = false;
- public $showNotification = false;
- public $isNotificationEnabled = true;
- public function render()
- {
- return view('livewire.realtime-connection');
- }
- public function disable()
- {
- auth()->user()->update(['is_notification_realtime_enabled' => false]);
- $this->showNotification = false;
- }
- public function mount() {
- $this->isNotificationEnabled = auth()->user()->is_notification_realtime_enabled;
- $this->checkConnection = auth()->user()->id === 0;
- }
-}
diff --git a/database/migrations/2024_03_26_122110_remove_realtime_notifications.php b/database/migrations/2024_03_26_122110_remove_realtime_notifications.php
new file mode 100644
index 0000000000..6d5d0e0413
--- /dev/null
+++ b/database/migrations/2024_03_26_122110_remove_realtime_notifications.php
@@ -0,0 +1,28 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+ /**
+ * Run the migrations.
+ */
+ public function up(): void
+ {
+ Schema::table('users', function (Blueprint $table) {
+ $table->dropColumn('is_notification_realtime_enabled');
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::table('users', function (Blueprint $table) {
+ $table->boolean('is_notification_realtime_enabled')->default(true);
+ });
+ }
+};
diff --git a/resources/views/components/popup.blade.php b/resources/views/components/popup.blade.php
index a184d80b0c..8061c29bd0 100644
--- a/resources/views/components/popup.blade.php
+++ b/resources/views/components/popup.blade.php
@@ -6,7 +6,8 @@
x-transition:enter-start="translate-y-full" x-transition:enter-end="translate-y-0"
x-transition:leave="transition ease-in duration-300" x-transition:leave-start="translate-y-0"
x-transition:leave-end="translate-y-full" x-init="setTimeout(() => { bannerVisible = true }, bannerVisibleAfter);"
- class="fixed bottom-0 right-0 w-full h-auto duration-300 ease-out sm:px-5 sm:pb-5 sm:w-[26rem] lg:w-full z-[999]" x-cloak>
+ class="fixed bottom-0 right-0 w-full h-auto duration-300 ease-out sm:px-5 sm:pb-5 sm:w-[26rem] lg:w-full z-[999]"
+ x-cloak>
<div
class="flex flex-col items-center justify-between w-full h-full max-w-4xl p-6 mx-auto bg-white border shadow-lg lg:border-t dark:border-coolgray-300 dark:bg-coolgray-100 lg:p-8 lg:flex-row sm:rounded">
<div
@@ -27,7 +28,7 @@
@if ($buttonText->attributes->whereStartsWith('@click')->first()) @click="bannerVisible=false;{{ $buttonText->attributes->get('@click') }}"
@else
@click="bannerVisible=false;" @endif
- class="inline-flex items-center justify-center flex-shrink-0 w-1/2 px-4 py-2 text-sm font-medium tracking-wide transition-colors duration-200 bg-white rounded-md dark:bg-coolgray-200 lg:w-auto dark:text-neutral-200 dark:hover:bg-coolgray-300 focus:shadow-outline focus:outline-none">
+ class="inline-flex items-center justify-center flex-shrink-0 w-1/2 px-4 py-2 text-sm font-medium tracking-wide transition-colors duration-200 rounded-md bg-neutral-100 hover:bg-neutral-200 dark:bg-coolgray-200 lg:w-auto dark:text-neutral-200 dark:hover:bg-coolgray-300 focus:shadow-outline focus:outline-none">
{{ $buttonText }}
</button>
</div>
diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php
index e502e9e6ef..744f337391 100644
--- a/resources/views/layouts/app.blade.php
+++ b/resources/views/layouts/app.blade.php
@@ -4,9 +4,6 @@
@if (isSubscribed() || !isCloud())
<livewire:layout-popups />
@endif
- @auth
- <livewire:realtime-connection />
- @endauth
@auth
<div x-data="{ open: false }" x-cloak class="mx-auto max-w-7xl">
<div class="relative z-50 lg:hidden" :class="open ? 'block' : 'hidden'" role="dialog" aria-modal="true">
diff --git a/resources/views/livewire/layout-popups.blade.php b/resources/views/livewire/layout-popups.blade.php
index 43de765a95..94be1fbb2c 100644
--- a/resources/views/livewire/layout-popups.blade.php
+++ b/resources/views/livewire/layout-popups.blade.php
@@ -1,13 +1,52 @@
<div x-data="{
popups: {
sponsorship: true,
- notification: true
+ notification: true,
+ realtime: false,
},
init() {
this.popups.sponsorship = localStorage.getItem('popupSponsorship') !== 'false';
this.popups.notification = localStorage.getItem('popupNotification') !== 'false';
+ this.popups.realtime = localStorage.getItem('popupRealtime');
+
+ let checkNumber = 1;
+ let checkPusherInterval = null;
+ if (!this.popups.realtime) {
+ checkPusherInterval = setInterval(() => {
+ if (window.Echo && window.Echo.connector.pusher.connection.state !== 'connected') {
+ checkNumber++;
+ if (checkNumber > 4) {
+ this.popups.realtime = true;
+ console.error(
+ 'Coolify could not connect to its real-time service. This will cause unusual problems on the UI if not fixed! Please check the related documentation (https://coolify.io/docs/cloudflare/tunnels) or get help on Discord (https://coollabs.io/discord).)'
+ );
+ clearInterval(checkPusherInterval);
+ }
+ }
+ }, 1000);
+ }
}
}">
+ @auth
+ <span x-show="popups.realtime === true">
+ <x-popup>
+ <x-slot:title>
+ <span class="font-bold text-left text-red-500">WARNING: </span>Realtime Error?!
+ </x-slot:title>
+ <x-slot:description>
+ <span>Coolify could not connect to its real-time service.<br>This will cause unusual problems on the UI
+ if
+ not fixed! <br><br>Please check the
+ related <a class="underline" href='https://coolify.io/docs/cloudflare/tunnels'
+ target='_blank'>documentation</a> or get
+ help on <a class="underline" href='https://coollabs.io/discord' target='_blank'>Discord</a>. </span>
+ </x-slot:description>
+ <x-slot:button-text @click="disableRealtime()">
+ Acknowledge & Disable This Popup
+ </x-slot:button-text>
+ </x-popup>
+ </span>
+ @endauth
<span x-show="popups.sponsorship">
<x-popup>
<x-slot:title>
@@ -20,7 +59,8 @@
<x-slot:description>
<span>Please
consider donating on <a href="https://github.com/sponsors/coollabsio"
- class="text-xs underline dark:text-white">GitHub</a> or <a href="https://opencollective.com/coollabsio"
+ class="text-xs underline dark:text-white">GitHub</a> or <a
+ href="https://opencollective.com/coollabsio"
class="text-xs underline dark:text-white">OpenCollective</a>.<br><br></span>
<span>It enables us to keep creating features without paywalls, ensuring our work remains free and
open.</span>
@@ -35,7 +75,8 @@
<div><span class="font-bold text-red-500">WARNING:</span> The number of active servers exceeds the limit
covered by your payment. If not resolved, some of your servers <span class="font-bold text-red-500">will
be deactivated</span>. Visit <a href="{{ route('subscription.show') }}"
- class="underline dark:text-white">/subscription</a> to update your subscription or remove some servers.
+ class="underline dark:text-white">/subscription</a> to update your subscription or remove some
+ servers.
</div>
</x-banner>
@endif
@@ -70,8 +111,13 @@
function disableSponsorship() {
localStorage.setItem('popupSponsorship', false);
}
+
function disableNotification() {
localStorage.setItem('popupNotification', false);
}
+
+ function disableRealtime() {
+ localStorage.setItem('popupRealtime', 'disabled');
+ }
</script>
</div>
diff --git a/resources/views/livewire/realtime-connection.blade.php b/resources/views/livewire/realtime-connection.blade.php
deleted file mode 100644
index 5a9d14a9f8..0000000000
--- a/resources/views/livewire/realtime-connection.blade.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<div x-data="{ showNotification: @entangle('showNotification') }">
- @if ($checkConnection)
- @script
- <script>
- let checkPusherInterval = null;
- let checkNumber = 0;
- checkPusherInterval = setInterval(() => {
- if (window.Echo) {
- if (window.Echo.connector.pusher.connection.state !== 'connected') {
- checkNumber++;
- if (checkNumber > 4) {
- @if ($isNotificationEnabled)
- $wire.showNotification = true;
- @endif
- console.error(
- 'Coolify could not connect to the new realtime service introduced in beta.154. This will cause unusual problems on the UI if not fixed! Please check the related documentation (https://coolify.io/docs/cloudflare/tunnels) or get help on Discord (https://coollabs.io/discord).)'
- );
- clearInterval(checkPusherInterval);
- }
- } else {
- console.log('Coolify Realtime Service is connected!');
- clearInterval(checkPusherInterval);
- }
- } else {
- @if ($isNotificationEnabled)
- $wire.showNotification = true;
- @endif
- console.error(
- 'Coolify could not connect to the new realtime service introduced in beta.154. This will cause unusual problems on the UI if not fixed! Please check the related documentation (https://coolify.io/docs/cloudflare/tunnels) or get help on Discord (https://coollabs.io/discord).)'
- );
- clearInterval(checkPusherInterval);
- }
- }, 1000);
- </script>
- @endscript
- <div class="toast z-[9999]" x-cloak x-show="showNotification">
- <div class="flex flex-col dark:text-white border border-red-500 border-dashed rounded alert-error bg-coolgray-200">
- <span><span class="font-bold text-left text-red-500">WARNING: </span>Coolify could not connect to the new
- realtime service introduced in beta.154. <br>This will cause unusual problems on the UI if not
- fixed!<br><br>Please check the
- related <a href='https://coolify.io/docs/cloudflare/tunnels' target='_blank'>documentation</a> or get
- help on <a href='https://coollabs.io/discord' target='_blank'>Discord</a>.</span>
- <x-forms.button class="bg-coolgray-400" wire:click='disable'>Acknowledge the problem and disable this
- popup</x-forms.button>
- </div>
- </div>
- @endif
-</div>