mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-11 06:25:17 +00:00
Merge pull request #4370 from Dokploy/fix/template-isolated-deployment
feat(templates): support isolated = false opt-out in template.toml
This commit is contained in:
@@ -494,4 +494,49 @@ describe("processTemplate", () => {
|
|||||||
expect(result.mounts).toHaveLength(1);
|
expect(result.mounts).toHaveLength(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("isolated deployment config", () => {
|
||||||
|
it("should default to isolated=true when not specified", () => {
|
||||||
|
const template: CompleteTemplate = {
|
||||||
|
metadata: {} as any,
|
||||||
|
variables: {},
|
||||||
|
config: {
|
||||||
|
domains: [],
|
||||||
|
env: {},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(template.config.isolated).toBeUndefined();
|
||||||
|
// undefined !== false => isolatedDeployment = true
|
||||||
|
expect(template.config.isolated !== false).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should be isolated when isolated=true is explicitly set", () => {
|
||||||
|
const template: CompleteTemplate = {
|
||||||
|
metadata: {} as any,
|
||||||
|
variables: {},
|
||||||
|
config: {
|
||||||
|
isolated: true,
|
||||||
|
domains: [],
|
||||||
|
env: {},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(template.config.isolated !== false).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should disable isolated deployment when isolated=false", () => {
|
||||||
|
const template: CompleteTemplate = {
|
||||||
|
metadata: {} as any,
|
||||||
|
variables: {},
|
||||||
|
config: {
|
||||||
|
isolated: false,
|
||||||
|
domains: [],
|
||||||
|
env: {},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(template.config.isolated !== false).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -30,9 +30,7 @@ describe("helpers functions", () => {
|
|||||||
const domain = processValue("${domain}", {}, mockSchema);
|
const domain = processValue("${domain}", {}, mockSchema);
|
||||||
expect(domain.startsWith(`${mockSchema.projectName}-`)).toBeTruthy();
|
expect(domain.startsWith(`${mockSchema.projectName}-`)).toBeTruthy();
|
||||||
expect(
|
expect(
|
||||||
domain.endsWith(
|
domain.endsWith(`${mockSchema.serverIp.replaceAll(".", "-")}.sslip.io`),
|
||||||
`${mockSchema.serverIp.replaceAll(".", "-")}.traefik.me`,
|
|
||||||
),
|
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -640,7 +640,7 @@ export const composeRouter = createTRPCRouter({
|
|||||||
name: input.id,
|
name: input.id,
|
||||||
sourceType: "raw",
|
sourceType: "raw",
|
||||||
appName: appName,
|
appName: appName,
|
||||||
isolatedDeployment: true,
|
isolatedDeployment: template.config.config?.isolated !== false,
|
||||||
});
|
});
|
||||||
|
|
||||||
await addNewService(ctx, compose.composeId);
|
await addNewService(ctx, compose.composeId);
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ export interface CompleteTemplate {
|
|||||||
[key: string]: string;
|
[key: string]: string;
|
||||||
};
|
};
|
||||||
config: {
|
config: {
|
||||||
|
isolated?: boolean;
|
||||||
domains: Array<{
|
domains: Array<{
|
||||||
serviceName: string;
|
serviceName: string;
|
||||||
port: number;
|
port: number;
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ export interface CompleteTemplate {
|
|||||||
};
|
};
|
||||||
variables: Record<string, string>;
|
variables: Record<string, string>;
|
||||||
config: {
|
config: {
|
||||||
|
isolated?: boolean;
|
||||||
domains: DomainConfig[];
|
domains: DomainConfig[];
|
||||||
env:
|
env:
|
||||||
| Record<string, string | boolean | number>
|
| Record<string, string | boolean | number>
|
||||||
|
|||||||
Reference in New Issue
Block a user