From cc74f9e38cc0cc54b35f8372b4b8da422372d37f Mon Sep 17 00:00:00 2001 From: Mauricio Siu Date: Sun, 5 Apr 2026 17:36:18 -0600 Subject: [PATCH] fix: start server listener before initialization to prevent healthcheck failures Move server.listen() before the initialization block so the HTTP server is already responding when Docker healthchecks begin. Previously, slow operations like SMTP timeouts in sendDokployRestartNotifications() could block the server from listening, causing healthcheck failures and container restarts. Closes #4049 --- apps/dokploy/server/server.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/dokploy/server/server.ts b/apps/dokploy/server/server.ts index 5d6d703fa..4de4d7689 100644 --- a/apps/dokploy/server/server.ts +++ b/apps/dokploy/server/server.ts @@ -56,6 +56,8 @@ void app.prepare().then(async () => { setupDockerStatsMonitoringSocketServer(server); } + server.listen(PORT, HOST); + console.log(`Server Started on: http://${HOST}:${PORT}`); if (process.env.NODE_ENV === "production" && !IS_CLOUD) { createDefaultMiddlewares(); await initializeNetwork(); @@ -65,9 +67,6 @@ void app.prepare().then(async () => { await initVolumeBackupsCronJobs(); await sendDokployRestartNotifications(); } - - server.listen(PORT, HOST); - console.log(`Server Started on: http://${HOST}:${PORT}`); await initEnterpriseBackupCronJobs(); if (!IS_CLOUD) {