From b777e08542f6b022af80b6bd536a3925532bf3de Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 21 Feb 2023 12:35:20 +0100 Subject: [PATCH 1/4] fix: arm servics --- apps/api/src/lib/common.ts | 2 +- apps/api/src/lib/services/handlers.ts | 36 +++++++++++++-------------- package.json | 2 +- 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/apps/api/src/lib/common.ts b/apps/api/src/lib/common.ts index 26ff479ea..00bfa671c 100644 --- a/apps/api/src/lib/common.ts +++ b/apps/api/src/lib/common.ts @@ -19,7 +19,7 @@ import { saveBuildLog, saveDockerRegistryCredentials } from './buildPacks/common import { scheduler } from './scheduler'; import type { ExecaChildProcess } from 'execa'; -export const version = '3.12.20'; +export const version = '3.12.21'; export const isDev = process.env.NODE_ENV === 'development'; export const proxyPort = process.env.COOLIFY_PROXY_PORT; export const proxySecurePort = process.env.COOLIFY_PROXY_SECURE_PORT; diff --git a/apps/api/src/lib/services/handlers.ts b/apps/api/src/lib/services/handlers.ts index b9bd4ca78..046cd2fb4 100644 --- a/apps/api/src/lib/services/handlers.ts +++ b/apps/api/src/lib/services/handlers.ts @@ -50,24 +50,21 @@ export async function startService(request: FastifyRequest, fa const config = {}; for (const s in template.services) { let newEnvironments = [] - if (arm) { - if (template.services[s]?.environmentArm?.length > 0) { - for (const environment of template.services[s].environmentArm) { - let [env, ...value] = environment.split("="); - value = value.join("=") - if (!value.startsWith('$$secret') && value !== '') { - newEnvironments.push(`${env}=${value}`) - } + if (arm && template.services[s]?.environmentArm?.length > 0) { + for (const environment of template.services[s].environmentArm) { + let [env, ...value] = environment.split("="); + value = value.join("=") + if (!value.startsWith('$$secret') && value !== '') { + newEnvironments.push(`${env}=${value}`) } } - } else { - if (template.services[s]?.environment?.length > 0) { - for (const environment of template.services[s].environment) { - let [env, ...value] = environment.split("="); - value = value.join("=") - if (!value.startsWith('$$secret') && value !== '') { - newEnvironments.push(`${env}=${value}`) - } + } + if (!arm && template.services[s]?.environment?.length > 0) { + for (const environment of template.services[s].environment) { + let [env, ...value] = environment.split("="); + value = value.join("=") + if (!value.startsWith('$$secret') && value !== '') { + newEnvironments.push(`${env}=${value}`) } } } @@ -87,9 +84,10 @@ export async function startService(request: FastifyRequest, fa } const customVolumes = await prisma.servicePersistentStorage.findMany({ where: { serviceId: id } }) let volumes = new Set() - if (arm) { - template.services[s]?.volumesArm && template.services[s].volumesArm.length > 0 && template.services[s].volumesArm.forEach(v => volumes.add(v)) - } else { + if (arm && template.services[s]?.volumesArm?.length > 0) { + template.services[s].volumesArm.forEach(v => volumes.add(v)) + } + if (!arm && template.services[s]?.volumes?.length > 0) { template.services[s]?.volumes && template.services[s].volumes.length > 0 && template.services[s].volumes.forEach(v => volumes.add(v)) } diff --git a/package.json b/package.json index b200d103f..42b63505c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "coolify", "description": "An open-source & self-hostable Heroku / Netlify alternative.", - "version": "3.12.20", + "version": "3.12.21", "license": "Apache-2.0", "repository": "github:coollabsio/coolify", "scripts": { From f0d89f850e918ae0df847cd92ea0b2a239b60504 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 21 Feb 2023 12:45:22 +0100 Subject: [PATCH 2/4] fix --- apps/api/src/lib/common.ts | 2 +- apps/api/src/lib/services/handlers.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/api/src/lib/common.ts b/apps/api/src/lib/common.ts index 00bfa671c..ab90b3a53 100644 --- a/apps/api/src/lib/common.ts +++ b/apps/api/src/lib/common.ts @@ -1048,7 +1048,7 @@ export function generateDatabaseConfiguration(database: any): DatabaseConfigurat } export function isARM() { const arch = process.arch; - if (arch === 'arm' || arch === 'arm64') { + if (arch === 'arm' || arch === 'arm64' || arch === 'aarch' || arch === 'aarch64') { return true; } return false; diff --git a/apps/api/src/lib/services/handlers.ts b/apps/api/src/lib/services/handlers.ts index 046cd2fb4..7db1df3e0 100644 --- a/apps/api/src/lib/services/handlers.ts +++ b/apps/api/src/lib/services/handlers.ts @@ -82,13 +82,14 @@ export async function startService(request: FastifyRequest, fa } } } + console.log({ newEnvironments }) const customVolumes = await prisma.servicePersistentStorage.findMany({ where: { serviceId: id } }) let volumes = new Set() if (arm && template.services[s]?.volumesArm?.length > 0) { template.services[s].volumesArm.forEach(v => volumes.add(v)) } if (!arm && template.services[s]?.volumes?.length > 0) { - template.services[s]?.volumes && template.services[s].volumes.length > 0 && template.services[s].volumes.forEach(v => volumes.add(v)) + template.services[s].volumes.forEach(v => volumes.add(v)) } // Workaround: old plausible analytics service wrong volume id name From 51b5edb04fd1576e83896f49e28601664da89a05 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 21 Feb 2023 12:48:06 +0100 Subject: [PATCH 3/4] hmm fix --- apps/api/src/lib/services/handlers.ts | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/apps/api/src/lib/services/handlers.ts b/apps/api/src/lib/services/handlers.ts index 7db1df3e0..d721d1472 100644 --- a/apps/api/src/lib/services/handlers.ts +++ b/apps/api/src/lib/services/handlers.ts @@ -50,16 +50,7 @@ export async function startService(request: FastifyRequest, fa const config = {}; for (const s in template.services) { let newEnvironments = [] - if (arm && template.services[s]?.environmentArm?.length > 0) { - for (const environment of template.services[s].environmentArm) { - let [env, ...value] = environment.split("="); - value = value.join("=") - if (!value.startsWith('$$secret') && value !== '') { - newEnvironments.push(`${env}=${value}`) - } - } - } - if (!arm && template.services[s]?.environment?.length > 0) { + if (template.services[s]?.environment?.length > 0) { for (const environment of template.services[s].environment) { let [env, ...value] = environment.split("="); value = value.join("=") From e530ecf9f956dc8cbff6e98aa932efebb70d252b Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 21 Feb 2023 12:59:21 +0100 Subject: [PATCH 4/4] fix --- apps/api/src/lib/services/handlers.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/api/src/lib/services/handlers.ts b/apps/api/src/lib/services/handlers.ts index d721d1472..7f0d4505e 100644 --- a/apps/api/src/lib/services/handlers.ts +++ b/apps/api/src/lib/services/handlers.ts @@ -73,7 +73,6 @@ export async function startService(request: FastifyRequest, fa } } } - console.log({ newEnvironments }) const customVolumes = await prisma.servicePersistentStorage.findMany({ where: { serviceId: id } }) let volumes = new Set() if (arm && template.services[s]?.volumesArm?.length > 0) {