Li
Li7d ago

coolify + postgres

2025-02-15T18:53:23.081956Z INFO convex_local_backend: Starting a Convex backend 2025-02-15T18:53:23.082164Z INFO convex_local_backend: Sentry is not enabled. 2025-02-15T18:53:53.116559Z ERROR common::errors: Caught error (RUST_BACKTRACE=1 RUST_LOG=info,common::errors=debug for full trace): Postgres timeout
36 Replies
Emma
Emma7d ago
Can you connect to the DATABASE_URL using psql?
Li
LiOP7d ago
yes
Emma
Emma7d ago
did you create a database called convex_self_hosted?
Li
LiOP7d ago
yes I used a local Postgres in Coolify for the test, and also used NeonDB. In both cases, nothing works.
Emma
Emma7d ago
If you run with RUST_BACKTRACE=1 RUST_LOG=info,common::errors=debug is there more to the trace?
Li
LiOP7d ago
wait a minute
Emma
Emma7d ago
If you run with docker compose up with local docker, does it work with that database url?
Li
LiOP7d ago
2025-02-15T19:02:55.425662799Z 2025-02-15T19:02:55.422780Z INFO convex_local_backend: Starting a Convex backend 2025-02-15T19:02:55.425759830Z 2025-02-15T19:02:55.422960Z INFO convex_local_backend: Sentry is not enabled. 2025-02-15T19:02:55.426356486Z 2025-02-15T19:02:55.425176Z ERROR common::errors: Caught error (RUST_BACKTRACE=1 RUST_LOG=info,common::errors=debug for full trace): cluster url already contains db name: /convex_self_hosted 2025-02-15T19:02:55.426374070Z 2025-02-15T19:02:55.425204Z DEBUG common::errors: cluster url already contains db name: /convex_self_hosted 2025-02-15T19:02:55.426378917Z 2025-02-15T19:02:55.426382171Z Stack backtrace: 2025-02-15T19:02:55.426385306Z 0: <unknown> 2025-02-15T19:02:55.426389963Z 2025-02-15T19:02:55.425507Z ERROR common::errors: Not reporting above error: SENTRY_DSN not set. 2025-02-15T19:02:55.429796194Z Error: cluster url already contains db name: /convex_self_hosted I haven't tried it
Emma
Emma7d ago
you need to remove the convex_self_hosted from the url
Li
LiOP7d ago
2025-02-15T19:06:43.457981765Z 2025-02-15T19:06:43.457811Z INFO convex_local_backend: Starting a Convex backend 2025-02-15T19:06:43.460063197Z 2025-02-15T19:06:43.458013Z INFO convex_local_backend: Sentry is not enabled. 2025-02-15T19:06:44.025239322Z 2025-02-15T19:06:44.024947Z ERROR common::errors: Caught error (RUST_BACKTRACE=1 RUST_LOG=info,common::errors=debug for full trace): Error occurred while creating a new object: error connecting to server: Network is unreachable (os error 101): error connecting to server: Network is unreachable (os error 101): Network is unreachable (os error 101) 2025-02-15T19:06:44.025620719Z 2025-02-15T19:06:44.025005Z DEBUG common::errors: Error occurred while creating a new object: error connecting to server: Network is unreachable (os error 101) 2025-02-15T19:06:44.025653339Z 2025-02-15T19:06:44.025659176Z Caused by: 2025-02-15T19:06:44.025664794Z 0: error connecting to server: Network is unreachable (os error 101) 2025-02-15T19:06:44.025679709Z 1: Network is unreachable (os error 101) 2025-02-15T19:06:44.025685315Z 2025-02-15T19:06:44.025688715Z Stack backtrace: 2025-02-15T19:06:44.025691903Z 0: <unknown> 2025-02-15T19:06:44.025695865Z 1: <unknown> 2025-02-15T19:06:44.025699222Z 2: <unknown> 2025-02-15T19:06:44.025702342Z 3: <unknown> 2025-02-15T19:06:44.025705693Z 2025-02-15T19:06:44.025456Z ERROR common::errors: Not reporting above error: SENTRY_DSN not set. 2025-02-15T19:06:44.027150985Z Error: Error occurred while creating a new object: error connecting to server: Network is unreachable (os error 101) Neon DB requires sslmode=true, but I can't specify this in DATABASE_URL because convex won't start, and if I use local postgres, convex can't connect due to the lack of tls
Emma
Emma7d ago
Ah ok, so does it work when you use the neon db URL? makes sense that local postgres doesn't work. we have a --do-not-require-ssl flag but unfortunately it isn't in the docker build right now. I can add it though and let you know when it is ready!
Li
LiOP7d ago
Okay, I'll be waiting
Emma
Emma7d ago
Does the neon db URL work? because it's unexpected if it doesn't, and the flag won't help with that
Li
LiOP7d ago
with NeonDB direct/pooler connection 2025-02-15T19:31:40.365429Z INFO convex_local_backend: Starting a Convex backend 2025-02-15T19:31:40.365642Z INFO convex_local_backend: Sentry is not enabled. 2025-02-15T19:31:40.966295Z ERROR common::errors: Caught error (RUST_BACKTRACE=1 RUST_LOG=info,common::errors=debug for full trace): Error occurred while creating a new object: error connecting to server: Network is unreachable (os error 101): error connecting to server: Network is unreachable (os error 101): Network is unreachable (os error 101) 2025-02-15T19:31:40.967058Z DEBUG common::errors: Error occurred while creating a new object: error connecting to server: Network is unreachable (os error 101) Caused by: 0: error connecting to server: Network is unreachable (os error 101) 1: Network is unreachable (os error 101) Stack backtrace: 0: <unknown> 1: <unknown> 2: <unknown> 3: <unknown> 2025-02-15T19:31:40.971128Z ERROR common::errors: Not reporting above error: SENTRY_DSN not set.
Emma
Emma7d ago
To confirm, your neon db url ends in .neon.tech? It should not include sslmode=require. That will already be included when the backend makes the connection. Can you try running with local docker following these instructions? https://github.com/get-convex/convex-backend/blob/main/self-hosted/README.md#docker-configuration I could not reproduce the issue running with the docker compose setup and my own neon db
Li
LiOP7d ago
I think the problem is with Coolify itself, since the container simply cannot connect to the external Neon database, I'm trying to solve the network problem on my own, but so far to no avail. Coolify is those guys who don't test projects themselves before adding them to Coolify, as a result, people face such problems I have a separate server with Dokploy, I will try to deploy a Convex there, if anything, I will write to you here
Emma
Emma7d ago
Ok, best of luck!
Li
LiOP7d ago
and btw, I wanted to clarify, does the storage work in the self-hosted convex? I just launched convex in coolify, but for some reason the storage wasn't working through the dashboard
Emma
Emma7d ago
I'm not super familiar with coolify, but storage should work if you have a volume set up where files can be persisted. the self-hosted convex backend will write storage to the volume filesystem I'd recommend running the docker compose setup locally before trying to deploy on these platforms because that's what we test on
Li
LiOP7d ago
is there a guide for setting up storage? I just deployed the convex to dokploy, but still the repository is not working
Emma
Emma7d ago
What is not working?
Li
LiOP7d ago
file storage from dashboard
Emma
Emma7d ago
it works fine for me on the docker compose setup. Are there any console logs or logs wherever the dashboard is running?
Li
LiOP7d ago
console logs Access to fetch at 'http://ip/:3210/api/storage/upload?token=014b98ea9cbc6bb0d36062402508680ad7249642154695efb7b2563823a87d02dcd0f28bdda649752e3f01d279024144bf84d74d48b1a7a874e7344174e9cad5fd5e7fb061' from origin 'http://ip:6791' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. POST http://ip/:3210/api/storage/upload?token=014b98ea9cbc6bb0d36062402508680ad7249642154695efb7b2563823a87d02dcd0f28bdda649752e3f01d279024144bf84d74d48b1a7a874e7344174e9cad5fd5e7fb061 net::ERR_FAILED can you share your docker compose config? or are you using the same thing?
Emma
Emma7d ago
Here are the instructions for setting up. the config is linked there https://github.com/get-convex/convex-backend/tree/main/self-hosted#docker-configuration
GitHub
convex-backend/self-hosted at main · get-convex/convex-backend
The open-source reactive database for app developers - get-convex/convex-backend
Li
LiOP7d ago
yeah, i know
Emma
Emma7d ago
GitHub
convex-backend/self-hosted/docker/docker-compose.yml at main · get-...
The open-source reactive database for app developers - get-convex/convex-backend
Li
LiOP7d ago
but the file storage is not working.
Emma
Emma7d ago
you're using that config? with the same backend and dashboard version numbers?
Li
LiOP7d ago
yes
Emma
Emma7d ago
(there was a cors issue we already fixed, so the version number is important)
Li
LiOP7d ago
dashboard:4499dd4fd7f2148687a7774599c613d052950f46 backend:6c974d219776b753cd23d26f4a296629ff7c2cad
Emma
Emma7d ago
hmm looks right. Do the backend logs say anything? (I still can't reproduce running docker locally. this is running docker locally on your machine?)
Li
LiOP7d ago
nothing
Emma
Emma7d ago
what response do you get when you run
curl -X OPTIONS "http://ip:3210/api/storage/upload?token=014b98ea9cbc6bb0d36062402508680ad7249642154695efb7b2563823a87d02dcd0f28bdda649752e3f01d279024144bf84d74d48b1a7a874e7344174e9cad5fd5e7fb061" \
-H "Origin: http://ip:6791" \
-H "Access-Control-Request-Method: POST" \
-H "Access-Control-Request-Headers: content-type" \
-v
curl -X OPTIONS "http://ip:3210/api/storage/upload?token=014b98ea9cbc6bb0d36062402508680ad7249642154695efb7b2563823a87d02dcd0f28bdda649752e3f01d279024144bf84d74d48b1a7a874e7344174e9cad5fd5e7fb061" \
-H "Origin: http://ip:6791" \
-H "Access-Control-Request-Method: POST" \
-H "Access-Control-Request-Headers: content-type" \
-v
btw, will be offline soon and won't be able to help until tuesday PST when we are all back in the office. If you're looking for a smoother experience to unblock yourself, feel free to use the cloud-hosted product and try self-hosting again later. Hope it's not too much inconvenience!
Li
LiOP7d ago
* Connected to ip port 3210 * using HTTP/1.x > OPTIONS /api/storage/upload?token=014b98ea9cbc6bb0d36062402508680ad7249642154695efb7b2563823a87d02dcd0f28bdda649752e3f01d279024144bf84d74d48b1a7a874e7344174e9cad5fd5e7fb061 HTTP/1.1 > Host: ip:3210 > User-Agent: curl/8.12.1 > Accept: */* > Origin: http://ip:6791 > Access-Control-Request-Method: POST > Access-Control-Request-Headers: content-type > * Request completely sent off < HTTP/1.1 200 OK < access-control-allow-credentials: true < vary: origin, access-control-request-method, access-control-request-headers < access-control-allow-methods: GET,POST,OPTIONS,PATCH,DELETE,PUT < access-control-allow-headers: baggage,sentry-trace,accept,accept-language,authorization,content-type,convex-client,referer,user-agent < access-control-max-age: 86400 < access-control-allow-origin: http://ip:6791 < allow: POST < content-length: 0 < date: Sat, 15 Feb 2025 21:22:01 GMT < * Connection #0 to host ip left intact

Did you find this page helpful?