supabase / cli

Supabase CLI. Manage postgres migrations, run Supabase locally, deploy edge functions. Postgres backups. Generating types from your database schema.
https://supabase.com/docs/reference/cli/about
MIT License
968 stars 183 forks source link

Vector fails to connect to docker socket on windows #2505

Closed seadynamic8 closed 1 day ago

seadynamic8 commented 2 weeks ago

Describe the bug

After update to v1.183.5, get this error when starting supabase cli: (local dev) ... now downgraded back to 1.178.2, get these errors:

with downgraded v1.178.2

supabase_realtime_chat_app container logs:
21:30:04.267 [info] Migrations already up
21:30:05.018 [debug] QUERY OK db=1.8ms queue=140.7ms idle=0.0ms
begin []
21:30:05.043 [debug] QUERY ERROR source="tenants" db=0.0ms
SELECT t0."id", t0."name", t0."external_id", t0."jwt_secret", t0."jwt_jwks", t0."postgres_cdc_default", t0."max_concurrent_users", t0."max_events_per_second", t0."max_bytes_per_second", t0."max_channels_per_client", t0."max_joins_per_second", t0."suspend", t0."enable_authorization", t0."inserted_at", t0."updated_at" FROM "tenants" AS t0 WHERE (t0."external_id" = $1) ["realtime-dev"]
21:30:05.046 [debug] QUERY OK db=0.3ms
rollback []
** (Postgrex.Error) ERROR 42703 (undefined_column) column t0.enable_authorization does not exist

    query: SELECT t0."id", t0."name", t0."external_id", t0."jwt_secret", t0."jwt_jwks", t0."postgres_cdc_default", t0."max_concurrent_users", t0."max_events_per_second", t0."max_bytes_per_second", t0."max_channels_per_client", t0."max_joins_per_second", t0."suspend", t0."enable_authorization", t0."inserted_at", t0."updated_at" FROM "tenants" AS t0 WHERE (t0."external_id" = $1)
    (ecto_sql 3.8.3) lib/ecto/adapters/sql.ex:932: Ecto.Adapters.SQL.raise_sql_call_error/1
    (ecto_sql 3.8.3) lib/ecto/adapters/sql.ex:847: Ecto.Adapters.SQL.execute/6
    (ecto 3.8.4) lib/ecto/repo/queryable.ex:221: Ecto.Repo.Queryable.execute/4
    (ecto 3.8.4) lib/ecto/repo/queryable.ex:19: Ecto.Repo.Queryable.all/3
    (ecto 3.8.4) lib/ecto/repo/queryable.ex:147: Ecto.Repo.Queryable.one/3
    /app/lib/realtime-2.28.32/priv/repo/seeds.exs:10: (file)
    /app/lib/realtime-2.28.32/priv/repo/seeds.exs:9: (file)
    nofile:1: (file)

.... repeats few times

Stopping containers...
supabase_realtime_chat_app container is not ready: unhealthy

with 1.183.5

WARNING: analytics requires mounting default docker socket: //./pipe/docker_engine
supabase_vector_chat_app container logs:
2024-07-09T21:46:56.683451Z  INFO vector::app: Internal log rate limit configured. internal_log_rate_secs=10
2024-07-09T21:46:56.688088Z  INFO vector::app: Log level is enabled. level="vector=info,codec=info,vrl=info,file_source=info,tower_limit=trace,rdkafka=info,buffers=info,lapin=info,kube=info"
2024-07-09T21:46:56.691761Z  INFO vector::app: Loading configs. paths=["/etc/vector/vector.yaml"]
2024-07-09T21:46:56.771891Z  WARN vector::config::loading: Transform "router._unmatched" has no consumers
2024-07-09T21:46:56.777654Z  INFO source{component_kind="source" component_id=docker_host component_type=docker_logs 
component_name=docker_host}: vector::sources::docker_logs: Capturing logs from now on. now=2024-07-09T21:46:56.776739985+00:00
2024-07-09T21:46:56.779760Z  INFO source{component_kind="source" component_id=docker_host component_type=docker_logs 
component_name=docker_host}: vector::sources::docker_logs: Listening to docker log events.
2024-07-09T21:46:56.943828Z  INFO vector::topology::running: Running healthchecks.
2024-07-09T21:46:56.943905Z  INFO vector::topology::builder: Healthcheck passed.
2024-07-09T21:46:56.943945Z  INFO vector::topology::builder: Healthcheck passed.
2024-07-09T21:46:56.943965Z  INFO vector::topology::builder: Healthcheck passed.
2024-07-09T21:46:56.943971Z  INFO vector::topology::builder: Healthcheck passed.
2024-07-09T21:46:56.943975Z  INFO vector::topology::builder: Healthcheck passed.
2024-07-09T21:46:56.943979Z  INFO vector::topology::builder: Healthcheck passed.
2024-07-09T21:46:56.943983Z  INFO vector::topology::builder: Healthcheck passed.
2024-07-09T21:46:56.944725Z  INFO vector: Vector has started. debug="false" version="0.28.1" arch="x86_64" revision="ff15924 2023-03-06"
2024-07-09T21:46:56.951310Z ERROR source{component_kind="source" component_id=docker_host component_type=docker_logs 
component_name=docker_host}: vector::sources::docker_logs: Listing currently running containers failed. error=error trying to connect: Connection refused (os error 111)
2024-07-09T21:46:56.969415Z  INFO vector::internal_events::api: API server running. address=0.0.0.0:9001 playground=http://0.0.0.0:9001/playground
2024-07-09T21:46:56.969467Z  INFO vector::app: All sources have finished.
2024-07-09T21:46:56.969471Z  INFO vector: Vector has stopped.
2024-07-09T21:46:56.972411Z  INFO vector::topology::running: Shutting down... Waiting on running components. remaining_components="storage_logs, logflare_auth, realtime_logs, kong_logs, project_logs, logflare_kong, rest_logs, logflare_functions, db_logs, logflare_db, router, auth_logs, kong_err, logflare_storage, logflare_rest, logflare_realtime" time_remaining="59 seconds left"

... repeats a few times

Stopping containers...
supabase_vector_chat_app container is not ready: unhealthy

To Reproduce Steps to reproduce the behavior:

  1. Run 'supabase start'
  2. See error above

Expected behavior

  1. No error and can continue running.

System information

sweatybridge commented 2 weeks ago

On 1.183.5, you want to disable analytics in config.toml since windows is not fully supported.

You can still use the docker desktop ui to view the logs.

seadynamic8 commented 2 weeks ago

@sweatybridge This seems to get supabase dev server working for now. Will the Studio be able to view the logs in the future? Like is this a temporary thing or will we always have to just use Docker Desktop UI, since that's not ideal?

sweatybridge commented 2 weeks ago

Will the Studio be able to view the logs in the future? Like is this a temporary thing or will we always have to just use Docker Desktop UI, since that's not ideal?

Yes, that's the end goal we want to achieve. The current blocker is the requirement to use docker-in-docker for vector ingestion. On windows, the docker socket is exposed as named pipe (ie. //./pipe/docker_engine) and mounting it into a linux container is not supported.

I will put up a guide soon to document the configuration required for docker desktop on windows. It will likely require exposing the tcp docker socket instead.

seadynamic8 commented 2 weeks ago

Thanks for the clarification.

dvorakjt commented 2 weeks ago

Thank you for this clarification! All of a sudden, Supabase failed to start on my Windows machine, but disabling analytics fixed it.

empz commented 1 week ago

Could "supabase start" detect if the host is Windows and automatically disable analytics? Otherwise is hard to know unless you find this.

nozoko commented 1 day ago

Agree with above that this needs to be more publicized. It was very difficult to find this (quite simple) solution to the problem, as when you run "supabase start" with the --debug flag as recommended by the command line, it gives an unrelated and unhelpful error of having a duplicate docker container name (something already named "supabase_res_Supabase"). Perhaps the supabase docs should be updated to note this required change to the config on Windows hosts until a solution is found?

In fact, looking at it now, the docs at https://supabase.com/docs/guides/cli/local-development actually say that logging is disabled by default, when it seems to actually be enabled by default now.

sweatybridge commented 1 day ago

This should be fixed in cli 1.187.5, using the docker settings here https://github.com/supabase/cli/issues/2538#issuecomment-2246855270

It would be great to get a confirmation from you as I prepare to update our official docs soon.

nozoko commented 1 day ago

This should be fixed in cli 1.187.5, using the docker settings here #2538 (comment)

It would be great to get a confirmation from you as I prepare to update our official docs soon.

It seems like I'm still having issues after making the changes to the docker config that you suggested. I am getting a different error message though. That said, I don't really need analytics and am not an experienced docker user, so I may be missing other configuration settings that would resolve the issue. If you are wondering, this is what I am seeing still on my end:

2024-07-24T06:20:54.549861Z  INFO vector::app: Internal log rate limit configured. internal_log_rate_secs=10
2024-07-24T06:20:54.549942Z  INFO vector::app: Log level is enabled. level="vector=info,codec=info,vrl=info,file_source=info,tower_limit=trace,rdkafka=info,buffers=info,lapin=info,kube=info"
2024-07-24T06:20:54.549988Z  INFO vector::app: Loading configs. paths=["/etc/vector/vector.yaml"]
2024-07-24T06:20:54.568261Z  WARN vector::config::loading: Transform "router._unmatched" has no consumers
2024-07-24T06:20:54.568730Z  INFO source{component_kind="source" component_id=docker_host component_type=docker_logs component_name=docker_host}: vector::sources::docker_logs: Capturing logs from now on. now=2024-07-24T06:20:54.568698453+00:00
2024-07-24T06:20:54.568783Z  INFO source{component_kind="source" component_id=docker_host component_type=docker_logs component_name=docker_host}: vector::sources::docker_logs: Listening to docker log events.
2024-07-24T06:20:54.676890Z  INFO vector::topology::running: Running healthchecks.
2024-07-24T06:20:54.676965Z  INFO vector::topology::builder: Healthcheck passed.
2024-07-24T06:20:54.676974Z  INFO vector::topology::builder: Healthcheck passed.
2024-07-24T06:20:54.676978Z  INFO vector::topology::builder: Healthcheck passed.
2024-07-24T06:20:54.676980Z  INFO vector::topology::builder: Healthcheck passed.
2024-07-24T06:20:54.676983Z  INFO vector::topology::builder: Healthcheck passed.
2024-07-24T06:20:54.676987Z  INFO vector::topology::builder: Healthcheck passed.
2024-07-24T06:20:54.676989Z  INFO vector::topology::builder: Healthcheck passed.
2024-07-24T06:20:54.677110Z  INFO vector: Vector has started. debug="false" version="0.28.1" arch="x86_64" revision="ff15924 2023-03-06"
2024-07-24T06:20:54.677120Z ERROR source{component_kind="source" component_id=docker_host component_type=docker_logs component_name=docker_host}: vector::sources::docker_logs: Listing currently running containers failed. error=error trying to connect: Connection refused (os error 111)
2024-07-24T06:20:54.683366Z  INFO vector::internal_events::api: API server running. address=0.0.0.0:9001 playground=http://0.0.0.0:9001/playground
2024-07-24T06:20:54.683391Z  INFO vector::app: All sources have finished.
2024-07-24T06:20:54.683393Z  INFO vector: Vector has stopped.
2024-07-24T06:20:54.683713Z  INFO vector::topology::running: Shutting down... Waiting on running components. remaining_components="logflare_db, logflare_kong, logflare_storage, db_logs, logflare_functions, logflare_rest, logflare_realtime, logflare_auth, kong_err" time_remaining="59 seconds left"
Stopping containers...
Pruned containers: [79544d71a6b34977cb4c2ccca39ef2dab5fa4fdf5790b20735d01fc1f2fe6f98 141da0d255a100603c26205e2faf7cbd03c4f95539cf3b1194b6c4b1718f6457 78c2527dae8bc54f51100eacce24ed8fb5cb6e02a406472e7e89840626bed19d eade1fdd17f2cf941a65dc1aa3317ea038ddc24d057c0d8ca30ebd4effe69964 c1758f4a7efa65a398a2d7b630c35005a66a443bdb68a3c4e6e2c0d4356ce534 eb7660cdc38bd42ba7654b64c2c05d753fa3a08ac28e177090bf7aa2a7851eb3 ccd8fd18c73d5fdbff3d135300be6323465ed2b2c94dd6ce384b9f7a2efe0f98 09d3519175222af16fb81008cd4938f588d591664eceeaaf32c145fe428572c1 f6928f6a40c9fb2a4dc214c439ff332a6e08762218807fc9a5fa3ef82636166c d565b2c82f8c687ca09c5a68074f9ca816c264861cd0da626f784536fba68dd4 d71b90419bd975601e050c6fd5df0afc3d38503bc1d61f90555d472f55ffd06c 0405297ad5abf4cae58ce0033e4808be0066f5f40117fc9964d7a7433a99e7aa]
Pruned network: [supabase_network_Supabase]
supabase_vector_Supabase container is not ready: unhealthy

Disabling analytics again resolves the problem. I tried restarting my system as well just in case the docker changes would only apply on reboot, but no luck. My supabase config file is the standard one save for disabling analytics, and my docker settings are the fresh install defaults save for the settings you recommended enabling to fix the issue.