mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 15:39:13 +00:00
## Problem When a function runs locally with `supabase start` or `supabase functions serve`, calls to `localhost` or `127.0.0.1` inside it fail with "Connection refused". The Edge Functions development environment page didn't say that the function runs in a Docker container, or how to reach the local Supabase services and servers on the reader's machine. Related to [FDBKIN-6695](https://linear.app/supabase/issue/FDBKIN-6695/document-how-local-edge-functions-can-call-services-on-the-host) Closes [DOCS-1853](https://linear.app/supabase/issue/DOCS-1853/explain-how-a-local-edge-function-reaches-the-local-stack-and-services) ## Solution Adds a "Reach other services from a local function" section to the Edge Functions development environment page. It explains that `localhost` inside a local function means the container, points to `SUPABASE_URL` (and `SUPABASE_DB_URL`) for the local Supabase services, and shows `host.docker.internal:<port>` for a server on the host, including the Linux requirement to listen on `0.0.0.0`. Under `supabase start`, `SUPABASE_DB_URL` uses a `supabase_db_` host that some clients, such as Postgres.js, can't resolve, so the section says to swap that host for `db`. A one-line `.env` example keeps the host URL in a local secret, so deployed code uses a production secret instead. It also drops the claim under `supabase start` that local development is the exact same environment as production, which the new section contradicts. The Postgres tab note on the CLI getting-started page told readers to reach the database from a function through `host.docker.internal`. It now says a local function can't reach the database at that URL, and links to the new section, so both pages give the same advice. On the Drizzle page, the garbled note in the "Connect" step now says the `db.ts` sample swaps the `supabase_db_` host for `db` in a local Edge Function, and links to the new section. The same step now links the **Connect** panel straight to the **Transaction pooler** URI, since the panel has no "Shared pooler" option. The `db.ts` comment now says `prepare: false` disables prepared statements, not prefetch. The page gets a task title and a description that say what it helps the reader do. Smaller fixes: the password instruction is plainer, "connection pooler" is lowercase, a double space is gone, and "Related resources" is in sentence case. The Prisma and Postgres.js quickstarts had the same bare title and "Quickstart" description, so they get task titles and descriptions too, and the three ORM quickstarts now match. The Postgres.js page uses "Query" rather than "Connect to", because "Connect to Postgres with Postgres.js" is over the style guide's 35-character title limit. ## How to verify 1. Open https://docs-git-tedd-docs-1853-supabase.vercel.app/docs/guides/functions/development-environment#reach-other-services-from-a-local-function, https://docs-git-tedd-docs-1853-supabase.vercel.app/docs/guides/local-development/cli/getting-started (the **Postgres** tab under "Access your project's services"), https://docs-git-tedd-docs-1853-supabase.vercel.app/docs/guides/database/drizzle (step 3, "Connect"), https://docs-git-tedd-docs-1853-supabase.vercel.app/docs/guides/database/prisma, and https://docs-git-tedd-docs-1853-supabase.vercel.app/docs/guides/database/postgres-js. 2. The section states that a locally served function runs in a Docker container, so `localhost` and `127.0.0.1` in function code mean the container. 3. Under "Reach the local Supabase services", the section says to use `SUPABASE_URL` for the local Supabase services, notes it is `http://kong:8000` locally, and links to the default secrets table on the secrets page. It says to swap a `supabase_db_` host in `SUPABASE_DB_URL` for `db` for clients that can't resolve it. 4. The section says to reach a server on the host through `host.docker.internal:<port>`, and that on Linux the server must listen on `0.0.0.0`. 5. The example sets `API_URL` in `supabase/functions/.env`. The local secrets and production secrets links open the matching sections of the secrets page. 6. The `supabase start` paragraph no longer claims the local environment is identical to production. 7. The getting-started Postgres tab note no longer mentions `host.docker.internal`, and its link opens the "Reach the local Supabase services" section. 8. On the Drizzle page, step 3 says the `db.ts` sample swaps the `supabase_db_` host for `db` in a local Edge Function, and links to "Reach the local Supabase services". The **Connect** panel link opens the **Direct** tab with **Transaction pooler** selected. The `db.ts` comment mentions prepared statements, and the last heading reads "Related resources". 9. The Drizzle page's title reads "Connect to Postgres with Drizzle", the Prisma page's reads "Connect to Postgres with Prisma", and the Postgres.js page's reads "Query Postgres with Postgres.js". The sidebar keeps its existing labels for all three. ## Checks Ran `pnpm exec oxfmt --check` on the changed files. Typechecked the snippet with `tsc --strict` (with a `Deno` declaration); it was also run with `deno check`, `deno lint`, and served with `supabase functions serve` on Linux, where `localhost` and a `127.0.0.1`-bound host server were refused and `host.docker.internal` to a `0.0.0.0`-bound server returned 200. Under `supabase start`, Postgres.js failed to resolve the `supabase_db_` host in `SUPABASE_DB_URL` and connected with the host set to `db`, and `localhost:54322` from a function was refused. The Drizzle `db.ts` host check was run under `supabase start` with a project ID that contains an underscore: it rewrote the host to `db` and a Drizzle query succeeded. Checked `SUPABASE_URL=http://kong:8000`, `SUPABASE_DB_URL`, and the Linux `host.docker.internal:host-gateway` mapping against `supabase/cli` (`apps/cli/src/shared/functions/serve.ts`, `apps/cli/src/commands/start/start.handler.ts`, `apps/cli/src/commands/start/services/edge-runtime.service.ts`). Checked the **Connect** panel labels and its `connectTab` and `method` query parameters against `apps/studio/components/interfaces/ConnectSheet`, and `prepare: false` against the Postgres.js source. The ORM quickstart titles and descriptions follow the style guide's length limits, and each description matches its page's steps. The navigation sets its own labels, and no nav entry, breadcrumb, or test reads the old titles. ESLint ignores MDX files, and the docs build was not run in the sandbox. ## Follow-ups - `apps/docs/content/guides/database/drizzle.mdx`: the `db.ts` sample is written for Node (`import 'dotenv/config'`, `process.env.DATABASE_URL`), but its `supabase_db_` host check only applies inside a Deno Edge Function under `supabase start`. A reader in either runtime gets a sample that half fits. - `apps/docs/content/guides/database/drizzle.mdx`: the page has no value statement and no next steps. It opens straight into the gerund heading "Connecting with Drizzle" and ends after the connection step. Step 1 installs `drizzle-kit`, but no step uses it, so the reader can't create the `users` table from `schema.ts`. ## Checklist - [x] I have read the [Contributing Guidelines](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) - [ ] I have checked that the change works in the preview deployment ## Feedback for Tedd To ask Tedd for a change to this PR, reply in Tedd's session on [DOCS-1853](https://linear.app/supabase/issue/DOCS-1853/explain-how-a-local-edge-function-reaches-the-local-stack-and-services). Tedd doesn't read comments on this PR. --------- Co-authored-by: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com> Co-authored-by: alexisintech <98043211+alexisintech@users.noreply.github.com>
474 lines
17 KiB
Plaintext
474 lines
17 KiB
Plaintext
---
|
|
title: 'Supabase CLI'
|
|
description: 'The Supabase CLI provides tools to develop your project locally, deploy to the Supabase Platform, and set up CI/CD workflows.'
|
|
subtitle: 'Develop locally, deploy to the Supabase Platform, and set up CI/CD workflows'
|
|
tocVideo: _2N6ApZ0MmI
|
|
---
|
|
|
|
The Supabase CLI runs the entire Supabase stack on your own machine or in a CI environment, so you can build and test locally, then connect your project to a hosted one when you're ready to deploy.
|
|
|
|
- [Quickstart](#quickstart) is the two-command version, if you already have the CLI and a container runtime.
|
|
- [Set up a local project](#set-up-a-local-project) installs the CLI and brings the stack up on your machine. Start here if you haven't run it before.
|
|
- [Connect to a hosted project](#connect-to-a-hosted-project) links your local directory to a project on the Supabase Platform.
|
|
- [Change your CLI version](#change-your-cli-version) updates the CLI and switches between stable and pre-release builds.
|
|
- [Telemetry](#telemetry) covers what the CLI collects and how to opt out.
|
|
|
|
## Quickstart
|
|
|
|
With two commands, you can set up and start a new local project:
|
|
|
|
1. Run `supabase init` to create a new local project.
|
|
2. Run `supabase start` to launch the Supabase services.
|
|
|
|
<Admonition type="note" title="Global command or project dependency">
|
|
|
|
How you run a CLI command depends on how you install it. Homebrew, Scoop, and the Linux packages give you a global `supabase` command. Installing with npm, pnpm, yarn, or bun adds the CLI to one project instead, so you run it through your package runner as `npx supabase <command>`. This page writes every example as `supabase <command>`.
|
|
|
|
The CLI is project-scoped either way. Most commands, including `start`, expect a directory that `supabase init` has already set up with a `supabase` directory and a `config.jsonc` file. Run `init` first, then the rest from the same directory.
|
|
|
|
</Admonition>
|
|
|
|
## Set up a local project
|
|
|
|
Install the CLI, bring the Supabase stack up on your machine, and stop it when you're done.
|
|
|
|
### Install the Supabase CLI [#installing-the-supabase-cli]
|
|
|
|
<Tabs
|
|
scrollable
|
|
size="small"
|
|
type="underlined"
|
|
defaultActiveId="npm"
|
|
queryGroup="platform"
|
|
>
|
|
<TabPanel id="npm" label="npm">
|
|
|
|
1. Install the CLI as a project dev dependency. This command adds the CLI to a single project rather than installing a global command:
|
|
|
|
```sh
|
|
npm install supabase --save-dev
|
|
# or: pnpm add -D supabase / yarn add -D supabase / bun add -D supabase
|
|
```
|
|
|
|
2. Pin the version in `package.json` so your whole team uses the same CLI version.
|
|
|
|
3. Run the CLI through your package runner:
|
|
|
|
```sh
|
|
npx supabase --help
|
|
# or: pnpm supabase / yarn supabase / bunx supabase
|
|
```
|
|
|
|
<Admonition type="caution">
|
|
|
|
The Supabase CLI requires **Node.js 20 or later** when run via `npx` or `npm`. Older Node.js versions, such as 16, are not supported and fail to start the CLI.
|
|
|
|
</Admonition>
|
|
|
|
</TabPanel>
|
|
<TabPanel id="macos" label="macOS">
|
|
|
|
Install the CLI with [Homebrew](https://brew.sh):
|
|
|
|
```sh
|
|
brew install supabase/tap/supabase
|
|
```
|
|
|
|
</TabPanel>
|
|
<TabPanel id="windows" label="Windows">
|
|
|
|
Install the CLI with [Scoop](https://scoop.sh):
|
|
|
|
```powershell
|
|
scoop bucket add supabase https://github.com/supabase/scoop-bucket.git
|
|
scoop install supabase
|
|
```
|
|
|
|
</TabPanel>
|
|
<TabPanel id="linux" label="Linux">
|
|
|
|
The CLI is available via [Homebrew](https://brew.sh) and Linux packages.
|
|
|
|
#### Homebrew
|
|
|
|
```sh
|
|
brew install supabase/tap/supabase
|
|
```
|
|
|
|
#### Linux packages
|
|
|
|
Linux packages are provided in [Releases](https://github.com/supabase/cli/releases).
|
|
|
|
1. Download the `.apk`, `.deb`, or `.rpm` file for your package manager.
|
|
2. Install the package:
|
|
- `sudo apk add --allow-untrusted <...>.apk`
|
|
- `sudo dpkg -i <...>.deb`
|
|
- `sudo rpm -i <...>.rpm`
|
|
|
|
</TabPanel>
|
|
</Tabs>
|
|
|
|
### Run a local Supabase project [#running-a-local-supabase-project]
|
|
|
|
The most common thing you do with the CLI is run the full Supabase stack (Postgres, Auth, Storage, and the rest) on your own machine. That stack runs in Docker containers, so you need a container runtime installed first. On Windows and Linux, follow the official guide to install and configure [Docker Desktop](https://docs.docker.com/desktop). In a coding agent sandbox or on a CI runner with no container engine, the experimental native runtime runs each service as a process instead. It supports Linux and macOS on Apple silicon. For platform requirements and setup, see [Docker and native runtimes](/docs/guides/local-development/docker-and-native-runtimes).
|
|
|
|
On macOS, we recommend [OrbStack](https://orbstack.dev/) instead of Docker Desktop. It's a drop-in replacement that handles extended file attributes (xattrs) on mounted volumes and container networking more reliably than Docker Desktop. It also starts faster and uses less CPU, memory, and disk, which makes a noticeable difference when running the full Supabase stack.
|
|
|
|
Alternatively, you can use a different container tool that offers Docker-compatible APIs:
|
|
|
|
| Tool | Platforms |
|
|
| --------------------------------------------- | --------------------- |
|
|
| [Rancher Desktop](https://rancherdesktop.io/) | macOS, Windows, Linux |
|
|
| [Podman](https://podman.io/) | macOS, Windows, Linux |
|
|
| [colima](https://github.com/abiosoft/colima) | macOS |
|
|
|
|
To bring the stack up:
|
|
|
|
1. Start your container runtime.
|
|
|
|
2. Open a terminal in the directory where you want to create your project.
|
|
|
|
3. Initialize the project:
|
|
|
|
```bash
|
|
supabase init
|
|
```
|
|
|
|
The command creates a `supabase` directory with a `config.jsonc` file, which is safe to commit to version control. `init` creates local files only: it doesn't sign you in or connect the directory to a project on the Supabase Platform. To connect one, see [Connect to a hosted project](#connect-to-a-hosted-project). If you prefer TOML, run `supabase config convert --to toml` to switch to `config.toml`. See [Config file formats](/docs/guides/local-development/cli/config-formats).
|
|
|
|
4. Start the Supabase services from the same directory:
|
|
|
|
```bash
|
|
supabase start
|
|
```
|
|
|
|
<Admonition type="note">
|
|
|
|
If you installed the CLI as a project dependency with npm, pnpm, yarn, or bun, run `npx supabase init` and `npx supabase start` instead. See [Install the Supabase CLI](#installing-the-supabase-cli).
|
|
|
|
</Admonition>
|
|
|
|
The first run takes time while the CLI downloads the Docker images. It pulls the entire Supabase stack, plus a few extra images useful for local development, such as a local SMTP server and a database diff tool.
|
|
|
|
### Access your project's services
|
|
|
|
After all the Supabase services are running, the CLI prints your local credentials. The output looks like this, with the URLs and keys you use in your local project:
|
|
|
|
```
|
|
Started supabase local development setup.
|
|
|
|
╭──────────────────────────────────────╮
|
|
│ 🔧 Development Tools │
|
|
├─────────┬────────────────────────────┤
|
|
│ Studio │ http://127.0.0.1:54323 │
|
|
│ Mailpit │ http://127.0.0.1:54324 │
|
|
│ MCP │ http://127.0.0.1:54321/mcp │
|
|
╰─────────┴────────────────────────────╯
|
|
|
|
╭──────────────────────────────────────────────────────╮
|
|
│ 🌐 APIs │
|
|
├────────────────┬─────────────────────────────────────┤
|
|
│ Project URL │ http://127.0.0.1:54321 │
|
|
│ REST │ http://127.0.0.1:54321/rest/v1 │
|
|
│ GraphQL │ http://127.0.0.1:54321/graphql/v1 │
|
|
│ Edge Functions │ http://127.0.0.1:54321/functions/v1 │
|
|
╰────────────────┴─────────────────────────────────────╯
|
|
|
|
╭───────────────────────────────────────────────────────────────╮
|
|
│ ⛁ Database │
|
|
├─────┬─────────────────────────────────────────────────────────┤
|
|
│ URL │ postgresql://postgres:postgres@127.0.0.1:54322/postgres │
|
|
╰─────┴─────────────────────────────────────────────────────────╯
|
|
|
|
╭──────────────────────────────────────────────────────────────╮
|
|
│ 🔑 Authentication Keys │
|
|
├─────────────┬────────────────────────────────────────────────┤
|
|
│ Publishable │ sb_publishable_... │
|
|
│ Secret │ sb_secret_... │
|
|
╰─────────────┴────────────────────────────────────────────────╯
|
|
```
|
|
|
|
<Tabs
|
|
scrollable
|
|
size="small"
|
|
type="underlined"
|
|
defaultActiveId="studio"
|
|
queryGroup="access-method"
|
|
>
|
|
<TabPanel id="studio" label="Studio">
|
|
|
|
```sh
|
|
# Default URL:
|
|
http://localhost:54323
|
|
```
|
|
|
|
The local development environment includes Supabase Studio, a graphical interface for querying and editing your database.
|
|
|
|

|
|
|
|
</TabPanel>
|
|
<TabPanel id="postgres" label="Postgres">
|
|
|
|
```sh
|
|
# Default URL:
|
|
postgresql://postgres:postgres@localhost:54322/postgres
|
|
```
|
|
|
|
Access the local Postgres instance with [`psql`](https://www.postgresql.org/docs/current/app-psql.html) or any other Postgres client, such as [pgAdmin](https://www.pgadmin.org/). For example:
|
|
|
|
```bash
|
|
psql 'postgresql://postgres:postgres@localhost:54322/postgres'
|
|
```
|
|
|
|
<Admonition type="note">
|
|
|
|
A local Edge Function can't reach the database at this URL. For the connection string to use instead, see [Reach the local Supabase services](/docs/guides/functions/development-environment#reach-the-local-supabase-services).
|
|
|
|
</Admonition>
|
|
|
|
</TabPanel>
|
|
<TabPanel id="kong" label="API Gateway">
|
|
|
|
```sh
|
|
# Default URL:
|
|
http://localhost:54321
|
|
```
|
|
|
|
If you are accessing these services without the client libraries, you might need to pass the client keys as an `Authorization` header. Learn more about [JWT headers](/docs/learn/auth-deep-dive/auth-deep-dive-jwts).
|
|
|
|
```sh
|
|
curl 'http://localhost:54321/rest/v1/' \
|
|
-H "apikey: sb_publishable_..."
|
|
|
|
http://localhost:54321/rest/v1/ # REST (PostgREST)
|
|
http://localhost:54321/realtime/v1/ # Realtime
|
|
http://localhost:54321/storage/v1/ # Storage
|
|
http://localhost:54321/auth/v1/ # Auth (GoTrue)
|
|
```
|
|
|
|
</TabPanel>
|
|
<TabPanel id="analytics" label="Analytics">
|
|
|
|
Local logs rely on the Supabase Analytics Server, which reads the Docker logging driver. On Linux and macOS, mount the `/var/run/docker.sock` domain socket. On Windows, expose the `tcp://localhost:2375` daemon socket. Configure the socket manually after [installing the CLI](#installing-the-supabase-cli).
|
|
|
|
<Admonition type="note">
|
|
|
|
For advanced logs analysis using the Logs Explorer, use the BigQuery backend instead of the default Postgres backend. See [Using the BigQuery backend](/docs/reference/self-hosting-analytics/introduction#using-the-bigquery-backend).
|
|
|
|
</Admonition>
|
|
|
|
All logs are stored in the local database under the `_analytics` schema.
|
|
|
|
</TabPanel>
|
|
</Tabs>
|
|
|
|
### Stop local services [#stopping-local-services]
|
|
|
|
When you finish working, stop the stack. Stopping doesn't reset your local database:
|
|
|
|
```bash
|
|
supabase stop
|
|
```
|
|
|
|
With the default ports, `supabase start` runs one local project per machine, because every project's config file uses the same ports. To run several local projects or git worktrees at the same time, see [Running multiple local projects](/docs/guides/local-development/running-multiple-local-projects).
|
|
|
|
## Connect to a hosted project
|
|
|
|
The stack you started in [Run a local Supabase project](#running-a-local-supabase-project) runs only on your machine. Nothing reaches a hosted project until you sign in to the CLI and link your local directory to one.
|
|
|
|
For the steps, see [Pushing to a remote project](/docs/guides/local-development/cli-workflows#pushing-to-a-remote-project). To run deployments from CI, see [Configure GitHub Actions](/docs/guides/deployment/managing-environments#configure-github-actions).
|
|
|
|
## Change your CLI version
|
|
|
|
These sections cover the CLI itself rather than your local project.
|
|
|
|
### Use the beta channel [#beta-channel]
|
|
|
|
Pre-release CLI builds ship from the development branch and are versioned `X.Y.Z-beta.N`. Use the npm `beta` dist-tag, or install `supabase-beta` with Homebrew or Scoop. `supabase-beta` is a separate package from `supabase`.
|
|
|
|
<Tabs
|
|
scrollable
|
|
size="small"
|
|
type="underlined"
|
|
defaultActiveId="npm"
|
|
queryGroup="platform"
|
|
>
|
|
<TabPanel id="npm" label="npm">
|
|
|
|
Install as a dev dependency:
|
|
|
|
```sh
|
|
npm install supabase@beta --save-dev
|
|
```
|
|
|
|
Or run without installing:
|
|
|
|
```sh
|
|
npx supabase@beta --help
|
|
```
|
|
|
|
</TabPanel>
|
|
<TabPanel id="macos" label="macOS">
|
|
|
|
```sh
|
|
brew install supabase/tap/supabase-beta
|
|
brew link --overwrite supabase-beta
|
|
```
|
|
|
|
</TabPanel>
|
|
<TabPanel id="windows" label="Windows">
|
|
|
|
```powershell
|
|
scoop bucket add supabase https://github.com/supabase/scoop-bucket.git
|
|
scoop install supabase-beta
|
|
```
|
|
|
|
</TabPanel>
|
|
<TabPanel id="linux" label="Linux">
|
|
|
|
#### Homebrew [#beta-homebrew]
|
|
|
|
```sh
|
|
brew install supabase/tap/supabase-beta
|
|
brew link --overwrite supabase-beta
|
|
```
|
|
|
|
#### Linux packages [#beta-linux-packages]
|
|
|
|
Beta builds are attached to [GitHub pre-releases](https://github.com/supabase/cli/releases). Download the `.apk`, `.deb`, or `.rpm` for your platform and install with the same commands as [Linux packages](#linux-packages).
|
|
|
|
</TabPanel>
|
|
</Tabs>
|
|
|
|
### Update the Supabase CLI [#updating-the-supabase-cli]
|
|
|
|
Update the CLI with the same package manager you installed it with. See the [CLI releases page](https://github.com/supabase/cli/releases) for available versions.
|
|
|
|
<Tabs
|
|
scrollable
|
|
size="small"
|
|
type="underlined"
|
|
defaultActiveId="npm"
|
|
queryGroup="platform"
|
|
>
|
|
<TabPanel id="npm" label="npm">
|
|
|
|
Update the CLI with [npm](https://www.npmjs.com/package/supabase):
|
|
|
|
```sh
|
|
npm update supabase --save-dev
|
|
```
|
|
|
|
Update to the current beta release, or switch a stable install to the beta channel:
|
|
|
|
```sh
|
|
npm install supabase@beta --save-dev
|
|
```
|
|
|
|
</TabPanel>
|
|
<TabPanel id="macos" label="macOS">
|
|
|
|
```sh
|
|
brew upgrade supabase
|
|
```
|
|
|
|
Beta channel:
|
|
|
|
```sh
|
|
brew upgrade supabase-beta
|
|
```
|
|
|
|
</TabPanel>
|
|
<TabPanel id="windows" label="Windows">
|
|
|
|
```powershell
|
|
scoop update supabase
|
|
```
|
|
|
|
Beta channel:
|
|
|
|
```powershell
|
|
scoop update supabase-beta
|
|
```
|
|
|
|
</TabPanel>
|
|
<TabPanel id="linux" label="Linux">
|
|
|
|
#### Homebrew [#update-homebrew]
|
|
|
|
```sh
|
|
brew upgrade supabase
|
|
```
|
|
|
|
Beta channel:
|
|
|
|
```sh
|
|
brew upgrade supabase-beta
|
|
```
|
|
|
|
#### Linux packages [#update-linux-packages]
|
|
|
|
1. Download the package from the [Supabase CLI releases page](https://github.com/supabase/cli/releases/latest)
|
|
2. Install the package using the same commands as the [initial installation](#linux-packages):
|
|
- `sudo apk add --allow-untrusted <...>.apk`
|
|
- `sudo dpkg -i <...>.deb`
|
|
- `sudo rpm -i <...>.rpm`
|
|
|
|
</TabPanel>
|
|
</Tabs>
|
|
|
|
If you have any Supabase containers running locally, stop them and delete their data volumes before upgrading. Deleting the volumes lets Supabase managed services apply new migrations on a clean local database.
|
|
|
|
<Admonition type="caution" title="Back up before you stop">
|
|
|
|
`supabase stop --no-backup` deletes your local schema and data changes. Save them first.
|
|
|
|
</Admonition>
|
|
|
|
1. Save local schema changes as a migration:
|
|
|
|
```sh
|
|
supabase db diff -f my_schema
|
|
```
|
|
|
|
2. Dump local data to your seed file:
|
|
|
|
```sh
|
|
supabase db dump --data-only > supabase/seed.sql
|
|
```
|
|
|
|
3. Stop the containers and delete their data volumes:
|
|
|
|
```sh
|
|
supabase stop --no-backup
|
|
```
|
|
|
|
## Telemetry
|
|
|
|
The Supabase CLI collects usage data, such as the commands you run, to help improve the CLI. The data is linked to a device ID and, when you authenticate the CLI, to your Supabase account. Telemetry is optional, and you can opt out at any time.
|
|
|
|
### How to opt out
|
|
|
|
1. Disable telemetry:
|
|
|
|
```bash
|
|
supabase telemetry disable
|
|
```
|
|
|
|
2. Confirm the current setting:
|
|
|
|
```bash
|
|
supabase telemetry status
|
|
```
|
|
|
|
To enable telemetry again, run `supabase telemetry enable`.
|
|
|
|
You can also opt out with an environment variable. Set `SUPABASE_TELEMETRY_DISABLED=1` or `DO_NOT_TRACK=1`. The value must be exactly `1`.
|
|
|
|
The CLI also checks GitHub for a newer CLI release after a command succeeds. This check is separate from telemetry. To turn it off, set `SUPABASE_NO_UPDATE_NOTIFIER=1`.
|
|
|
|
## Learn more
|
|
|
|
- [CLI configuration](/docs/guides/local-development/cli/config)
|
|
- [CLI reference](/docs/reference/cli)
|