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
1.02k stars 201 forks source link

Support for GitPod #268

Closed Haberkamp closed 1 year ago

Haberkamp commented 2 years ago

Bug report

Describe the bug

It seems that it's not possible to start supabase in a gitpod workspace

To Reproduce

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

  1. Create a new gitpod workspace
  2. Install supabase via homebrew
  3. Run supabase init and after that supabase start
  4. See error

Expected behaviour

All containers should start successfully without an error.

Screenshots

Bildschirmfoto 2022-05-17 um 14 19 26

System information

soedirgo commented 2 years ago

I'm not familiar with GitPod, but can you do everything the Docker CLI can do inside it?

Haberkamp commented 2 years ago

Yes, I was able to pull a docker image for adminer (a tool for database management with a web ui) and I could reach the application. So you're able to use the Docker CLI in GitPod.

EDIT: When working inside a GitPod instance you are already inside a docker container. I don't know if this is a problem since running the supabase start command creates new containers and you now have multiple containers inside another container.

sweatybridge commented 1 year ago

When working inside a GitPod instance you are already inside a docker container.

Running CLI in docker would require docker-in-docker support. I have not tested this myself but it appears to be supported on GitPod https://github.com/gitpod-io/gitpod/issues/52#issuecomment-738629624

zivbk1 commented 1 year ago

I have a similar problem, but different errors when I run supabase start.

failed to register layer: ApplyLayer exit status 1 stdout:  stderr: failed to Lchown "/usr/local/lib/node_modules/pm2/node_modules/nssocket/.npmignore" for UID 1389985163, GID 386085923 (try increasing the number of subordinate IDs in /etc/subuid and /etc/subgid): lchown /usr/local/lib/node_modules/pm2/node_modules/nssocket/.npmignore: invalid argument

and

Error: failed to register layer: ApplyLayer exit status 1 stdout:  stderr: failed to Lchown "/usr/local/lib/node_modules/pm2/node_modules/nssocket/.npmignore" for UID 1389985163, GID 386085923 (try increasing the number of subordinate IDs in /etc/subuid and /etc/subgid): lchown /usr/local/lib/node_modules/pm2/node_modules/nssocket/.npmignore: invalid argument
Try rerunning the command with --debug to troubleshoot the error.

See the attached log.txt file.

zivbk1 commented 1 year ago

@Haberkamp Did you run supabase login before init and start?

To Reproduce

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

  1. Create a new gitpod workspace
  2. Install supabase via homebrew
  3. Run supabase init and after that supabase start
  4. See error
zlanich commented 1 year ago

I'm still getting exactly what @zivbk1 posted, even on CLI version 1.50.4. I've seen related issues on the internet that suggest modifying /etc/subuid and /etc/subgid, but even though those are writeable from the terminal in GitPod using sudo, I can't seem to get said modifications to have any effect (very possible I'm doing something wrong).

I can't find much else on the internet regarding this issue.

Related:

sweatybridge commented 1 year ago

I managed to run supabase start on GitPod using CLI v1.50.8. Here are the fixes we made

  1. bump storage-api to v0.37.4 which avoids installing nssocket
  2. updates health check to resolve localhost to ipv4 address
gitpod /workspace/cli (main) $ go run . start
Setting up Edge Functions runtime...
Seeding data supabase/seed.sql...
Started supabase local development setup.

         API URL: http://localhost:54321

Please give it another try after updating and feel free to reopen if it doesn't work.

zlanich commented 1 year ago

@sweatybridge YES, just bumping supabase in package.json fixed everything. Thank you!