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!

tansan

tansan

I sent you a DM. I wasn’t sure if we can post referral links here.

dimitarvp

dimitarvp

I received it, thank you!

Where Next?

Popular in Questions Top

Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
pgiesin
This should be a simple problem but I just can’t seem to figure it out. I have a standalone Elixir app that won’t find the database. Dep...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
Phillipp
Hey, I have a NanoPi-M3 and try to install Elixir on their Ubuntu image. I followed the Raspberry Pi installation instructions from the ...
New
mgjohns61585
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
qwerescape
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
sabri
Can someone explain the settings of pool_size of Ecto in config file? and what is the recommend size? Thanks
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

Other popular topics Top

shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
dotdotdotPaul
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
sergio
I couldn’t find any guides that worked well with Phoenix 1.6.0 and esbuild. I hope this helps people test the waters and eases you into t...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 45766 226
New
AstonJ
You’re a programmer, so you don’t need spoon feeding with the conventional drivel about “this is an integer.” No. You need to know what’s...
New
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
lucidguppy
I have a super simple question about elixir - how would I take a file like this foo bar baz and output a new file that enumerates th...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

We're in Beta

About us Mission Statement