Closed7
supabaseをローカルで動かした時にcontainer is not ready: unhealthyで困る(colimaで起動していてvectorなどと相性が悪いのが原因ぽい)

pnpmの場合buildが必要
pnpm add supabase main
╭──────────────────────────────────────────╮
│ │
│ Update available! 10.12.1 → 10.12.4. │
│ Changelog: https://pnpm.io/v/10.12.4 │
│ To update, run: pnpm add -g pnpm │
│ │
╰──────────────────────────────────────────╯
WARN 1 deprecated subdependencies found: node-domexception@1.0.0
Packages: +26
++++++++++++++++++++++++++
Progress: resolved 26, reused 26, downloaded 0, added 26, done
WARN Failed to create bin at /Users/arata/ghq/github.com/ara-ta3/supabase-local-getting-started/node_modules/.pnpm/supabase@2.26.9/node_modules/supabase/node_modules/.bin/supabase. ENOENT: no such file or directory, open '/Users/arata/ghq/github.com/ara-ta3/supabase-local-getting-started/node_modules/.pnpm/supabase@2.26.9/node_modules/supabase/bin/supabase'
WARN Failed to create bin at /Users/arata/ghq/github.com/ara-ta3/supabase-local-getting-started/node_modules/.pnpm/supabase@2.26.9/node_modules/supabase/node_modules/.bin/supabase. ENOENT: no such file or directory, open '/Users/arata/ghq/github.com/ara-ta3/supabase-local-getting-started/node_modules/.pnpm/supabase@2.26.9/node_modules/supabase/bin/supabase'
WARN Failed to create bin at /Users/arata/ghq/github.com/ara-ta3/supabase-local-getting-started/node_modules/.bin/supabase. ENOENT: no such file or directory, open '/Users/arata/ghq/github.com/ara-ta3/supabase-local-getting-started/node_modules/.pnpm/supabase@2.26.9/node_modules/supabase/bin/supabase'
dependencies:
+ supabase 2.26.9
╭ Warning ───────────────────────────────────────────────────────────────────────────────────╮
│ │
│ Ignored build scripts: supabase. │
│ Run "pnpm approve-builds" to pick which dependencies should be allowed to run scripts. │
│ │
╰────────────────────────────────────────────────────────────────────────────────────────────╯
Done in 1.6s using pnpm v10.12.1
ref

コードはここ

DockerのRuntimeはcolima
supabase startだと起動しなかった
> pnpm exec supabase start
Stopping containers...
supabase_vector_supabase-local-getting-started container is not ready: unhealthy
chatgptに言われるがままvectorとlogflareを除外したら動いた
> pnpm exec supabase start -x vector -x logflare
Seeding globals from roles.sql...
WARN: no files matched pattern: supabase/seed.sql
Started supabase local development setup.
API URL: http://127.0.0.1:54321
GraphQL URL: http://127.0.0.1:54321/graphql/v1
S3 Storage URL: http://127.0.0.1:54321/storage/v1/s3
DB URL: postgresql://postgres:postgres@127.0.0.1:54322/postgres
Studio URL: http://127.0.0.1:54323
Inbucket URL: http://127.0.0.1:54324
JWT secret: super-secret-jwt-token-with-at-least-32-characters-long
anon key: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0
service_role key: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MzgxMjk5Nn0.EGIM96RAZx35lJzdJsyH-qQwv8Hdp7fsn3W0YpN81IU
S3 Access Key: 625729a08b95bf1b7ff351a663f3a23c
S3 Secret Key: 850181e4652dd023b7a98c58ae0d2d34bd487ee0cc3254aed6eda37307425907
S3 Region: local

-xはexclude
> pnpm exec supabase start --help
Start containers for Supabase local development
Usage:
supabase start [flags]
Flags:
-x, --exclude strings Names of containers to not start. [gotrue,realtime,storage-api,imgproxy,kong,mailpit,postgrest,postgres-meta,studio,edge-runtime,logflare,vector,supavisor]

colimaを利用しつつ、excludeせずにやるには
- DOCKER_SOCKET_LOCATIONでdocker.sockを指定する
- --mount-type=sshfsと--network-addressのオプションが必要らしい
1に関しては.envに書けば読んでくれるらしい

んーーーいくつか試したけど無理だなぁ
- シンボリックリンク貼った
- --mount-type=sshfs --network-addressなど
colimaと相性が悪いんか?ってなってる

無難に supabase start -x vector -x logflare
で起動するのが良さそう
このスクラップは2ヶ月前にクローズされました