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.

feat: Query container state periodically

Andras Bacsaie16643c48ccc
diff --git a/src/routes/applications/[id]/__layout.svelte b/src/routes/applications/[id]/__layout.svelte
index 44acd35eff..b0384cf004 100644
--- a/src/routes/applications/[id]/__layout.svelte
+++ b/src/routes/applications/[id]/__layout.svelte
@@ -75,15 +75,18 @@
import { errorNotification } from '$lib/form';
import DeleteIcon from '$lib/components/DeleteIcon.svelte';
import Loading from '$lib/components/Loading.svelte';
- import { del, post } from '$lib/api';
+ import { del, get, post } from '$lib/api';
import { goto } from '$app/navigation';
import { gitTokens } from '$lib/store';
import { toast } from '@zerodevx/svelte-toast';
import { disabledButton } from '$lib/store';
+ import { onDestroy, onMount } from 'svelte';
+
if (githubToken) $gitTokens.githubToken = githubToken;
if (gitlabToken) $gitTokens.gitlabToken = gitlabToken;
let loading = false;
+ let statusInterval;
$disabledButton =
!$session.isAdmin ||
!application.fqdn ||
@@ -130,6 +133,19 @@
return errorNotification(error);
}
}
+ async function getStatus() {
+ statusInterval = setInterval(async () => {
+ const data = await get(`/applications/${id}.json`);
+ isRunning = data.isRunning;
+ isExited = data.isExited;
+ }, 1000);
+ }
+ onDestroy(() => {
+ clearInterval(statusInterval);
+ });
+ onMount(async () => {
+ await getStatus();
+ });
</script>
<nav class="nav-side">
diff --git a/src/routes/applications/[id]/index.json.ts b/src/routes/applications/[id]/index.json.ts
index addacd1f37..ef9f57dcb9 100644
--- a/src/routes/applications/[id]/index.json.ts
+++ b/src/routes/applications/[id]/index.json.ts
@@ -65,9 +65,9 @@ export const post: RequestHandler = async (event) => {
denoOptions
} = await event.request.json();
if (port) port = Number(port);
+ if (denoOptions) denoOptions = denoOptions.trim();
try {
- console.log(buildPack);
const defaultConfiguration = await setDefaultConfiguration({
buildPack,
port,
diff --git a/src/routes/applications/[id]/logs/build/index.svelte b/src/routes/applications/[id]/logs/build/index.svelte
index aa321172bd..b5e0afc1db 100644
--- a/src/routes/applications/[id]/logs/build/index.svelte
+++ b/src/routes/applications/[id]/logs/build/index.svelte
@@ -21,12 +21,11 @@
<script lang="ts">
import { page } from '$app/stores';
- import { changeQueryParams, dateOptions, getDomain } from '$lib/components/common';
+ import { changeQueryParams, dateOptions } from '$lib/components/common';
import BuildLog from './_BuildLog.svelte';
import { get } from '$lib/api';
import { errorNotification } from '$lib/form';
- import { goto } from '$app/navigation';
export let builds;
export let application;
diff --git a/src/routes/applications/[id]/logs/index.json.ts b/src/routes/applications/[id]/logs/index.json.ts
index 4fa0c3d86c..3d02c8ea79 100644
--- a/src/routes/applications/[id]/logs/index.json.ts
+++ b/src/routes/applications/[id]/logs/index.json.ts
@@ -22,7 +22,9 @@ export const get: RequestHandler = async (event) => {
if (container) {
return {
body: {
- logs: (await container.logs({ stdout: true, stderr: true, timestamps: true }))
+ logs: (
+ await container.logs({ stdout: true, stderr: true, timestamps: true, tail: 5000 })
+ )
.toString()
.split('\n')
.map((l) => l.slice(8))