Anyone can reproduce steps to make single postgres cluster and remix app on fly.io
I have no problems with connecting app to cluster but steps are coming when trying to config my dev enviorement to be able to connect to postgres with prisma. Followed steps from fly.io docs. Generated good connection url for postgres used it on prisma but didn’t get any results.
Anyone can help with that? Im on windows10 so propably there are some problems with tunnels on windows but im not sure.
One potential issue here is DNS. The quickest thing to try is:
Run flyctl ips private to get a list of VM IP addresses
Try connecting to the IP directly, you can use a connection string like this: postgres://<user>:<password>@[fdaa:0:1:a7b:6b:0:1e7a:2]:5432/databasename
Other things to check:
Is the wireguard connection up and healthy?
Try pinging one of your private IPs: ping -6 fdaa:0:1:a7b:6b:0:1e7a:2
Feel free to post all the output from these commands here and we can help you interpret what it means.
I looked at your DB and it was not in a good state. Did you happen to deploy with postgres:14 by chance? It looks like you added a [services] block, is it possible you used version 14 when you deployed?
Your DB is actually postgres v13 (this is our default for a new cluster), so it was stuck in a state where it couldn’t boot one of the nodes. fly logs was showing errors like this:
[18180] FATAL: database files are incompatible with server
[18180] DETAIL: The data directory was initialized by PostgreSQL version 13, which is not compatible with this version 14.0 (Debian 14.0-1.pgdg110+1).
I reverted the DB and it’s running healthily now. Would you see if that helped?
When you run psql, is that from your development machine after connecting to the Wireguard VPN? One way to check exactly where the connectivity problem is would be to ssh into the DB server itself, using fly ssh console -s to choose it, and trying to run psql there — should confirm that the DB is running correctly.
Then from inside the application server (can be reached with fly ssh console -s again) using the private IP address, to check if the app servers can reach the DB ones.
If both these work okay we can try switching back to the app.internal address.
@sudhir.j was trying this now i can connect with my pgAdmin4 client but fly ssh console -s and running psql there giving me # psql psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory Is the server running locally and accepting connections on that socket?
any ideas?
The pgAdmin4 problem seems like a misconfiguration somewhere, @Programistafrontend — the databases managed by Fly are listing on a DATABASE_URL the looks a bit like postgresql://username:password@db-app.internal:5432/dbname. The app seems to think Postgres is running locally on the same machine and trying to connect over the default file socket.
That dig output shows DNS working, but only when you specify our DNS server. The problem here is that the DNS server windows uses by default doesn’t know how to handle requests for .internal. So when you use the hostname with prisma, it can’t find the IP.
Will you try connecting Prisma to [fdaa:0:39d3:a7b:23c3:0:58de:2]:5432 and see if it works?