mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-15 16:35:17 +00:00
feat(settings): improve background execution of Traefik setup with error logging
- Updated Traefik setup calls to run in the background, allowing immediate client response. - Added error handling to log issues during the background execution of Traefik setup for better debugging.
This commit is contained in:
@@ -605,12 +605,14 @@ export const settingsRouter = createTRPCRouter({
|
|||||||
const envs = prepareEnvironmentVariables(input.env);
|
const envs = prepareEnvironmentVariables(input.env);
|
||||||
const ports = await readPorts("dokploy-traefik", input?.serverId);
|
const ports = await readPorts("dokploy-traefik", input?.serverId);
|
||||||
|
|
||||||
await writeTraefikSetup({
|
// Run in background so the request returns immediately; client polls /api/health.
|
||||||
|
void writeTraefikSetup({
|
||||||
env: envs,
|
env: envs,
|
||||||
additionalPorts: ports,
|
additionalPorts: ports,
|
||||||
serverId: input.serverId,
|
serverId: input.serverId,
|
||||||
|
}).catch((err) => {
|
||||||
|
console.error("writeTraefikEnv background writeTraefikSetup:", err);
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}),
|
}),
|
||||||
haveTraefikDashboardPortEnabled: adminProcedure
|
haveTraefikDashboardPortEnabled: adminProcedure
|
||||||
@@ -858,10 +860,16 @@ export const settingsRouter = createTRPCRouter({
|
|||||||
}
|
}
|
||||||
const preparedEnv = prepareEnvironmentVariables(env);
|
const preparedEnv = prepareEnvironmentVariables(env);
|
||||||
|
|
||||||
await writeTraefikSetup({
|
// Run in background so the request returns immediately; client polls /api/health.
|
||||||
|
void writeTraefikSetup({
|
||||||
env: preparedEnv,
|
env: preparedEnv,
|
||||||
additionalPorts: input.additionalPorts,
|
additionalPorts: input.additionalPorts,
|
||||||
serverId: input.serverId,
|
serverId: input.serverId,
|
||||||
|
}).catch((err) => {
|
||||||
|
console.error(
|
||||||
|
"updateTraefikPorts background writeTraefikSetup:",
|
||||||
|
err,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user