Skip to content

Commit cc74f9e

Browse files
committed
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
1 parent df7e1da commit cc74f9e

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

apps/dokploy/server/server.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ void app.prepare().then(async () => {
5656
setupDockerStatsMonitoringSocketServer(server);
5757
}
5858

59+
server.listen(PORT, HOST);
60+
console.log(`Server Started on: http://${HOST}:${PORT}`);
5961
if (process.env.NODE_ENV === "production" && !IS_CLOUD) {
6062
createDefaultMiddlewares();
6163
await initializeNetwork();
@@ -65,9 +67,6 @@ void app.prepare().then(async () => {
6567
await initVolumeBackupsCronJobs();
6668
await sendDokployRestartNotifications();
6769
}
68-
69-
server.listen(PORT, HOST);
70-
console.log(`Server Started on: http://${HOST}:${PORT}`);
7170
await initEnterpriseBackupCronJobs();
7271

7372
if (!IS_CLOUD) {

0 commit comments

Comments
 (0)