SIN machine with postgres instance has been down for 10h+

Hi,

I have a machine with Postgres instance that has been dropping connections all day since morning. Tried to restart both the elixir/phoenix app and the DB itself a few time - no joy.

This is a hobby project so I don’t have a support attached to it, but a 10H downtime is just weird for something that is not free.

Hi Syamil,

Single-machine Postgres deploys will be fairly vulnerable to hardware failure, which is what seems to have happened with you. If you need higher availability I would recommend adding two replicas so the cluster can failover in case one of the machines goes down.

You can read more about unmanaged postgres operations here: https://fly.io/docs/postgres/

Cheers!

I’m able to connect via tableplus - just that my app couldn’t connect to it. I can add replica, sure. But I still need to write to the main.

Log says I have hit the instance limit - so I upgraded it but still not able to connect from the app.

Please share some logs of what the app is saying when it can’t connect. It doesn’t sound like your database is down though, which is good information to have.

Can you also share the exact log line mentioning instance limit?

Elixir error is standard Postgrex cannot connect error:

2026-05-21T13:50:43Z app[32874977b90e85] sin [info]13:50:43.987 [error] Postgrex.Protocol (#PID<0.2727.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (top2.nearest.of.<redacted>.internal:5432): timeout

Tracked it down to this error:

:gen_tcp.connect(~c"fdaa:<redacted>", 5432, [:inet6], 5000)
{:error, :timeout}

So the problem might be cross-host 6PN. From my app, connecting to the DB Machine’s 6PN address times out.

Hi, I’d recommend creating another app machine (which should land on another host) and trying from there. Let me know if a different machine works better. It could be bad connectivity from the host where your current machine lives to the Postgres one.

Thought so, but can’t risk another hour of debugging so just migrated to a managed PG on different provider instead. Thanks

Unmanaged Postgres has developed a bit of a reputation in this forum for hardcore/DBA-type engineers only. Managed is the way to go, IMO, unless one needs a custom set-up. Fly’s own managed offering looks pretty good, but is not priced in a way that suits hobby projects.

I’ve had some luck with the free tier on Supabase, though they have an excessively low use detector, and pause the database weekly. As the aphorism goes: good, cheap, pick one! :cat_with_wry_smile: