Hey, I am trying to get my Phoenix app running on fly.io!
But it seems like I can’t connect to the database hosted on DigitalOcean (DbaaS).
I set the environment variable
DATABASE_URL to the one I copy from DigitalOcean and it seems like fly.io servers can’t resolve the DNS entry for it?
This is what I get in the logs:
[error] Postgrex.Protocol (#PID<0.3781.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (xxxxxxxxxx.db.ondigitalocean.com:25060): non-existing domain - :nxdomain
But if I ping it on my machine it resolves the IP.
I also disabled trusted sources on DO to be able to connect to it. DO does not support IPv6 for this, unfortunately.
This is the configuration I have in Phoenix:
database_url = System.get_env("DATABASE_URL") || raise """ environment variable DATABASE_URL is missing. For example: ecto://USER:PASS@HOST/DATABASE """ config :app, App.Repo, url: database_url, pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"), socket_options: [:inet6], ssl: true