Skip to content

Commit 0f526af

Browse files
authored
Merge pull request #4370 from Dokploy/fix/template-isolated-deployment
feat(templates): support isolated = false opt-out in template.toml
2 parents 8227a48 + 72f5d71 commit 0f526af

5 files changed

Lines changed: 49 additions & 4 deletions

File tree

apps/dokploy/__test__/templates/config.template.test.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,4 +494,49 @@ describe("processTemplate", () => {
494494
expect(result.mounts).toHaveLength(1);
495495
});
496496
});
497+
498+
describe("isolated deployment config", () => {
499+
it("should default to isolated=true when not specified", () => {
500+
const template: CompleteTemplate = {
501+
metadata: {} as any,
502+
variables: {},
503+
config: {
504+
domains: [],
505+
env: {},
506+
},
507+
};
508+
509+
expect(template.config.isolated).toBeUndefined();
510+
// undefined !== false => isolatedDeployment = true
511+
expect(template.config.isolated !== false).toBe(true);
512+
});
513+
514+
it("should be isolated when isolated=true is explicitly set", () => {
515+
const template: CompleteTemplate = {
516+
metadata: {} as any,
517+
variables: {},
518+
config: {
519+
isolated: true,
520+
domains: [],
521+
env: {},
522+
},
523+
};
524+
525+
expect(template.config.isolated !== false).toBe(true);
526+
});
527+
528+
it("should disable isolated deployment when isolated=false", () => {
529+
const template: CompleteTemplate = {
530+
metadata: {} as any,
531+
variables: {},
532+
config: {
533+
isolated: false,
534+
domains: [],
535+
env: {},
536+
},
537+
};
538+
539+
expect(template.config.isolated !== false).toBe(false);
540+
});
541+
});
497542
});

apps/dokploy/__test__/templates/helpers.template.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ describe("helpers functions", () => {
3030
const domain = processValue("${domain}", {}, mockSchema);
3131
expect(domain.startsWith(`${mockSchema.projectName}-`)).toBeTruthy();
3232
expect(
33-
domain.endsWith(
34-
`${mockSchema.serverIp.replaceAll(".", "-")}.traefik.me`,
35-
),
33+
domain.endsWith(`${mockSchema.serverIp.replaceAll(".", "-")}.sslip.io`),
3634
).toBeTruthy();
3735
});
3836
});

apps/dokploy/server/api/routers/compose.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ export const composeRouter = createTRPCRouter({
640640
name: input.id,
641641
sourceType: "raw",
642642
appName: appName,
643-
isolatedDeployment: true,
643+
isolatedDeployment: template.config.config?.isolated !== false,
644644
});
645645

646646
await addNewService(ctx, compose.composeId);

packages/server/src/templates/github.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export interface CompleteTemplate {
2121
[key: string]: string;
2222
};
2323
config: {
24+
isolated?: boolean;
2425
domains: Array<{
2526
serviceName: string;
2627
port: number;

packages/server/src/templates/processors.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export interface CompleteTemplate {
4545
};
4646
variables: Record<string, string>;
4747
config: {
48+
isolated?: boolean;
4849
domains: DomainConfig[];
4950
env:
5051
| Record<string, string | boolean | number>

0 commit comments

Comments
 (0)