From dcf7f92aabc8a01aac9896c192b691b4924ee8da Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 1 Apr 2022 14:29:06 +0200 Subject: [PATCH 001/112] fix: Build variables --- src/lib/buildPacks/docker.ts | 4 ++-- src/lib/buildPacks/nextjs.ts | 4 ++-- src/lib/buildPacks/node.ts | 4 ++-- src/lib/buildPacks/nuxtjs.ts | 4 ++-- src/lib/buildPacks/static.ts | 4 ++-- src/lib/docker.ts | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/lib/buildPacks/docker.ts b/src/lib/buildPacks/docker.ts index 2c86bb532..371ffed82 100644 --- a/src/lib/buildPacks/docker.ts +++ b/src/lib/buildPacks/docker.ts @@ -28,11 +28,11 @@ export default async function ({ if (secret.isBuildSecret) { if (pullmergeRequestId) { if (secret.isPRMRSecret) { - Dockerfile.push(`ARG ${secret.name} ${secret.value}`); + Dockerfile.push(`ARG ${secret.name}=${secret.value}`); } } else { if (!secret.isPRMRSecret) { - Dockerfile.push(`ARG ${secret.name} ${secret.value}`); + Dockerfile.push(`ARG ${secret.name}=${secret.value}`); } } } diff --git a/src/lib/buildPacks/nextjs.ts b/src/lib/buildPacks/nextjs.ts index 4f1f3b0d6..0f58b3b84 100644 --- a/src/lib/buildPacks/nextjs.ts +++ b/src/lib/buildPacks/nextjs.ts @@ -23,11 +23,11 @@ const createDockerfile = async (data, image): Promise => { if (secret.isBuildSecret) { if (pullmergeRequestId) { if (secret.isPRMRSecret) { - Dockerfile.push(`ARG ${secret.name} ${secret.value}`); + Dockerfile.push(`ARG ${secret.name}=${secret.value}`); } } else { if (!secret.isPRMRSecret) { - Dockerfile.push(`ARG ${secret.name} ${secret.value}`); + Dockerfile.push(`ARG ${secret.name}=${secret.value}`); } } } diff --git a/src/lib/buildPacks/node.ts b/src/lib/buildPacks/node.ts index 54527a728..869e28b5d 100644 --- a/src/lib/buildPacks/node.ts +++ b/src/lib/buildPacks/node.ts @@ -24,11 +24,11 @@ const createDockerfile = async (data, image): Promise => { if (secret.isBuildSecret) { if (pullmergeRequestId) { if (secret.isPRMRSecret) { - Dockerfile.push(`ARG ${secret.name} ${secret.value}`); + Dockerfile.push(`ARG ${secret.name}=${secret.value}`); } } else { if (!secret.isPRMRSecret) { - Dockerfile.push(`ARG ${secret.name} ${secret.value}`); + Dockerfile.push(`ARG ${secret.name}=${secret.value}`); } } } diff --git a/src/lib/buildPacks/nuxtjs.ts b/src/lib/buildPacks/nuxtjs.ts index 207afe864..bfa48bf73 100644 --- a/src/lib/buildPacks/nuxtjs.ts +++ b/src/lib/buildPacks/nuxtjs.ts @@ -23,11 +23,11 @@ const createDockerfile = async (data, image): Promise => { if (secret.isBuildSecret) { if (pullmergeRequestId) { if (secret.isPRMRSecret) { - Dockerfile.push(`ARG ${secret.name} ${secret.value}`); + Dockerfile.push(`ARG ${secret.name}=${secret.value}`); } } else { if (!secret.isPRMRSecret) { - Dockerfile.push(`ARG ${secret.name} ${secret.value}`); + Dockerfile.push(`ARG ${secret.name}=${secret.value}`); } } } diff --git a/src/lib/buildPacks/static.ts b/src/lib/buildPacks/static.ts index 17900ced3..e9e7179d5 100644 --- a/src/lib/buildPacks/static.ts +++ b/src/lib/buildPacks/static.ts @@ -22,11 +22,11 @@ const createDockerfile = async (data, image): Promise => { if (secret.isBuildSecret) { if (pullmergeRequestId) { if (secret.isPRMRSecret) { - Dockerfile.push(`ARG ${secret.name} ${secret.value}`); + Dockerfile.push(`ARG ${secret.name}=${secret.value}`); } } else { if (!secret.isPRMRSecret) { - Dockerfile.push(`ARG ${secret.name} ${secret.value}`); + Dockerfile.push(`ARG ${secret.name}=${secret.value}`); } } } diff --git a/src/lib/docker.ts b/src/lib/docker.ts index 717303040..89290fba2 100644 --- a/src/lib/docker.ts +++ b/src/lib/docker.ts @@ -27,11 +27,11 @@ export async function buildCacheImageWithNode(data, imageForBuild) { if (secret.isBuildSecret) { if (pullmergeRequestId) { if (secret.isPRMRSecret) { - Dockerfile.push(`ARG ${secret.name} ${secret.value}`); + Dockerfile.push(`ARG ${secret.name}=${secret.value}`); } } else { if (!secret.isPRMRSecret) { - Dockerfile.push(`ARG ${secret.name} ${secret.value}`); + Dockerfile.push(`ARG ${secret.name}=${secret.value}`); } } } From 4e334d4fff777c078181fad9b4f310ac453ec5c0 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 1 Apr 2022 14:41:38 +0200 Subject: [PATCH 002/112] fix: Use NodeJS for sveltekit for now --- src/lib/components/templates.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib/components/templates.ts b/src/lib/components/templates.ts index 1b2e7346d..5ad62f6fa 100644 --- a/src/lib/components/templates.ts +++ b/src/lib/components/templates.ts @@ -252,6 +252,9 @@ export const buildPacks = [ } ]; export const scanningTemplates = { + '@sveltejs/kit': { + buildPack: 'nodejs' + }, astro: { buildPack: 'astro' }, From 19f661706d0801dd2cc674419cb48e6716b5548e Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 1 Apr 2022 15:34:29 +0200 Subject: [PATCH 003/112] fix: Ignore coolify proxy error for now --- src/lib/database/common.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/database/common.ts b/src/lib/database/common.ts index e89105f05..29d04982b 100644 --- a/src/lib/database/common.ts +++ b/src/lib/database/common.ts @@ -46,7 +46,9 @@ export function ErrorHandler(e) { if (e.message?.includes('git clone')) { truncatedError.message = 'git clone failed'; } - sentry.captureException(truncatedError); + if (!e.message?.includes('Coolify Proxy is not running')) { + sentry.captureException(truncatedError); + } const payload = { status: truncatedError.status || 500, body: { From f3b5de4697aee112e17f5b56c2e7cc4edfe30dae Mon Sep 17 00:00:00 2001 From: Restray Date: Fri, 1 Apr 2022 21:10:24 +0200 Subject: [PATCH 004/112] feat(dev): allow windows users to use pnpm dev --- package.json | 3 ++- pnpm-lock.yaml | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 6c7237198..f7b472958 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "version": "2.2.7", "license": "AGPL-3.0", "scripts": { - "dev": "docker-compose -f docker-compose-dev.yaml up -d && NODE_ENV=development svelte-kit dev", + "dev": "docker-compose -f docker-compose-dev.yaml up -d && cross-env NODE_ENV=development & svelte-kit dev", "dev:stop": "docker-compose -f docker-compose-dev.yaml down", "dev:logs": "docker-compose -f docker-compose-dev.yaml logs -f --tail 10", "studio": "npx prisma studio", @@ -37,6 +37,7 @@ "@typescript-eslint/parser": "4.31.1", "@zerodevx/svelte-toast": "0.7.1", "autoprefixer": "10.4.4", + "cross-env": "^7.0.3", "cross-var": "1.1.0", "eslint": "7.32.0", "eslint-config-prettier": "8.5.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a89edbf25..537a1fb6b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,6 +20,7 @@ specifiers: compare-versions: 4.1.3 cookie: 0.4.2 cooltipz-css: ^2.1.0 + cross-env: ^7.0.3 cross-var: 1.1.0 cuid: 2.1.8 dayjs: 1.11.0 @@ -92,6 +93,7 @@ devDependencies: '@typescript-eslint/parser': 4.31.1_eslint@7.32.0+typescript@4.6.3 '@zerodevx/svelte-toast': 0.7.1 autoprefixer: 10.4.4_postcss@8.4.12 + cross-env: 7.0.3 cross-var: 1.1.0 eslint: 7.32.0 eslint-config-prettier: 8.5.0_eslint@7.32.0 @@ -2081,6 +2083,17 @@ packages: luxon: 1.28.0 dev: false + /cross-env/7.0.3: + resolution: + { + integrity: sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw== + } + engines: { node: '>=10.14', npm: '>=6', yarn: '>=1' } + hasBin: true + dependencies: + cross-spawn: 7.0.3 + dev: true + /cross-spawn/5.1.0: resolution: { integrity: sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk= } dependencies: From 809f40dec938a3e9bdd0a6cf3ec8606ecba3075d Mon Sep 17 00:00:00 2001 From: Restray Date: Fri, 1 Apr 2022 21:41:22 +0200 Subject: [PATCH 005/112] feat: add loading on register button --- src/routes/register/index.svelte | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/routes/register/index.svelte b/src/routes/register/index.svelte index 35501fce2..0b2183444 100644 --- a/src/routes/register/index.svelte +++ b/src/routes/register/index.svelte @@ -19,6 +19,9 @@ emailEl.focus(); }); async function handleSubmit() { + // Prevent double submission + if (loading) return; + if (password !== passwordCheck) { return errorNotification('Passwords do not match.'); } @@ -88,8 +91,13 @@ />
- {loading ? 'Registering...' : 'Register'}
From adfc976f41555ca985e640a5c3444b59d9d24010 Mon Sep 17 00:00:00 2001 From: Mohit Yadav <48997634+Just-Moh-it@users.noreply.github.com> Date: Sat, 2 Apr 2022 17:28:42 +0530 Subject: [PATCH 006/112] Suggested change Changed to appropriate word --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7d02bca45..2cb2d5bf6 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ An open-source & self-hostable Heroku / Netlify alternative. https://demo.coolify.io/ -(If it is unresponsible, that means someone overloaded the server. 🙃) +(If it is unresponsive, that means someone overloaded the server. 🙃) ## How to install From b60b832426d90a7709ee7431f9b4aca8091acd95 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Sat, 2 Apr 2022 15:53:25 +0200 Subject: [PATCH 007/112] chore: version++ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6c7237198..01258dbcb 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "coolify", "description": "An open-source & self-hostable Heroku / Netlify alternative.", - "version": "2.2.7", + "version": "2.2.8", "license": "AGPL-3.0", "scripts": { "dev": "docker-compose -f docker-compose-dev.yaml up -d && NODE_ENV=development svelte-kit dev", From ddfbda6f8064626e7466e8d415d8fd34a1b20db9 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Sat, 2 Apr 2022 16:22:51 +0200 Subject: [PATCH 008/112] feat: initial python support --- .../20220402135305_python/migration.sql | 4 + prisma/schema.prisma | 3 + src/lib/buildPacks/common.ts | 10 ++- src/lib/buildPacks/index.ts | 4 +- src/lib/buildPacks/python.ts | 73 +++++++++++++++++++ src/lib/components/common.ts | 2 +- src/lib/components/templates.ts | 13 ++++ src/lib/database/applications.ts | 10 ++- src/lib/queues/builder.ts | 12 ++- src/routes/applications/[id]/index.json.ts | 22 +++++- src/routes/applications/[id]/index.svelte | 56 +++++++++++++- src/tailwind.css | 4 +- 12 files changed, 197 insertions(+), 16 deletions(-) create mode 100644 prisma/migrations/20220402135305_python/migration.sql create mode 100644 src/lib/buildPacks/python.ts diff --git a/prisma/migrations/20220402135305_python/migration.sql b/prisma/migrations/20220402135305_python/migration.sql new file mode 100644 index 000000000..0c253d539 --- /dev/null +++ b/prisma/migrations/20220402135305_python/migration.sql @@ -0,0 +1,4 @@ +-- AlterTable +ALTER TABLE "Application" ADD COLUMN "pythonModule" TEXT; +ALTER TABLE "Application" ADD COLUMN "pythonVariable" TEXT; +ALTER TABLE "Application" ADD COLUMN "pythonWSGI" TEXT; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index a849ae36f..b7fab7185 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -87,6 +87,9 @@ model Application { baseDirectory String? publishDirectory String? phpModules String? + pythonWSGI String? + pythonModule String? + pythonVariable String? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt settings ApplicationSettings? diff --git a/src/lib/buildPacks/common.ts b/src/lib/buildPacks/common.ts index 3f8b4b43e..441794217 100644 --- a/src/lib/buildPacks/common.ts +++ b/src/lib/buildPacks/common.ts @@ -100,10 +100,14 @@ export const setDefaultConfiguration = async (data) => { if (buildPack === 'static') port = 80; else if (buildPack === 'node') port = 3000; else if (buildPack === 'php') port = 80; + else if (buildPack === 'python') port = 8000; } - if (!installCommand) installCommand = template?.installCommand || 'yarn install'; - if (!startCommand) startCommand = template?.startCommand || 'yarn start'; - if (!buildCommand) buildCommand = template?.buildCommand || null; + if (template) { + if (!installCommand) installCommand = template?.installCommand || 'yarn install'; + if (!startCommand) startCommand = template?.startCommand || 'yarn start'; + if (!buildCommand) buildCommand = template?.buildCommand || null; + } + if (!publishDirectory) publishDirectory = template?.publishDirectory || null; if (baseDirectory) { if (!baseDirectory.startsWith('/')) baseDirectory = `/${baseDirectory}`; diff --git a/src/lib/buildPacks/index.ts b/src/lib/buildPacks/index.ts index 41a7655f9..babbe8f17 100644 --- a/src/lib/buildPacks/index.ts +++ b/src/lib/buildPacks/index.ts @@ -12,6 +12,7 @@ import php from './php'; import rust from './rust'; import astro from './static'; import eleventy from './static'; +import python from './python'; export { node, @@ -27,5 +28,6 @@ export { php, rust, astro, - eleventy + eleventy, + python }; diff --git a/src/lib/buildPacks/python.ts b/src/lib/buildPacks/python.ts new file mode 100644 index 000000000..1aad28fe6 --- /dev/null +++ b/src/lib/buildPacks/python.ts @@ -0,0 +1,73 @@ +import { buildImage } from '$lib/docker'; +import { promises as fs } from 'fs'; + +const createDockerfile = async (data, image): Promise => { + const { + workdir, + port, + baseDirectory, + secrets, + pullmergeRequestId, + pythonWSGI, + pythonModule, + pythonVariable + } = data; + const Dockerfile: Array = []; + Dockerfile.push(`FROM ${image}`); + Dockerfile.push('WORKDIR /app'); + Dockerfile.push(`LABEL coolify.image=true`); + if (secrets.length > 0) { + secrets.forEach((secret) => { + if (secret.isBuildSecret) { + if (pullmergeRequestId) { + if (secret.isPRMRSecret) { + Dockerfile.push(`ARG ${secret.name}=${secret.value}`); + } + } else { + if (!secret.isPRMRSecret) { + Dockerfile.push(`ARG ${secret.name}=${secret.value}`); + } + } + } + }); + } + if (pythonWSGI?.toLowerCase() === 'gunicorn') { + Dockerfile.push(`RUN pip install gunicorn`); + } else if (pythonWSGI?.toLowerCase() === 'uwsgi') { + Dockerfile.push(`RUN apk add --no-cache uwsgi-python3`); + // Dockerfile.push(`RUN pip install --no-cache-dir uwsgi`) + } + + try { + await fs.stat(`${workdir}${baseDirectory || ''}/requirements.txt`); + Dockerfile.push(`COPY .${baseDirectory || ''}/requirements.txt ./`); + Dockerfile.push(`RUN pip install --no-cache-dir -r .${baseDirectory || ''}/requirements.txt`); + } catch (e) { + // + } + Dockerfile.push(`COPY .${baseDirectory || ''} ./`); + Dockerfile.push(`EXPOSE ${port}`); + console.log({ pythonWSGI }); + if (pythonWSGI?.toLowerCase() === 'gunicorn') { + console.log({ pythonModule, pythonVariable }); + Dockerfile.push(`CMD gunicorn -w=4 -b=0.0.0.0:8000 ${pythonModule}:${pythonVariable}`); + } else if (pythonWSGI?.toLowerCase() === 'uwsgi') { + Dockerfile.push( + `CMD uwsgi --master -p 4 --http-socket 0.0.0.0:8000 --uid uwsgi --plugins python3 --protocol uwsgi --wsgi ${pythonModule}:${pythonVariable}` + ); + } else { + Dockerfile.push(`CMD python ${pythonModule}`); + } + + await fs.writeFile(`${workdir}/Dockerfile`, Dockerfile.join('\n')); +}; + +export default async function (data) { + try { + const image = 'python:3-alpine'; + await createDockerfile(data, image); + await buildImage(data); + } catch (error) { + throw error; + } +} diff --git a/src/lib/components/common.ts b/src/lib/components/common.ts index b9b3ac982..96ae8fb52 100644 --- a/src/lib/components/common.ts +++ b/src/lib/components/common.ts @@ -19,7 +19,7 @@ export const staticDeployments = [ 'astro', 'eleventy' ]; -export const notNodeDeployments = ['php', 'docker', 'rust']; +export const notNodeDeployments = ['php', 'docker', 'rust', 'python']; export function getDomain(domain) { return domain?.replace('https://', '').replace('http://', ''); diff --git a/src/lib/components/templates.ts b/src/lib/components/templates.ts index 5ad62f6fa..b82b12f51 100644 --- a/src/lib/components/templates.ts +++ b/src/lib/components/templates.ts @@ -146,6 +146,13 @@ export function findBuildPack(pack, packageManager = 'npm') { port: 80 }; } + if (pack === 'python') { + return { + ...metaData, + startCommand: null, + port: 8000 + }; + } return { name: 'node', fancyName: 'Node.js', @@ -249,6 +256,12 @@ export const buildPacks = [ fancyName: 'Rust', hoverColor: 'hover:bg-pink-700', color: 'bg-pink-700' + }, + { + name: 'python', + fancyName: 'Python', + hoverColor: 'hover:bg-green-700', + color: 'bg-green-700' } ]; export const scanningTemplates = { diff --git a/src/lib/database/applications.ts b/src/lib/database/applications.ts index ad03ed7c0..1d8140144 100644 --- a/src/lib/database/applications.ts +++ b/src/lib/database/applications.ts @@ -214,11 +214,15 @@ export async function configureApplication({ buildCommand, startCommand, baseDirectory, - publishDirectory + publishDirectory, + pythonWSGI, + pythonModule, + pythonVariable }) { return await prisma.application.update({ where: { id }, data: { + name, buildPack, fqdn, port, @@ -227,7 +231,9 @@ export async function configureApplication({ startCommand, baseDirectory, publishDirectory, - name + pythonWSGI, + pythonModule, + pythonVariable } }); } diff --git a/src/lib/queues/builder.ts b/src/lib/queues/builder.ts index 3898bcdb5..be46976c5 100644 --- a/src/lib/queues/builder.ts +++ b/src/lib/queues/builder.ts @@ -51,7 +51,10 @@ export default async function (job) { pullmergeRequestId = null, sourceBranch = null, settings, - persistentStorage + persistentStorage, + pythonWSGI, + pythonModule, + pythonVariable } = job.data; const { debug } = settings; @@ -127,7 +130,7 @@ export default async function (job) { } try { - db.prisma.build.update({ where: { id: buildId }, data: { commit } }); + await db.prisma.build.update({ where: { id: buildId }, data: { commit } }); } catch (err) { console.log(err); } @@ -200,7 +203,10 @@ export default async function (job) { startCommand, baseDirectory, secrets, - phpModules + phpModules, + pythonWSGI, + pythonModule, + pythonVariable }); else { saveBuildLog({ line: `Build pack ${buildPack} not found`, buildId, applicationId }); diff --git a/src/routes/applications/[id]/index.json.ts b/src/routes/applications/[id]/index.json.ts index 3b4405706..8a67242d2 100644 --- a/src/routes/applications/[id]/index.json.ts +++ b/src/routes/applications/[id]/index.json.ts @@ -5,6 +5,7 @@ import { checkContainer } from '$lib/haproxy'; import type { RequestHandler } from '@sveltejs/kit'; import jsonwebtoken from 'jsonwebtoken'; import { get as getRequest } from '$lib/api'; +import { setDefaultConfiguration } from '$lib/buildPacks/common'; export const get: RequestHandler = async (event) => { const { teamId, status, body } = await getUserDetails(event); @@ -52,12 +53,23 @@ export const post: RequestHandler = async (event) => { buildCommand, startCommand, baseDirectory, - publishDirectory + publishDirectory, + pythonWSGI, + pythonModule, + pythonVariable } = await event.request.json(); - if (port) port = Number(port); try { + const defaultConfiguration = await setDefaultConfiguration({ + buildPack, + port, + installCommand, + startCommand, + buildCommand, + publishDirectory, + baseDirectory + }); await db.configureApplication({ id, buildPack, @@ -68,7 +80,11 @@ export const post: RequestHandler = async (event) => { buildCommand, startCommand, baseDirectory, - publishDirectory + publishDirectory, + pythonWSGI, + pythonModule, + pythonVariable, + ...defaultConfiguration }); return { status: 201 }; } catch (error) { diff --git a/src/routes/applications/[id]/index.svelte b/src/routes/applications/[id]/index.svelte index 49f800975..bcdbfc876 100644 --- a/src/routes/applications/[id]/index.svelte +++ b/src/routes/applications/[id]/index.svelte @@ -38,6 +38,7 @@ import { page, session } from '$app/stores'; import { errorNotification } from '$lib/form'; import { onMount } from 'svelte'; + import Select from 'svelte-select'; import Explainer from '$lib/components/Explainer.svelte'; import Setting from '$lib/components/Setting.svelte'; @@ -57,6 +58,23 @@ let previews = application.settings.previews; let dualCerts = application.settings.dualCerts; let autodeploy = application.settings.autodeploy; + + let wsgis = [ + { + value: 'None', + label: 'None' + }, + { + value: 'Gunicorn', + label: 'Gunicorn' + } + // }, + // { + // value: 'uWSGI', + // label: 'uWSGI' + // } + ]; + if (browser && window.location.hostname === 'demo.coolify.io' && !application.fqdn) { application.fqdn = `http://${cuid()}.demo.coolify.io`; } @@ -119,6 +137,9 @@ loading = false; } } + async function selectWSGI(event) { + application.pythonWSGI = event.detail.value; + }
@@ -315,6 +336,39 @@ on:click={() => !isRunning && changeSettings('dualCerts')} />
+ {#if application.buildPack === 'python'} +
+ +
+ +
+
+ + +
+ {/if} {#if !staticDeployments.includes(application.buildPack)}
@@ -323,7 +377,7 @@ name="port" id="port" bind:value={application.port} - placeholder="default: 3000" + placeholder={application.buildPack === 'python' ? '8000' : '3000'} />
{/if} diff --git a/src/tailwind.css b/src/tailwind.css index 1f357acfb..20f67dd73 100644 --- a/src/tailwind.css +++ b/src/tailwind.css @@ -54,10 +54,10 @@ textarea { } #svelte .item.hover { - @apply bg-coolgray-100 text-white; + @apply bg-coollabs text-white !important; } #svelte .item.active { - @apply bg-coollabs text-white; + @apply bg-coolgray-100 text-white; } select { From 78293340cc87371fcc67bf5d8abdc0fbf023121d Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Sat, 2 Apr 2022 16:27:44 +0200 Subject: [PATCH 009/112] chore: version++ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 01258dbcb..bfb67698f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "coolify", "description": "An open-source & self-hostable Heroku / Netlify alternative.", - "version": "2.2.8", + "version": "2.3.0", "license": "AGPL-3.0", "scripts": { "dev": "docker-compose -f docker-compose-dev.yaml up -d && NODE_ENV=development svelte-kit dev", From 066f5b25e0e347403e3bc917a174a18d6fa4e82d Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Sat, 2 Apr 2022 17:05:32 +0200 Subject: [PATCH 010/112] fix: Python no wsgi --- src/routes/applications/[id]/index.svelte | 28 +++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/routes/applications/[id]/index.svelte b/src/routes/applications/[id]/index.svelte index bcdbfc876..8b94d4795 100644 --- a/src/routes/applications/[id]/index.svelte +++ b/src/routes/applications/[id]/index.svelte @@ -352,22 +352,22 @@ id="pythonModule" required bind:value={application.pythonModule} - placeholder={application.pythonWSGI?.toLowerCase() !== 'gunicorn' - ? 'myapp.py' - : 'myapp'} - /> -
-
- -
+ {#if application.pythonWSGI?.toLowerCase() === 'gunicorn'} +
+ + +
+ {/if} {/if} {#if !staticDeployments.includes(application.buildPack)}
From 7a74ba17965f9bca7f24925736861cb43deca5d9 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Sat, 2 Apr 2022 17:43:24 +0200 Subject: [PATCH 011/112] ui: Improvements --- src/lib/components/DatabaseLinks.svelte | 25 +++++ src/lib/components/ServiceLinks.svelte | 55 +++++++++++ src/routes/applications/[id]/__layout.svelte | 4 +- src/routes/applications/[id]/index.svelte | 14 ++- .../applications/[id]/logs/build/index.svelte | 71 +++++++++++++- .../applications/[id]/logs/index.svelte | 73 +++++++++++++- .../applications/[id]/previews/index.svelte | 97 ++++++++++++++++--- .../applications/[id]/secrets/index.svelte | 71 +++++++++++++- .../applications/[id]/storage/index.svelte | 75 +++++++++++++- src/routes/databases/[id]/index.svelte | 31 ++---- .../services/[id]/_Services/_Services.svelte | 4 +- src/routes/services/[id]/index.svelte | 66 ++----------- src/routes/services/[id]/secrets/index.svelte | 38 +++++++- src/routes/settings/index.svelte | 2 +- 14 files changed, 501 insertions(+), 125 deletions(-) create mode 100644 src/lib/components/DatabaseLinks.svelte create mode 100644 src/lib/components/ServiceLinks.svelte diff --git a/src/lib/components/DatabaseLinks.svelte b/src/lib/components/DatabaseLinks.svelte new file mode 100644 index 000000000..9ef11a238 --- /dev/null +++ b/src/lib/components/DatabaseLinks.svelte @@ -0,0 +1,25 @@ + + + + {#if database.type === 'clickhouse'} + + {:else if database.type === 'couchdb'} + + {:else if database.type === 'mongodb'} + + {:else if database.type === 'mysql'} + + {:else if database.type === 'postgresql'} + + {:else if database.type === 'redis'} + + {/if} + diff --git a/src/lib/components/ServiceLinks.svelte b/src/lib/components/ServiceLinks.svelte new file mode 100644 index 000000000..a3b4ce2cd --- /dev/null +++ b/src/lib/components/ServiceLinks.svelte @@ -0,0 +1,55 @@ + + +{#if service.type === 'plausibleanalytics'} + + + +{:else if service.type === 'nocodb'} + + + +{:else if service.type === 'minio'} + + + +{:else if service.type === 'vscodeserver'} + + + +{:else if service.type === 'wordpress'} + + + +{:else if service.type === 'vaultwarden'} + + + +{:else if service.type === 'languagetool'} + + + +{:else if service.type === 'n8n'} + + + +{:else if service.type === 'uptimekuma'} + + + +{:else if service.type === 'ghost'} + + + +{/if} diff --git a/src/routes/applications/[id]/__layout.svelte b/src/routes/applications/[id]/__layout.svelte index 4a79bba44..7c6f528b7 100644 --- a/src/routes/applications/[id]/__layout.svelte +++ b/src/routes/applications/[id]/__layout.svelte @@ -255,9 +255,9 @@ class:bg-coolgray-500={$page.url.pathname === `/applications/${id}/secrets`} > - -
- {/each} - - -{/if} - From 2b0df270dfd81129fc9d7f34e2149e94273e8a8c Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 7 Apr 2022 23:58:56 +0200 Subject: [PATCH 088/112] fix: small typo --- src/routes/services/[id]/_Services/_Services.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/services/[id]/_Services/_Services.svelte b/src/routes/services/[id]/_Services/_Services.svelte index 637944b65..41dd86ff6 100644 --- a/src/routes/services/[id]/_Services/_Services.svelte +++ b/src/routes/services/[id]/_Services/_Services.svelte @@ -93,7 +93,7 @@
- + Date: Fri, 8 Apr 2022 00:09:09 +0200 Subject: [PATCH 089/112] fix: Unique storage paths --- .../20220407220809_unique_storage_fix/migration.sql | 5 +++++ prisma/schema.prisma | 4 ++-- src/routes/iam/index.svelte | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 prisma/migrations/20220407220809_unique_storage_fix/migration.sql diff --git a/prisma/migrations/20220407220809_unique_storage_fix/migration.sql b/prisma/migrations/20220407220809_unique_storage_fix/migration.sql new file mode 100644 index 000000000..9b645cc3b --- /dev/null +++ b/prisma/migrations/20220407220809_unique_storage_fix/migration.sql @@ -0,0 +1,5 @@ +-- DropIndex +DROP INDEX "ApplicationPersistentStorage_path_key"; + +-- DropIndex +DROP INDEX "ApplicationPersistentStorage_applicationId_key"; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 7f37f9a2b..2c97a9e8b 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -117,8 +117,8 @@ model ApplicationSettings { model ApplicationPersistentStorage { id String @id @default(cuid()) application Application @relation(fields: [applicationId], references: [id]) - applicationId String @unique - path String @unique + applicationId String + path String createdAt DateTime @default(now()) updatedAt DateTime @updatedAt diff --git a/src/routes/iam/index.svelte b/src/routes/iam/index.svelte index 0541abbb8..f2554813e 100644 --- a/src/routes/iam/index.svelte +++ b/src/routes/iam/index.svelte @@ -77,7 +77,7 @@
-
Identity and Access Management System
+
Identity and Access Management
-
+
{#if $session.teamId === '0' && accounts.length > 0}
Accounts
{:else} diff --git a/src/routes/index.svelte b/src/routes/index.svelte index 1a5f61b4b..84cf7188f 100644 --- a/src/routes/index.svelte +++ b/src/routes/index.svelte @@ -92,7 +92,7 @@
diff --git a/src/routes/new/source/_Github.svelte b/src/routes/new/source/_Github.svelte deleted file mode 100644 index e8f2d33c4..000000000 --- a/src/routes/new/source/_Github.svelte +++ /dev/null @@ -1,96 +0,0 @@ - - -
-
-
-
-
Configuration
- -
-
- - - -
-
- - -
- -
- - -
-
- - -
-
-
- - -
- -
-
-
-
diff --git a/src/routes/new/source/_Gitlab.svelte b/src/routes/new/source/_Gitlab.svelte deleted file mode 100644 index 219bc56b0..000000000 --- a/src/routes/new/source/_Gitlab.svelte +++ /dev/null @@ -1,73 +0,0 @@ - - -
-
-
-
Configuration
- -
-
- - -
-
- - -
- -
- - -
-
- - -
-
-
diff --git a/src/routes/new/source/index.svelte b/src/routes/new/source/index.svelte deleted file mode 100644 index 73384561a..000000000 --- a/src/routes/new/source/index.svelte +++ /dev/null @@ -1,66 +0,0 @@ - - -
-
Add New Git Source
-
- -
-
Official providers
-
- - - -
-
-
- {#if gitSource.type === 'github'} - - {:else if gitSource.type === 'gitlab'} - - {:else if gitSource.type === 'bitbucket'} -
Not implemented yet
- {/if} -
diff --git a/src/routes/services/index.svelte b/src/routes/services/index.svelte index 06e74873b..389ee8036 100644 --- a/src/routes/services/index.svelte +++ b/src/routes/services/index.svelte @@ -13,6 +13,7 @@ import Ghost from '$lib/components/svg/services/Ghost.svelte'; import MeiliSearch from '$lib/components/svg/services/MeiliSearch.svelte'; import { session } from '$app/stores'; + import { getDomain } from '$lib/components/common'; export let services; async function newService() { @@ -87,9 +88,12 @@
{service.name}
- {#if $session.teamId === '0'} + {#if $session.teamId === '0' && otherServices.length > 0}
{service.teams[0].name}
{/if} + {#if service.fqdn} +
{getDomain(service.fqdn)}
+ {/if} {#if !service.type || !service.fqdn}
Configuration missing @@ -134,6 +138,9 @@ {#if $session.teamId === '0'}
{service.teams[0].name}
{/if} + {#if service.fqdn} +
{getDomain(service.fqdn)}
+ {/if} {#if !service.type || !service.fqdn}
Configuration missing diff --git a/src/routes/sources/[id]/_Github.svelte b/src/routes/sources/[id]/_Github.svelte index 102971353..b2866d195 100644 --- a/src/routes/sources/[id]/_Github.svelte +++ b/src/routes/sources/[id]/_Github.svelte @@ -3,13 +3,19 @@ import { page, session } from '$app/stores'; import { post } from '$lib/api'; import { errorNotification } from '$lib/form'; + import { toast } from '@zerodevx/svelte-toast'; const { id } = $page.params; let loading = false; async function handleSubmit() { loading = true; try { - return await post(`/sources/${id}.json`, { name: source.name }); + await post(`/sources/${id}.json`, { + name: source.name, + htmlUrl: source.htmlUrl, + apiUrl: source.apiUrl + }); + toast.push('Settings saved.'); } catch ({ error }) { return errorNotification(error); } finally { @@ -38,7 +44,18 @@ }, 100); } - function newGithubApp() { + async function newGithubApp() { + loading = true; + try { + await post(`/sources/${id}/github.json`, { + type: 'github', + name: source.name, + htmlUrl: source.htmlUrl, + apiUrl: source.apiUrl + }); + } catch ({ error }) { + return errorNotification(error); + } const left = screen.width / 2 - 1020 / 2; const top = screen.height / 2 - 618 / 2; const newWindow = open( @@ -59,31 +76,72 @@ } -{#if !source.githubAppId} - -{:else if source.githubApp?.installationId} -
-
-
General
- {#if $session.isAdmin} - - - {/if} -
-
-
- - +
+ {#if !source.githubAppId} + +
+
General
+
+
+
+ + +
+
+
+ + +
+
+ + +
+
+ {#if source.apiUrl && source.htmlUrl && source.name} +
+ +
+ {/if} + + {:else if source.githubAppId} +
+
+
General
+ {#if $session.isAdmin} + + + {/if} +
+
+
+
+ + +
+
+
+ + +
+
+ + +
+
+
+ {:else} +
+
- -{:else} - -{/if} + {/if} +
diff --git a/src/routes/sources/[id]/_Gitlab.svelte b/src/routes/sources/[id]/_Gitlab.svelte index 7823aebe9..bf3b48733 100644 --- a/src/routes/sources/[id]/_Gitlab.svelte +++ b/src/routes/sources/[id]/_Gitlab.svelte @@ -1,35 +1,73 @@ -{#if !source.gitlabApp?.appId} -
-
-
- - -
- {#if payload.applicationType === 'group'} -
- - -
- {/if} - -
- -
- - - -
-
-
Configuration
+
+ +
+
General
+ {#if $session.isAdmin} -
+ {#if source.gitlabAppId} + + {/if} + {/if} +
+
+ {#if !source.gitlabAppId} +
+ + +
-
-
- - + + +
+ {/if} + {/if} + +
+
+ + +
+
+ {#if source.gitlabApp.groupName} +
+ +
+ {/if} +
+ + +
+
+ + +
+
+
+ + {#if !source.gitlabAppId} + + {/if} +
- {#if payload.applicationType === 'group'} -
- - -
- {/if} +
- - + +
- - Secret +
- -
-{:else} -
-
-
-
General
- {#if $session.isAdmin} - - - {/if} -
-
-
- - -
-
-
-
-{/if} +
+ + {#if !source.gitlabAppId} + + {/if} +
diff --git a/src/routes/sources/[id]/github.json.ts b/src/routes/sources/[id]/github.json.ts new file mode 100644 index 000000000..e0f1d3b61 --- /dev/null +++ b/src/routes/sources/[id]/github.json.ts @@ -0,0 +1,18 @@ +import { getUserDetails } from '$lib/common'; +import * as db from '$lib/database'; +import { ErrorHandler } from '$lib/database'; +import type { RequestHandler } from '@sveltejs/kit'; + +export const post: RequestHandler = async (event) => { + const { teamId, status, body } = await getUserDetails(event); + if (status === 401) return { status, body }; + const { id } = event.params; + + try { + let { type, name, htmlUrl, apiUrl } = await event.request.json(); + await db.addGitHubSource({ id, teamId, type, name, htmlUrl, apiUrl }); + return { status: 201 }; + } catch (error) { + return ErrorHandler(error); + } +}; diff --git a/src/routes/sources/[id]/gitlab.json.ts b/src/routes/sources/[id]/gitlab.json.ts index 8420669e6..b1ed314bf 100644 --- a/src/routes/sources/[id]/gitlab.json.ts +++ b/src/routes/sources/[id]/gitlab.json.ts @@ -9,11 +9,23 @@ export const post: RequestHandler = async (event) => { const { id } = event.params; try { - let { oauthId, groupName, appId, appSecret } = await event.request.json(); + let { type, name, htmlUrl, apiUrl, oauthId, appId, appSecret, groupName } = + await event.request.json(); oauthId = Number(oauthId); - await db.addSource({ id, teamId, oauthId, groupName, appId, appSecret }); + await db.addGitLabSource({ + id, + teamId, + type, + name, + htmlUrl, + apiUrl, + oauthId, + appId, + appSecret, + groupName + }); return { status: 201 }; } catch (error) { return ErrorHandler(error); diff --git a/src/routes/sources/[id]/index.json.ts b/src/routes/sources/[id]/index.json.ts index 58fb7008b..cd19e6785 100644 --- a/src/routes/sources/[id]/index.json.ts +++ b/src/routes/sources/[id]/index.json.ts @@ -43,10 +43,10 @@ export const post: RequestHandler = async (event) => { const { id } = event.params; - const { name } = await event.request.json(); + const { name, htmlUrl, apiUrl } = await event.request.json(); try { - await db.updateGitsource({ id, name }); + await db.updateGitsource({ id, name, htmlUrl, apiUrl }); return { status: 201 }; } catch (error) { return ErrorHandler(error); diff --git a/src/routes/sources/[id]/index.svelte b/src/routes/sources/[id]/index.svelte index 83f171412..015c98a1f 100644 --- a/src/routes/sources/[id]/index.svelte +++ b/src/routes/sources/[id]/index.svelte @@ -29,9 +29,41 @@
@@ -40,10 +72,21 @@ {source.name}
-
- {#if source.type === 'github'} - - {:else if source.type === 'gitlab'} - +
+ {#if !source.gitlabAppId && !source.githubAppId} +
+
Select a provider
+
+ + +
+
{/if} +
+ {#if source.type === 'github'} + + {:else if source.type === 'gitlab'} + + {/if} +
diff --git a/src/routes/sources/[id]/newGithubApp.svelte b/src/routes/sources/[id]/newGithubApp.svelte index c8cb4f6f3..b6a74c3ba 100644 --- a/src/routes/sources/[id]/newGithubApp.svelte +++ b/src/routes/sources/[id]/newGithubApp.svelte @@ -36,6 +36,7 @@ export let settings; onMount(() => { const { organization, id, htmlUrl } = source; + console.log(source); const { fqdn } = settings; const host = dev ? 'http://localhost:3000' diff --git a/src/routes/sources/index.svelte b/src/routes/sources/index.svelte index c763e0b58..e07c21973 100644 --- a/src/routes/sources/index.svelte +++ b/src/routes/sources/index.svelte @@ -22,6 +22,9 @@
@@ -71,7 +78,7 @@ class:border-l-4={source.gitlabApp && !source.gitlabAppId} >
{source.name}
- {#if $session.teamId === '0'} + {#if $session.teamId === '0' && otherSources.length > 0}
{source.teams[0].name}
{/if} {#if (source.type === 'gitlab' && !source.gitlabAppId) || (source.type === 'github' && !source.githubAppId && !source.githubApp?.installationId)} @@ -79,7 +86,7 @@ Configuration missing
{:else} -
{source.htmlUrl}
+
{getDomain(source.htmlUrl)}
{/if}
diff --git a/src/routes/new/source/index.json.ts b/src/routes/sources/new.ts similarity index 64% rename from src/routes/new/source/index.json.ts rename to src/routes/sources/new.ts index 803b597e9..25943f8bc 100644 --- a/src/routes/new/source/index.json.ts +++ b/src/routes/sources/new.ts @@ -1,4 +1,4 @@ -import { getUserDetails } from '$lib/common'; +import { getUserDetails, uniqueName } from '$lib/common'; import * as db from '$lib/database'; import { ErrorHandler } from '$lib/database'; import type { RequestHandler } from '@sveltejs/kit'; @@ -7,9 +7,9 @@ export const post: RequestHandler = async (event) => { const { teamId, status, body } = await getUserDetails(event); if (status === 401) return { status, body }; - const { name, type, htmlUrl, apiUrl, organization } = await event.request.json(); + const name = uniqueName(); try { - const { id } = await db.newSource({ name, teamId, type, htmlUrl, apiUrl, organization }); + const { id } = await db.newSource({ teamId, name }); return { status: 201, body: { id } }; } catch (e) { return ErrorHandler(e); From a165b219500572416b7566a517a770864901d589 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 8 Apr 2022 10:47:01 +0200 Subject: [PATCH 093/112] ui: fix --- src/routes/sources/[id]/_Github.svelte | 2 +- src/routes/sources/[id]/_Gitlab.svelte | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/sources/[id]/_Github.svelte b/src/routes/sources/[id]/_Github.svelte index b2866d195..af776cfea 100644 --- a/src/routes/sources/[id]/_Github.svelte +++ b/src/routes/sources/[id]/_Github.svelte @@ -76,7 +76,7 @@ } -
+
{#if !source.githubAppId}
diff --git a/src/routes/sources/[id]/_Gitlab.svelte b/src/routes/sources/[id]/_Gitlab.svelte index bf3b48733..89e43cfe3 100644 --- a/src/routes/sources/[id]/_Gitlab.svelte +++ b/src/routes/sources/[id]/_Gitlab.svelte @@ -121,7 +121,7 @@ } -
+
General
From 1657e5a151cd28f2b805cbf56798b8b6749ed615 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 8 Apr 2022 10:54:40 +0200 Subject: [PATCH 094/112] fix: no line during buildLog --- src/lib/common.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/lib/common.ts b/src/lib/common.ts index 4eec73539..57cdabba2 100644 --- a/src/lib/common.ts +++ b/src/lib/common.ts @@ -52,12 +52,14 @@ export const sentry = Sentry; export const uniqueName = () => uniqueNamesGenerator(customConfig); export const saveBuildLog = async ({ line, buildId, applicationId }) => { - if (line.includes('ghs_')) { - const regex = /ghs_.*@/g; - line = line.replace(regex, '@'); + if (line) { + if (line.includes('ghs_')) { + const regex = /ghs_.*@/g; + line = line.replace(regex, '@'); + } + const addTimestamp = `${generateTimestamp()} ${line}`; + return await buildLogQueue.add(buildId, { buildId, line: addTimestamp, applicationId }); } - const addTimestamp = `${generateTimestamp()} ${line}`; - return await buildLogQueue.add(buildId, { buildId, line: addTimestamp, applicationId }); }; export const isTeamIdTokenAvailable = (request) => { From 0b709c93a8a2fa9892b720255a87717c2741e11c Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 8 Apr 2022 10:57:44 +0200 Subject: [PATCH 095/112] fix: html/apiUrls cannot end with / --- src/routes/sources/[id]/_Github.svelte | 8 ++++---- src/routes/sources/[id]/_Gitlab.svelte | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/routes/sources/[id]/_Github.svelte b/src/routes/sources/[id]/_Github.svelte index af776cfea..6b8aa0c89 100644 --- a/src/routes/sources/[id]/_Github.svelte +++ b/src/routes/sources/[id]/_Github.svelte @@ -12,8 +12,8 @@ try { await post(`/sources/${id}.json`, { name: source.name, - htmlUrl: source.htmlUrl, - apiUrl: source.apiUrl + htmlUrl: source.htmlUrl.replace(/\/$/, ''), + apiUrl: source.apiUrl.replace(/\/$/, '') }); toast.push('Settings saved.'); } catch ({ error }) { @@ -50,8 +50,8 @@ await post(`/sources/${id}/github.json`, { type: 'github', name: source.name, - htmlUrl: source.htmlUrl, - apiUrl: source.apiUrl + htmlUrl: source.htmlUrl.replace(/\/$/, ''), + apiUrl: source.apiUrl.replace(/\/$/, '') }); } catch ({ error }) { return errorNotification(error); diff --git a/src/routes/sources/[id]/_Gitlab.svelte b/src/routes/sources/[id]/_Gitlab.svelte index 89e43cfe3..b528b1850 100644 --- a/src/routes/sources/[id]/_Gitlab.svelte +++ b/src/routes/sources/[id]/_Gitlab.svelte @@ -38,8 +38,8 @@ await post(`/sources/${id}/gitlab.json`, { type: 'gitlab', name: source.name, - htmlUrl: source.htmlUrl, - apiUrl: source.apiUrl, + htmlUrl: source.htmlUrl.replace(/\/$/, ''), + apiUrl: source.apiUrl.replace(/\/$/, ''), oauthId: source.gitlabApp.oauthId, appId: source.gitlabApp.appId, appSecret: source.gitlabApp.appSecret, @@ -56,8 +56,8 @@ try { await post(`/sources/${id}.json`, { name: source.name, - htmlUrl: source.htmlUrl, - apiUrl: source.apiUrl + htmlUrl: source.htmlUrl.replace(/\/$/, ''), + apiUrl: source.apiUrl.replace(/\/$/, '') }); } catch ({ error }) { return errorNotification(error); From d9ba1a0b5c6fb42087cbd830263cdbfe770f1130 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 8 Apr 2022 11:16:07 +0200 Subject: [PATCH 096/112] fix: typo --- src/routes/sources/index.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/sources/index.svelte b/src/routes/sources/index.svelte index e07c21973..f8891531d 100644 --- a/src/routes/sources/index.svelte +++ b/src/routes/sources/index.svelte @@ -94,7 +94,7 @@
{#if otherSources.length > 0 && $session.teamId === '0'} -
Other Srouces
+
Other Sources
{#each otherSources as source} From ce71dccbc1285cbe1956675706530de437b1da2e Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 8 Apr 2022 11:19:01 +0200 Subject: [PATCH 097/112] fix: Missing buildpack --- src/routes/applications/index.svelte | 112 ++++++++++++++------------- 1 file changed, 58 insertions(+), 54 deletions(-) diff --git a/src/routes/applications/index.svelte b/src/routes/applications/index.svelte index 0c69c47fe..5fb4979cc 100644 --- a/src/routes/applications/index.svelte +++ b/src/routes/applications/index.svelte @@ -68,60 +68,7 @@ {#each ownApplications as application}
- {#if application.buildPack.toLowerCase() === 'rust'} - - {:else if application.buildPack.toLowerCase() === 'node'} - - {:else if application.buildPack.toLowerCase() === 'react'} - - {:else if application.buildPack.toLowerCase() === 'svelte'} - - {:else if application.buildPack.toLowerCase() === 'vuejs'} - - {:else if application.buildPack.toLowerCase() === 'php'} - - {:else if application.buildPack.toLowerCase() === 'python'} - - {:else if application.buildPack.toLowerCase() === 'static'} - - {:else if application.buildPack.toLowerCase() === 'nestjs'} - - {:else if application.buildPack.toLowerCase() === 'nuxtjs'} - - {:else if application.buildPack.toLowerCase() === 'nextjs'} - - {:else if application.buildPack.toLowerCase() === 'gatsby'} - - {:else if application.buildPack.toLowerCase() === 'docker'} - - {:else if application.buildPack.toLowerCase() === 'astro'} - - {:else if application.buildPack.toLowerCase() === 'eleventy'} - - {/if} - -
{application.name}
- {#if $session.teamId === '0' && otherApplications.length > 0} -
Team {application.teams[0].name}
- {/if} - {#if application.fqdn} -
{getDomain(application.fqdn)}
- {/if} - {#if !application.gitSourceId || !application.destinationDockerId || !application.fqdn} -
- Configuration missing -
- {/if} -
-
- {/each} -
- {#if otherApplications.length > 0 && $session.teamId === '0'} -
Other Applications
- + {#if otherApplications.length > 0 && $session.teamId === '0'} +
Other Applications
+
+ {#each otherApplications as application} + +
+ {#if application.buildPack} + {#if application.buildPack.toLowerCase() === 'rust'} + + {:else if application.buildPack.toLowerCase() === 'node'} + + {:else if application.buildPack.toLowerCase() === 'react'} + + {:else if application.buildPack.toLowerCase() === 'svelte'} + + {:else if application.buildPack.toLowerCase() === 'vuejs'} + + {:else if application.buildPack.toLowerCase() === 'php'} + + {:else if application.buildPack.toLowerCase() === 'python'} + + {:else if application.buildPack.toLowerCase() === 'static'} + + {:else if application.buildPack.toLowerCase() === 'nestjs'} + + {:else if application.buildPack.toLowerCase() === 'nuxtjs'} + + {:else if application.buildPack.toLowerCase() === 'nextjs'} + + {:else if application.buildPack.toLowerCase() === 'gatsby'} + + {:else if application.buildPack.toLowerCase() === 'docker'} + + {:else if application.buildPack.toLowerCase() === 'astro'} + + {:else if application.buildPack.toLowerCase() === 'eleventy'} + + {/if} + {/if}
{application.name}
{#if $session.teamId === '0'} From 13acf09dcc119e42594829428e3f5c8d03ef9081 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 8 Apr 2022 14:03:21 +0200 Subject: [PATCH 098/112] ui: fixes --- src/routes/applications/[id]/configuration/source.svelte | 8 ++++++-- src/routes/applications/index.svelte | 6 +++--- src/routes/databases/index.svelte | 2 +- src/routes/destinations/index.svelte | 2 +- src/routes/services/index.svelte | 6 +++--- src/routes/sources/index.svelte | 4 ++-- 6 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/routes/applications/[id]/configuration/source.svelte b/src/routes/applications/[id]/configuration/source.svelte index 953c23d69..1be6330d1 100644 --- a/src/routes/applications/[id]/configuration/source.svelte +++ b/src/routes/applications/[id]/configuration/source.svelte @@ -54,6 +54,10 @@ return errorNotification(error); } } + async function newSource() { + const { id } = await post('/sources/new', {}); + return await goto(`/sources/${id}`, { replaceState: true }); + }
@@ -64,7 +68,7 @@ {:else} diff --git a/src/routes/applications/index.svelte b/src/routes/applications/index.svelte index 5fb4979cc..3221f6634 100644 --- a/src/routes/applications/index.svelte +++ b/src/routes/applications/index.svelte @@ -58,7 +58,7 @@ {/if}
- {#if !applications || applications.length === 0} + {#if !applications || ownApplications.length === 0}
No applications found
@@ -107,7 +107,7 @@
Team {application.teams[0].name}
{/if} {#if application.fqdn} -
{getDomain(application.fqdn)}
+
{getDomain(application.fqdn) || ''}
{/if} {#if !application.gitSourceId || !application.destinationDockerId || !application.fqdn}
@@ -163,7 +163,7 @@
Team {application.teams[0].name}
{/if} {#if application.fqdn} -
{getDomain(application.fqdn)}
+
{getDomain(application.fqdn) || ''}
{/if} {#if !application.gitSourceId || !application.destinationDockerId || !application.fqdn}
diff --git a/src/routes/databases/index.svelte b/src/routes/databases/index.svelte index c160bc009..4ace17e27 100644 --- a/src/routes/databases/index.svelte +++ b/src/routes/databases/index.svelte @@ -46,7 +46,7 @@
- {#if !databases || databases.length === 0} + {#if !databases || ownDatabases.length === 0}
No databases found
diff --git a/src/routes/destinations/index.svelte b/src/routes/destinations/index.svelte index 84d1fc0bb..7c04f8aab 100644 --- a/src/routes/destinations/index.svelte +++ b/src/routes/destinations/index.svelte @@ -57,7 +57,7 @@ {/if}
- {#if !destinations || destinations.length === 0} + {#if !destinations || ownDestinations.length === 0}
No destination found
diff --git a/src/routes/services/index.svelte b/src/routes/services/index.svelte index 389ee8036..e829256c4 100644 --- a/src/routes/services/index.svelte +++ b/src/routes/services/index.svelte @@ -52,7 +52,7 @@
- {#if !services || services.length === 0} + {#if !services || ownServices.length === 0}
No services found
@@ -92,7 +92,7 @@
{service.teams[0].name}
{/if} {#if service.fqdn} -
{getDomain(service.fqdn)}
+
{getDomain(service.fqdn) || ''}
{/if} {#if !service.type || !service.fqdn}
@@ -139,7 +139,7 @@
{service.teams[0].name}
{/if} {#if service.fqdn} -
{getDomain(service.fqdn)}
+
{getDomain(service.fqdn) || ''}
{/if} {#if !service.type || !service.fqdn}
diff --git a/src/routes/sources/index.svelte b/src/routes/sources/index.svelte index f8891531d..ba4e6e9c5 100644 --- a/src/routes/sources/index.svelte +++ b/src/routes/sources/index.svelte @@ -62,7 +62,7 @@ {/if}
- {#if !sources || sources.length === 0} + {#if !sources || ownSources.length === 0}
No git sources found
@@ -86,7 +86,7 @@ Configuration missing
{:else} -
{getDomain(source.htmlUrl)}
+
{getDomain(source.htmlUrl) || ''}
{/if}
From 66af12f9b5be595841f19b2263744728eb9c5455 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 8 Apr 2022 14:12:06 +0200 Subject: [PATCH 099/112] ui: fixes --- src/routes/applications/index.svelte | 9 +++++---- src/routes/databases/index.svelte | 29 ++++++++++++++-------------- src/routes/destinations/index.svelte | 25 ++++++++++++------------ src/routes/services/index.svelte | 29 ++++++++++++++-------------- src/routes/sources/index.svelte | 29 ++++++++++++++-------------- 5 files changed, 63 insertions(+), 58 deletions(-) diff --git a/src/routes/applications/index.svelte b/src/routes/applications/index.svelte index 3221f6634..99bb67175 100644 --- a/src/routes/applications/index.svelte +++ b/src/routes/applications/index.svelte @@ -62,9 +62,10 @@
No applications found
- {:else} + {/if} + {#if ownApplications.length > 0 || otherApplications.length > 0}
-
+
{#each ownApplications as application}
@@ -119,8 +120,8 @@ {/each}
{#if otherApplications.length > 0 && $session.teamId === '0'} -
Other Applications
-
+
Other Applications
+
{#each otherApplications as application}
diff --git a/src/routes/databases/index.svelte b/src/routes/databases/index.svelte index 4ace17e27..29ef54965 100644 --- a/src/routes/databases/index.svelte +++ b/src/routes/databases/index.svelte @@ -50,12 +50,13 @@
No databases found
- {:else} + {/if} + {#if ownDatabases.length > 0 || otherDatabases.length > 0}
-
+
{#each ownDatabases as database} - -
+ +
{#if database.type === 'clickhouse'} {:else if database.type === 'couchdb'} @@ -69,14 +70,14 @@ {:else if database.type === 'redis'} {/if} -
+
{database.name}
{#if $session.teamId === '0' && otherDatabases.length > 0} -
{database.teams[0].name}
+
{database.teams[0].name}
{/if} {#if !database.type} -
+
Configuration missing
{/if} @@ -85,11 +86,11 @@ {/each}
{#if otherDatabases.length > 0 && $session.teamId === '0'} -
Other Databases
-
+
Other Databases
+
{#each otherDatabases as database} - -
+ +
{#if database.type === 'clickhouse'} {:else if database.type === 'couchdb'} @@ -103,14 +104,14 @@ {:else if database.type === 'redis'} {/if} -
+
{database.name}
{#if $session.teamId === '0'} -
{database.teams[0].name}
+
{database.teams[0].name}
{/if} {#if !database.type} -
+
Configuration missing
{:else} diff --git a/src/routes/destinations/index.svelte b/src/routes/destinations/index.svelte index 7c04f8aab..6921e4db4 100644 --- a/src/routes/destinations/index.svelte +++ b/src/routes/destinations/index.svelte @@ -61,33 +61,34 @@
No destination found
- {:else} + {/if} + {#if ownDestinations.length > 0 || otherDestinations.length > 0}
-
+ {#if otherDestinations.length > 0 && $session.teamId === '0'} -
Other Destinations
-
+
Other Destinations
+
{#each otherDestinations as destination} - +
-
{destination.name}
+
{destination.name}
{#if $session.teamId === '0'} -
{destination.teams[0].name}
+
{destination.teams[0].name}
{/if} -
{destination.network}
+
{destination.network}
{/each} diff --git a/src/routes/services/index.svelte b/src/routes/services/index.svelte index e829256c4..f8022f14f 100644 --- a/src/routes/services/index.svelte +++ b/src/routes/services/index.svelte @@ -56,12 +56,13 @@
No services found
- {:else} + {/if} + {#if ownServices.length > 0 || otherServices.length > 0}
-
+
{#each ownServices as service} - -
+ +
{#if service.type === 'plausibleanalytics'} {:else if service.type === 'nocodb'} @@ -85,17 +86,17 @@ {:else if service.type === 'meilisearch'} {/if} -
+
{service.name}
{#if $session.teamId === '0' && otherServices.length > 0} -
{service.teams[0].name}
+
{service.teams[0].name}
{/if} {#if service.fqdn}
{getDomain(service.fqdn) || ''}
{/if} {#if !service.type || !service.fqdn} -
+
Configuration missing
{/if} @@ -104,11 +105,11 @@ {/each}
{#if otherServices.length > 0 && $session.teamId === '0'} -
Other Services
-
+
Other Services
+
{#each otherServices as service} - -
+ +
{#if service.type === 'plausibleanalytics'} {:else if service.type === 'nocodb'} @@ -132,17 +133,17 @@ {:else if service.type === 'meilisearch'} {/if} -
+
{service.name}
{#if $session.teamId === '0'} -
{service.teams[0].name}
+
{service.teams[0].name}
{/if} {#if service.fqdn}
{getDomain(service.fqdn) || ''}
{/if} {#if !service.type || !service.fqdn} -
+
Configuration missing
{:else} diff --git a/src/routes/sources/index.svelte b/src/routes/sources/index.svelte index ba4e6e9c5..9bde85feb 100644 --- a/src/routes/sources/index.svelte +++ b/src/routes/sources/index.svelte @@ -66,23 +66,24 @@
No git sources found
- {:else} + {/if} + {#if ownSources.length > 0 || otherSources.length > 0}
-
+
{#each ownSources as source} - +
-
{source.name}
+
{source.name}
{#if $session.teamId === '0' && otherSources.length > 0} -
{source.teams[0].name}
+
{source.teams[0].name}
{/if} {#if (source.type === 'gitlab' && !source.gitlabAppId) || (source.type === 'github' && !source.githubAppId && !source.githubApp?.installationId)} -
+
Configuration missing
{:else} @@ -94,22 +95,22 @@
{#if otherSources.length > 0 && $session.teamId === '0'} -
Other Sources
-
+
Other Sources
+
{#each otherSources as source} - +
-
{source.name}
+
{source.name}
{#if $session.teamId === '0'} -
{source.teams[0].name}
+
{source.teams[0].name}
{/if} {#if (source.type === 'gitlab' && !source.gitlabAppId) || (source.type === 'github' && !source.githubAppId && !source.githubApp?.installationId)} -
+
Configuration missing
{:else} From 3449e0f8fc02ced1ce13f8b911f04d4a92bc2b1d Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 8 Apr 2022 14:16:14 +0200 Subject: [PATCH 100/112] ui: fix --- src/routes/sources/index.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/sources/index.svelte b/src/routes/sources/index.svelte index 9bde85feb..fe4063f3f 100644 --- a/src/routes/sources/index.svelte +++ b/src/routes/sources/index.svelte @@ -61,7 +61,7 @@ {/if}
-
+
{#if !sources || ownSources.length === 0}
No git sources found
From e3f78a1cf9d052ff37d870b30d4b5149d255a8c9 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 8 Apr 2022 15:02:48 +0200 Subject: [PATCH 101/112] ui: fixes --- src/routes/applications/index.svelte | 2 +- src/routes/databases/index.svelte | 2 +- src/routes/services/index.svelte | 2 +- src/routes/sources/index.svelte | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/routes/applications/index.svelte b/src/routes/applications/index.svelte index 99bb67175..3cfcbf141 100644 --- a/src/routes/applications/index.svelte +++ b/src/routes/applications/index.svelte @@ -57,7 +57,7 @@
{/if}
-
+
{#if !applications || ownApplications.length === 0}
No applications found
diff --git a/src/routes/databases/index.svelte b/src/routes/databases/index.svelte index 29ef54965..a47dbc66f 100644 --- a/src/routes/databases/index.svelte +++ b/src/routes/databases/index.svelte @@ -45,7 +45,7 @@
-
+
{#if !databases || ownDatabases.length === 0}
No databases found
diff --git a/src/routes/services/index.svelte b/src/routes/services/index.svelte index f8022f14f..998779a1f 100644 --- a/src/routes/services/index.svelte +++ b/src/routes/services/index.svelte @@ -51,7 +51,7 @@
-
+
{#if !services || ownServices.length === 0}
No services found
diff --git a/src/routes/sources/index.svelte b/src/routes/sources/index.svelte index fe4063f3f..1e2d4d510 100644 --- a/src/routes/sources/index.svelte +++ b/src/routes/sources/index.svelte @@ -61,7 +61,7 @@ {/if}
-
+
{#if !sources || ownSources.length === 0}
No git sources found
From e8516bc83193a4b4fd439aa32e76cacc4c06c824 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 8 Apr 2022 15:12:10 +0200 Subject: [PATCH 102/112] ui: fixes --- .../[id]/configuration/destination.svelte | 35 ++++++++++++-- .../[id]/configuration/source.svelte | 46 +++++++++++++++++-- 2 files changed, 72 insertions(+), 9 deletions(-) diff --git a/src/routes/applications/[id]/configuration/destination.svelte b/src/routes/applications/[id]/configuration/destination.svelte index 2c796b5ed..1b0c6df5c 100644 --- a/src/routes/applications/[id]/configuration/destination.svelte +++ b/src/routes/applications/[id]/configuration/destination.svelte @@ -29,7 +29,7 @@