tansan
Has anyone successfully launched an Elixir app with postgres?
I followed their fly launch guide and it should be straightforward and it should work out of the box after they inject the DATABASE_URL, but it just keeps failing and I haven’t been able to figure out why.
Anyone here figure out how?
INFO [fly api proxy] listening at /.fly/api
2023/08/14 07:35:35 listening on [fdaa:2:c486:a7b:d829:3bff:2a58:2]:22 (DNS: [fdaa::3]:53)
07:35:36.341 [error] Postgrex.Protocol (#PID<0.141.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (my-app-name-db.flycast:5432): non-existing domain - :nxdomain
07:35:36.341 [error] Postgrex.Protocol (#PID<0.140.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (my-app-name-db.flycast:5432): non-existing domain - :nxdomain
07:35:37.693 [error] Postgrex.Protocol (#PID<0.140.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (my-app-name-db.flycast:5432): non-existing domain - :nxdomain
07:35:38.029 [error] Postgrex.Protocol (#PID<0.141.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (my-app-name-db.flycast:5432): non-existing domain - :nxdomain
07:35:39.302 [error] Could not create schema migrations table. This error usually happens due to the following:
* The database does not exist
My app is using the this in runtime:
url: System.fetch_env!("DATABASE_URL"),
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10")
Most Liked
hubertlepicki
I suspect this is wrong?
(my-app-name-db.flycast:5432): non-existing domain - :nxdomain
Specific my-app-name-db.flycast.
Either the DATABASE _URL is wrong or you’re overwriting it in config file with example value.
slouchpie
I remember this was a problem for me.
Fly apps communicate using IP v6.
You should have something like this in your runtime.exs
config :my_app, MyAppWeb.Endpoint,
server: true,
url: [host: endpoint_host, port: 80],
http: [
port: 4000,
# IMPORTANT: support IPv6 addresses
transport_options: [socket_opts: [:inet6]]
]
and similarly this
config :my_app, MyApp.Repo.Local,
url: database_url,
# IMPORTANT: Or it won't find the DB server
socket_options: [:inet6],
pool_size: 10,
tansan
Ah maybe that is it! Thank you for the help.
Actually, in that short time, I ended up switching over to railway.app instead. I’ve found a lot of little things a lot better in railway.app than render and fly.io. From env var management to ease of spinning up services to support. The developer experience was much better than the other two.
If anyone wants my referral link, I can send it to you!
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








