mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-06-16 04:35:24 +02:00
Merge pull request #1866 from Dokploy/1853-external-volume-should-not-be-isolated
refactor: remove unused volume suffix function from collision utility
This commit is contained in:
3
apps/dokploy/drizzle/0102_opposite_grandmaster.sql
Normal file
3
apps/dokploy/drizzle/0102_opposite_grandmaster.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
ALTER TABLE "compose" ADD COLUMN "isolatedDeploymentsVolume" boolean DEFAULT false NOT NULL;
|
||||
|
||||
UPDATE "compose" SET "isolatedDeploymentsVolume" = true;
|
||||
6129
apps/dokploy/drizzle/meta/0102_snapshot.json
Normal file
6129
apps/dokploy/drizzle/meta/0102_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -715,6 +715,13 @@
|
||||
"when": 1751751631943,
|
||||
"tag": "0101_moaning_blazing_skull",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 102,
|
||||
"version": "7",
|
||||
"when": 1751848685503,
|
||||
"tag": "0102_opposite_grandmaster",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -79,6 +79,10 @@ export const compose = pgTable("compose", {
|
||||
suffix: text("suffix").notNull().default(""),
|
||||
randomize: boolean("randomize").notNull().default(false),
|
||||
isolatedDeployment: boolean("isolatedDeployment").notNull().default(false),
|
||||
// Keep this for backward compatibility since we will not add the prefix anymore to volumes
|
||||
isolatedDeploymentsVolume: boolean("isolatedDeploymentsVolume")
|
||||
.notNull()
|
||||
.default(false),
|
||||
triggerType: triggerType("triggerType").default("push"),
|
||||
composeStatus: applicationStatus("composeStatus").notNull().default("idle"),
|
||||
projectId: text("projectId")
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
import { findComposeById } from "@dokploy/server/services/compose";
|
||||
import { dump, load } from "js-yaml";
|
||||
import { addAppNameToAllServiceNames } from "./collision/root-network";
|
||||
import { generateRandomHash } from "./compose";
|
||||
import { addSuffixToAllVolumes } from "./compose/volume";
|
||||
import { generateRandomHash } from "./compose";
|
||||
import type { ComposeSpecification } from "./types";
|
||||
|
||||
export const addAppNameToPreventCollision = (
|
||||
composeData: ComposeSpecification,
|
||||
appName: string,
|
||||
isolatedDeploymentsVolume: boolean,
|
||||
): ComposeSpecification => {
|
||||
let updatedComposeData = { ...composeData };
|
||||
|
||||
updatedComposeData = addAppNameToAllServiceNames(updatedComposeData, appName);
|
||||
updatedComposeData = addSuffixToAllVolumes(updatedComposeData, appName);
|
||||
if (isolatedDeploymentsVolume) {
|
||||
updatedComposeData = addSuffixToAllVolumes(updatedComposeData, appName);
|
||||
}
|
||||
return updatedComposeData;
|
||||
};
|
||||
|
||||
@@ -29,6 +32,7 @@ export const randomizeIsolatedDeploymentComposeFile = async (
|
||||
const newComposeFile = addAppNameToPreventCollision(
|
||||
composeData,
|
||||
randomSuffix,
|
||||
compose.isolatedDeploymentsVolume,
|
||||
);
|
||||
|
||||
return dump(newComposeFile);
|
||||
@@ -36,11 +40,16 @@ export const randomizeIsolatedDeploymentComposeFile = async (
|
||||
|
||||
export const randomizeDeployableSpecificationFile = (
|
||||
composeSpec: ComposeSpecification,
|
||||
isolatedDeploymentsVolume: boolean,
|
||||
suffix?: string,
|
||||
) => {
|
||||
if (!suffix) {
|
||||
return composeSpec;
|
||||
}
|
||||
const newComposeFile = addAppNameToPreventCollision(composeSpec, suffix);
|
||||
const newComposeFile = addAppNameToPreventCollision(
|
||||
composeSpec,
|
||||
suffix,
|
||||
isolatedDeploymentsVolume,
|
||||
);
|
||||
return newComposeFile;
|
||||
};
|
||||
|
||||
@@ -202,6 +202,7 @@ export const addDomainToCompose = async (
|
||||
if (compose.isolatedDeployment) {
|
||||
const randomized = randomizeDeployableSpecificationFile(
|
||||
result,
|
||||
compose.isolatedDeploymentsVolume,
|
||||
compose.suffix || compose.appName,
|
||||
);
|
||||
result = randomized;
|
||||
|
||||
Reference in New Issue
Block a user