nxdomain for Elixir app

Hello,

I’m trying to deploy this Elixir app GitHub - mirego/accent: The first developer-oriented translation tool. True asynchronous flow between translators and your team..

It should be pretty easy because I already had it running on Heroku with Dockerfile what they have in that repo. But it doesn’t work with Fly.

Issue is with connecting with postgresql, I tried it yesterday and today. I attached postgresql with fly cli and I see secret in application.

failed to connect: ** (DBConnection.ConnectionError) tcp connect (top2.nearest.of.cookienovo-db.internal:5432): non-existing domain - :nxdomain

Dockerfile is same as it is in repo, I just added this at the bottom, also tried without it.

# Appended by flyctl
ENV ECTO_IPV6 true
ENV ERL_AFLAGS "-proto_dist inet6_tcp"

Toml is just generated one with these envs:

DATABASE_POOL_SIZE = 5
PORT = "8080"

I’m not able to connect to that app with fly ssh console too, it’s just connecting. Fly doctor looks ok, I’m able to connect and play with other apps without any problems.

fly ssh console
Connecting to top1.nearest.of.cookienovo-accent.internal... complete
Error error connecting to SSH server: connect tcp [fdaa:0:7c41:a7b:a992:66dd:5ad1:2]:22: operation timed out

Ecto needs to be told about ipv6 in your config/runtime.exs, which newer generated phoenix projects sets for you. In your config/runtime.exs, replace your repo config with the following:

ecto_ipv6? = System.get_env("ECTO_IPV6") == "true"

config :accent, Accent.Repo,
  pool_size: Utilities.string_to_integer(System.get_env("DATABASE_POOL_SIZE")),
  ssl: Utilities.string_to_boolean(System.get_env("DATABASE_SSL")),
  url: System.get_env("DATABASE_URL") || "postgres://localhost/accent_development",
  socket_options: if(ecto_ipv6?, do: [:inet6], else: [])  
1 Like

Thanks. It helped. I made PR with your code in repo too. Thank you.