realtime icon indicating copy to clipboard operation
realtime copied to clipboard

Local docker regression: REALTIME_IP_VERSION is ignored

Open jbertozzi opened this issue 8 months ago • 9 comments

Bug report

Describe the bug

Running a self-hosted instance on a server with ipv6 disabled is not working.

According the doc, setting the environment variable REALTIME_IP_VERSION to the value ipv4 should make the server bind to ipv4 only, but we still get the error:

  num_acceptors: 100,                                                                                     
  max_connections: 1000,                                                                                  
  socket_opts: [                                                                                          
    :inet6,                                                                                                                                                                                                          
    {:port,                                                                                                                                                                                                          
     4000}                                                                                                                                                                                                           
  ]                                                                                                       
}) for reason :eafnosupport (address family not supported by protocol family)     

This looks like a regression as this was supposed to be fixed: https://github.com/supabase/realtime/pull/253

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Disable ipv6 on your server
  2. Add the environment variable REALTIME_IP_VERSION in the docker compose
  3. run docker compose up -d
  4. Check the logs docker logs realtime-dev.supabase-realtime

Expected behavior

Container realtime-dev.supabase-realtime crashes

System information

  • OS: RHEL9

jbertozzi avatar Mar 11 '26 07:03 jbertozzi

@jbertozzi I think https://github.com/supabase/supabase/issues/13816 gives some clarity. Honestly, they just REALLY don't care about the open source/self-hosting side of things. We could fork of course... But honestly, they just simply don't care.

FYI @aantti

AntonOfTheWoods avatar Mar 29 '26 09:03 AntonOfTheWoods

Thanks for flagging, I'll take a look.

aantti avatar Mar 30 '26 08:03 aantti

@jbertozzi Curious, what is the Realtime version you're trying to use? 🤔

aantti avatar Apr 08 '26 15:04 aantti

@aantti I tried on the latest and greatest from 2 weeks ago and still faced the same issue - hence me finding this topic and rudely inserting myself!

AntonOfTheWoods avatar Apr 09 '26 00:04 AntonOfTheWoods

@AntonOfTheWoods No problem at all - but what stumps me quite a bit is that I can't seem to find REALTIME_IP_VERSION anywhere in the Realtime codebase (there's DB_IP_VERSION but it's for something else). If I'm not mistaken, it's been deprecated and removed quite a long time ago (in 2022?).

I haven't seen any issues with Realtime and IPv4-only hosts, I tested it again yesterday with 2.76.5 and it correctly works without IPv6 enabled. In fact, I believe - unless specifically enabled, self-hosted Supabase containers won't have IPv6 configured.

Adding REALTIME_IP_VERSION="ipv4" to the environment doesn't affect current Realtime.

@jbertozzi Are you running just Realtime or self-hosted Supabase, btw? Still curious, what version, what exact environment, and how to possibly recreate what you're dealing with.

aantti avatar Apr 09 '26 07:04 aantti

@aantti thanks for the update. It explains a few things! Are you saying that you have successfully launched it on hosts that had ipv6 disabled in the linux boot cmd, i.e, GRUB_CMDLINE_LINUX_DEFAULT="... ipv6.disable=1 ..."?

AntonOfTheWoods avatar Apr 10 '26 10:04 AntonOfTheWoods

@AntonOfTheWoods No, I was primarily referring to the REALTIME_IP_VERSION not being a configuration option anymore, and that on a no-IPv6-address-configured VPS (but with IPv6 stack still present), it works 😢

I've just rented a dedicated server, disabled IPv6 fully via grub settings, and I can confirm - when no IPv6 in the kernel, Realtime is failing as described above (as does Studio, btw - but that's because of the current HOSTNAME configuration in docker-compose.yml).

I'll pass this to the Realtime team.

aantti avatar Apr 10 '26 12:04 aantti

I've just rented a dedicated server, disabled IPv6 fully via grub settings, and I can confirm - when no IPv6 in the kernel, Realtime is failing as described above (as does Studio, btw - but that's because of the current HOSTNAME configuration in docker-compose.yml).

Yep, I found and fixed the Studio issue - very simple. My initial searched suggested that sort of thing would also work for realtime, given the "fix" that was done back a few years ago.

And thanks for going to all that trouble. An incus/lxc or lima VM would have sufficed - that's what I'm using but that is definitely industrial level repro!

I'll pass this to the Realtime team.

You're a gentleman and a scholar!

AntonOfTheWoods avatar Apr 10 '26 12:04 AntonOfTheWoods

:tada: This issue has been resolved in version 2.83.1 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

realtime-release-bot avatar Apr 13 '26 08:04 realtime-release-bot