dokploy icon indicating copy to clipboard operation
dokploy copied to clipboard

Bad gateway after a server restart due to postgres not being ready.

Open steadexe opened this issue 1 year ago • 5 comments

To Reproduce

Restart the server and make sure postgres takes longer to start that Dokploy.

After restarting Dokploy container error disappeared.

docker logs on Dokploy's container revealed connection refused to postgres. Which makes me think, it's easily fixable by adding some healthcheck and an infinite loop which tries to connect every few second until it can.

Current vs. Expected behavior

Actually, Dokploy throw an error and never finishes to load if postgres is not yet ready, which result Traefik to throw a Bad Gateway.

Dokploy should wait until postgres has started to boot before throwing an error.

Provide environment information

Ubuntu 24.04.3
Linux 6.8.0-78-generic #78-Ubuntu SMP PREEMPT_DYNAMIC Tue Aug 12 11:34:18 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Which area(s) are affected? (Select all that apply)

Installation

Are you deploying the applications where Dokploy is installed or on a remote server?

Same server where Dokploy is installed

Additional context

I think adding a healthcheck to postgres and better, makes dokploy wait indefinetely until it started to connect to postgres to ensure it run smoothly.

After a cold start of a server, it can takes several minutes until all VM boots, and until all IO settle.

Some people runs Dokploy on a homelab, or on very big infra, it's best to assume everything can take a virtual infinite amount of time to load. I think it's best to not rely on an arbitrary timing.

I think this is how node-redis or mongoose does, they wait until connection can be established.

Will you send a PR to fix it?

No

steadexe avatar Aug 19 '25 09:08 steadexe

Same here

pierrecarcellermeunier avatar Sep 12 '25 10:09 pierrecarcellermeunier

I have the exact same issue after running

curl -sSL https://dokploy.com/security/0.26.6.sh | bash

Services are still running, but I can't get into Dokploy web UI anymore 😢

Help please!

dfranco avatar Feb 09 '26 05:02 dfranco

To Reproduce

Restart the server and make sure postgres takes longer to start that Dokploy.

After restarting Dokploy container error disappeared.

docker logs on Dokploy's container revealed connection refused to postgres. Which makes me think, it's easily fixable by adding some healthcheck and an infinite loop which tries to connect every few second until it can.

Current vs. Expected behavior

Actually, Dokploy throw an error and never finishes to load if postgres is not yet ready, which result Traefik to throw a Bad Gateway.

Dokploy should wait until postgres has started to boot before throwing an error.

Provide environment information

Ubuntu 24.04.3 Linux 6.8.0-78-generic #78-Ubuntu SMP PREEMPT_DYNAMIC Tue Aug 12 11:34:18 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Which area(s) are affected? (Select all that apply)

Installation

Are you deploying the applications where Dokploy is installed or on a remote server?

Same server where Dokploy is installed

Additional context

I think adding a healthcheck to postgres and better, makes dokploy wait indefinetely until it started to connect to postgres to ensure it run smoothly.

After a cold start of a server, it can takes several minutes until all VM boots, and until all IO settle.

Some people runs Dokploy on a homelab, or on very big infra, it's best to assume everything can take a virtual infinite amount of time to load. I think it's best to not rely on an arbitrary timing.

I think this is how node-redis or mongoose does, they wait until connection can be established.

Will you send a PR to fix it?

No

we improved this starting from 0.27.0 now dokploy use healthchecks to validate the postgres container, now if the postgres is not ready, the dokploy container will keep restarting until it find the postgres ready, so this issue should be fixed

https://github.com/Dokploy/dokploy/releases/tag/v0.27.0

Siumauricio avatar Feb 26 '26 04:02 Siumauricio

I have the exact same issue after running

curl -sSL https://dokploy.com/security/0.26.6.sh | bash

Services are still running, but I can't get into Dokploy web UI anymore 😢

Help please!

We were very clear that you need to upgrade your instance before running the security command https://github.com/Dokploy/dokploy/releases/tag/v0.26.6, you can check the issues we already answer this a couple times

Siumauricio avatar Feb 26 '26 04:02 Siumauricio

For now this issue is done so we can close

Siumauricio avatar Feb 26 '26 04:02 Siumauricio