Skip to content

add storage to cli#44

Merged
soedirgo merged 1 commit into
mainfrom
add-storage
Jul 23, 2021
Merged

add storage to cli#44
soedirgo merged 1 commit into
mainfrom
add-storage

Conversation

@inian
Copy link
Copy Markdown
Member

@inian inian commented Jul 23, 2021

@inian inian requested a review from soedirgo July 23, 2021 14:37
@soedirgo
Copy link
Copy Markdown
Member

@inian the new CLI in new has a different setup compared to the self-hosting Docker one (this one uses a pg_dump from a fresh Supabase project). I'll merge this in, but I'll need to adapt this to the new CLI - probably gonna need some entries in the config file.

@soedirgo soedirgo merged commit e5fd57c into main Jul 23, 2021
@soedirgo soedirgo deleted the add-storage branch July 23, 2021 14:48
@inian
Copy link
Copy Markdown
Member Author

inian commented Jul 23, 2021

Ah cool, wanted to get this in before launch week. I will send a PR after launch week to the new branch too?

@soedirgo
Copy link
Copy Markdown
Member

soedirgo commented Jul 23, 2021

Sounds good 👍 the relevant lines are:

Container (e.g. Gotrue):

cli/internal/start/start.go

Lines 432 to 458 in 3c5558f

if err := utils.DockerRun(
ctx,
utils.GotrueId,
&container.Config{
Image: utils.GotrueImage,
Env: []string{
"GOTRUE_JWT_SECRET=super-secret-jwt-token-with-at-least-32-characters-long",
"GOTRUE_JWT_AUD=authenticated",
"GOTRUE_JWT_EXP=3600",
"GOTRUE_JWT_DEFAULT_GROUP_NAME=authenticated",
"GOTRUE_DB_DRIVER=postgres",
"DB_NAMESPACE=auth",
"API_EXTERNAL_URL=http://localhost:" + utils.ApiPort,
"GOTRUE_API_HOST=" + utils.GotrueId,
"PORT=9999",
"GOTRUE_DISABLE_SIGNUP=false",
// TODO: Change dynamically.
"GOTRUE_SITE_URL=http://localhost:8000",
"GOTRUE_LOG_LEVEL=DEBUG",
"GOTRUE_OPERATOR_TOKEN=super-secret-operator-token",
"DATABASE_URL=postgres://supabase_auth_admin:postgres@" + utils.PgbouncerId + ":5432/postgres?sslmode=disable",
},
},
&container.HostConfig{NetworkMode: container.NetworkMode(utils.NetId)},
); err != nil {
return err
}

Config:

cli/internal/init/init.go

Lines 1045 to 1054 in 3c5558f

initConfigFmt = `{
"projectId": "%[1]s",
"ports": {
"api": 8000,
"db": 5432
},
"dbVersion": "120007",
"excludeSchemas": ["extensions"]
}
`

Not sure what the format should be like, but let me know which configs you need to make dynamic (S3 stuff, etc.), public/private, etc.

Kong config:

kongConfigFmt = `_format_version: '1.1'
services:
- name: auth-v1-authorize
_comment: 'GoTrue: /auth/v1/authorize* -> http://auth:9999/authorize*'
url: http://supabase_auth_%[1]s:9999/authorize
routes:
- name: auth-v1-authorize
strip_path: true
paths:
- /auth/v1/authorize
plugins:
- name: cors
- name: auth-v1-callback
_comment: 'GoTrue: /auth/v1/callback* -> http://auth:9999/callback*'
url: http://supabase_auth_%[1]s:9999/callback
routes:
- name: auth-v1-callback
strip_path: true
paths:
- /auth/v1/callback
plugins:
- name: cors
- name: auth-v1-verify
_comment: 'GoTrue: /auth/v1/verify* -> http://auth:9999/verify*'
url: http://supabase_auth_%[1]s:9999/verify
routes:
- name: auth-v1-verify
strip_path: true
paths:
- /auth/v1/verify
plugins:
- name: cors
- name: auth-v1
_comment: 'GoTrue: /auth/v1/* -> http://auth:9999/*'
url: http://supabase_auth_%[1]s:9999/
routes:
- name: auth-v1
strip_path: true
paths:
- /auth/v1/
plugins:
- name: cors
- name: key-auth
config:
hide_credentials: true
- name: realtime-v1
_comment: 'Realtime: /realtime/v1/* -> ws://realtime:4000/socket/*'
url: http://supabase_realtime_%[1]s:4000/socket/
routes:
- name: realtime-v1-all
strip_path: true
paths:
- /realtime/v1/
plugins:
- name: cors
- name: key-auth
config:
hide_credentials: true
- name: rest-v1
_comment: 'PostgREST: /rest/v1/* -> http://rest:3000/*'
url: http://supabase_rest_%[1]s:3000/
routes:
- name: rest-v1-all
strip_path: true
paths:
- /rest/v1/
plugins:
- name: cors
- name: key-auth
config:
hide_credentials: true
consumers:
- username: apikey
keyauth_credentials:
- key: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzdXBhYmFzZSIsImlhdCI6MTYwMzk2ODgzNCwiZXhwIjoyNTUwNjUzNjM0LCJyb2xlIjoiYW5vbiJ9.36fUebxgx1mcBo4s19v0SzqmzunP--hm_hep0uLX0ew
- key: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzdXBhYmFzZSIsImlhdCI6MTYwMzk2ODgzNCwiZXhwIjoyNTUwNjUzNjM0LCJyb2xlIjoic2VydmljZV9yb2xlIn0.necIJaiP7X2T2QjGeV-FhpkizcNTX8HjDDBAxpgQTEI
`

Also this has the updated storage schema from the dump so shouldn't need the SQL stuff.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Aug 3, 2021

🎉 This PR is included in version 0.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

zlotnika pushed a commit to zlotnika/cli that referenced this pull request Apr 3, 2026
kallebysantos pushed a commit to kallebysantos/supabase-cli that referenced this pull request May 6, 2026
## What kind of change does this PR introduce?

chore / test coverage

## What is the current behavior?

The `gen` command group (`gen types`, `gen signing-key`, `gen
bearer-jwt`) had no e2e test coverage.

## What is the new behavior?

- Adds `gen.e2e.test.ts` with behaviour and parity tests for all three
`gen` subcommands:
- `gen types` — happy path (TypeScript output shape), `--debug` flag,
401/403/404 error exits, unsupported `--lang go` with `--project-id`,
missing data source
  - `gen signing-key` — default ES256 key shape, RS256 via `--algorithm`
- `gen bearer-jwt` — missing `--role` error, anon/authenticated roles,
custom `--valid-for`, custom `--sub`
- Extends `normalize.ts` in `cli-test-helpers` with JWT/JWK
normalization rules so `testParity` works on the non-deterministic
crypto output from `gen signing-key` and `gen bearer-jwt`
- Adds unit tests for the new normalize rules
- Updates recorded fixtures for existing tests affected by fixture
regeneration
@supabase-cli-releaser supabase-cli-releaser Bot mentioned this pull request May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants