From 8a2de1001f81c3b18aba9c1af0de5301e1caf8fd Mon Sep 17 00:00:00 2001 From: Ikechukwu Eze <92305839+ikezedev@users.noreply.github.com> Date: Sun, 31 Jul 2022 19:50:03 +0200 Subject: [PATCH 01/26] first steps with ui --- .../components/svg/databases/EdgeDB.svelte | 22 ++++++++ .../databases/[id]/_DatabaseLinks.svelte | 3 ++ .../[id]/_Databases/_Databases.svelte | 9 +++- .../databases/[id]/_Databases/_EdgeDB.svelte | 53 +++++++++++++++++++ .../databases/[id]/configuration/type.svelte | 3 ++ apps/ui/src/routes/databases/index.svelte | 5 ++ 6 files changed, 93 insertions(+), 2 deletions(-) create mode 100644 apps/ui/src/lib/components/svg/databases/EdgeDB.svelte create mode 100644 apps/ui/src/routes/databases/[id]/_Databases/_EdgeDB.svelte diff --git a/apps/ui/src/lib/components/svg/databases/EdgeDB.svelte b/apps/ui/src/lib/components/svg/databases/EdgeDB.svelte new file mode 100644 index 000000000..25b705c2c --- /dev/null +++ b/apps/ui/src/lib/components/svg/databases/EdgeDB.svelte @@ -0,0 +1,22 @@ + + + diff --git a/apps/ui/src/routes/databases/[id]/_DatabaseLinks.svelte b/apps/ui/src/routes/databases/[id]/_DatabaseLinks.svelte index 50eed98b2..ec88e8edf 100644 --- a/apps/ui/src/routes/databases/[id]/_DatabaseLinks.svelte +++ b/apps/ui/src/routes/databases/[id]/_DatabaseLinks.svelte @@ -3,6 +3,7 @@ import Clickhouse from '$lib/components/svg/databases/Clickhouse.svelte'; import CouchDb from '$lib/components/svg/databases/CouchDB.svelte'; + import EdgeDb from '$lib/components/svg/databases/EdgeDB.svelte'; import MariaDb from '$lib/components/svg/databases/MariaDB.svelte'; import MongoDb from '$lib/components/svg/databases/MongoDB.svelte'; import MySql from '$lib/components/svg/databases/MySQL.svelte'; @@ -25,5 +26,7 @@ {:else if database.type === 'redis'} + {:else if database.type === 'redis'} + {/if} diff --git a/apps/ui/src/routes/databases/[id]/_Databases/_Databases.svelte b/apps/ui/src/routes/databases/[id]/_Databases/_Databases.svelte index bc259cbd6..c57520ee6 100644 --- a/apps/ui/src/routes/databases/[id]/_Databases/_Databases.svelte +++ b/apps/ui/src/routes/databases/[id]/_Databases/_Databases.svelte @@ -13,6 +13,7 @@ import PostgreSql from './_PostgreSQL.svelte'; import Redis from './_Redis.svelte'; import CouchDb from './_CouchDb.svelte'; + import EdgeDB from './_EdgeDB.svelte'; import { post } from '$lib/api'; import { toast } from '@zerodevx/svelte-toast'; import { t } from '$lib/translations'; @@ -37,8 +38,10 @@ databaseDefault = database.defaultDatabase; databaseDbUser = database.dbUser; databaseDbUserPassword = database.dbUserPassword; - if (database.type === 'mongodb') { - databaseDefault = '?readPreference=primary&ssl=false'; + if (database.type === 'mongodb' || database.type === 'edgedb') { + if (database.type === 'mongodb') { + databaseDefault = '?readPreference=primary&ssl=false'; + } databaseDbUser = database.rootUser; databaseDbUserPassword = database.rootUserPassword; } else if (database.type === 'redis') { @@ -196,6 +199,8 @@ {:else if database.type === 'couchdb'} + {:else if database.type === 'edgedb'} + {/if}
diff --git a/apps/ui/src/routes/register.svelte b/apps/ui/src/routes/register.svelte index 0cdf81c4a..2c920311a 100644 --- a/apps/ui/src/routes/register.svelte +++ b/apps/ui/src/routes/register.svelte @@ -100,7 +100,7 @@
-

Coolify dashboard

+

Coolify

{/if} From a5548c080c87b2adee0c1dc79d03cfbe70164a00 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 7 Sep 2022 08:58:51 +0200 Subject: [PATCH 07/26] fix: service state update --- .../routes/services/[id]/_Services/_Services.svelte | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/ui/src/routes/services/[id]/_Services/_Services.svelte b/apps/ui/src/routes/services/[id]/_Services/_Services.svelte index 0c05271b6..c84f7efa2 100644 --- a/apps/ui/src/routes/services/[id]/_Services/_Services.svelte +++ b/apps/ui/src/routes/services/[id]/_Services/_Services.svelte @@ -12,7 +12,14 @@ import { get, post } from '$lib/api'; import { errorNotification, getDomain } from '$lib/common'; import { t } from '$lib/translations'; - import { appSession, disabledButton, status, location, setLocation, addToast } from '$lib/store'; + import { + appSession, + status, + setLocation, + addToast, + checkIfDeploymentEnabledServices, + isDeploymentEnabled + } from '$lib/store'; import CopyPasswordField from '$lib/components/CopyPasswordField.svelte'; import Setting from '$lib/components/Setting.svelte'; @@ -78,8 +85,8 @@ }); await post(`/services/${id}`, { ...service }); setLocation(service); - $disabledButton = false; forceSave = false; + $isDeploymentEnabled = checkIfDeploymentEnabledServices($appSession.isAdmin, service); return addToast({ message: 'Configuration saved.', type: 'success' From 2f772080b8ed28071589ba7d65020da956f18275 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 7 Sep 2022 09:06:30 +0200 Subject: [PATCH 08/26] fix: add initial DNS servers --- apps/api/prisma/seed.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/api/prisma/seed.js b/apps/api/prisma/seed.js index 9fa55136f..eeb41b253 100644 --- a/apps/api/prisma/seed.js +++ b/apps/api/prisma/seed.js @@ -17,7 +17,6 @@ const algorithm = 'aes-256-ctr'; async function main() { // Enable registration for the first user - // Set initial HAProxy password const settingsFound = await prisma.setting.findFirst({}); if (!settingsFound) { await prisma.setting.create({ @@ -25,7 +24,8 @@ async function main() { isRegistrationEnabled: true, proxyPassword: encrypt(generatePassword()), proxyUser: cuid(), - arch: process.arch + arch: process.arch, + DNSServers: '1.1.1.1,8.8.8.8' } }); } else { From 05a1721499d0601d8e89a1de96678eb2c6683771 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 7 Sep 2022 09:15:03 +0200 Subject: [PATCH 09/26] fix: revert last change with domain check --- apps/api/src/routes/api/v1/applications/handlers.ts | 2 -- apps/ui/src/routes/applications/[id]/index.svelte | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/api/src/routes/api/v1/applications/handlers.ts b/apps/api/src/routes/api/v1/applications/handlers.ts index e37590381..1d00e94d1 100644 --- a/apps/api/src/routes/api/v1/applications/handlers.ts +++ b/apps/api/src/routes/api/v1/applications/handlers.ts @@ -525,9 +525,7 @@ export async function checkDomain(request: FastifyRequest) { } export async function checkDNS(request: FastifyRequest) { try { - const { id } = request.params - let { exposePort, fqdn, forceSave, dualCerts } = request.body if (!fqdn) { return {} diff --git a/apps/ui/src/routes/applications/[id]/index.svelte b/apps/ui/src/routes/applications/[id]/index.svelte index f11286b98..d9df70f4e 100644 --- a/apps/ui/src/routes/applications/[id]/index.svelte +++ b/apps/ui/src/routes/applications/[id]/index.svelte @@ -218,7 +218,7 @@ if (loading) return; loading = true; try { - nonWWWDomain = application.fqdn != null && getDomain(application.fqdn).replace(/^www\./, ''); + nonWWWDomain = application.fqdn && getDomain(application.fqdn).replace(/^www\./, ''); if (application.deploymentType) application.deploymentType = application.deploymentType.toLowerCase(); !isBot && From 53e70fbfcb78e0c32a29e4e2c351156b623c289b Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 7 Sep 2022 09:15:10 +0200 Subject: [PATCH 10/26] dev: update devcontainer --- .devcontainer/devcontainer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 64c664a9e..25e97c31a 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -20,7 +20,8 @@ "svelte.svelte-vscode", "ardenivanov.svelte-intellisense", "Prisma.prisma", - "bradlc.vscode-tailwindcss" + "bradlc.vscode-tailwindcss", + "waderyan.gitblame" ], // Use 'forwardPorts' to make a list of ports inside the container available locally. "forwardPorts": [3000, 3001], From eef313665b3e54f301b7ffc7b117302fba0a4961 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 7 Sep 2022 09:18:44 +0200 Subject: [PATCH 11/26] fix: service volume generation --- apps/api/src/lib/services/handlers.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/apps/api/src/lib/services/handlers.ts b/apps/api/src/lib/services/handlers.ts index d66747e67..a609ce3e1 100644 --- a/apps/api/src/lib/services/handlers.ts +++ b/apps/api/src/lib/services/handlers.ts @@ -198,7 +198,7 @@ COPY ./init-db.sh /docker-entrypoint-initdb.d/init-db.sh`; await fs.writeFile(`${workdir}/Dockerfile`, Dockerfile); - const { volumeMounts } = persistentVolumes(id, persistentStorage, config.plausibleAnalytics) + const { volumeMounts } = persistentVolumes(id, persistentStorage, config) const composeFile: ComposeFile = { version: '3.8', @@ -852,7 +852,7 @@ async function startGhostService(request: FastifyRequest) { }); } - const { volumeMounts } = persistentVolumes(id, persistentStorage, config.ghost) + const { volumeMounts } = persistentVolumes(id, persistentStorage, config) const composeFile: ComposeFile = { version: '3.8', services: { @@ -1086,7 +1086,7 @@ async function startUmamiService(request: FastifyRequest) { FROM ${config.postgresql.image} COPY ./schema.postgresql.sql /docker-entrypoint-initdb.d/schema.postgresql.sql`; await fs.writeFile(`${workdir}/Dockerfile`, Dockerfile); - const { volumeMounts } = persistentVolumes(id, persistentStorage, config.umami) + const { volumeMounts } = persistentVolumes(id, persistentStorage, config) const composeFile: ComposeFile = { version: '3.8', services: { @@ -1114,6 +1114,7 @@ async function startUmamiService(request: FastifyRequest) { }, volumes: volumeMounts }; + console.log(composeFile) const composeFileDestination = `${workdir}/docker-compose.yaml`; await fs.writeFile(composeFileDestination, yaml.dump(composeFile)); await startServiceContainers(destinationDocker.id, composeFileDestination) @@ -1167,7 +1168,7 @@ async function startHasuraService(request: FastifyRequest) { }); } - const { volumeMounts } = persistentVolumes(id, persistentStorage, config.hasura) + const { volumeMounts } = persistentVolumes(id, persistentStorage, config) const composeFile: ComposeFile = { version: '3.8', services: { @@ -1272,7 +1273,7 @@ async function startFiderService(request: FastifyRequest) { config.fider.environmentVariables[secret.name] = secret.value; }); } - const { volumeMounts } = persistentVolumes(id, persistentStorage, config.fider) + const { volumeMounts } = persistentVolumes(id, persistentStorage, config) const composeFile: ComposeFile = { version: '3.8', services: { @@ -1880,7 +1881,7 @@ async function startMoodleService(request: FastifyRequest) { config.moodle.environmentVariables[secret.name] = secret.value; }); } - const { volumeMounts } = persistentVolumes(id, persistentStorage, config.moodle) + const { volumeMounts } = persistentVolumes(id, persistentStorage, config) const composeFile: ComposeFile = { version: '3.8', services: { @@ -2006,7 +2007,7 @@ async function startGlitchTipService(request: FastifyRequest) config.glitchTip.environmentVariables[secret.name] = secret.value; }); } - const { volumeMounts } = persistentVolumes(id, persistentStorage, config.glitchTip) + const { volumeMounts } = persistentVolumes(id, persistentStorage, config) const composeFile: ComposeFile = { version: '3.8', services: { From 9161882f3346969b8e1b11bda27ed6be1aba64a6 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 7 Sep 2022 09:21:28 +0200 Subject: [PATCH 12/26] debug: add debug log --- apps/ui/src/routes/applications/[id]/index.svelte | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/ui/src/routes/applications/[id]/index.svelte b/apps/ui/src/routes/applications/[id]/index.svelte index d9df70f4e..291ebd820 100644 --- a/apps/ui/src/routes/applications/[id]/index.svelte +++ b/apps/ui/src/routes/applications/[id]/index.svelte @@ -219,6 +219,7 @@ loading = true; try { nonWWWDomain = application.fqdn && getDomain(application.fqdn).replace(/^www\./, ''); + console.log({debug: nonWWWDomain}) if (application.deploymentType) application.deploymentType = application.deploymentType.toLowerCase(); !isBot && From 8dee345f859c268e7e00610a44ac28f73185e84b Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 7 Sep 2022 09:23:03 +0200 Subject: [PATCH 13/26] enable autoupdate option for everyone --- apps/ui/src/routes/settings/global.svelte | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/apps/ui/src/routes/settings/global.svelte b/apps/ui/src/routes/settings/global.svelte index ee64d908e..287274e24 100644 --- a/apps/ui/src/routes/settings/global.svelte +++ b/apps/ui/src/routes/settings/global.svelte @@ -362,17 +362,15 @@ on:click={() => changeSettings('isAPIDebuggingEnabled')} /> - {#if browser && $features.beta} -
- changeSettings('isAutoUpdateEnabled')} - /> -
- {/if} +
+ changeSettings('isAutoUpdateEnabled')} + /> +
From 98073202e934eb91182439ec1b510f9d1c3584e8 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 7 Sep 2022 09:28:53 +0200 Subject: [PATCH 14/26] fix: minio default env variables --- apps/api/src/lib/services/handlers.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/api/src/lib/services/handlers.ts b/apps/api/src/lib/services/handlers.ts index a609ce3e1..f56657ce7 100644 --- a/apps/api/src/lib/services/handlers.ts +++ b/apps/api/src/lib/services/handlers.ts @@ -333,6 +333,8 @@ async function startMinioService(request: FastifyRequest) { image: `${image}:${version}`, volumes: [`${id}-minio-data:/data`], environmentVariables: { + MINIO_SERVER_URL: fqdn, + MINIO_DOMAIN: getDomain(fqdn), MINIO_ROOT_USER: rootUser, MINIO_ROOT_PASSWORD: rootUserPassword, MINIO_BROWSER_REDIRECT_URL: fqdn @@ -2476,7 +2478,7 @@ async function startTaigaService(request: FastifyRequest) { TAIGA_SECRET_KEY: secretKey, } }, - + postgresql: { image: `postgres:12.3`, volumes: [`${id}-postgresql-data:/var/lib/postgresql/data`], From e7919e9a1b403598daba10acff11b2f95b34da11 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 7 Sep 2022 09:39:29 +0200 Subject: [PATCH 15/26] ui: fix initial loading icon bg --- apps/ui/src/routes/applications/[id]/__layout.svelte | 2 +- apps/ui/src/routes/databases/[id]/__layout.svelte | 2 +- apps/ui/src/routes/services/[id]/__layout.svelte | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/ui/src/routes/applications/[id]/__layout.svelte b/apps/ui/src/routes/applications/[id]/__layout.svelte index a9cd88482..0384dab28 100644 --- a/apps/ui/src/routes/applications/[id]/__layout.svelte +++ b/apps/ui/src/routes/applications/[id]/__layout.svelte @@ -244,7 +244,7 @@ {/if} {#if $status.application.initialLoading} + + + {#if isNewSecret} +
+ +
+ {:else} +
+
+ +
+ {#if !isPRMRSecret} +
+ +
+ {/if} +
+ {/if} + diff --git a/apps/ui/src/routes/databases/[id]/__layout.svelte b/apps/ui/src/routes/databases/[id]/__layout.svelte index 26f8bd9e7..9b690a7ba 100644 --- a/apps/ui/src/routes/databases/[id]/__layout.svelte +++ b/apps/ui/src/routes/databases/[id]/__layout.svelte @@ -58,7 +58,7 @@ import { goto } from '$app/navigation'; import { page } from '$app/stores'; import { errorNotification, handlerNotFoundLoad } from '$lib/common'; - import { appSession, status, disabledButton } from '$lib/store'; + import { appSession, status, isDeploymentEnabled } from '$lib/store'; import DeleteIcon from '$lib/components/DeleteIcon.svelte'; import { onDestroy, onMount } from 'svelte'; import Tooltip from '$lib/components/Tooltip.svelte'; @@ -67,7 +67,7 @@ let statusInterval: any = false; let forceDelete = false; - $disabledButton = !$appSession.isAdmin; + $isDeploymentEnabled = !$appSession.isAdmin; async function deleteDatabase(force: boolean) { const sure = confirm(`Are you sure you would like to delete '${database.name}'?`); @@ -148,11 +148,11 @@ {#if id !== 'new'}