coolify icon indicating copy to clipboard operation
coolify copied to clipboard

[Bug]: postgres database is unreachable locally

Open treboryx opened this issue 11 months ago • 9 comments

Description

A new postgres database is unreachable on the local network and you must do the following manually:

docker network connect <network name> <docker name>

This is potentially an issue with other containers too?

Minimal Reproduction (if possible, example repository)

Just create a new database and try to connect to it from your application

Exception or Error

No response

Version

v4.0.0-beta.236

treboryx avatar Mar 13 '24 17:03 treboryx

What do you mean by "local network"?

If you create a database, for example, in the default Docker network called coolify, only applications in the same network could reach that database.

If you make the database public, it can be reached from anywhere.

andrasbacsai avatar Mar 14 '24 08:03 andrasbacsai

What do you mean by "local network"?

If you create a database, for example, in the default Docker network called coolify, only applications in the same network could reach that database.

If you make the database public, it can be reached from anywhere.

The problem is, when you create a new postgres database, the container of said database isn't connected to the coolify network. You have to manually do it then you'll be able to connect.

This was originally reported on Discord in the following thread. I suggest scrolling at the bottom (to avoid some irrelevant messages) where another user reported the same and the above solution worked for him as well.

https://discord.com/channels/459365938081431553/1207818952215101531/1216510826152853534

treboryx avatar Mar 14 '24 08:03 treboryx

Same issue here with the pocketbase service, selecting a network in the new resource wizard doesn't automatically add pocketbase to it. Only solution seems to be the workaround from the discord thread.

ytsdv avatar Mar 19 '24 18:03 ytsdv

any update? it's becoming a hassle to deploy a new app.

treboryx avatar Apr 03 '24 14:04 treboryx

Same here. No way to connect to a database from another resource other than making it publicly available.

hserranome avatar Apr 17 '24 21:04 hserranome

This is already solved. Let me know if it still does not work.

andrasbacsai avatar Apr 30 '24 13:04 andrasbacsai

I ran into this problem. I can't connect to the db unless I use public address. I don't know how to solve this. I tried to use the simplest form of coolify I could. tried to delete both the web app (node) and the Postgres db but I can't connect locally. How can I solve this?

baatten avatar May 06 '24 15:05 baatten

I will check it again. As I tested, it was working.

andrasbacsai avatar May 06 '24 20:05 andrasbacsai

I ran into this problem. I can't connect to the db unless I use public address. I don't know how to solve this. I tried to use the simplest form of coolify I could. tried to delete both the web app (node) and the Postgres db but I can't connect locally. How can I solve this?

Our issues were due to a limitation of using nixpack. as told by @andrasbacsai nixpack is not supporting containerisation. We will start to use docker build instead. Thanks again for directions Andras :-)

baatten avatar May 07 '24 13:05 baatten

Same problem with nixpack running commands at build time that target the database, e.g. pnpm drizzle-kit migrate. I can only access the db with the public address.

herkulano avatar Jun 11 '24 17:06 herkulano

I have the same issue but not with posgres but with a FastAPI docker compose application. The postgres was automatically added to network "coolify" but not the FastAPI app.

After manually running docker network connect coolify app-qgsk8so-081040975032, it now works.

stefnba avatar Jun 12 '24 08:06 stefnba