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.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
fix: logs for not running containers
Andras Bacsai6882e83d1e57
diff --git a/apps/api/src/routes/api/v1/applications/handlers.ts b/apps/api/src/routes/api/v1/applications/handlers.tsindex 588ad98bee..686eea8cc8 100644--- a/apps/api/src/routes/api/v1/applications/handlers.ts+++ b/apps/api/src/routes/api/v1/applications/handlers.ts@@ -1243,7 +1243,10 @@ export async function getApplicationLogs(request: FastifyRequest<GetApplicationLreturn { logs: sortedLogs }// }} catch (error) {- const { statusCode } = error;+ const { statusCode, stderr } = error;+ if (stderr.startsWith('Error: No such container')) {+ return { logs: [], noContainer: true }+ }if (statusCode === 404) {return {logs: []diff --git a/apps/ui/src/routes/applications/[id]/_Menu.svelte b/apps/ui/src/routes/applications/[id]/_Menu.svelteindex d1a1a0d43d..667cadde09 100644--- a/apps/ui/src/routes/applications/[id]/_Menu.svelte+++ b/apps/ui/src/routes/applications/[id]/_Menu.svelte@@ -160,12 +160,12 @@<span>Logs</span></li><li- class:text-stone-600={$status.application.overallStatus !== 'healthy'}+ class:text-stone-600={$status.application.overallStatus === 'stopped'}class="rounded"class:bg-coollabs={$page.url.pathname === `/applications/${$page.params.id}/logs`}><a- href={$status.application.overallStatus === 'healthy' ? `/applications/${$page.params.id}/logs` : ''}+ href={$status.application.overallStatus !== 'stopped' ? `/applications/${$page.params.id}/logs` : ''}class="no-underline w-full"><svgxmlns="http://www.w3.org/2000/svg"diff --git a/apps/ui/src/routes/applications/[id]/__layout.svelte b/apps/ui/src/routes/applications/[id]/__layout.svelteindex df7965b530..64f8a4ea61 100644--- a/apps/ui/src/routes/applications/[id]/__layout.svelte+++ b/apps/ui/src/routes/applications/[id]/__layout.svelte@@ -394,10 +394,13 @@{:else if $isDeploymentEnabled && !$page.url.pathname.startsWith(`/applications/${id}/configuration/`)}<button- class="btn btn-sm gap-2 btn-primary"+ class="btn btn-sm gap-2"+ class:btn-error={$status.application.overallStatus === 'degraded'}+ class:btn-primary={$status.application.overallStatus !== 'degraded'}disabled={!$isDeploymentEnabled}on:click={() => handleDeploySubmit(false)}>+ {#if $status.application.overallStatus !== 'degraded'}<svgxmlns="http://www.w3.org/2000/svg"class="w-6 h-6"@@ -411,7 +414,26 @@<path stroke="none" d="M0 0h24v24H0z" fill="none" /><path d="M7 4v16l13 -8z" /></svg>- {$status.application.overallStatus === 'degraded' ? 'Restart Degraded Services' : 'Deploy'}+ {:else}+ <svg+ xmlns="http://www.w3.org/2000/svg"+ class="w-6 h-6"+ 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="M16.3 5h.7a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-10a2 2 0 0 1 2 -2h5l-2.82 -2.82m0 5.64l2.82 -2.82"+ transform="rotate(-45 12 12)"+ />+ </svg>++ {/if}+ {$status.application.overallStatus === 'degraded' ? 'Restart Degraded Stack' : 'Deploy'}</button>{/if}{#if $location && $status.application.overallStatus === 'healthy'}diff --git a/apps/ui/src/routes/applications/[id]/logs/index.svelte b/apps/ui/src/routes/applications/[id]/logs/index.svelteindex a0ef249b29..a716f07880 100644--- a/apps/ui/src/routes/applications/[id]/logs/index.svelte+++ b/apps/ui/src/routes/applications/[id]/logs/index.svelte@@ -5,8 +5,6 @@import { errorNotification } from '$lib/common';import { onMount, onDestroy } from 'svelte';import Tooltip from '$lib/components/Tooltip.svelte';- import { status } from '$lib/store';- import { goto } from '$app/navigation';let application: any = {};let logsLoading = false;@@ -19,6 +17,8 @@let position = 0;let services: any = [];let selectedService: any = null;+ let noContainer = false;+const { id } = $page.params;onMount(async () => {const response = await get(`/applications/${id}`);@@ -33,7 +33,7 @@name: ''}];- await selectService('')+ await selectService('');}});onDestroy(() => {@@ -50,27 +50,17 @@}return tempdockerComposeServices;}- async function loadAllLogs() {- try {- logsLoading = true;- const data: any = await get(`/applications/${id}/logs`);- if (data?.logs) {- lastLog = data.logs[data.logs.length - 1];- logs = data.logs;- }- } catch (error) {- return errorNotification(error);- } finally {- logsLoading = false;- }- }async function loadLogs() {if (logsLoading) return;try {const newLogs: any = await get(`/applications/${id}/logs/${selectedService}?since=${lastLog?.split(' ')[0] || 0}`);-+ if (newLogs.noContainer) {+ noContainer = true;+ } else {+ noContainer = false;+ }if (newLogs?.logs && newLogs.logs[newLogs.logs.length - 1] !== logs[logs.length - 1]) {logs = logs.concat(newLogs.logs);lastLog = newLogs.logs[newLogs.logs.length - 1];@@ -103,7 +93,7 @@}}async function selectService(service: any, init: boolean = false) {- if (services.length === 1 && init) return+ if (services.length === 1 && init) return;if (loadLogsInterval) clearInterval(loadLogsInterval);if (followingInterval) clearInterval(followingInterval);@@ -143,7 +133,9 @@{#if selectedService}<div class="flex flex-row justify-center space-x-2">{#if logs.length === 0}- <div class="text-xl font-bold tracking-tighter">{$t('application.build.waiting_logs')}</div>+ {#if noContainer}+ <div class="text-xl font-bold tracking-tighter">Container not found / exited.</div>+ {/if}{:else}<div class="relative w-full"><div class="flex justify-start sticky space-x-2 pb-2">