How to connect Phoenix.new application to Postgres Managed DB?

How do you get the Phoenix.new application to connect to the hosted managed postres that fly.io hosts.

I can’t login in the command terminal in phoenix.new it just sits and doesn’t pen a browser.
My local db is setup for IP 6.
I have created users dev and prod for both of those instances, I understand I need to set the DB URL as environment var, but it says that the connection times out as it’s getting dropped due to the connection local IPV6 issue.

How is this fixable?

The command terminal in phoenix.new has flyctl pre-installed, you’ll just need to run flyctl auth login to authenticate against your account. If it can’t open a new browser window in the environment it’ll output an auth link in the terminal output like this:

$ flyctl auth whoami
? You must be logged in to do this. Would you like to sign in? Yes
failed opening browser. Copy the url (https://fly.io/app/auth/cli/<token>) into a browser and continue

Copy and paste that link into your browser to auth the terminal session. You can then run any flyctl commands against your account.

I haven’t used MPG in phoenix.new, but I think you’d probably need to use mpg proxy to get the connection available in the sandbox.

I found the link it was hiding as my browser window was not large enough to see it.

I have some sub users accounts for prod and dev but it seems like it can not connect.

Do I need to update my config to point to that db or how does it know what is dev and what is production?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.