This is for some reason not working for me
fly proxy 15432:5432 -a APP
psql: error: connection to server at "localhost" (::1), port 15432 failed: Connection refused
Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (127.0.0.1), port 15432 failed: FATAL: database "pricing_livebook" does not exist
fly postgres connect --app APP --database DB
is working fine.
Am I doing something obviously wrong here?
I think you want
fly proxy 15432:5432 -a <db-name> in the first example.
postgres connect loads up a shell,
proxy forwards the port so you can connect with other tools.
Gah, sorry. Teach me to post right as dinner is called. The proxy call is what I’m running that is then not working. I’ve fixed my question.
Oh that makes sense.
Sorry to ask another obvious question, but are you letting the
proxy command keep running while you try to connect? If you cancel that command the proxy stops, so you’ll need to
psql from another terminal.
Ok, it wasn’t that. But I had attached a new app to an existing database, which generated a new username. And it appears that, because I had not specified a database in my psql command, that it was looking for one with the same name as my username. Adding the database name let the connection work.
The next problem was that I could connect, but not query the tables for lack of permissions. I had to grant those permissions explicitly to the new user. I can see how that might be the desired behavior, but it might be worth noting somewhere