From 2f5cd620c5ddab82346ecd78e0d7ffab12854977 Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Sun, 7 Sep 2025 13:26:19 -0600 Subject: [PATCH 1/3] feat(settings): add error handling for unsupported resource types in Traefik setup - Introduced error handling for unsupported resource types in `readPorts` and `writeTraefikSetup` functions. - Enhanced `initializeStandaloneTraefik` to include image pulling with error logging for better debugging. --- packages/server/src/services/settings.ts | 7 ++++++- packages/server/src/setup/traefik-setup.ts | 19 +++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/packages/server/src/services/settings.ts b/packages/server/src/services/settings.ts index f39064523..301573cb4 100644 --- a/packages/server/src/services/settings.ts +++ b/packages/server/src/services/settings.ts @@ -342,6 +342,8 @@ export const readPorts = async ( command = `docker service inspect ${resourceName} --format '{{json .Spec.EndpointSpec.Ports}}'`; } else if (resourceType === "standalone") { command = `docker container inspect ${resourceName} --format '{{json .NetworkSettings.Ports}}'`; + } else { + throw new Error("Resource type not found"); } let result = ""; if (serverId) { @@ -397,17 +399,20 @@ export const writeTraefikSetup = async (input: TraefikOptions) => { "dokploy-traefik", input.serverId, ); + if (resourceType === "service") { await initializeTraefikService({ env: input.env, additionalPorts: input.additionalPorts, serverId: input.serverId, }); - } else { + } else if (resourceType === "standalone") { await initializeStandaloneTraefik({ env: input.env, additionalPorts: input.additionalPorts, serverId: input.serverId, }); + } else { + throw new Error("Traefik resource type not found"); } }; diff --git a/packages/server/src/setup/traefik-setup.ts b/packages/server/src/setup/traefik-setup.ts index 17c48d0ff..6b98457b9 100644 --- a/packages/server/src/setup/traefik-setup.ts +++ b/packages/server/src/setup/traefik-setup.ts @@ -87,16 +87,27 @@ export const initializeStandaloneTraefik = async ({ }; const docker = await getRemoteDocker(serverId); + try { + await docker.pull(imageName); + await new Promise((resolve) => setTimeout(resolve, 3000)); + console.log("Traefik Image Pulled ✅"); + } catch (error) { + console.log("Traefik Image Not Found: Pulling ", error); + } try { const container = docker.getContainer(containerName); await container.remove({ force: true }); await new Promise((resolve) => setTimeout(resolve, 5000)); } catch {} - await docker.createContainer(settings); - const newContainer = docker.getContainer(containerName); - await newContainer.start(); - console.log("Traefik Started ✅"); + try { + await docker.createContainer(settings); + const newContainer = docker.getContainer(containerName); + await newContainer.start(); + console.log("Traefik Started ✅"); + } catch (error) { + console.log("Traefik Not Found: Starting ", error); + } }; export const initializeTraefikService = async ({ From 3eaeaa1db4347017686eac02c792bf55878fecca Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Sun, 7 Sep 2025 13:31:38 -0600 Subject: [PATCH 2/3] chore(package): bump version from v0.25.0 to v0.25.1 --- apps/dokploy/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/dokploy/package.json b/apps/dokploy/package.json index 66d9f7edd..883b0f880 100644 --- a/apps/dokploy/package.json +++ b/apps/dokploy/package.json @@ -1,6 +1,6 @@ { "name": "dokploy", - "version": "v0.25.0", + "version": "v0.25.1", "private": true, "license": "Apache-2.0", "type": "module", From 24729f35ec495b04c0a46ab62246ed2e9c6940f2 Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Sun, 7 Sep 2025 14:03:10 -0600 Subject: [PATCH 3/3] fix(traefik): remove error toast on dashboard action failure --- .../settings/servers/actions/show-traefik-actions.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/apps/dokploy/components/dashboard/settings/servers/actions/show-traefik-actions.tsx b/apps/dokploy/components/dashboard/settings/servers/actions/show-traefik-actions.tsx index 38039cc6b..d9573ca74 100644 --- a/apps/dokploy/components/dashboard/settings/servers/actions/show-traefik-actions.tsx +++ b/apps/dokploy/components/dashboard/settings/servers/actions/show-traefik-actions.tsx @@ -97,11 +97,7 @@ export const ShowTraefikActions = ({ serverId }: Props) => { ); refetchDashboard(); }) - .catch(() => { - toast.error( - `${haveTraefikDashboardPortEnabled ? "Disabled" : "Enabled"} Dashboard`, - ); - }); + .catch(() => {}); }} className="w-full cursor-pointer space-x-3" >