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
6 changes: 6 additions & 0 deletions docs/app/reflex_docs/pages/docs/cloud_cliref.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,14 @@ def prefix(
"history",
"build-logs",
"list",
"rollback",
"describe",
],
),
"providers": prefix(
REFLEX_CLOUD_PREFIX + " providers",
["status", "list"],
),
"projects": prefix(
REFLEX_CLOUD_PREFIX + " project",
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ def get_sidebar_items_hosting():
children=[
hosting.self_hosting,
hosting.databricks,
hosting.cloud_providers,
hosting.bring_your_own_cloud,
hosting.deploy_to_gcp,
],
Expand Down
46 changes: 46 additions & 0 deletions docs/hosting/app-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,49 @@ Here there is a `Delete app` button. Pressing this button will delete the app an
Clicking on the `Settings` tab in the Cloud UI on the app page also allows a user to change the `app name`, change the `app description` and check the `app id`.

The other app settings also allows users to edit and add secrets (environment variables) to the app. For more information on secrets, see the [Secrets (Environment Variables)](/docs/hosting/secrets-environment-vars/) page.

## Deployment history

Every `reflex deploy` creates a new deployment. List an app's deployment history — each deployment's status, Python/Reflex versions, VM type, optional description, and whether it can be rolled back to — with:

```bash
reflex cloud apps history [APP_ID]
```

If you omit `APP_ID`, the app is resolved from the `appid` in your `cloud.yml`/`pyproject.toml`, or you can pass `--app-name`. Add `--json` for machine-readable output.

## Deployment descriptions

You can attach a short changelog note to a deployment so your history is easy to scan (for example, `"bump pricing page copy"`). Set it at deploy time:

```bash
reflex deploy --description "bump pricing page copy"
```

You can also set or replace the note on an existing deployment. Find the deployment id with `reflex cloud apps history`, then:

```bash
reflex cloud apps describe <DEPLOYMENT_ID> --app-id <APP_ID> --description "hotfix: revert checkout change"
```

Pass `--description ""` to clear the note. Descriptions show up in `reflex cloud apps history` and in the Cloud dashboard.

```md alert info
# CLI command to set a deployment description
`reflex cloud apps describe [OPTIONS] DEPLOYMENT_ID --description "<note>"`
```

## Rolling back a deployment

If a deploy introduces a regression, you can roll back to any previous deployment that still has a built image. A rollback redeploys that deployment's existing image — no rebuild from source — and makes it current again, demoting the currently running deployment to history.

```bash
reflex cloud apps rollback <DEPLOYMENT_ID> --app-id <APP_ID>
```

Use `reflex cloud apps history` to find rollback-eligible deployments: their `can rollback` value is `True`. A deployment can only be rolled back to on the provider whose registry holds its image, so after [switching an app's provider](/docs/hosting/cloud-providers/) the deployments built on the previous provider are no longer offered as rollback targets.

```md alert info
# CLI command to roll back
`reflex cloud apps rollback [OPTIONS] DEPLOYMENT_ID`
```
75 changes: 75 additions & 0 deletions docs/hosting/cloud-providers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
```python exec
import reflex as rx
```

# Cloud Providers

By default, `reflex deploy` runs your app on Reflex Cloud's managed infrastructure. If your organization has connected its own cloud account, you can instead deploy the same app — with the same `reflex deploy` command and the same managed lifecycle (logs, scaling, history, rollbacks) — into **your own cloud account**. Today this is supported for **Google Cloud (GCP)**, where your app runs on [Cloud Run](https://cloud.google.com/run) in your GCP project.

```md alert info
# Enterprise tier only.

Deploying to a connected cloud provider is part of the **Enterprise tier** of Reflex Cloud. Contact [sales@reflex.dev](mailto:sales@reflex.dev) to upgrade.
```

```md alert warning
# Managed vs. self-service GCP deploys

This page covers the **managed** flow: an admin connects a GCP account to your organization once, and Reflex Cloud deploys into it for you using the normal `reflex deploy` command, giving you the full managed lifecycle (history, rollback, scaling, logs). This is different from the self-service [`reflex cloud deploy --gcp`](/docs/hosting/deploy-to-gcp/) command, which builds and deploys from your own machine using your local `gcloud`.
```

## Connecting Google Cloud

An organization admin connects the GCP account once, from the Reflex Cloud dashboard under **Organization → Cloud Providers**. You provide a service-account key, your GCP project number, and a region; Reflex validates that the service account has the permissions needed to deploy Cloud Run services and push images to Artifact Registry before storing the (encrypted) credentials.

Once connected, check availability from the CLI:

```bash
reflex cloud providers status
```

This reports whether GCP is connected, whether your plan allows GCP deploys, and the connected project and region. List all connected provider accounts with:

```bash
reflex cloud providers list
```

## Choosing a provider at deploy time

When your org has GCP connected, `reflex deploy` asks where you want to deploy:

```console
$ reflex deploy
This organization has Google Cloud connected (region us-central1).
Where would you like to deploy? [reflex-cloud/gcp] (reflex-cloud):
```

Choose `reflex-cloud` for Reflex's managed infrastructure or `gcp` for your connected Google Cloud account. To skip the prompt (for example in CI), pass `--provider`:

```bash
reflex deploy --provider gcp
reflex deploy --provider reflex-cloud
```

You can also pin the provider in your `cloud.yml` / `pyproject.toml` so every deploy targets the same place:

```yaml
provider: gcp
```

When you deploy to GCP, the region and machine sizing come from the connected GCP account, so `--region` and `--vmtype` are ignored.

## Switching providers

An app remembers its provider between deploys. You can switch it at any time by choosing a different provider on your next `reflex deploy` (or with `--provider`). Switching a **deployed** app tears down its resources on the previous provider and requires a redeploy to come back up on the new one — `reflex deploy` performs that redeploy as part of the switch. In interactive mode the CLI warns and asks for confirmation before switching a deployed app.

## What runs where

| | Reflex Cloud | Google Cloud (managed) |
| --- | --- | --- |
| Runtime | Reflex-managed | Cloud Run in your GCP project |
| Compute billing | Reflex Cloud | Your GCP account |
| Region / sizing | `--region` / `--vmtype` | From the connected GCP account |
| Logs, history, rollback, scaling | ✅ | ✅ |

Deployment descriptions and rollbacks work the same way on both providers — see [App management](/docs/hosting/app-management/).
6 changes: 6 additions & 0 deletions docs/hosting/deploy-to-gcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ The `reflex cloud deploy --gcp` command deploys a Reflex app to your own [Google
Self-deploying to GCP Cloud Run is part of the **Enterprise tier** of Reflex Cloud. The control plane will return `403` to non-Enterprise tokens, and the CLI surfaces a clear error pointing at this. Contact [sales@reflex.dev](mailto:sales@reflex.dev) to upgrade.
```

```md alert warning
# Self-service vs. managed GCP deploys

This page covers the **self-service** `reflex cloud deploy --gcp` command, which builds and deploys from your own machine using your local `gcloud`. If you'd rather connect a GCP account to your organization once and deploy with the normal `reflex deploy` command — keeping the managed lifecycle (history, rollback, scaling, logs) — see [Cloud Providers](/docs/hosting/cloud-providers/).
```

## Prerequisites

Before running the command, install and authenticate the local tools the deploy script invokes:
Expand Down
1 change: 1 addition & 0 deletions news/+reflex-deploy-provider.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`reflex deploy` now accepts `--provider` (deploy to Reflex Cloud or a GCP account connected to your organization) and `--description` (record an optional changelog note on the deployment, shown in `reflex cloud apps history`).
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added optional per-deployment descriptions (changelog notes): set one at deploy time with `reflex deploy --description "..."`, set or clear it later with `reflex cloud apps describe`, and view it in `reflex cloud apps history`.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added `reflex cloud apps rollback DEPLOYMENT_ID`, which rolls an app back to a previous deployment by redeploying its already-built image without rebuilding from source. `reflex cloud apps history` now reports whether each deployment can be rolled back to.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added Google Cloud (GCP) as a managed deploy target for `reflex deploy`. When your organization has a GCP account connected (Enterprise tier), `reflex deploy` asks whether to deploy to Reflex Cloud or your GCP account (or pass `--provider gcp` / set `provider: gcp` in your config to skip the prompt), and `reflex cloud providers status` / `list` report the connection state.
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class Config:
packages: list[str] = dataclasses.field(default_factory=list)
appid: str | None = dataclasses.field(default=None)
strategy: str | None = dataclasses.field(default=None)
provider: str | None = dataclasses.field(default=None)
include_db: bool = dataclasses.field(default=False)

_cloud_config_path: Path | None = dataclasses.field(default=None)
Expand Down
Loading
Loading