Compare commits

...

3 Commits

Author SHA1 Message Date
Andras Bacsai
3b25c8f96b fix: docker compose env file 2023-08-12 00:10:14 +02:00
Andras Bacsai
1c8c567791 fix: env variables in compose deplyoments 2023-07-27 12:40:58 +02:00
Andras Bacsai
807a3c9d66 fix: n8n double mount
version++
2023-07-26 10:38:36 +02:00
7 changed files with 25 additions and 17 deletions

View File

@@ -2440,6 +2440,7 @@
image: n8nio/n8n:$$core_version image: n8nio/n8n:$$core_version
volumes: volumes:
- $$id-data:/root/.n8n - $$id-data:/root/.n8n
- $$id-data:/home/node/.n8n
- $$id-data-write:/files - $$id-data-write:/files
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock
environment: environment:

View File

@@ -381,7 +381,6 @@ main()
reEncryptSecrets() reEncryptSecrets()
.catch((e) => { .catch((e) => {
console.error(e); console.error(e);
process.exit(1);
}) })
.finally(async () => { .finally(async () => {
await prisma.$disconnect(); await prisma.$disconnect();

View File

@@ -19,7 +19,9 @@ export default async function (data) {
dockerComposeConfiguration, dockerComposeConfiguration,
dockerComposeFileLocation dockerComposeFileLocation
} = data; } = data;
const fileYaml = `${workdir}${baseDirectory}${dockerComposeFileLocation}`; const baseDir = `${workdir}${baseDirectory}`;
const envFile = `${baseDir}/.env`;
const fileYaml = `${baseDir}${dockerComposeFileLocation}`;
const dockerComposeRaw = await fs.readFile(fileYaml, 'utf8'); const dockerComposeRaw = await fs.readFile(fileYaml, 'utf8');
const dockerComposeYaml = yaml.load(dockerComposeRaw); const dockerComposeYaml = yaml.load(dockerComposeRaw);
if (!dockerComposeYaml.services) { if (!dockerComposeYaml.services) {
@@ -31,7 +33,7 @@ export default async function (data) {
envs = [...envs, ...generateSecrets(secrets, pullmergeRequestId, false, null)]; envs = [...envs, ...generateSecrets(secrets, pullmergeRequestId, false, null)];
buildEnvs = [...buildEnvs, ...generateSecrets(secrets, pullmergeRequestId, true, null, true)]; buildEnvs = [...buildEnvs, ...generateSecrets(secrets, pullmergeRequestId, true, null, true)];
} }
await fs.writeFile(envFile, envs.join('\n'));
const composeVolumes = []; const composeVolumes = [];
if (volumes.length > 0) { if (volumes.length > 0) {
for (const volume of volumes) { for (const volume of volumes) {
@@ -50,31 +52,38 @@ export default async function (data) {
if (value['env_file']) { if (value['env_file']) {
delete value['env_file']; delete value['env_file'];
} }
value['env_file'] = [envFile];
let environment = typeof value['environment'] === 'undefined' ? [] : value['environment']; // let environment = typeof value['environment'] === 'undefined' ? [] : value['environment'];
if (Object.keys(environment).length > 0) { // let finalEnvs = [...envs];
environment = Object.entries(environment).map(([key, value]) => `${key}=${value}`); // if (Object.keys(environment).length > 0) {
} // for (const arg of Object.keys(environment)) {
value['environment'] = [...environment, ...envs]; // const [key, _] = arg.split('=');
// if (finalEnvs.filter((env) => env.startsWith(key)).length === 0) {
// finalEnvs.push(arg);
// }
// }
// }
// value['environment'] = [...finalEnvs];
let build = typeof value['build'] === 'undefined' ? [] : value['build']; let build = typeof value['build'] === 'undefined' ? [] : value['build'];
if (typeof build === 'string') { if (typeof build === 'string') {
build = { context: build }; build = { context: build };
} }
const buildArgs = typeof build['args'] === 'undefined' ? [] : build['args']; const buildArgs = typeof build['args'] === 'undefined' ? [] : build['args'];
let finalArgs = [...buildEnvs]; let finalBuildArgs = [...buildEnvs];
if (Object.keys(buildArgs).length > 0) { if (Object.keys(buildArgs).length > 0) {
for (const arg of Object.keys(buildArgs)) { for (const arg of Object.keys(buildArgs)) {
const [key, _] = arg.split('='); const [key, _] = arg.split('=');
if (finalArgs.filter((env) => env.startsWith(key)).length === 0) { if (finalBuildArgs.filter((env) => env.startsWith(key)).length === 0) {
finalArgs.push(arg); finalBuildArgs.push(arg);
} }
} }
} }
if (build.length > 0 || buildArgs.length > 0) { if (build.length > 0 || buildArgs.length > 0) {
value['build'] = { value['build'] = {
...build, ...build,
args: finalArgs args: finalBuildArgs
}; };
} }
@@ -121,7 +130,6 @@ export default async function (data) {
.replace(/^\./, `~`) .replace(/^\./, `~`)
.replace(/^\.\./, '~') .replace(/^\.\./, '~')
.replace(/^\$PWD/, '~'); .replace(/^\$PWD/, '~');
console.log({ source });
} else { } else {
if (!target) { if (!target) {
target = source; target = source;

View File

@@ -18,7 +18,7 @@ import { scheduler } from './scheduler';
import type { ExecaChildProcess } from 'execa'; import type { ExecaChildProcess } from 'execa';
import { FastifyReply } from 'fastify'; import { FastifyReply } from 'fastify';
export const version = '3.12.35'; export const version = '3.12.37';
export const isDev = process.env.NODE_ENV === 'development'; export const isDev = process.env.NODE_ENV === 'development';
export const proxyPort = process.env.COOLIFY_PROXY_PORT; export const proxyPort = process.env.COOLIFY_PROXY_PORT;
export const proxySecurePort = process.env.COOLIFY_PROXY_SECURE_PORT; export const proxySecurePort = process.env.COOLIFY_PROXY_SECURE_PORT;

View File

@@ -477,7 +477,7 @@ export async function saveServiceType(
const [volumeName, path] = volume.split(':'); const [volumeName, path] = volume.split(':');
if (!volumeName.startsWith('/')) { if (!volumeName.startsWith('/')) {
const found = await prisma.servicePersistentStorage.findFirst({ const found = await prisma.servicePersistentStorage.findFirst({
where: { volumeName, serviceId: id } where: { volumeName, serviceId: id, path }
}); });
if (!found) { if (!found) {
await prisma.servicePersistentStorage.create({ await prisma.servicePersistentStorage.create({

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,7 @@
{ {
"name": "coolify", "name": "coolify",
"description": "An open-source & self-hostable Heroku / Netlify alternative.", "description": "An open-source & self-hostable Heroku / Netlify alternative.",
"version": "3.12.35", "version": "3.12.37",
"license": "Apache-2.0", "license": "Apache-2.0",
"repository": "github:coollabsio/coolify", "repository": "github:coollabsio/coolify",
"scripts": { "scripts": {