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
fix: ENV variables set differently
Andras Bacsai82de234f2173
diff --git a/package.json b/package.jsonindex 3f6d3f6c8f..7928841b0c 100644--- a/package.json+++ b/package.json@@ -1,7 +1,7 @@{"name": "coolify","description": "An open-source & self-hostable Heroku / Netlify alternative.",- "version": "2.0.0",+ "version": "2.0.2","license": "AGPL-3.0","scripts": {"dev": "docker-compose -f docker-compose-dev.yaml up -d && NODE_ENV=development svelte-kit dev --host 0.0.0.0",diff --git a/src/lib/queues/builder.ts b/src/lib/queues/builder.tsindex fb5c802507..9430e786ea 100644--- a/src/lib/queues/builder.ts+++ b/src/lib/queues/builder.ts@@ -1,4 +1,5 @@import crypto from 'crypto';+import fs from 'fs/promises';import * as buildpacks from '../buildPacks';import * as importers from '../importers';import { dockerInstance } from '../docker';@@ -208,10 +209,11 @@ export default async function (job) {if (secrets.length > 0) {secrets.forEach((secret) => {if (!secret.isBuildSecret) {- envs.push(`--env ${secret.name}=${secret.value}`);+ envs.push(`${secret.name}=${secret.value}`);}});}+ await fs.writeFile(`${workdir}/.env`, envs.join('\n'));const labels = makeLabelForStandaloneApplication({applicationId,fqdn,@@ -230,14 +232,20 @@ export default async function (job) {baseDirectory,publishDirectory});- saveBuildLog({ line: 'Deployment started.', buildId, applicationId });- const { stderr } = await asyncExecShell(- `DOCKER_HOST=${host} docker run ${envs.join(' ')} ${labels.join(- ' '- )} --name ${imageId} --network ${docker.network} --restart always -d ${applicationId}:${tag}`- );- if (stderr) console.log(stderr);- saveBuildLog({ line: 'Deployment successful!', buildId, applicationId });+ try {+ saveBuildLog({ line: 'Deployment started.', buildId, applicationId });+ const { stderr } = await asyncExecShell(+ `DOCKER_HOST=${host} docker run --env-file=${workdir}/.env ${labels.join(+ ' '+ )} --name ${imageId} --network ${+ docker.network+ } --restart always -d ${applicationId}:${tag}`+ );+ if (stderr) console.log(stderr);+ saveBuildLog({ line: 'Deployment successful!', buildId, applicationId });+ } catch (error) {+ throw new Error(error);+ }if (destinationDockerId && destinationDocker.isCoolifyProxyUsed) {saveBuildLog({ line: 'Proxy configuration started!', buildId, applicationId });diff --git a/src/lib/queues/index.ts b/src/lib/queues/index.tsindex 5ebef3106d..a686fb04c8 100644--- a/src/lib/queues/index.ts+++ b/src/lib/queues/index.ts@@ -120,7 +120,9 @@ buildWorker.on('completed', async (job: Bullmq.Job) => {} catch (err) {console.log(err);} finally {- await asyncExecShell(`rm -fr ${job.data.workdir}`);+ const workdir = `/tmp/build-sources/${job.data.repository}/${job.data.build_id}`;+ await asyncExecShell(`rm -fr ${workdir}`);+ await asyncExecShell(`rm /tmp/build-sources/${job.data.repository}/id.rsa`);}return;});@@ -132,7 +134,9 @@ buildWorker.on('failed', async (job: Bullmq.Job, failedReason) => {} catch (error) {console.log(error);} finally {- await asyncExecShell(`rm -fr ${job.data.workdir}`);+ const workdir = `/tmp/build-sources/${job.data.repository}/${job.data.build_id}`;+ await asyncExecShell(`rm -fr ${workdir}`);+ await asyncExecShell(`rm /tmp/build-sources/${job.data.repository}/id.rsa`);}saveBuildLog({ line: 'Failed build!', buildId: job.data.build_id, applicationId: job.data.id });saveBuildLog({