Windows 上的“supabase start”失败

Aza*_*ath 5 docker docker-compose supabase supabase-database

我正在运行 Windows 11,并根据文档通过 Scoop 安装了 supabase cli。我将其添加到现有存储库中,因此我已经毫无问题地运行了以下命令:

supabase login
supabase init
Run Code Online (Sandbox Code Playgroud)

当我去运行它时,supabase start它第一次完全安装了 docker 映像和所有内容,但它总是以以下错误消息结束:

> supabase start
Database is not healthy.
Error: failed to connect to `host=localhost user=postgres database=postgres`: failed to receive message (unexpected EOF)
Try rerunning the command with --debug to troubleshoot the error.
Run Code Online (Sandbox Code Playgroud)

我尝试--debug按照指示使用该标志运行,但我似乎无法从中看出任何信息,并且由于不同的问题而失败:

...                                                                                                        2023/03/11 22:46:09 Send Done
2023/03/11 22:46:09 Recv First Byte
2023/03/11 22:46:10 Sent Header: Host [docker]
2023/03/11 22:46:10 Sent Header: User-Agent [Go-http-client/1.1]
2023/03/11 22:46:10 Send Done
2023/03/11 22:46:10 Recv First Byte
Database is not healthy.
2023/03/11 22:46:11 Connect Start: tcp [::1]:54322
2023/03/11 22:46:11 Connect Done: tcp [::1]:54322
2023/03/11 22:46:11 PG Send: {"Type":"StartupMessage","ProtocolVersion":196608,"Parameters":{"database":"postgres","user":"postgres"}}
2023/03/11 22:46:13 Connect Start: tcp 127.0.0.1:54322
2023/03/11 22:46:13 Connect Done: tcp 127.0.0.1:54322
2023/03/11 22:46:13 PG Send: {"Type":"StartupMessage","ProtocolVersion":196608,"Parameters":{"database":"postgres","user":"postgres"}}
2023/03/11 22:46:15 Connect Start: tcp [::1]:54322
2023/03/11 22:46:15 Connect Done: tcp [::1]:54322
2023/03/11 22:46:15 PG Send: {"Type":"StartupMessage","ProtocolVersion":196608,"Parameters":{"database":"postgres","user":"postgres"}}
2023/03/11 22:46:17 Connect Start: tcp 127.0.0.1:54322
2023/03/11 22:46:17 Connect Done: tcp 127.0.0.1:54322
2023/03/11 22:46:17 PG Send: {"Type":"StartupMessage","ProtocolVersion":196608,"Parameters":{"database":"postgres","user":"postgres"}}
Error: failed to connect to `host=localhost user=postgres database=postgres`: failed to receive message (timeout: context deadline exceeded)
Run Code Online (Sandbox Code Playgroud)

我只使用默认的 config.toml 运行supabase init

版本:

> docker --version
Docker version 20.10.22, build 3a2c30b
> docker-compose --version
Docker Compose version v2.15.1
> supabase -v
1.40.1
Run Code Online (Sandbox Code Playgroud)

jcc*_*ero 2

我对此只有肤浅的了解supabase,但是根据您描述的症状,似乎容器有时postgresql无法足够快地提供运行状况探测,从而导致supabase start命令失败。

这个问题在您第一次发出时尤其重要,supabase start因为在这种情况下,postgresql容器应该初始化所需的数据库结构和相关内容。

正如此相关 Github 问题中所述,我认为该问题很可能是由于物理机资源不足引起的。

不幸的是,据我所知,supabase没有提供任何标志或配置选项来定义某种类型的超时来控制等待运行状况探测的时间。

supabase start --ignore-health-check要解决该问题,您可以尝试使用以下标志运行产品:

supabase start --ignore-health-check
Run Code Online (Sandbox Code Playgroud)

但可能的方法应该是垂直扩展物理机,提供更多资源,尤其是 RAM 内存。它运行 Windows 11,您可能需要为 Windows 内存限制配置 Docker这个相关的 SO 问题对于此配置也可能有帮助。