tansan

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

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

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

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!

Where Next?

Popular in Questions Top

Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: The documentation above suggests that while ...
New
srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call t...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New

Other popular topics Top

msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 43622 214
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
boundedvariable
I am going through the kafka architecture. All the features what the kafka is providing are already in Erlang. I would like hear your opi...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

We're in Beta

About us Mission Statement