diff --git a/apps/dokploy/pages/api/deploy/[refreshToken].ts b/apps/dokploy/pages/api/deploy/[refreshToken].ts index 78e026257..415ece29b 100644 --- a/apps/dokploy/pages/api/deploy/[refreshToken].ts +++ b/apps/dokploy/pages/api/deploy/[refreshToken].ts @@ -242,17 +242,19 @@ export default async function handler( if (IS_CLOUD && application.serverId) { jobData.serverId = application.serverId; - await deploy(jobData); - return true; + deploy(jobData).catch((error) => { + console.error("Background deployment failed:", error); + }); + } else { + await myQueue.add( + "deployments", + { ...jobData }, + { + removeOnComplete: true, + removeOnFail: true, + }, + ); } - await myQueue.add( - "deployments", - { ...jobData }, - { - removeOnComplete: true, - removeOnFail: true, - }, - ); } catch (error) { res.status(400).json({ message: "Error deploying Application", error }); return; diff --git a/apps/dokploy/pages/api/deploy/compose/[refreshToken].ts b/apps/dokploy/pages/api/deploy/compose/[refreshToken].ts index 61c7f7157..d9b5ef2a2 100644 --- a/apps/dokploy/pages/api/deploy/compose/[refreshToken].ts +++ b/apps/dokploy/pages/api/deploy/compose/[refreshToken].ts @@ -179,17 +179,19 @@ export default async function handler( if (IS_CLOUD && composeResult.serverId) { jobData.serverId = composeResult.serverId; - await deploy(jobData); - return true; + deploy(jobData).catch((error) => { + console.error("Background deployment failed:", error); + }); + } else { + await myQueue.add( + "deployments", + { ...jobData }, + { + removeOnComplete: true, + removeOnFail: true, + }, + ); } - await myQueue.add( - "deployments", - { ...jobData }, - { - removeOnComplete: true, - removeOnFail: true, - }, - ); } catch (error) { res.status(400).json({ message: "Error deploying Compose", error }); return; diff --git a/apps/dokploy/pages/api/deploy/github.ts b/apps/dokploy/pages/api/deploy/github.ts index 92cf3dc9e..9369e800e 100644 --- a/apps/dokploy/pages/api/deploy/github.ts +++ b/apps/dokploy/pages/api/deploy/github.ts @@ -128,7 +128,9 @@ export default async function handler( if (IS_CLOUD && app.serverId) { jobData.serverId = app.serverId; - await deploy(jobData); + deploy(jobData).catch((error) => { + console.error("Background deployment failed:", error); + }); continue; } await myQueue.add( @@ -165,7 +167,9 @@ export default async function handler( if (IS_CLOUD && composeApp.serverId) { jobData.serverId = composeApp.serverId; - await deploy(jobData); + deploy(jobData).catch((error) => { + console.error("Background deployment failed:", error); + }); continue; } @@ -246,7 +250,9 @@ export default async function handler( if (IS_CLOUD && app.serverId) { jobData.serverId = app.serverId; - await deploy(jobData); + deploy(jobData).catch((error) => { + console.error("Background deployment failed:", error); + }); continue; } await myQueue.add( @@ -291,7 +297,9 @@ export default async function handler( } if (IS_CLOUD && composeApp.serverId) { jobData.serverId = composeApp.serverId; - await deploy(jobData); + deploy(jobData).catch((error) => { + console.error("Background deployment failed:", error); + }); continue; } @@ -491,7 +499,9 @@ export default async function handler( if (IS_CLOUD && app.serverId) { jobData.serverId = app.serverId; - await deploy(jobData); + deploy(jobData).catch((error) => { + console.error("Background deployment failed:", error); + }); continue; } await myQueue.add( diff --git a/apps/dokploy/server/api/routers/application.ts b/apps/dokploy/server/api/routers/application.ts index 4149c79f0..c0666fcc7 100644 --- a/apps/dokploy/server/api/routers/application.ts +++ b/apps/dokploy/server/api/routers/application.ts @@ -336,7 +336,9 @@ export const applicationRouter = createTRPCRouter({ if (IS_CLOUD && application.serverId) { jobData.serverId = application.serverId; - await deploy(jobData); + deploy(jobData).catch((error) => { + console.error("Background deployment failed:", error); + }); return true; } await myQueue.add( @@ -701,7 +703,9 @@ export const applicationRouter = createTRPCRouter({ }; if (IS_CLOUD && application.serverId) { jobData.serverId = application.serverId; - await deploy(jobData); + deploy(jobData).catch((error) => { + console.error("Background deployment failed:", error); + }); return true; } @@ -813,7 +817,9 @@ export const applicationRouter = createTRPCRouter({ }; if (IS_CLOUD && app.serverId) { jobData.serverId = app.serverId; - await deploy(jobData); + deploy(jobData).catch((error) => { + console.error("Background deployment failed:", error); + }); return true; } diff --git a/apps/dokploy/server/api/routers/compose.ts b/apps/dokploy/server/api/routers/compose.ts index e233dc6ca..3261f61fa 100644 --- a/apps/dokploy/server/api/routers/compose.ts +++ b/apps/dokploy/server/api/routers/compose.ts @@ -417,7 +417,9 @@ export const composeRouter = createTRPCRouter({ if (IS_CLOUD && compose.serverId) { jobData.serverId = compose.serverId; - await deploy(jobData); + deploy(jobData).catch((error) => { + console.error("Background deployment failed:", error); + }); return true; } await myQueue.add( @@ -453,7 +455,9 @@ export const composeRouter = createTRPCRouter({ }; if (IS_CLOUD && compose.serverId) { jobData.serverId = compose.serverId; - await deploy(jobData); + deploy(jobData).catch((error) => { + console.error("Background deployment failed:", error); + }); return true; } await myQueue.add(