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
UI fixes
Andras Bacsai82bfdb87e3c1
diff --git a/src/app.d.ts b/src/app.d.tsindex 40f5035982..d69042fe83 100644--- a/src/app.d.ts+++ b/src/app.d.ts@@ -10,6 +10,7 @@ declare namespace App {interface Stuff {application: any;isRunning: boolean;+ appId: string;}}diff --git a/src/lib/queues/builder.ts b/src/lib/queues/builder.tsindex 1cb3d2a6ac..3898bcdb57 100644--- a/src/lib/queues/builder.ts+++ b/src/lib/queues/builder.ts@@ -55,8 +55,7 @@ export default async function (job) {} = job.data;const { debug } = settings;- await asyncSleep(1000);-+ await asyncSleep(500);await db.prisma.build.updateMany({where: {status: 'queued',diff --git a/src/routes/applications/[id]/__layout.svelte b/src/routes/applications/[id]/__layout.svelteindex c41f332829..4a79bba444 100644--- a/src/routes/applications/[id]/__layout.svelte+++ b/src/routes/applications/[id]/__layout.svelte@@ -88,7 +88,14 @@try {const { buildId } = await post(`/applications/${id}/deploy.json`, { ...application });toast.push('Deployment queued.');- return await goto(`/applications/${id}/logs/build?buildId=${buildId}`);+ console.log($page.url);+ if ($page.url.pathname.startsWith(`/applications/${id}/logs/build`)) {+ return window.location.assign(`/applications/${id}/logs/build?buildId=${buildId}`);+ } else {+ return await goto(`/applications/${id}/logs/build?buildId=${buildId}`, {+ replaceState: true+ });+ }} catch ({ error }) {return errorNotification(error);}diff --git a/src/routes/applications/[id]/configuration/_GithubRepositories.svelte b/src/routes/applications/[id]/configuration/_GithubRepositories.svelteindex f69db04762..4afbea65cc 100644--- a/src/routes/applications/[id]/configuration/_GithubRepositories.svelte+++ b/src/routes/applications/[id]/configuration/_GithubRepositories.svelte@@ -151,8 +151,8 @@<a href={`/sources/${application.gitSource.id}`}><button>Configure it now</button></a></div>{:else}- <form on:submit|preventDefault={handleSubmit}>- <div>+ <form on:submit|preventDefault={handleSubmit} class="flex flex-col justify-center text-center">+ <div class="flex-col space-y-3 md:space-y-0 space-x-1">{#if loading.repositories}<select name="repository" disabled class="w-96"><option selected value="">Loading repositories...</option>diff --git a/src/routes/applications/[id]/configuration/source.svelte b/src/routes/applications/[id]/configuration/source.svelteindex ec078ce75b..b1df17aa3f 100644--- a/src/routes/applications/[id]/configuration/source.svelte+++ b/src/routes/applications/[id]/configuration/source.svelte@@ -41,7 +41,7 @@gitlabApp: Prisma.GitlabApp;githubApp: Prisma.GithubApp;};- sources = sources.filter(+ const filteredSources = sources.filter((source) =>(source.type === 'github' && source.githubAppId && source.githubApp.installationId) ||(source.type === 'gitlab' && source.gitlabAppId)@@ -59,8 +59,8 @@<div class="flex space-x-1 p-6 font-bold"><div class="mr-4 text-2xl tracking-tight">Select a Git Source</div></div>-<div class="flex justify-center">- {#if !sources || sources.length === 0}+<div class="flex flex-col justify-center">+ {#if !filteredSources || filteredSources.length === 0}<div class="flex-col"><div class="pb-2">No configurable Git Source found</div><div class="flex justify-center">@@ -83,7 +83,7 @@</div>{:else}<div class="flex flex-wrap justify-center">- {#each sources as source}+ {#each filteredSources as source}<div class="p-2"><form on:submit|preventDefault={() => handleSubmit(source.id)}><buttondiff --git a/src/routes/applications/[id]/index.svelte b/src/routes/applications/[id]/index.svelteindex 49f8009755..a5d846e894 100644--- a/src/routes/applications/[id]/index.svelte+++ b/src/routes/applications/[id]/index.svelte@@ -109,7 +109,7 @@try {await post(`/applications/${id}/check.json`, { fqdn: application.fqdn, forceSave });await post(`/applications/${id}.json`, { ...application });- return window.location.reload();+ return toast.push('Configurations saved.');} catch ({ error }) {if (error.startsWith('DNS not set')) {forceSave = true;diff --git a/src/routes/applications/[id]/logs/build/_BuildLog.svelte b/src/routes/applications/[id]/logs/build/_BuildLog.svelteindex 1ac0ab83af..4379d2d278 100644--- a/src/routes/applications/[id]/logs/build/_BuildLog.svelte+++ b/src/routes/applications/[id]/logs/build/_BuildLog.svelte@@ -84,7 +84,7 @@<LoadingLogs />{/if}{#if currentStatus === 'queued'}- <div class="text-center">Queued and waiting for execution.</div>+ <div class="text-center font-bold text-xl">Queued and waiting for execution.</div>{:else}<div class="flex justify-end sticky top-0 p-2"><buttondiff --git a/src/routes/applications/[id]/logs/build/index.svelte b/src/routes/applications/[id]/logs/build/index.svelteindex eba0e1e546..e4c5c4ec94 100644--- a/src/routes/applications/[id]/logs/build/index.svelte+++ b/src/routes/applications/[id]/logs/build/index.svelte@@ -54,7 +54,6 @@return build;});- return window.location.reload();} catch ({ error }) {return errorNotification(error);}diff --git a/src/routes/applications/index.svelte b/src/routes/applications/index.svelteindex d236264462..5f6056ac5b 100644--- a/src/routes/applications/index.svelte+++ b/src/routes/applications/index.svelte@@ -1,34 +1,19 @@-<script context="module" lang="ts">- import type { Load } from '@sveltejs/kit';- export const load: Load = async ({ fetch }) => {- const endpoint = '/applications.json';- const res = await fetch(endpoint);-- if (res.ok) {- return {- props: {- ...(await res.json())- }- };- }-- return {- status: res.status,- error: new Error(`Could not load ${endpoint}`)- };- };-</script>-<script lang="ts">export let applications: Array<Application>;import { session } from '$app/stores';import Application from './_Application.svelte';+ import { post } from '$lib/api';+ import { goto } from '$app/navigation';+ async function newApplication() {+ const { id } = await post('/applications/new', {});+ return await goto(`/applications/${id}`, { replaceState: true });+ }</script><div class="flex space-x-1 p-6 font-bold"><div class="mr-4 text-2xl ">Applications</div>{#if $session.isAdmin}- <a href="/new/application" class="add-icon bg-green-600 hover:bg-green-500">+ <div on:click={newApplication} class="add-icon cursor-pointer bg-green-600 hover:bg-green-500"><svgclass="w-6"xmlns="http://www.w3.org/2000/svg"@@ -42,7 +27,7 @@d="M12 6v6m0 0v6m0-6h6m-6 0H6"/></svg>- </a>+ </div>{/if}</div><div class="flex flex-wrap justify-center">diff --git a/src/routes/applications/index.json.ts b/src/routes/applications/index.tssimilarity index 100%rename from src/routes/applications/index.json.tsrename to src/routes/applications/index.tsdiff --git a/src/routes/new/application/index.json.ts b/src/routes/applications/new.tssimilarity index 81%rename from src/routes/new/application/index.json.tsrename to src/routes/applications/new.tsindex b8d25fc637..62d55edf64 100644--- a/src/routes/new/application/index.json.ts+++ b/src/routes/applications/new.ts@@ -6,10 +6,7 @@ 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 { name } = await event.request.json();- if (!name) return { status: 400, body: { error: 'Missing name.' } };-+ const name = uniqueName();try {const { id } = await db.newApplication({ name, teamId });return { status: 201, body: { id } };diff --git a/src/routes/dashboard.json.ts b/src/routes/dashboard.json.tsindex 226a76a378..4c3ed3097f 100644--- a/src/routes/dashboard.json.ts+++ b/src/routes/dashboard.json.ts@@ -8,12 +8,22 @@ export const get: RequestHandler = async (event) => {if (status === 401) return { status, body };try {- const applicationsCount = await (await db.listApplications(teamId)).length;- const sourcesCount = await (await db.listSources(teamId)).length;- const destinationsCount = await (await db.listDestinations(teamId)).length;- const teamsCount = await (await db.getMyTeams({ userId })).length;- const databasesCount = await (await db.listDatabases(teamId)).length;- const servicesCount = await (await db.listServices(teamId)).length;+ const applicationsCount = await db.prisma.application.count({+ where: { teams: { some: { id: teamId } } }+ });+ const sourcesCount = await db.prisma.gitSource.count({+ where: { teams: { some: { id: teamId } } }+ });+ const destinationsCount = await db.prisma.destinationDocker.count({+ where: { teams: { some: { id: teamId } } }+ });+ const teamsCount = await db.prisma.permission.count({ where: { userId } });+ const databasesCount = await db.prisma.database.count({+ where: { teams: { some: { id: teamId } } }+ });+ const servicesCount = await db.prisma.service.count({+ where: { teams: { some: { id: teamId } } }+ });return {body: {applicationsCount,diff --git a/src/routes/databases/index.svelte b/src/routes/databases/index.svelteindex f476b3c66c..f6834cd0b7 100644--- a/src/routes/databases/index.svelte+++ b/src/routes/databases/index.svelte@@ -1,24 +1,3 @@-<script context="module" lang="ts">- import type { Load } from '@sveltejs/kit';- export const load: Load = async ({ fetch }) => {- const url = `/databases.json`;- const res = await fetch(url);-- if (res.ok) {- return {- props: {- ...(await res.json())- }- };- }-- return {- status: res.status,- error: new Error(`Could not load ${url}`)- };- };-</script>-<script lang="ts">export let databases;import Clickhouse from '$lib/components/svg/databases/Clickhouse.svelte';@@ -27,11 +6,18 @@import MySQL from '$lib/components/svg/databases/MySQL.svelte';import PostgreSQL from '$lib/components/svg/databases/PostgreSQL.svelte';import Redis from '$lib/components/svg/databases/Redis.svelte';+ import { post } from '$lib/api';+ import { goto } from '$app/navigation';++ async function newDatabase() {+ const { id } = await post('/databases/new', {});+ return await goto(`/databases/${id}`, { replaceState: true });+ }</script><div class="flex space-x-1 p-6 font-bold"><div class="mr-4 text-2xl tracking-tight">Databases</div>- <a href="/new/database" class="add-icon bg-purple-600 hover:bg-purple-500">+ <div on:click={newDatabase} class="add-icon cursor-pointer bg-purple-600 hover:bg-purple-500"><svgclass="w-6"xmlns="http://www.w3.org/2000/svg"@@ -45,7 +31,7 @@d="M12 6v6m0 0v6m0-6h6m-6 0H6"/></svg>- </a>+ </div></div><div class="flex flex-wrap justify-center">diff --git a/src/routes/databases/index.json.ts b/src/routes/databases/index.tssimilarity index 99%rename from src/routes/databases/index.json.tsrename to src/routes/databases/index.tsindex 17ff3c7792..29cdad39ca 100644--- a/src/routes/databases/index.json.ts+++ b/src/routes/databases/index.ts@@ -6,6 +6,7 @@ import type { RequestHandler } from '@sveltejs/kit';export const get: RequestHandler = async (event) => {const { teamId, status, body } = await getUserDetails(event);if (status === 401) return { status, body };+try {const databases = await db.listDatabases(teamId);return {diff --git a/src/routes/new/database/index.json.ts b/src/routes/databases/new.tssimilarity index 83%rename from src/routes/new/database/index.json.tsrename to src/routes/databases/new.tsindex a774aff84b..86bf028bf5 100644--- a/src/routes/new/database/index.json.ts+++ b/src/routes/databases/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';@@ -6,9 +6,7 @@ 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 { name } = await event.request.json();-+ const name = uniqueName();try {const { id } = await db.newDatabase({ name, teamId });return { status: 201, body: { id } };diff --git a/src/routes/new/application/import.json.ts b/src/routes/new/application/import.json.tsdeleted file mode 100644index 495bc3dcfc..0000000000--- a/src/routes/new/application/import.json.ts+++ /dev/null@@ -1,29 +0,0 @@-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 };-- let { name, fqdn, port, buildCommand, startCommand, installCommand } = await event.request.json();-- if (fqdn) fqdn = fqdn.toLowerCase();- if (port) port = Number(port);-- try {- const { id } = await db.importApplication({- name,- teamId,- fqdn,- port,- buildCommand,- startCommand,- installCommand- });- return { status: 201, body: { id } };- } catch (error) {- return ErrorHandler(error);- }-};diff --git a/src/routes/new/application/index.svelte b/src/routes/new/application/index.sveltedeleted file mode 100644index 0f267fd858..0000000000--- a/src/routes/new/application/index.svelte+++ /dev/null@@ -1,53 +0,0 @@-<script context="module" lang="ts">- import type { Load } from '@sveltejs/kit';- export const load: Load = async ({ fetch }) => {- const url = `/common/getUniqueName.json`;- const res = await fetch(url);-- if (res.ok) {- return {- props: {- ...(await res.json())- }- };- }-- return {- status: res.status,- error: new Error(`Could not load ${url}`)- };- };-</script>--<script lang="ts">- export let name;- import { onMount } from 'svelte';- import { goto } from '$app/navigation';- import { post } from '$lib/api';- import { errorNotification } from '$lib/form';-- let nameEl: HTMLInputElement;- onMount(() => {- nameEl.focus();- });- async function handleSubmit() {- try {- const { id } = await post('/new/application.json', { name });- return await goto(`/applications/${id}`);- } catch ({ error }) {- return errorNotification(error);- }- }-</script>--<div class="flex space-x-1 p-6 font-bold">- <div class="mr-4 text-2xl tracking-tight">Add New Application</div>-</div>-<div class="pt-10">- <form on:submit|preventDefault={handleSubmit}>- <div class="flex flex-col items-center space-y-4">- <input name="name" placeholder="Application name" bind:this={nameEl} bind:value={name} />- <button type="submit" class="bg-green-600 hover:bg-green-500">Save</button>- </div>- </form>-</div>diff --git a/src/routes/new/database/index.svelte b/src/routes/new/database/index.sveltedeleted file mode 100644index 4ee9ee6fbb..0000000000--- a/src/routes/new/database/index.svelte+++ /dev/null@@ -1,59 +0,0 @@-<script context="module" lang="ts">- import type { Load } from '@sveltejs/kit';- export const load: Load = async ({ fetch, session }) => {- const url = `/common/getUniqueName.json`;- const res = await fetch(url);-- if (res.ok) {- return {- props: {- ...(await res.json())- }- };- }-- return {- status: res.status,- error: new Error(`Could not load ${url}`)- };- };-</script>--<script lang="ts">- export let name;- import { errorNotification } from '$lib/form';- import { onMount } from 'svelte';- import { goto } from '$app/navigation';- import { post } from '$lib/api';- let autofocus;-- onMount(() => {- autofocus.focus();- });- async function handleSubmit() {- try {- const { id } = await post('/new/database.json', { name });- return await goto(`/databases/${id}`);- } catch ({ error }) {- return errorNotification(error);- }- }-</script>--<div class="flex space-x-1 p-6 font-bold">- <div class="mr-4 text-2xl tracking-tight">Add New Database</div>-</div>-<div class="pt-10">- <form on:submit|preventDefault={handleSubmit}>- <div class="flex flex-col items-center space-y-4">- <input- name="name"- placeholder="Database name"- required- bind:this={autofocus}- bind:value={name}- />- <button type="submit" class="bg-purple-600 hover:bg-purple-500">Save</button>- </div>- </form>-</div>diff --git a/src/routes/new/service/index.svelte b/src/routes/new/service/index.sveltedeleted file mode 100644index f658a4ec20..0000000000--- a/src/routes/new/service/index.svelte+++ /dev/null@@ -1,59 +0,0 @@-<script context="module" lang="ts">- import type { Load } from '@sveltejs/kit';- export const load: Load = async ({ fetch, session }) => {- const url = `/common/getUniqueName.json`;- const res = await fetch(url);-- if (res.ok) {- return {- props: {- ...(await res.json())- }- };- }-- return {- status: res.status,- error: new Error(`Could not load ${url}`)- };- };-</script>--<script lang="ts">- export let name;- import { enhance, errorNotification } from '$lib/form';- import { onMount } from 'svelte';- import { goto } from '$app/navigation';- import { post } from '$lib/api';- let autofocus;-- onMount(() => {- autofocus.focus();- });- async function handleSubmit() {- try {- const { id } = await post(`/new/service.json`, { name });- return await goto(`/services/${id}`);- } catch ({ error }) {- return errorNotification(error);- }- }-</script>--<div class="flex space-x-1 p-6 font-bold">- <div class="mr-4 text-2xl tracking-tight">Add New Service</div>-</div>-<div class="pt-10">- <form on:submit|preventDefault={handleSubmit}>- <div class="flex flex-col items-center space-y-4">- <input- name="name"- placeholder="Service name"- required- bind:this={autofocus}- bind:value={name}- />- <button type="submit" class="bg-pink-600 hover:bg-pink-500">Save</button>- </div>- </form>-</div>diff --git a/src/routes/services/index.svelte b/src/routes/services/index.svelteindex 1ea70b904c..a4d34cd5f5 100644--- a/src/routes/services/index.svelte+++ b/src/routes/services/index.svelte@@ -1,24 +1,3 @@-<script context="module" lang="ts">- import type { Load } from '@sveltejs/kit';- export const load: Load = async ({ fetch }) => {- const url = `/services.json`;- const res = await fetch(url);-- if (res.ok) {- return {- props: {- ...(await res.json())- }- };- }-- return {- status: res.status,- error: new Error(`Could not load ${url}`)- };- };-</script>-<script lang="ts">import PlausibleAnalytics from '$lib/components/svg/services/PlausibleAnalytics.svelte';import NocoDb from '$lib/components/svg/services/NocoDB.svelte';@@ -27,13 +6,19 @@import Wordpress from '$lib/components/svg/services/Wordpress.svelte';import VaultWarden from '$lib/components/svg/services/VaultWarden.svelte';import LanguageTool from '$lib/components/svg/services/LanguageTool.svelte';+ import { post } from '$lib/api';+ import { goto } from '$app/navigation';export let services;+ async function newService() {+ const { id } = await post('/services/new', {});+ return await goto(`/services/${id}`, { replaceState: true });+ }</script><div class="flex space-x-1 p-6 font-bold"><div class="mr-4 text-2xl tracking-tight">Services</div>- <a href="/new/service" class="add-icon bg-pink-600 hover:bg-pink-500">+ <div on:click={newService} class="add-icon cursor-pointer bg-pink-600 hover:bg-pink-500"><svgclass="w-6"xmlns="http://www.w3.org/2000/svg"@@ -47,7 +32,7 @@d="M12 6v6m0 0v6m0-6h6m-6 0H6"/></svg>- </a>+ </div></div><div class="flex flex-wrap justify-center">diff --git a/src/routes/services/index.json.ts b/src/routes/services/index.tssimilarity index 100%rename from src/routes/services/index.json.tsrename to src/routes/services/index.tsdiff --git a/src/routes/new/service/index.json.ts b/src/routes/services/new.tssimilarity index 91%rename from src/routes/new/service/index.json.tsrename to src/routes/services/new.tsindex 3594f7920c..2faad169c8 100644--- a/src/routes/new/service/index.json.ts+++ b/src/routes/services/new.ts@@ -6,9 +6,7 @@ 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 { name } = await event.request.json();-+ const name = uniqueName();try {const { id } = await db.newService({ name, teamId });return { status: 201, body: { id } };diff --git a/src/routes/teams/index.svelte b/src/routes/teams/index.svelteindex c8572d5fc1..05c020cdfb 100644--- a/src/routes/teams/index.svelte+++ b/src/routes/teams/index.svelte@@ -91,23 +91,21 @@</div></div>{/if}-<div class="mx-auto max-w-2xl">- <div class="flex flex-wrap justify-center">- {#each teams as team}- <a href="/teams/{team.teamId}" class="w-96 p-2 no-underline">- <div- class="box-selection relative"- class:hover:bg-cyan-600={team.team?.id !== '0'}- class:hover:bg-red-500={team.team?.id === '0'}- >- <div class="truncate text-center text-xl font-bold">{team.team.name}</div>- <div class="text-center text-xs">- ({team.team?.id === '0' ? 'root team - ' : ''}{team.permission})- </div>-- <div class="mt-1 text-center">{team.team._count.users} member(s)</div>+<div class="flex flex-wrap justify-center">+ {#each teams as team}+ <a href="/teams/{team.teamId}" class="w-96 p-2 no-underline">+ <div+ class="box-selection relative"+ class:hover:bg-cyan-600={team.team?.id !== '0'}+ class:hover:bg-red-500={team.team?.id === '0'}+ >+ <div class="truncate text-center text-xl font-bold">+ {team.team.name}+ {team.team?.id === '0' ? '(root)' : ''}</div>- </a>- {/each}- </div>++ <div class="mt-1 text-center">{team.team._count.users} member(s)</div>+ </div>+ </a>+ {/each}</div>diff --git a/src/tailwind.css b/src/tailwind.cssindex 1eb6fe580a..1a30a3ac01 100644--- a/src/tailwind.css+++ b/src/tailwind.css@@ -85,7 +85,7 @@ a {}.nav-side {- @apply relative right-0 top-0 z-50 m-5 flex flex-wrap items-center justify-end space-x-2 bg-coolblack/40 text-white sm:absolute;+ @apply absolute right-0 top-0 z-50 m-5 flex flex-wrap items-center justify-end space-x-2 bg-coolblack/40 text-white;}.add-icon {