supabase / supabase

The open source Firebase alternative. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
https://supabase.com
Apache License 2.0
71.87k stars 6.88k forks source link

Fails to start in freshly initialized project when ipv6 is disabled #28456

Closed Silur closed 1 month ago

Silur commented 1 month ago

Using supabase 1.187.10-1 (installed from AUR) on arch linux x64 with ipv6.disabled=1 in kernel parameters:

mkdir test && cd $_
supabase init
supabase start --debug

fails with:

+ ulimit -n
+ '[' '!' -z 10000 ']'
+ echo 'Setting RLIMIT_NOFILE to 10000'
+ ulimit -Sn 10000
+ export ERL_CRASH_DUMP=/tmp/erl_crash.dump
+ ERL_CRASH_DUMP=/tmp/erl_crash.dump
+ '[' false = true ']'
+ echo 'Running migrations'
+ sudo -E -u nobody /app/bin/migrate
+ '[' true = true ']'schema...
+ echo 'Seeding selfhosted Realtime'
+ sudo -E -u nobody /app/bin/realtime eval 'Realtime.Release.seeds(Realtime.Repo)'
+ echo 'Starting Realtime'a...
+ ulimit -n
+ exec /app/bin/realtime eval '{:ok, _} = Application.ensure_all_started(:realtime)
{:ok, _} = Realtime.Tenants.health_check("realtime-dev")'
** (MatchError) no match of right hand side value: {:error, {:realtime, {{:shutdown, {:failed_to_start_child, RealtimeWeb.Endpoint, {:shutdown, {:failed_to_start_child, {:ranch_listener_sup, RealtimeWeb.Endpoint.HTTP}, {:shutdown, {:failed_to_start_child, :ranch_acceptors_sup, {:listen_error, RealtimeWeb.Endpoint.HTTP, :eafnosupport}}}}}}}, {Realtime.Application, :start, [:normal, []]}}}}
    (stdlib 5.2.3) erl_eval.erl:498: :erl_eval.expr/6
    nofile:1: (file)
    (elixir 1.16.2) lib/code.ex:572: Code.validated_eval_string/3
2024/08/07 19:12:38 Sent Header: Host [api.moby.localhost]
2024/08/07 19:12:38 Sent Header: User-Agent [Docker-Client/unknown-version (linux)]
2024/08/07 19:12:38 Send Done
2024/08/07 19:12:39 Recv First Byte
2024/08/07 19:12:39 PG Send: {"Type":"Terminate"}

Full reproduction:

https://asciinema.org/a/0jq2r4YRr1rglSvmB9rBitorJ

The issue does not arise when ipv6 is enabled back in system level.

Trying supabase start -x realtime or setting the deprecated ip mode in the realtime config does not work.

encima commented 1 month ago

Hi there @Silur Thanks for opening this, this is expected behaviour as far as I am aware. IPv6 is the default for both Supabase hosted and self-hosted. Realtime has the configuration parameters for IP_Version documented in the self-hosting docs here

Let us know if that is clear enough and we can close this or, if not, let us know how the docs could be improved!

Silur commented 1 month ago

As stated in the issue, disabling the realtime service altogether or setting the IP_Version in the realtime configuration has no effect as the code that was handling this behavior was actually removed https://github.com/supabase/supabase/issues/13816#issuecomment-1585583852 over a year ago.

Also, DB_IP_VERSION cannot be set from supabase-cli.