nclh
June 25, 2024, 7:34pm
1
Hello! New & happy Fly user here (convert from Google Cloud and having a blast so far).
An issue I’m running into with Fly Postgres:
When I use fly pg attach
, the auto-generated URL looks like this:
postgres://<username>:<password>@my-db-app.flycast:5432/<db>?sslmode=disable
Using this in my app generates an error:
2024-06-25 09:48:41.719
Unhandled exception: (DB::ConnectionRefused)
When I switch out the url manually and instead use:
postgres://<username>:<password>@my-db-app.internal:5432/<db>
(switching .flycast to .internal and removing the sslmode parameter), everything works.
Any ideas why that is the case? Is there any reason this won’t continue to work? Is there anything I should be aware of using this connection string instead of the auto-generated one from fly pg attach?
roadmr
June 25, 2024, 8:46pm
2
Hi, can you please check if your Postgres app has a private address assigned to it?
fly ips list -a your-db-app
.
It should have something like:
VERSION IP TYPE REGION CREATED AT
v6 fdaa:2:7d1e:0:1::83 private global 54s ago
Also, ensure both the database and the consuming app are on the same Fly organization.
Let me know what you find!
Regards,
nclh
June 25, 2024, 9:03pm
3
Thank you Daniel!
Private ip assigned
Same organization
fly ips list -a <my-db-app>
VERSION IP TYPE REGION CREATED AT
v6 fdaa:<rest of ip> private global Jun 18 2024 19:15
roadmr
June 25, 2024, 9:23pm
4
What happens if you install psql
on your app’s machine and then try to connect?
psql postgres://<username>:<password>@my-db-app.internal:5432/<db>
I tried that on a freshly-deployed Postgres app from a different app (same org!) and it connected just fine.
Let me know!
system
Closed
July 2, 2024, 9:23pm
5
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.