Errors deploying new pg cluster - :nxdomain

I’m upgrading an existing Elixir app, adding a new PG cluster. However, running the initial migrations I see this:

Error: :46.771 [error] Postgrex.Protocol (#PID<0.162.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (top2.nearest.of.my-dashboard-pg.internal:5432): non-existing domain - :nxdomain

I’ve tried deleting the original app (my-dashboard) and cluster, and recreating from scratch:

$ fly postgres create
...
2 desired, 2 placed, 2 healthy, 0 unhealthy [health checks: 6 total, 6 passing]
--> v0 deployed successfully

$ fly launch --org "my-org" --name "my-dashboard" –region ams
? Would you like to deploy now? No

$ fly postgres attach --postgres-app my-dashboard-pg
...
Postgres cluster my-dashboard-pg is now attached to my-dashboard

$ fly deploy
==> Creating release
==> Release command
...
Error: :46.771 [error] Postgrex.Protocol (#PID<0.162.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (top2.nearest.of.my-dashboard-pg.internal:5432): non-existing domain - :nxdomain
...
Error Release command failed, deployment aborted

I still get the same issue. Is this an internal DNS issue? Or am I missing a step? Happy to share org/app details privately to help diagnose.

Having both :inet and :inet6 configured (eg, for testing the container locally with Docker) causes these issues. Removing :inet fixes the issue.

1 Like

Will you share your repo settings for the Phoenix app? This error usually means Ecto isn’t configured for IPv6. It should look something like this:

config :web_app, WebApp.Repo,
  socket_options: [:inet6]
1 Like

Yeah, for testing with Docker we were using something like:

config :web_app, WebApp.Repo,
  socket_options: [:inet, :inet6]

Removing the :inet fixed the issue, but breaks Docker locally… which we can live with. :+1:t2:

I had this issue while following Chris’s two-command deploy, adding the :inet6 socket option fixed it!