diff --git a/apps/dokploy/__test__/compose/compose.test.ts b/apps/dokploy/__test__/compose/compose.test.ts index 69d3a5212..b691537a1 100644 --- a/apps/dokploy/__test__/compose/compose.test.ts +++ b/apps/dokploy/__test__/compose/compose.test.ts @@ -1,7 +1,7 @@ import type { ComposeSpecification } from "@dokploy/server"; import { addSuffixToAllProperties } from "@dokploy/server"; -import { load } from "js-yaml"; import { expect, test } from "vitest"; +import { parse } from "yaml"; const composeFile1 = ` version: "3.8" @@ -61,7 +61,7 @@ secrets: file: ./db_password.txt `; -const expectedComposeFile1 = load(` +const expectedComposeFile1 = parse(` version: "3.8" services: @@ -120,7 +120,7 @@ secrets: `) as ComposeSpecification; test("Add suffix to all properties in compose file 1", () => { - const composeData = load(composeFile1) as ComposeSpecification; + const composeData = parse(composeFile1) as ComposeSpecification; const suffix = "testhash"; const updatedComposeData = addSuffixToAllProperties(composeData, suffix); @@ -185,7 +185,7 @@ secrets: file: ./db_password.txt `; -const expectedComposeFile2 = load(` +const expectedComposeFile2 = parse(` version: "3.8" services: @@ -243,7 +243,7 @@ secrets: `) as ComposeSpecification; test("Add suffix to all properties in compose file 2", () => { - const composeData = load(composeFile2) as ComposeSpecification; + const composeData = parse(composeFile2) as ComposeSpecification; const suffix = "testhash"; const updatedComposeData = addSuffixToAllProperties(composeData, suffix); @@ -308,7 +308,7 @@ secrets: file: ./service_secret.txt `; -const expectedComposeFile3 = load(` +const expectedComposeFile3 = parse(` version: "3.8" services: @@ -366,7 +366,7 @@ secrets: `) as ComposeSpecification; test("Add suffix to all properties in compose file 3", () => { - const composeData = load(composeFile3) as ComposeSpecification; + const composeData = parse(composeFile3) as ComposeSpecification; const suffix = "testhash"; const updatedComposeData = addSuffixToAllProperties(composeData, suffix); @@ -420,7 +420,7 @@ volumes: driver: local `; -const expectedComposeFile = load(` +const expectedComposeFile = parse(` version: "3.8" services: @@ -467,7 +467,7 @@ volumes: `) as ComposeSpecification; test("Add suffix to all properties in Plausible compose file", () => { - const composeData = load(composeFile) as ComposeSpecification; + const composeData = parse(composeFile) as ComposeSpecification; const suffix = "testhash"; const updatedComposeData = addSuffixToAllProperties(composeData, suffix); diff --git a/apps/dokploy/__test__/compose/config/config-root.test.ts b/apps/dokploy/__test__/compose/config/config-root.test.ts index 668e17902..a633bab53 100644 --- a/apps/dokploy/__test__/compose/config/config-root.test.ts +++ b/apps/dokploy/__test__/compose/config/config-root.test.ts @@ -1,7 +1,7 @@ import type { ComposeSpecification } from "@dokploy/server"; import { addSuffixToConfigsRoot, generateRandomHash } from "@dokploy/server"; -import { load } from "js-yaml"; import { expect, test } from "vitest"; +import { parse } from "yaml"; test("Generate random hash with 8 characters", () => { const hash = generateRandomHash(); @@ -23,7 +23,7 @@ configs: `; test("Add suffix to configs in root property", () => { - const composeData = load(composeFile) as ComposeSpecification; + const composeData = parse(composeFile) as ComposeSpecification; const suffix = generateRandomHash(); @@ -59,7 +59,7 @@ configs: `; test("Add suffix to multiple configs in root property", () => { - const composeData = load(composeFileMultipleConfigs) as ComposeSpecification; + const composeData = parse(composeFileMultipleConfigs) as ComposeSpecification; const suffix = generateRandomHash(); @@ -92,7 +92,7 @@ configs: `; test("Add suffix to configs with different properties in root property", () => { - const composeData = load( + const composeData = parse( composeFileDifferentProperties, ) as ComposeSpecification; @@ -137,7 +137,7 @@ configs: `; // Expected compose file con el prefijo `testhash` -const expectedComposeFileConfigRoot = load(` +const expectedComposeFileConfigRoot = parse(` version: "3.8" services: @@ -162,7 +162,7 @@ configs: `) as ComposeSpecification; test("Add suffix to configs in root property", () => { - const composeData = load(composeFileConfigRoot) as ComposeSpecification; + const composeData = parse(composeFileConfigRoot) as ComposeSpecification; const suffix = "testhash"; diff --git a/apps/dokploy/__test__/compose/config/config-service.test.ts b/apps/dokploy/__test__/compose/config/config-service.test.ts index 246872f09..08dd696e6 100644 --- a/apps/dokploy/__test__/compose/config/config-service.test.ts +++ b/apps/dokploy/__test__/compose/config/config-service.test.ts @@ -3,8 +3,8 @@ import { addSuffixToConfigsInServices, generateRandomHash, } from "@dokploy/server"; -import { load } from "js-yaml"; import { expect, test } from "vitest"; +import { parse } from "yaml"; const composeFile = ` version: "3.8" @@ -22,7 +22,7 @@ configs: `; test("Add suffix to configs in services", () => { - const composeData = load(composeFile) as ComposeSpecification; + const composeData = parse(composeFile) as ComposeSpecification; const suffix = generateRandomHash(); @@ -54,7 +54,7 @@ configs: `; test("Add suffix to configs in services with single config", () => { - const composeData = load( + const composeData = parse( composeFileSingleServiceConfig, ) as ComposeSpecification; @@ -108,7 +108,7 @@ configs: `; test("Add suffix to configs in services with multiple configs", () => { - const composeData = load( + const composeData = parse( composeFileMultipleServicesConfigs, ) as ComposeSpecification; @@ -157,7 +157,7 @@ services: `; // Expected compose file con el prefijo `testhash` -const expectedComposeFileConfigServices = load(` +const expectedComposeFileConfigServices = parse(` version: "3.8" services: @@ -182,7 +182,7 @@ services: `) as ComposeSpecification; test("Add suffix to configs in services", () => { - const composeData = load(composeFileConfigServices) as ComposeSpecification; + const composeData = parse(composeFileConfigServices) as ComposeSpecification; const suffix = "testhash"; diff --git a/apps/dokploy/__test__/compose/config/config.test.ts b/apps/dokploy/__test__/compose/config/config.test.ts index 2d5feeb9a..3a160431e 100644 --- a/apps/dokploy/__test__/compose/config/config.test.ts +++ b/apps/dokploy/__test__/compose/config/config.test.ts @@ -1,7 +1,7 @@ import type { ComposeSpecification } from "@dokploy/server"; import { addSuffixToAllConfigs, generateRandomHash } from "@dokploy/server"; -import { load } from "js-yaml"; import { expect, test } from "vitest"; +import { parse } from "yaml"; test("Generate random hash with 8 characters", () => { const hash = generateRandomHash(); @@ -43,7 +43,7 @@ configs: file: ./db-config.yml `; -const expectedComposeFileCombinedConfigs = load(` +const expectedComposeFileCombinedConfigs = parse(` version: "3.8" services: @@ -77,7 +77,7 @@ configs: `) as ComposeSpecification; test("Add suffix to all configs in root and services", () => { - const composeData = load(composeFileCombinedConfigs) as ComposeSpecification; + const composeData = parse(composeFileCombinedConfigs) as ComposeSpecification; const suffix = "testhash"; @@ -122,7 +122,7 @@ configs: file: ./db-config.yml `; -const expectedComposeFileWithEnvAndExternal = load(` +const expectedComposeFileWithEnvAndExternal = parse(` version: "3.8" services: @@ -159,7 +159,7 @@ configs: `) as ComposeSpecification; test("Add suffix to configs with environment and external", () => { - const composeData = load( + const composeData = parse( composeFileWithEnvAndExternal, ) as ComposeSpecification; @@ -200,7 +200,7 @@ configs: file: ./db-config.yml `; -const expectedComposeFileWithTemplateDriverAndLabels = load(` +const expectedComposeFileWithTemplateDriverAndLabels = parse(` version: "3.8" services: @@ -231,7 +231,7 @@ configs: `) as ComposeSpecification; test("Add suffix to configs with template driver and labels", () => { - const composeData = load( + const composeData = parse( composeFileWithTemplateDriverAndLabels, ) as ComposeSpecification; diff --git a/apps/dokploy/__test__/compose/network/network-root.test.ts b/apps/dokploy/__test__/compose/network/network-root.test.ts index c55f6fa86..0d3c841d4 100644 --- a/apps/dokploy/__test__/compose/network/network-root.test.ts +++ b/apps/dokploy/__test__/compose/network/network-root.test.ts @@ -1,7 +1,7 @@ import type { ComposeSpecification } from "@dokploy/server"; import { addSuffixToNetworksRoot, generateRandomHash } from "@dokploy/server"; -import { load } from "js-yaml"; import { expect, test } from "vitest"; +import { parse } from "yaml"; const composeFile = ` version: "3.8" @@ -35,7 +35,7 @@ test("Generate random hash with 8 characters", () => { }); test("Add suffix to networks root property", () => { - const composeData = load(composeFile) as ComposeSpecification; + const composeData = parse(composeFile) as ComposeSpecification; const suffix = generateRandomHash(); @@ -79,7 +79,7 @@ networks: `; test("Add suffix to advanced networks root property (2 TRY)", () => { - const composeData = load(composeFile2) as ComposeSpecification; + const composeData = parse(composeFile2) as ComposeSpecification; const suffix = generateRandomHash(); @@ -120,7 +120,7 @@ networks: `; test("Add suffix to networks with external properties", () => { - const composeData = load(composeFile3) as ComposeSpecification; + const composeData = parse(composeFile3) as ComposeSpecification; const suffix = generateRandomHash(); @@ -160,7 +160,7 @@ networks: `; test("Add suffix to networks with IPAM configurations", () => { - const composeData = load(composeFile4) as ComposeSpecification; + const composeData = parse(composeFile4) as ComposeSpecification; const suffix = generateRandomHash(); @@ -201,7 +201,7 @@ networks: `; test("Add suffix to networks with custom options", () => { - const composeData = load(composeFile5) as ComposeSpecification; + const composeData = parse(composeFile5) as ComposeSpecification; const suffix = generateRandomHash(); @@ -264,7 +264,7 @@ networks: `; test("Add suffix to networks with static suffix", () => { - const composeData = load(composeFile6) as ComposeSpecification; + const composeData = parse(composeFile6) as ComposeSpecification; const suffix = "testhash"; @@ -273,7 +273,7 @@ test("Add suffix to networks with static suffix", () => { } const networks = addSuffixToNetworksRoot(composeData.networks, suffix); - const expectedComposeData = load( + const expectedComposeData = parse( expectedComposeFile6, ) as ComposeSpecification; expect(networks).toStrictEqual(expectedComposeData.networks); @@ -293,7 +293,7 @@ networks: `; test("It shoudn't add suffix to dokploy-network", () => { - const composeData = load(composeFile7) as ComposeSpecification; + const composeData = parse(composeFile7) as ComposeSpecification; const suffix = generateRandomHash(); diff --git a/apps/dokploy/__test__/compose/network/network-service.test.ts b/apps/dokploy/__test__/compose/network/network-service.test.ts index 3cf46d4ab..e07fa1546 100644 --- a/apps/dokploy/__test__/compose/network/network-service.test.ts +++ b/apps/dokploy/__test__/compose/network/network-service.test.ts @@ -3,8 +3,8 @@ import { addSuffixToServiceNetworks, generateRandomHash, } from "@dokploy/server"; -import { load } from "js-yaml"; import { expect, test } from "vitest"; +import { parse } from "yaml"; const composeFile = ` version: "3.8" @@ -23,7 +23,7 @@ services: `; test("Add suffix to networks in services", () => { - const composeData = load(composeFile) as ComposeSpecification; + const composeData = parse(composeFile) as ComposeSpecification; const suffix = generateRandomHash(); @@ -67,7 +67,7 @@ networks: `; test("Add suffix to networks in services with aliases", () => { - const composeData = load(composeFile2) as ComposeSpecification; + const composeData = parse(composeFile2) as ComposeSpecification; const suffix = generateRandomHash(); @@ -107,7 +107,7 @@ networks: `; test("Add suffix to networks in services (Object with simple networks)", () => { - const composeData = load(composeFile3) as ComposeSpecification; + const composeData = parse(composeFile3) as ComposeSpecification; const suffix = generateRandomHash(); @@ -153,7 +153,7 @@ networks: `; test("Add suffix to networks in services (combined case)", () => { - const composeData = load(composeFileCombined) as ComposeSpecification; + const composeData = parse(composeFileCombined) as ComposeSpecification; const suffix = generateRandomHash(); @@ -196,7 +196,7 @@ services: `; test("It shoudn't add suffix to dokploy-network in services", () => { - const composeData = load(composeFile7) as ComposeSpecification; + const composeData = parse(composeFile7) as ComposeSpecification; const suffix = generateRandomHash(); @@ -245,7 +245,7 @@ services: `; test("It shoudn't add suffix to dokploy-network in services multiples cases", () => { - const composeData = load(composeFile8) as ComposeSpecification; + const composeData = parse(composeFile8) as ComposeSpecification; const suffix = generateRandomHash(); diff --git a/apps/dokploy/__test__/compose/network/network.test.ts b/apps/dokploy/__test__/compose/network/network.test.ts index 7ba1c6a83..c1900ed74 100644 --- a/apps/dokploy/__test__/compose/network/network.test.ts +++ b/apps/dokploy/__test__/compose/network/network.test.ts @@ -5,8 +5,8 @@ import { addSuffixToServiceNetworks, generateRandomHash, } from "@dokploy/server"; -import { load } from "js-yaml"; import { expect, test } from "vitest"; +import { parse } from "yaml"; const composeFileCombined = ` version: "3.8" @@ -39,7 +39,7 @@ networks: `; test("Add suffix to networks in services and root (combined case)", () => { - const composeData = load(composeFileCombined) as ComposeSpecification; + const composeData = parse(composeFileCombined) as ComposeSpecification; const suffix = generateRandomHash(); @@ -89,7 +89,7 @@ test("Add suffix to networks in services and root (combined case)", () => { expect(redisNetworks).not.toHaveProperty("backend"); }); -const expectedComposeFile = load(` +const expectedComposeFile = parse(` version: "3.8" services: @@ -120,7 +120,7 @@ networks: `); test("Add suffix to networks in compose file", () => { - const composeData = load(composeFileCombined) as ComposeSpecification; + const composeData = parse(composeFileCombined) as ComposeSpecification; const suffix = "testhash"; if (!composeData?.networks) { @@ -156,7 +156,7 @@ networks: driver: bridge `; -const expectedComposeFile2 = load(` +const expectedComposeFile2 = parse(` version: "3.8" services: @@ -182,7 +182,7 @@ networks: `); test("Add suffix to networks in compose file with external and internal networks", () => { - const composeData = load(composeFile2) as ComposeSpecification; + const composeData = parse(composeFile2) as ComposeSpecification; const suffix = "testhash"; const updatedComposeData = addSuffixToAllNetworks(composeData, suffix); @@ -218,7 +218,7 @@ networks: com.docker.network.bridge.enable_icc: "true" `; -const expectedComposeFile3 = load(` +const expectedComposeFile3 = parse(` version: "3.8" services: @@ -247,7 +247,7 @@ networks: `); test("Add suffix to networks in compose file with multiple services and complex network configurations", () => { - const composeData = load(composeFile3) as ComposeSpecification; + const composeData = parse(composeFile3) as ComposeSpecification; const suffix = "testhash"; const updatedComposeData = addSuffixToAllNetworks(composeData, suffix); @@ -289,7 +289,7 @@ networks: `; -const expectedComposeFile4 = load(` +const expectedComposeFile4 = parse(` version: "3.8" services: @@ -326,7 +326,7 @@ networks: `); test("Expect don't add suffix to dokploy-network in compose file with multiple services and complex network configurations", () => { - const composeData = load(composeFile4) as ComposeSpecification; + const composeData = parse(composeFile4) as ComposeSpecification; const suffix = "testhash"; const updatedComposeData = addSuffixToAllNetworks(composeData, suffix); diff --git a/apps/dokploy/__test__/compose/secrets/secret-root.test.ts b/apps/dokploy/__test__/compose/secrets/secret-root.test.ts index b8cef56e4..ef74d64cf 100644 --- a/apps/dokploy/__test__/compose/secrets/secret-root.test.ts +++ b/apps/dokploy/__test__/compose/secrets/secret-root.test.ts @@ -1,7 +1,7 @@ import type { ComposeSpecification } from "@dokploy/server"; import { addSuffixToSecretsRoot, generateRandomHash } from "@dokploy/server"; -import { load } from "js-yaml"; import { expect, test } from "vitest"; +import { parse } from "yaml"; test("Generate random hash with 8 characters", () => { const hash = generateRandomHash(); @@ -23,7 +23,7 @@ secrets: `; test("Add suffix to secrets in root property", () => { - const composeData = load(composeFileSecretsRoot) as ComposeSpecification; + const composeData = parse(composeFileSecretsRoot) as ComposeSpecification; const suffix = generateRandomHash(); if (!composeData?.secrets) { @@ -52,7 +52,7 @@ secrets: `; test("Add suffix to secrets in root property (Test 1)", () => { - const composeData = load(composeFileSecretsRoot1) as ComposeSpecification; + const composeData = parse(composeFileSecretsRoot1) as ComposeSpecification; const suffix = generateRandomHash(); if (!composeData?.secrets) { @@ -84,7 +84,7 @@ secrets: `; test("Add suffix to secrets in root property (Test 2)", () => { - const composeData = load(composeFileSecretsRoot2) as ComposeSpecification; + const composeData = parse(composeFileSecretsRoot2) as ComposeSpecification; const suffix = generateRandomHash(); if (!composeData?.secrets) { diff --git a/apps/dokploy/__test__/compose/secrets/secret-services.test.ts b/apps/dokploy/__test__/compose/secrets/secret-services.test.ts index e12f611d0..a378bd606 100644 --- a/apps/dokploy/__test__/compose/secrets/secret-services.test.ts +++ b/apps/dokploy/__test__/compose/secrets/secret-services.test.ts @@ -3,8 +3,8 @@ import { addSuffixToSecretsInServices, generateRandomHash, } from "@dokploy/server"; -import { load } from "js-yaml"; import { expect, test } from "vitest"; +import { parse } from "yaml"; const composeFileSecretsServices = ` version: "3.8" @@ -21,7 +21,7 @@ secrets: `; test("Add suffix to secrets in services", () => { - const composeData = load(composeFileSecretsServices) as ComposeSpecification; + const composeData = parse(composeFileSecretsServices) as ComposeSpecification; const suffix = generateRandomHash(); if (!composeData.services) { @@ -54,7 +54,9 @@ secrets: `; test("Add suffix to secrets in services (Test 1)", () => { - const composeData = load(composeFileSecretsServices1) as ComposeSpecification; + const composeData = parse( + composeFileSecretsServices1, + ) as ComposeSpecification; const suffix = generateRandomHash(); if (!composeData.services) { @@ -93,7 +95,9 @@ secrets: `; test("Add suffix to secrets in services (Test 2)", () => { - const composeData = load(composeFileSecretsServices2) as ComposeSpecification; + const composeData = parse( + composeFileSecretsServices2, + ) as ComposeSpecification; const suffix = generateRandomHash(); if (!composeData.services) { diff --git a/apps/dokploy/__test__/compose/secrets/secret.test.ts b/apps/dokploy/__test__/compose/secrets/secret.test.ts index 3ff524ad7..3f6544bf1 100644 --- a/apps/dokploy/__test__/compose/secrets/secret.test.ts +++ b/apps/dokploy/__test__/compose/secrets/secret.test.ts @@ -1,7 +1,7 @@ import type { ComposeSpecification } from "@dokploy/server"; import { addSuffixToAllSecrets } from "@dokploy/server"; -import { load } from "js-yaml"; import { expect, test } from "vitest"; +import { parse } from "yaml"; const composeFileCombinedSecrets = ` version: "3.8" @@ -25,7 +25,7 @@ secrets: file: ./app_secret.txt `; -const expectedComposeFileCombinedSecrets = load(` +const expectedComposeFileCombinedSecrets = parse(` version: "3.8" services: @@ -48,7 +48,7 @@ secrets: `) as ComposeSpecification; test("Add suffix to all secrets", () => { - const composeData = load(composeFileCombinedSecrets) as ComposeSpecification; + const composeData = parse(composeFileCombinedSecrets) as ComposeSpecification; const suffix = "testhash"; const updatedComposeData = addSuffixToAllSecrets(composeData, suffix); @@ -77,7 +77,7 @@ secrets: file: ./cache_secret.txt `; -const expectedComposeFileCombinedSecrets3 = load(` +const expectedComposeFileCombinedSecrets3 = parse(` version: "3.8" services: @@ -99,7 +99,9 @@ secrets: `) as ComposeSpecification; test("Add suffix to all secrets (3rd Case)", () => { - const composeData = load(composeFileCombinedSecrets3) as ComposeSpecification; + const composeData = parse( + composeFileCombinedSecrets3, + ) as ComposeSpecification; const suffix = "testhash"; const updatedComposeData = addSuffixToAllSecrets(composeData, suffix); @@ -128,7 +130,7 @@ secrets: file: ./db_password.txt `; -const expectedComposeFileCombinedSecrets4 = load(` +const expectedComposeFileCombinedSecrets4 = parse(` version: "3.8" services: @@ -150,7 +152,9 @@ secrets: `) as ComposeSpecification; test("Add suffix to all secrets (4th Case)", () => { - const composeData = load(composeFileCombinedSecrets4) as ComposeSpecification; + const composeData = parse( + composeFileCombinedSecrets4, + ) as ComposeSpecification; const suffix = "testhash"; const updatedComposeData = addSuffixToAllSecrets(composeData, suffix); diff --git a/apps/dokploy/__test__/compose/service/service-container-name.test.ts b/apps/dokploy/__test__/compose/service/service-container-name.test.ts index 6ad45c588..d6521464d 100644 --- a/apps/dokploy/__test__/compose/service/service-container-name.test.ts +++ b/apps/dokploy/__test__/compose/service/service-container-name.test.ts @@ -1,7 +1,7 @@ import type { ComposeSpecification } from "@dokploy/server"; import { addSuffixToServiceNames, generateRandomHash } from "@dokploy/server"; -import { load } from "js-yaml"; import { expect, test } from "vitest"; +import { parse } from "yaml"; const composeFile = ` version: "3.8" @@ -27,7 +27,7 @@ test("Generate random hash with 8 characters", () => { }); test("Add suffix to service names with container_name in compose file", () => { - const composeData = load(composeFile) as ComposeSpecification; + const composeData = parse(composeFile) as ComposeSpecification; const suffix = generateRandomHash(); diff --git a/apps/dokploy/__test__/compose/service/service-depends-on.test.ts b/apps/dokploy/__test__/compose/service/service-depends-on.test.ts index 14a5789c4..547c309d5 100644 --- a/apps/dokploy/__test__/compose/service/service-depends-on.test.ts +++ b/apps/dokploy/__test__/compose/service/service-depends-on.test.ts @@ -1,7 +1,7 @@ import type { ComposeSpecification } from "@dokploy/server"; import { addSuffixToServiceNames, generateRandomHash } from "@dokploy/server"; -import { load } from "js-yaml"; import { expect, test } from "vitest"; +import { parse } from "yaml"; test("Generate random hash with 8 characters", () => { const hash = generateRandomHash(); @@ -32,7 +32,7 @@ networks: `; test("Add suffix to service names with depends_on (array) in compose file", () => { - const composeData = load(composeFile4) as ComposeSpecification; + const composeData = parse(composeFile4) as ComposeSpecification; const suffix = generateRandomHash(); @@ -102,7 +102,7 @@ networks: `; test("Add suffix to service names with depends_on (object) in compose file", () => { - const composeData = load(composeFile5) as ComposeSpecification; + const composeData = parse(composeFile5) as ComposeSpecification; const suffix = generateRandomHash(); diff --git a/apps/dokploy/__test__/compose/service/service-extends.test.ts b/apps/dokploy/__test__/compose/service/service-extends.test.ts index 0b7e92c53..f539eeebd 100644 --- a/apps/dokploy/__test__/compose/service/service-extends.test.ts +++ b/apps/dokploy/__test__/compose/service/service-extends.test.ts @@ -1,7 +1,7 @@ import type { ComposeSpecification } from "@dokploy/server"; import { addSuffixToServiceNames, generateRandomHash } from "@dokploy/server"; -import { load } from "js-yaml"; import { expect, test } from "vitest"; +import { parse } from "yaml"; test("Generate random hash with 8 characters", () => { const hash = generateRandomHash(); @@ -30,7 +30,7 @@ networks: `; test("Add suffix to service names with extends (string) in compose file", () => { - const composeData = load(composeFile6) as ComposeSpecification; + const composeData = parse(composeFile6) as ComposeSpecification; const suffix = generateRandomHash(); @@ -90,7 +90,7 @@ networks: `; test("Add suffix to service names with extends (object) in compose file", () => { - const composeData = load(composeFile7) as ComposeSpecification; + const composeData = parse(composeFile7) as ComposeSpecification; const suffix = generateRandomHash(); diff --git a/apps/dokploy/__test__/compose/service/service-links.test.ts b/apps/dokploy/__test__/compose/service/service-links.test.ts index 6c8cde39e..4187edce8 100644 --- a/apps/dokploy/__test__/compose/service/service-links.test.ts +++ b/apps/dokploy/__test__/compose/service/service-links.test.ts @@ -1,7 +1,7 @@ import type { ComposeSpecification } from "@dokploy/server"; import { addSuffixToServiceNames, generateRandomHash } from "@dokploy/server"; -import { load } from "js-yaml"; import { expect, test } from "vitest"; +import { parse } from "yaml"; test("Generate random hash with 8 characters", () => { const hash = generateRandomHash(); @@ -31,7 +31,7 @@ networks: `; test("Add suffix to service names with links in compose file", () => { - const composeData = load(composeFile2) as ComposeSpecification; + const composeData = parse(composeFile2) as ComposeSpecification; const suffix = generateRandomHash(); diff --git a/apps/dokploy/__test__/compose/service/service-names.test.ts b/apps/dokploy/__test__/compose/service/service-names.test.ts index c65299b03..c9c9d78c1 100644 --- a/apps/dokploy/__test__/compose/service/service-names.test.ts +++ b/apps/dokploy/__test__/compose/service/service-names.test.ts @@ -1,7 +1,7 @@ import type { ComposeSpecification } from "@dokploy/server"; import { addSuffixToServiceNames, generateRandomHash } from "@dokploy/server"; -import { load } from "js-yaml"; import { expect, test } from "vitest"; +import { parse } from "yaml"; test("Generate random hash with 8 characters", () => { const hash = generateRandomHash(); @@ -26,7 +26,7 @@ networks: `; test("Add suffix to service names in compose file", () => { - const composeData = load(composeFile) as ComposeSpecification; + const composeData = parse(composeFile) as ComposeSpecification; const suffix = generateRandomHash(); diff --git a/apps/dokploy/__test__/compose/service/service.test.ts b/apps/dokploy/__test__/compose/service/service.test.ts index 38895e073..a58e16722 100644 --- a/apps/dokploy/__test__/compose/service/service.test.ts +++ b/apps/dokploy/__test__/compose/service/service.test.ts @@ -3,8 +3,8 @@ import { addSuffixToAllServiceNames, addSuffixToServiceNames, } from "@dokploy/server"; -import { load } from "js-yaml"; import { expect, test } from "vitest"; +import { parse } from "yaml"; const composeFileCombinedAllCases = ` version: "3.8" @@ -38,7 +38,7 @@ networks: driver: bridge `; -const expectedComposeFile = load(` +const expectedComposeFile = parse(` version: "3.8" services: @@ -71,7 +71,9 @@ networks: `); test("Add suffix to all service names in compose file", () => { - const composeData = load(composeFileCombinedAllCases) as ComposeSpecification; + const composeData = parse( + composeFileCombinedAllCases, + ) as ComposeSpecification; const suffix = "testhash"; @@ -131,7 +133,7 @@ networks: driver: bridge `; -const expectedComposeFile1 = load(` +const expectedComposeFile1 = parse(` version: "3.8" services: @@ -176,7 +178,7 @@ networks: `) as ComposeSpecification; test("Add suffix to all service names in compose file 1", () => { - const composeData = load(composeFile1) as ComposeSpecification; + const composeData = parse(composeFile1) as ComposeSpecification; const suffix = "testhash"; const updatedComposeData = addSuffixToAllServiceNames(composeData, suffix); @@ -227,7 +229,7 @@ networks: driver: bridge `; -const expectedComposeFile2 = load(` +const expectedComposeFile2 = parse(` version: "3.8" services: @@ -271,7 +273,7 @@ networks: `) as ComposeSpecification; test("Add suffix to all service names in compose file 2", () => { - const composeData = load(composeFile2) as ComposeSpecification; + const composeData = parse(composeFile2) as ComposeSpecification; const suffix = "testhash"; const updatedComposeData = addSuffixToAllServiceNames(composeData, suffix); @@ -322,7 +324,7 @@ networks: driver: bridge `; -const expectedComposeFile3 = load(` +const expectedComposeFile3 = parse(` version: "3.8" services: @@ -366,7 +368,7 @@ networks: `) as ComposeSpecification; test("Add suffix to all service names in compose file 3", () => { - const composeData = load(composeFile3) as ComposeSpecification; + const composeData = parse(composeFile3) as ComposeSpecification; const suffix = "testhash"; const updatedComposeData = addSuffixToAllServiceNames(composeData, suffix); diff --git a/apps/dokploy/__test__/compose/service/sevice-volumes-from.test.ts b/apps/dokploy/__test__/compose/service/sevice-volumes-from.test.ts index 8aa8296e8..1de94b894 100644 --- a/apps/dokploy/__test__/compose/service/sevice-volumes-from.test.ts +++ b/apps/dokploy/__test__/compose/service/sevice-volumes-from.test.ts @@ -1,7 +1,7 @@ import type { ComposeSpecification } from "@dokploy/server"; import { addSuffixToServiceNames, generateRandomHash } from "@dokploy/server"; -import { load } from "js-yaml"; import { expect, test } from "vitest"; +import { parse } from "yaml"; test("Generate random hash with 8 characters", () => { const hash = generateRandomHash(); @@ -35,7 +35,7 @@ networks: `; test("Add suffix to service names with volumes_from in compose file", () => { - const composeData = load(composeFile3) as ComposeSpecification; + const composeData = parse(composeFile3) as ComposeSpecification; const suffix = generateRandomHash(); diff --git a/apps/dokploy/__test__/compose/volume/volume-2.test.ts b/apps/dokploy/__test__/compose/volume/volume-2.test.ts index 6aa9d01d3..7ffbc4c1a 100644 --- a/apps/dokploy/__test__/compose/volume/volume-2.test.ts +++ b/apps/dokploy/__test__/compose/volume/volume-2.test.ts @@ -4,8 +4,8 @@ import { addSuffixToVolumesRoot, generateRandomHash, } from "@dokploy/server"; -import { load } from "js-yaml"; import { expect, test } from "vitest"; +import { parse } from "yaml"; const composeFile = ` services: @@ -70,7 +70,7 @@ volumes: driver: local `; -const expectedDockerCompose = load(` +const expectedDockerCompose = parse(` services: mail: image: bytemark/smtp @@ -143,7 +143,7 @@ test("Generate random hash with 8 characters", () => { // Docker compose needs unique names for services, volumes, networks and containers // So base on a input which is a dockercompose file, it should replace the name with a hash and return a new dockercompose file test("Add suffix to volumes root property", () => { - const composeData = load(composeFile) as ComposeSpecification; + const composeData = parse(composeFile) as ComposeSpecification; const suffix = generateRandomHash(); @@ -165,7 +165,7 @@ test("Add suffix to volumes root property", () => { }); test("Expect to change the suffix in all the possible places", () => { - const composeData = load(composeFile) as ComposeSpecification; + const composeData = parse(composeFile) as ComposeSpecification; const suffix = "testhash"; const updatedComposeData = addSuffixToAllVolumes(composeData, suffix); @@ -195,7 +195,7 @@ volumes: mongo-data: `; -const expectedDockerCompose2 = load(` +const expectedDockerCompose2 = parse(` version: '3.8' services: app: @@ -218,7 +218,7 @@ volumes: `) as ComposeSpecification; test("Expect to change the suffix in all the possible places (2 Try)", () => { - const composeData = load(composeFile2) as ComposeSpecification; + const composeData = parse(composeFile2) as ComposeSpecification; const suffix = "testhash"; const updatedComposeData = addSuffixToAllVolumes(composeData, suffix); @@ -248,7 +248,7 @@ volumes: mongo-data: `; -const expectedDockerCompose3 = load(` +const expectedDockerCompose3 = parse(` version: '3.8' services: app: @@ -271,7 +271,7 @@ volumes: `) as ComposeSpecification; test("Expect to change the suffix in all the possible places (3 Try)", () => { - const composeData = load(composeFile3) as ComposeSpecification; + const composeData = parse(composeFile3) as ComposeSpecification; const suffix = "testhash"; const updatedComposeData = addSuffixToAllVolumes(composeData, suffix); @@ -645,7 +645,7 @@ volumes: db-config: `; -const expectedDockerComposeComplex = load(` +const expectedDockerComposeComplex = parse(` version: "3.8" services: studio: @@ -1012,7 +1012,7 @@ volumes: `); test("Expect to change the suffix in all the possible places (4 Try)", () => { - const composeData = load(composeFileComplex) as ComposeSpecification; + const composeData = parse(composeFileComplex) as ComposeSpecification; const suffix = "testhash"; const updatedComposeData = addSuffixToAllVolumes(composeData, suffix); @@ -1065,7 +1065,7 @@ volumes: db-data: `; -const expectedDockerComposeExample1 = load(` +const expectedDockerComposeExample1 = parse(` version: "3.8" services: web: @@ -1111,7 +1111,7 @@ volumes: `) as ComposeSpecification; test("Expect to change the suffix in all the possible places (5 Try)", () => { - const composeData = load(composeFileExample1) as ComposeSpecification; + const composeData = parse(composeFileExample1) as ComposeSpecification; const suffix = "testhash"; const updatedComposeData = addSuffixToAllVolumes(composeData, suffix); @@ -1143,7 +1143,7 @@ volumes: backrest-cache: `; -const expectedDockerComposeBackrest = load(` +const expectedDockerComposeBackrest = parse(` services: backrest: image: garethgeorge/backrest:v1.7.3 @@ -1168,7 +1168,7 @@ volumes: `) as ComposeSpecification; test("Should handle volume paths with subdirectories correctly", () => { - const composeData = load(composeFileBackrest) as ComposeSpecification; + const composeData = parse(composeFileBackrest) as ComposeSpecification; const suffix = "testhash"; const updatedComposeData = addSuffixToAllVolumes(composeData, suffix); diff --git a/apps/dokploy/__test__/compose/volume/volume-root.test.ts b/apps/dokploy/__test__/compose/volume/volume-root.test.ts index 80db1f0cc..69afb7f99 100644 --- a/apps/dokploy/__test__/compose/volume/volume-root.test.ts +++ b/apps/dokploy/__test__/compose/volume/volume-root.test.ts @@ -1,7 +1,7 @@ import type { ComposeSpecification } from "@dokploy/server"; import { addSuffixToVolumesRoot, generateRandomHash } from "@dokploy/server"; -import { load } from "js-yaml"; import { expect, test } from "vitest"; +import { parse } from "yaml"; const composeFile = ` version: "3.8" @@ -29,7 +29,7 @@ test("Generate random hash with 8 characters", () => { }); test("Add suffix to volumes in root property", () => { - const composeData = load(composeFile) as ComposeSpecification; + const composeData = parse(composeFile) as ComposeSpecification; const suffix = generateRandomHash(); @@ -67,7 +67,7 @@ networks: `; test("Add suffix to volumes in root property (Case 2)", () => { - const composeData = load(composeFile2) as ComposeSpecification; + const composeData = parse(composeFile2) as ComposeSpecification; const suffix = generateRandomHash(); @@ -101,7 +101,7 @@ networks: `; test("Add suffix to volumes in root property (Case 3)", () => { - const composeData = load(composeFile3) as ComposeSpecification; + const composeData = parse(composeFile3) as ComposeSpecification; const suffix = generateRandomHash(); @@ -148,7 +148,7 @@ volumes: `; // Expected compose file con el prefijo `testhash` -const expectedComposeFile4 = load(` +const expectedComposeFile4 = parse(` version: "3.8" services: @@ -179,7 +179,7 @@ volumes: `) as ComposeSpecification; test("Add suffix to volumes in root property", () => { - const composeData = load(composeFile4) as ComposeSpecification; + const composeData = parse(composeFile4) as ComposeSpecification; const suffix = "testhash"; diff --git a/apps/dokploy/__test__/compose/volume/volume-services.test.ts b/apps/dokploy/__test__/compose/volume/volume-services.test.ts index 0e9cb018f..a42ab5fa9 100644 --- a/apps/dokploy/__test__/compose/volume/volume-services.test.ts +++ b/apps/dokploy/__test__/compose/volume/volume-services.test.ts @@ -3,8 +3,8 @@ import { addSuffixToVolumesInServices, generateRandomHash, } from "@dokploy/server"; -import { load } from "js-yaml"; import { expect, test } from "vitest"; +import { parse } from "yaml"; test("Generate random hash with 8 characters", () => { const hash = generateRandomHash(); @@ -24,7 +24,7 @@ services: `; test("Add suffix to volumes declared directly in services", () => { - const composeData = load(composeFile1) as ComposeSpecification; + const composeData = parse(composeFile1) as ComposeSpecification; const suffix = generateRandomHash(); @@ -59,7 +59,7 @@ volumes: `; test("Add suffix to volumes declared directly in services (Case 2)", () => { - const composeData = load(composeFileTypeVolume) as ComposeSpecification; + const composeData = parse(composeFileTypeVolume) as ComposeSpecification; const suffix = generateRandomHash(); diff --git a/apps/dokploy/__test__/compose/volume/volume.test.ts b/apps/dokploy/__test__/compose/volume/volume.test.ts index 6f8e76708..2ccd12da6 100644 --- a/apps/dokploy/__test__/compose/volume/volume.test.ts +++ b/apps/dokploy/__test__/compose/volume/volume.test.ts @@ -1,7 +1,7 @@ import type { ComposeSpecification } from "@dokploy/server"; import { addSuffixToAllVolumes } from "@dokploy/server"; -import { load } from "js-yaml"; import { expect, test } from "vitest"; +import { parse } from "yaml"; const composeFileTypeVolume = ` version: "3.8" @@ -23,7 +23,7 @@ volumes: driver: local `; -const expectedComposeFileTypeVolume = load(` +const expectedComposeFileTypeVolume = parse(` version: "3.8" services: @@ -44,7 +44,7 @@ volumes: `) as ComposeSpecification; test("Add suffix to volumes with type: volume in services", () => { - const composeData = load(composeFileTypeVolume) as ComposeSpecification; + const composeData = parse(composeFileTypeVolume) as ComposeSpecification; const suffix = "testhash"; @@ -73,7 +73,7 @@ volumes: driver: local `; -const expectedComposeFileTypeVolume1 = load(` +const expectedComposeFileTypeVolume1 = parse(` version: "3.8" services: @@ -93,7 +93,7 @@ volumes: `) as ComposeSpecification; test("Add suffix to mixed volumes in services", () => { - const composeData = load(composeFileTypeVolume1) as ComposeSpecification; + const composeData = parse(composeFileTypeVolume1) as ComposeSpecification; const suffix = "testhash"; @@ -128,7 +128,7 @@ volumes: device: /path/to/app/logs `; -const expectedComposeFileTypeVolume2 = load(` +const expectedComposeFileTypeVolume2 = parse(` version: "3.8" services: @@ -154,7 +154,7 @@ volumes: `) as ComposeSpecification; test("Add suffix to complex volume configurations in services", () => { - const composeData = load(composeFileTypeVolume2) as ComposeSpecification; + const composeData = parse(composeFileTypeVolume2) as ComposeSpecification; const suffix = "testhash"; @@ -218,7 +218,7 @@ volumes: device: /path/to/shared/logs `; -const expectedComposeFileTypeVolume3 = load(` +const expectedComposeFileTypeVolume3 = parse(` version: "3.8" services: @@ -273,7 +273,7 @@ volumes: `) as ComposeSpecification; test("Add suffix to complex nested volumes configuration in services", () => { - const composeData = load(composeFileTypeVolume3) as ComposeSpecification; + const composeData = parse(composeFileTypeVolume3) as ComposeSpecification; const suffix = "testhash"; diff --git a/apps/dokploy/__test__/drop/drop.test.ts b/apps/dokploy/__test__/drop/drop.test.ts index b597b3aa4..54a3fba4d 100644 --- a/apps/dokploy/__test__/drop/drop.test.ts +++ b/apps/dokploy/__test__/drop/drop.test.ts @@ -133,6 +133,7 @@ const baseApp: ApplicationNested = { username: null, dockerContextPath: null, rollbackActive: false, + stopGracePeriodSwarm: null, }; describe("unzipDrop using real zip files", () => { diff --git a/apps/dokploy/__test__/server/mechanizeDockerContainer.test.ts b/apps/dokploy/__test__/server/mechanizeDockerContainer.test.ts new file mode 100644 index 000000000..6eb5d1831 --- /dev/null +++ b/apps/dokploy/__test__/server/mechanizeDockerContainer.test.ts @@ -0,0 +1,102 @@ +import { beforeEach, describe, expect, it, vi } from "vitest"; + +import type { ApplicationNested } from "@dokploy/server/utils/builders"; +import { mechanizeDockerContainer } from "@dokploy/server/utils/builders"; + +type MockCreateServiceOptions = { + StopGracePeriod?: number; + [key: string]: unknown; +}; + +const { inspectMock, getServiceMock, createServiceMock, getRemoteDockerMock } = + vi.hoisted(() => { + const inspect = vi.fn<[], Promise>(); + const getService = vi.fn(() => ({ inspect })); + const createService = vi.fn<[MockCreateServiceOptions], Promise>( + async () => undefined, + ); + const getRemoteDocker = vi.fn(async () => ({ + getService, + createService, + })); + return { + inspectMock: inspect, + getServiceMock: getService, + createServiceMock: createService, + getRemoteDockerMock: getRemoteDocker, + }; + }); + +vi.mock("@dokploy/server/utils/servers/remote-docker", () => ({ + getRemoteDocker: getRemoteDockerMock, +})); + +const createApplication = ( + overrides: Partial = {}, +): ApplicationNested => + ({ + appName: "test-app", + buildType: "dockerfile", + env: null, + mounts: [], + cpuLimit: null, + memoryLimit: null, + memoryReservation: null, + cpuReservation: null, + command: null, + ports: [], + sourceType: "docker", + dockerImage: "example:latest", + registry: null, + environment: { + project: { env: null }, + env: null, + }, + replicas: 1, + stopGracePeriodSwarm: 0n, + serverId: "server-id", + ...overrides, + }) as unknown as ApplicationNested; + +describe("mechanizeDockerContainer", () => { + beforeEach(() => { + inspectMock.mockReset(); + inspectMock.mockRejectedValue(new Error("service not found")); + getServiceMock.mockClear(); + createServiceMock.mockClear(); + getRemoteDockerMock.mockClear(); + getRemoteDockerMock.mockResolvedValue({ + getService: getServiceMock, + createService: createServiceMock, + }); + }); + + it("converts bigint stopGracePeriodSwarm to a number and keeps zero values", async () => { + const application = createApplication({ stopGracePeriodSwarm: 0n }); + + await mechanizeDockerContainer(application); + + expect(createServiceMock).toHaveBeenCalledTimes(1); + const call = createServiceMock.mock.calls[0]; + if (!call) { + throw new Error("createServiceMock should have been called once"); + } + const [settings] = call; + expect(settings.StopGracePeriod).toBe(0); + expect(typeof settings.StopGracePeriod).toBe("number"); + }); + + it("omits StopGracePeriod when stopGracePeriodSwarm is null", async () => { + const application = createApplication({ stopGracePeriodSwarm: null }); + + await mechanizeDockerContainer(application); + + expect(createServiceMock).toHaveBeenCalledTimes(1); + const call = createServiceMock.mock.calls[0]; + if (!call) { + throw new Error("createServiceMock should have been called once"); + } + const [settings] = call; + expect(settings).not.toHaveProperty("StopGracePeriod"); + }); +}); diff --git a/apps/dokploy/__test__/traefik/traefik.test.ts b/apps/dokploy/__test__/traefik/traefik.test.ts index 5be96e473..88c6c3b38 100644 --- a/apps/dokploy/__test__/traefik/traefik.test.ts +++ b/apps/dokploy/__test__/traefik/traefik.test.ts @@ -111,6 +111,7 @@ const baseApp: ApplicationNested = { updateConfigSwarm: null, username: null, dockerContextPath: null, + stopGracePeriodSwarm: null, }; const baseDomain: Domain = { diff --git a/apps/dokploy/components/dashboard/application/advanced/cluster/modify-swarm-settings.tsx b/apps/dokploy/components/dashboard/application/advanced/cluster/modify-swarm-settings.tsx index 9e10f43ec..4227eeb44 100644 --- a/apps/dokploy/components/dashboard/application/advanced/cluster/modify-swarm-settings.tsx +++ b/apps/dokploy/components/dashboard/application/advanced/cluster/modify-swarm-settings.tsx @@ -25,6 +25,7 @@ import { FormLabel, FormMessage, } from "@/components/ui/form"; +import { Input } from "@/components/ui/input"; import { Tooltip, TooltipContent, @@ -176,10 +177,18 @@ const addSwarmSettings = z.object({ modeSwarm: createStringToJSONSchema(ServiceModeSwarmSchema).nullable(), labelsSwarm: createStringToJSONSchema(LabelsSwarmSchema).nullable(), networkSwarm: createStringToJSONSchema(NetworkSwarmSchema).nullable(), + stopGracePeriodSwarm: z.bigint().nullable(), }); type AddSwarmSettings = z.infer; +const hasStopGracePeriodSwarm = ( + value: unknown, +): value is { stopGracePeriodSwarm: bigint | number | string | null } => + typeof value === "object" && + value !== null && + "stopGracePeriodSwarm" in value; + interface Props { id: string; type: "postgres" | "mariadb" | "mongo" | "mysql" | "redis" | "application"; @@ -224,12 +233,22 @@ export const AddSwarmSettings = ({ id, type }: Props) => { modeSwarm: null, labelsSwarm: null, networkSwarm: null, + stopGracePeriodSwarm: null, }, resolver: zodResolver(addSwarmSettings), }); useEffect(() => { if (data) { + const stopGracePeriodValue = hasStopGracePeriodSwarm(data) + ? data.stopGracePeriodSwarm + : null; + const normalizedStopGracePeriod = + stopGracePeriodValue === null || stopGracePeriodValue === undefined + ? null + : typeof stopGracePeriodValue === "bigint" + ? stopGracePeriodValue + : BigInt(stopGracePeriodValue); form.reset({ healthCheckSwarm: data.healthCheckSwarm ? JSON.stringify(data.healthCheckSwarm, null, 2) @@ -255,6 +274,7 @@ export const AddSwarmSettings = ({ id, type }: Props) => { networkSwarm: data.networkSwarm ? JSON.stringify(data.networkSwarm, null, 2) : null, + stopGracePeriodSwarm: normalizedStopGracePeriod, }); } }, [form, form.reset, data]); @@ -275,6 +295,7 @@ export const AddSwarmSettings = ({ id, type }: Props) => { modeSwarm: data.modeSwarm, labelsSwarm: data.labelsSwarm, networkSwarm: data.networkSwarm, + stopGracePeriodSwarm: data.stopGracePeriodSwarm ?? null, }) .then(async () => { toast.success("Swarm settings updated"); @@ -352,9 +373,9 @@ export const AddSwarmSettings = ({ id, type }: Props) => { language="json" placeholder={`{ "Test" : ["CMD-SHELL", "curl -f http://localhost:3000/health"], - "Interval" : 10000, - "Timeout" : 10000, - "StartPeriod" : 10000, + "Interval" : 10000000000, + "Timeout" : 10000000000, + "StartPeriod" : 10000000000, "Retries" : 10 }`} className="h-[12rem] font-mono" @@ -407,9 +428,9 @@ export const AddSwarmSettings = ({ id, type }: Props) => { language="json" placeholder={`{ "Condition" : "on-failure", - "Delay" : 10000, + "Delay" : 10000000000, "MaxAttempts" : 10, - "Window" : 10000 + "Window" : 10000000000 } `} className="h-[12rem] font-mono" {...field} @@ -529,9 +550,9 @@ export const AddSwarmSettings = ({ id, type }: Props) => { language="json" placeholder={`{ "Parallelism" : 1, - "Delay" : 10000, + "Delay" : 10000000000, "FailureAction" : "continue", - "Monitor" : 10000, + "Monitor" : 10000000000, "MaxFailureRatio" : 10, "Order" : "start-first" }`} @@ -587,9 +608,9 @@ export const AddSwarmSettings = ({ id, type }: Props) => { language="json" placeholder={`{ "Parallelism" : 1, - "Delay" : 10000, + "Delay" : 10000000000, "FailureAction" : "continue", - "Monitor" : 10000, + "Monitor" : 10000000000, "MaxFailureRatio" : 10, "Order" : "start-first" }`} @@ -774,7 +795,57 @@ export const AddSwarmSettings = ({ id, type }: Props) => { )} /> - + ( + + Stop Grace Period (nanoseconds) + + + + + Duration in nanoseconds + + + + + +
+														{`Enter duration in nanoseconds:
+														• 30000000000 - 30 seconds
+														• 120000000000 - 2 minutes  
+														• 3600000000000 - 1 hour
+														• 0 - no grace period`}
+													
+
+
+
+
+ + + field.onChange( + e.target.value ? BigInt(e.target.value) : null, + ) + } + /> + +
+										
+									
+
+ )} + />