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
Merge branch 'next' into edge-db
Ikechukwu Eze801b9c14837f
diff --cc apps/api/src/lib/common.tsindex 656075d8e3,6bfbcc47cf..30743af3c9--- a/apps/api/src/lib/common.ts+++ b/apps/api/src/lib/common.ts@@@ -465,30 -472,94 +472,100 @@@ export const supportedDatabaseTypesAndVname: 'redis',fancyName: 'Redis',baseImage: 'bitnami/redis',- versions: ['6.2', '6.0', '5.0']+ versions: ['7.0', '6.2', '6.0', '5.0']},- { name: 'couchdb', fancyName: 'CouchDB', baseImage: 'bitnami/couchdb', versions: ['3.2.2'] }+ { name: 'couchdb', fancyName: 'CouchDB', baseImage: 'bitnami/couchdb', versions: ['3.2.1'] },+ {+ name: 'edgedb',+ fancyName: 'EdgeDB',+ baseImage: 'edgedb/edgedb',- versions: ['2.0', '1.4'],- }++ versions: ['2.0', '1.4']++ }];+ export async function createRemoteEngineConfiguration(id: string) {+ const homedir = os.homedir();+ const sshKeyFile = `/tmp/id_rsa-${id}`+ const { sshKey: { privateKey }, remoteIpAddress, remotePort, remoteUser } = await prisma.destinationDocker.findFirst({ where: { id }, include: { sshKey: true } })+ await fs.writeFile(sshKeyFile, decrypt(privateKey) + '\n', { encoding: 'utf8', mode: 400 })+ // Needed for remote docker compose+ const { stdout: numberOfSSHAgentsRunning } = await asyncExecShell(`ps ax | grep [s]sh-agent | grep ssh-agent.pid | grep -v grep | wc -l`)+ if (numberOfSSHAgentsRunning !== '' && Number(numberOfSSHAgentsRunning.trim()) == 0) {+ await asyncExecShell(`eval $(ssh-agent -sa /tmp/ssh-agent.pid)`)+ }+ await asyncExecShell(`SSH_AUTH_SOCK=/tmp/ssh-agent.pid ssh-add -q ${sshKeyFile}`)- export async function startTraefikProxy(engine: string): Promise<void> {- const host = getEngine(engine);- const found = await checkContainer(engine, 'coolify-proxy', true);- const { proxyPassword, proxyUser, id } = await listSettings();+ const { stdout: numberOfSSHTunnelsRunning } = await asyncExecShell(`ps ax | grep 'ssh -fNL 11122:localhost:22' | grep -v grep | wc -l`)+ console.log(numberOfSSHTunnelsRunning)+ if (numberOfSSHTunnelsRunning !== '' && Number(numberOfSSHTunnelsRunning.trim()) == 0) {+ try {+ await asyncExecShell(`SSH_AUTH_SOCK=/tmp/ssh-agent.pid ssh -fNL 11122:localhost:22 ${remoteIpAddress}`)++ } catch(error){+ console.log(error)+ }++ }+++ const config = sshConfig.parse('')+ const found = config.find({ Host: remoteIpAddress })if (!found) {- const { stdout: Config } = await asyncExecShell(- `DOCKER_HOST="${host}" docker network inspect bridge --format '{{json .IPAM.Config }}'`- );+ config.append({+ Host: remoteIpAddress,+ Hostname: 'localhost',+ Port: '11122',+ User: remoteUser,+ IdentityFile: sshKeyFile,+ StrictHostKeyChecking: 'no'+ })+ }+ try {+ await fs.stat(`${homedir}/.ssh/`)+ } catch (error) {+ await fs.mkdir(`${homedir}/.ssh/`)+ }++ await fs.writeFile(`${homedir}/.ssh/config`, sshConfig.stringify(config))++ return++ }+ export async function executeDockerCmd({ dockerId, command }: { dockerId: string, command: string }) {+ let { remoteEngine, remoteIpAddress, engine } = await prisma.destinationDocker.findUnique({ where: { id: dockerId } })+ if (remoteEngine) {+ await createRemoteEngineConfiguration(dockerId)+ engine = `ssh://${remoteIpAddress}`+ } else {+ engine = 'unix:///var/run/docker.sock'+ }+ return await asyncExecShell(+ `DOCKER_BUILDKIT=1 DOCKER_HOST="${engine}" ${command}`+ );++ }+ export async function startTraefikProxy(id: string): Promise<void> {+ const { engine, network, remoteEngine, remoteIpAddress } = await prisma.destinationDocker.findUnique({ where: { id } })+ const found = await checkContainer({ dockerId: id, container: 'coolify-proxy', remove: true });+ const { id: settingsId, ipv4, ipv6 } = await listSettings();++ if (!found) {+ const { stdout: Config } = await executeDockerCmd({ dockerId: id, command: `docker network inspect ${network} --format '{{json .IPAM.Config }}'` })const ip = JSON.parse(Config)[0].Gateway;- await asyncExecShell(- `DOCKER_HOST="${host}" docker run --restart always \+ let traefikUrl = mainTraefikEndpoint+ if (remoteEngine) {+ let ip = null+ if (isDev) {+ ip = getAPIUrl()+ } else {+ ip = `http://${ipv4 || ipv6}:3000`+ }+ traefikUrl = `${ip}/webhooks/traefik/remote/${id}`+ }+ await executeDockerCmd({+ dockerId: id,+ command: `docker run --restart always \--add-host 'host.docker.internal:host-gateway' \- --add-host 'host.docker.internal:${ip}' \+ ${ip ? `--add-host 'host.docker.internal:${ip}'` : ''} \-v coolify-traefik-letsencrypt:/etc/traefik/acme \-v /var/run/docker.sock:/var/run/docker.sock \--network coolify-infra \@@@ -797,18 -810,6 +827,18 @@@ export function generateDatabaseConfiguvolume: `${id}-${type}-data:/bitnami/couchdb`,ulimits: {}};+ } else if (type === 'edgedb') {+ return {+ privatePort: 5656,+ environmentVariables: {+ EDGEDB_SERVER_PASSWORD: rootUserPassword,+ EDGEDB_SERVER_USER: rootUser,+ EDGEDB_SERVER_DATABASE: defaultDatabase,+ },+ image: `${baseImage}:${version}`,+ volume: `${id}-${type}-data:/edgedb/edgedb`,- ulimits: {},++ ulimits: {}+ };}}diff --cc apps/ui/src/routes/databases/[id]/_Databases/_Databases.svelteindex c57520ee63,9824e8c12d..8127fd025c--- a/apps/ui/src/routes/databases/[id]/_Databases/_Databases.svelte+++ b/apps/ui/src/routes/databases/[id]/_Databases/_Databases.svelte@@@ -199,13 -200,18 +203,20 @@@<Redis bind:database />{:else if database.type === 'couchdb'}<CouchDb {database} />+ {:else if database.type === 'edgedb'}+ <EdgeDB {database} />{/if}<div class="grid grid-cols-2 items-center px-10 pb-8">- <label for="url" class="text-base font-bold text-stone-100"- >{$t('database.connection_string')}</label- >+ <div>+ <label for="url" class="text-base font-bold text-stone-100"+ >{$t('database.connection_string')}</label+ >+ {#if !isPublic && database.destinationDocker.remoteEngine}+ <Explainer+ text="You can only access the database with this URL if your application is deployed to the same Destination."+ />+ {/if}+ </div><CopyPasswordFieldtextarea={true}placeholder={$t('forms.generated_automatically_after_start')}