Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

Merge branch 'next' into edge-db

Andras Bacsai3d70162a8d33
diff --cc apps/api/src/lib/common.ts
index b698fc12ce,cba9012557..febb083743
--- a/apps/api/src/lib/common.ts
+++ b/apps/api/src/lib/common.ts
@@@ -472,16 -403,53 +403,59 @@@ export const supportedDatabaseTypesAndV
name: 'redis',
fancyName: 'Redis',
baseImage: 'bitnami/redis',
- versions: ['7.0', '6.2', '6.0', '5.0']
+ baseImageARM: 'redis',
+ versions: ['7.0', '6.2', '6.0', '5.0'],
+ versionsARM: ['7.0', '6.2', '6.0', '5.0']
},
- { name: 'couchdb', fancyName: 'CouchDB', baseImage: 'bitnami/couchdb', versions: ['3.2.1'] },
{
+ name: 'couchdb',
+ fancyName: 'CouchDB',
+ baseImage: 'bitnami/couchdb',
+ baseImageARM: 'couchdb',
+ versions: ['3.2.2', '3.1.2', '2.3.1'],
+ versionsARM: ['3.2.2', '3.1.2', '2.3.1']
- }
++ },
++ {
+ name: 'edgedb',
+ fancyName: 'EdgeDB',
+ baseImage: 'edgedb/edgedb',
+ versions: ['2.0', '1.4']
- }
++ }
];
+
+ export async function getFreeSSHLocalPort(id: string): Promise<number | boolean> {
+ const { default: isReachable } = await import('is-port-reachable');
+ const { remoteIpAddress, sshLocalPort } = await prisma.destinationDocker.findUnique({ where: { id } })
+ if (sshLocalPort) {
+ return Number(sshLocalPort)
+ }
+
+ const data = await prisma.setting.findFirst();
+ const { minPort, maxPort } = data;
+
+ const ports = await prisma.destinationDocker.findMany({ where: { sshLocalPort: { not: null }, remoteIpAddress: { not: remoteIpAddress } } })
+
+ const alreadyConfigured = await prisma.destinationDocker.findFirst({
+ where: {
+ remoteIpAddress, id: { not: id }, sshLocalPort: { not: null }
+ }
+ })
+ if (alreadyConfigured?.sshLocalPort) {
+ await prisma.destinationDocker.update({ where: { id }, data: { sshLocalPort: alreadyConfigured.sshLocalPort } })
+ return Number(alreadyConfigured.sshLocalPort)
+ }
+ const range = generateRangeArray(minPort, maxPort)
+ const availablePorts = range.filter(port => !ports.map(p => p.sshLocalPort).includes(port))
+ for (const port of availablePorts) {
+ const found = await isReachable(port, { host: 'localhost' })
+ if (!found) {
+ await prisma.destinationDocker.update({ where: { id }, data: { sshLocalPort: Number(port) } })
+ return Number(port)
+ }
+ }
+ return false
+ }
+
export async function createRemoteEngineConfiguration(id: string) {
const homedir = os.homedir();
const sshKeyFile = `/tmp/id_rsa-${id}`
@@@ -828,25 -848,24 +866,37 @@@ export function generateDatabaseConfigu
volume: `${id}-${type}-data:/bitnami/couchdb`,
ulimits: {}
};
- if (isARM(arch)) {
++ if (isARM(arch)) {
+ configuration.volume = `${id}-${type}-data:/opt/couchdb/data`;
+ }
+ return configuration
+ } else if (type === 'edgedb') {
+ return {
+ privatePort: 5656,
+ environmentVariables: {
- EDGEDB_SERVER_PASSWORD: rootUserPassword,
- EDGEDB_SERVER_USER: rootUser,
- EDGEDB_SERVER_DATABASE: defaultDatabase,
- EDGEDB_SERVER_SECURITY: 'insecure_dev_mode'
++ EDGEDB_SERVER_PASSWORD: rootUserPassword,
++ EDGEDB_SERVER_USER: rootUser,
++ EDGEDB_SERVER_DATABASE: defaultDatabase,
++ EDGEDB_SERVER_SECURITY: 'insecure_dev_mode'
+ },
+ image: `${baseImage}:${version}`,
+ volume: `${id}-${type}-data:/edgedb/edgedb`,
+ ulimits: {}
+ };
}
}
-
- export function getDatabaseImage(type: string): string {
+ export function isARM(arch: string) {
+ if (arch === 'arm' || arch === 'arm64') {
+ return true
+ }
+ return false
+ }
+ export function getDatabaseImage(type: string, arch: string): string {
const found = supportedDatabaseTypesAndVersions.find((t) => t.name === type);
if (found) {
+ if (isARM(arch)) {
+ return found.baseImageARM || found.baseImage
+ }
return found.baseImage;
}
return '';
diff --cc apps/ui/src/routes/databases/[id]/_Databases/_Databases.svelte
index 8127fd025c,5cfa6025e3..61972edfe6
--- a/apps/ui/src/routes/databases/[id]/_Databases/_Databases.svelte
+++ b/apps/ui/src/routes/databases/[id]/_Databases/_Databases.svelte
@@@ -12,12 -12,10 +12,11 @@@
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';
import { errorNotification } from '$lib/common';
- import { appSession, status } from '$lib/store';
+ import { addToast, appSession, status } from '$lib/store';
import Explainer from '$lib/components/Explainer.svelte';
const { id } = $page.params;
diff --cc apps/ui/src/routes/databases/[id]/configuration/type.svelte
index e17df92349,006ad0a14a..148b5a3f7a
--- a/apps/ui/src/routes/databases/[id]/configuration/type.svelte
+++ b/apps/ui/src/routes/databases/[id]/configuration/type.svelte
@@@ -31,15 -31,6 +31,7 @@@
const { id } = $page.params;
const from = $page.url.searchParams.get('from');
-
- import Clickhouse from '$lib/components/svg/databases/Clickhouse.svelte';
- import CouchDB from '$lib/components/svg/databases/CouchDB.svelte';
- import MongoDB from '$lib/components/svg/databases/MongoDB.svelte';
- import MariaDB from '$lib/components/svg/databases/MariaDB.svelte';
- 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 EdgeDb from '$lib/components/svg/databases/EdgeDB.svelte';
++
import { goto } from '$app/navigation';
import { get, post } from '$lib/api';
import { t } from '$lib/translations';
@@@ -63,23 -55,8 +56,8 @@@
<div class="p-2">
<form on:submit|preventDefault={() => handleSubmit(type.name)}>
<button type="submit" class="box-selection relative text-xl font-bold hover:bg-purple-700">
- {#if type.name === 'clickhouse'}
- <Clickhouse isAbsolute />
- {:else if type.name === 'couchdb'}
- <CouchDB isAbsolute />
- {:else if type.name === 'mongodb'}
- <MongoDB isAbsolute />
- {:else if type.name === 'mariadb'}
- <MariaDB isAbsolute />
- {:else if type.name === 'mysql'}
- <MySQL isAbsolute />
- {:else if type.name === 'postgresql'}
- <PostgreSQL isAbsolute />
- {:else if type.name === 'redis'}
- <Redis isAbsolute />
- {:else if type.name === 'edgedb'}
- <EdgeDb isAbsolute />
- {/if}{type.fancyName}
- <DatabaseIcons type={type.name} isAbsolute={true} />
++ <DatabaseIcons type={type.name} isAbsolute={true} />
+ {type.fancyName}
</button>
</form>
</div>
diff --cc apps/ui/src/routes/databases/index.svelte
index 4679a2f91f,04dbeb768f..cdb45d0c43
--- a/apps/ui/src/routes/databases/index.svelte
+++ b/apps/ui/src/routes/databases/index.svelte
@@@ -80,23 -73,7 +73,7 @@@
{#each ownDatabases as database}
<a href="/databases/{database.id}" class="p-2 no-underline">
<div class="box-selection group relative hover:bg-purple-600">
- {#if database.type === 'clickhouse'}
- <Clickhouse isAbsolute />
- {:else if database.type === 'couchdb'}
- <CouchDB isAbsolute />
- {:else if database.type === 'mongodb'}
- <MongoDB isAbsolute />
- {:else if database.type === 'mysql'}
- <MySQL isAbsolute />
- {:else if database.type === 'mariadb'}
- <MariaDB isAbsolute />
- {:else if database.type === 'postgresql'}
- <PostgreSQL isAbsolute />
- {:else if database.type === 'redis'}
- <Redis isAbsolute />
- {:else if database.type === 'edgedb'}
- <EdgeDb isAbsolute />
- {/if}
- <DatabaseIcons type={database.type} isAbsolute={true} />
++ <DatabaseIcons type={database.type} isAbsolute={true} />
<div class="truncate text-center text-xl font-bold">
{database.name}
</div>
@@@ -121,23 -98,7 +98,7 @@@
{#each otherDatabases as database}
<a href="/databases/{database.id}" class="p-2 no-underline">
<div class="box-selection group relative hover:bg-purple-600">
- {#if database.type === 'clickhouse'}
- <Clickhouse isAbsolute />
- {:else if database.type === 'couchdb'}
- <CouchDB isAbsolute />
- {:else if database.type === 'mongodb'}
- <MongoDB isAbsolute />
- {:else if database.type === 'mariadb'}
- <MariaDB isAbsolute />
- {:else if database.type === 'mysql'}
- <MySQL isAbsolute />
- {:else if database.type === 'postgresql'}
- <PostgreSQL isAbsolute />
- {:else if database.type === 'redis'}
- <Redis isAbsolute />
- {:else if database.type === 'edgedb'}
- <EdgeDb isAbsolute />
- {/if}
- <DatabaseIcons type={database.type} isAbsolute={true} />
++ <DatabaseIcons type={database.type} isAbsolute={true} />
<div class="truncate text-center text-xl font-bold">
{database.name}
</div>