From c9b52f1310e586b6dd54a2eac156c59e4b2e9e95 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 24 Feb 2022 10:37:37 +0100 Subject: [PATCH 1/8] fix: Coolify image pulls --- src/routes/__layout.svelte | 39 ++++---------------------------------- src/routes/update.json.ts | 4 +++- 2 files changed, 7 insertions(+), 36 deletions(-) diff --git a/src/routes/__layout.svelte b/src/routes/__layout.svelte index 093f81d73..eee6acc52 100644 --- a/src/routes/__layout.svelte +++ b/src/routes/__layout.svelte @@ -30,7 +30,6 @@ + +
+
+
Configuration
+ {#if $session.isAdmin} + + + {/if} + +
+
+ + +
+ +
+ + +
+ +
+ + +
+
+
${ + cannotDisable + ? 'You cannot disable this proxy as FQDN is configured for Coolify.' + : '' + }`} + /> +
+
+ + + diff --git a/src/routes/destinations/[id]/index.json.ts b/src/routes/destinations/[id]/index.json.ts index 9d8804a67..7d83d9da3 100644 --- a/src/routes/destinations/[id]/index.json.ts +++ b/src/routes/destinations/[id]/index.json.ts @@ -1,4 +1,5 @@ -import { asyncExecShell, getEngine, getTeam, getUserDetails } from '$lib/common'; +import { getUserDetails } from '$lib/common'; +import { generateRemoteEngine } from '$lib/components/common'; import * as db from '$lib/database'; import { ErrorHandler } from '$lib/database'; import { checkContainer } from '$lib/haproxy'; @@ -12,15 +13,21 @@ export const get: RequestHandler = async (event) => { try { const destination = await db.getDestination({ id, teamId }); const settings = await db.listSettings(); - const state = - destination?.engine && (await checkContainer(destination.engine, 'coolify-haproxy')); + let payload = { + destination, + settings, + state: false + }; + if (destination.remoteEngine) { + const engine = await generateRemoteEngine(destination); + payload.state = await checkContainer(engine, 'coolify-haproxy'); + } else { + payload.state = + destination?.engine && (await checkContainer(destination.engine, 'coolify-haproxy')); + } return { status: 200, - body: { - destination, - settings, - state - } + body: { ...payload } }; } catch (error) { return ErrorHandler(error); diff --git a/src/routes/destinations/[id]/index.svelte b/src/routes/destinations/[id]/index.svelte index a5b2996c8..68f529b54 100644 --- a/src/routes/destinations/[id]/index.svelte +++ b/src/routes/destinations/[id]/index.svelte @@ -35,6 +35,7 @@ import type Prisma from '@prisma/client'; import LocalDocker from './_LocalDocker.svelte'; + import RemoteDocker from './_RemoteDocker.svelte';
@@ -42,6 +43,11 @@ > {destination.name}
+
- + {#if destination.remoteEngine} + + {:else} + + {/if}
diff --git a/src/routes/new/destination/_Docker.svelte b/src/routes/new/destination/_LocalDocker.svelte similarity index 75% rename from src/routes/new/destination/_Docker.svelte rename to src/routes/new/destination/_LocalDocker.svelte index 47a070049..79a2c81b0 100644 --- a/src/routes/new/destination/_Docker.svelte +++ b/src/routes/new/destination/_LocalDocker.svelte @@ -51,26 +51,7 @@ placeholder="eg: /var/run/docker.sock" bind:value={payload.engine} /> - -
diff --git a/src/routes/new/destination/_RemoteDocker.svelte b/src/routes/new/destination/_RemoteDocker.svelte new file mode 100644 index 000000000..780c66019 --- /dev/null +++ b/src/routes/new/destination/_RemoteDocker.svelte @@ -0,0 +1,90 @@ + + +
+
+
+
Configuration
+ +
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+ +