Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions guides/cli/how-to-use-lightdash-deploy.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ This guide will walk you through how it works, when to use each option, and what
## Before you deploy: A quick word of caution

<Warning>
Running `lightdash deploy` uses your local dbt profile (from your `profiles.yml`). If your local profile isn't pointing to production, you could deploy to the wrong environment.
This works in simple setups, but can introduce risk when using multiple environments or working in a team.
**`lightdash deploy` pushes directly to your production project.**

Running this command uses your local dbt profile (from your `profiles.yml`). If your default target points to a dev or staging environment, `lightdash deploy` will overwrite your production semantic layer with that configuration, breaking dashboards for all users.

If you're working locally, **use [`lightdash preview`](/guides/cli/how-to-use-lightdash-preview) instead**. It creates a temporary, isolated project that won't affect production.
</Warning>

For a safer, scalable approach to deploying and previewing changes, use CI/CD. This allows you to:
Expand Down Expand Up @@ -53,7 +56,7 @@ If your dbt project uses different profiles or targets for dev and prod, you can
lightdash deploy --profile prod
```
<Warning>
Be careful — if your local prod profile isn't properly pointing to your production database,
Be careful. If your local prod profile isn't properly pointing to your production database,
this can result in incorrect connections (e.g. accidentally deploying to a dev dataset).
</Warning>

Expand Down
8 changes: 6 additions & 2 deletions references/lightdash-cli.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -370,9 +370,13 @@ lightdash stop-preview "neon unicorn"
Compiles and deploys the current project to your [selected Lightdash Cloud project](#lightdash-config-set-project).

<Warning>
**It is not common practice to use this command from the CLI after initial project creation.**
**`lightdash deploy` pushes directly to your production project.**

This command is usually [used in Github Actions](/guides/cli/how-to-use-lightdash-deploy#automatically-deploy-your-changes-to-lightdash-using-a-github-action) or other deploy scripts.
Running this command from a local branch will overwrite your production semantic layer with whatever is compiled locally, including any dev or staging targets from your `profiles.yml`. This can break dashboards for all users.

**Use [`lightdash preview`](#lightdash-preview) for local development and testing.** Preview creates a temporary, isolated project that won't affect production.

For production deploys, we recommend using [CI/CD with GitHub Actions](/guides/cli/how-to-use-lightdash-deploy#automatically-deploy-your-changes-to-lightdash-using-a-github-action).
</Warning>

All standard [dbt options](#dbt-options) work with `lightdash deploy`.
Expand Down