When I was running this in fly.io one thing that I needed to debug for too long time was that the ipv6 socket_options didn’t work with Neon and fly.io enables the ECTO_IPV6=true environmental variable by default in the Dockerfile.
We added a new Elixir guide. Please let us know if you have any feedback.
Is anyone using Ecto Migrate to manage schema migrations between Neon database branches? If so, we would be interested in hearing about your setup. Thank you!
I finally got around to trying to connect to Neon, just from my local dev so far. In NixOS, I’ve set cacertfile to /etc/ssl/certs/ca-certificates.crt.
A couple of gotchas I found:
If a PGHOST environment variable is set, as it is in my project’s Devbox environment, that will be used over what’s in Ecto’s Repo config. So I ran mix ecto commands with: PGHOST="" mix ecto.migrations
(Of course, the environment wouldn’t usually have PGHOST set to something other than Neon if it’s Neon that’s in use, but I just wanted to temporarily experiment.)
If Neon has suspended compute after a few minutes of inactivity, the connection for the mix ecto command results in ** (DBConnection.ConnectionError) connection not available and request was dropped from queue after 2987ms. Simply running the command again works for me.
@Daniel I have a question.
If Ecto keeps a connection pool and query nothing with Neon, would this be treated as active time in Neon and incur costs? If so, are there any recommended methods to circumvent this? (for example, use dynamic repo)
$ mix ecto.setup
22:08:41.251 [notice] TLS :client: In state :hello received SERVER ALERT: Fatal - Access Denied
22:08:41.257 [error] Postgrex.Protocol (#PID<0.370.0>) failed to connect: ** (DBConnection.ConnectionError) ssl connect: TLS client: In state hello received SERVER ALERT: Fatal - Access Denied
- {:tls_alert, {:access_denied, ~c"TLS client: In state hello received SERVER ALERT: Fatal - Access Denied\n"}}
If you did use your own hostname, let me know and I will take a closer look at our example.
Regarding your earlier question, I am not familiar with Ecto’s connection pool, but if you are not querying Neon, and you are on the Free Tier, your compute should transition to an idle state after 5 minutes of inactivity. You can monitor this on the Branches page in the console: