Conversation
… observability, and limits
…aults, endpoints, and walkthrough
…ews/ to /workers/previews/
…hroughout Previews docs
…m dashes, add doc links, use PackageManagers components
|
This PR requires additional review attention because it affects the following areas: PartialsThis PR updates partial files, which are pieces of content used across multiple files in our Render component.
|
|
This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:
|
|
CI run failed: build logs |
| - Preview URLs are not currently generated for [Workers for Platforms](/cloudflare-for-platforms/workers-for-platforms/) [user Workers](/cloudflare-for-platforms/workers-for-platforms/how-workers-for-platforms-works/#user-workers). This is a temporary limitation, we are working to remove it. | ||
| - You cannot currently configure Preview URLs to run on a subdomain other than [`workers.dev`](/workers/configuration/routing/workers-dev/). | ||
| - You cannot view logs for Preview URLs today, this includes Workers Logs, Wrangler tail and Logpush. | ||
| This page has moved. For the latest documentation on Previews, refer to [Previews](/workers/previews/). |
There was a problem hiding this comment.
this page is no longer reachable because of the redirect, no? should we just delete this file?
|
|
||
| ### From the dashboard | ||
|
|
||
| Go to your Worker > **Settings**, and you will see a banner for setting up your default Preview settings. This walks you through the bindings, environment variables, and [observability](#observability-and-logging) settings you want every Preview to start with. This is the fastest way to get your whole team set up — anyone who creates a Preview (manually or by pushing a branch) gets the same configuration without needing to specify it themselves. |
There was a problem hiding this comment.
This banner will only appear if the Worker already has production bindings (and will likely be removed or retooled before we launch). Brand new Workers won't require any unique setup flows for Previews; configuring a Worker with Previews settings is just like configuring a Worker with Production settings. In other words, we should just point users to configuring their Previews settings from the Settings and Bindings tabs.
There was a problem hiding this comment.
I'm pretty skeptical of the value of this page. The important reference information will already be captured by our actual API reference docs (and OpenAPI schema), and the high-level feature concept explanations don't belong in a page focused on interacting with the API. Topics like how settings provided at deployment time interact with Previews settings probably shouldn't be presented through the narrow lens of the API.
We don't document other APIs in this way. Why Previews? If it's to aid in agent discoverability, I think API reference docs (or just relying on wrangler commands instead of making API requests directly) will suffice.
| InlineBadge, | ||
| } from "~/components"; | ||
|
|
||
| A **Preview** is an isolated copy of your Worker that runs on its own URL, so you can test changes before deploying to production. A Worker can have many Previews running at the same time, each isolated from each other. Each Preview runs with its own [bindings](/workers/runtime-apis/bindings/), [environment variables](/workers/configuration/environment-variables/), and [secrets](/workers/configuration/secrets/), so your preview traffic never touches your production data. |
There was a problem hiding this comment.
| A **Preview** is an isolated copy of your Worker that runs on its own URL, so you can test changes before deploying to production. A Worker can have many Previews running at the same time, each isolated from each other. Each Preview runs with its own [bindings](/workers/runtime-apis/bindings/), [environment variables](/workers/configuration/environment-variables/), and [secrets](/workers/configuration/secrets/), so your preview traffic never touches your production data. | |
| A **Preview** is a separate instance of your Worker that runs on its own URL, so you can test changes before deploying to production. Previews run with their own set of [bindings](/workers/runtime-apis/bindings/), [environment variables](/workers/configuration/environment-variables/), and [secrets](/workers/configuration/secrets/), so your preview traffic never touches your production data. |
There was a problem hiding this comment.
A Worker can have many Previews running at the same time, each isolated from each other
This is only true insofar as two Previews don't share the same binding configuration. This isn't a claim we can reliably make.
| git checkout -b new-feature | ||
| ``` | ||
|
|
||
| 3. Deploy a Preview: |
There was a problem hiding this comment.
We should probably include git push as an option here (assuming the user has connected this Worker to their git repo in the interim...)
I wonder if a "quick start" focused on Previews is actually valuable. Previews are a means to and end of supporting the overall SDLC of your Workers application, not the destination itself.
| | Preview | `my-feature.app.example.com` | | ||
| | Deployment | `f498jo-my-feature.app.example.com` | | ||
|
|
||
| To enable Previews on a custom domain via the API, set `previews_enabled` to `true`: |
There was a problem hiding this comment.
Feels out-of-place to show how to do this via API.
|
|
||
| ## Secure access to Previews | ||
|
|
||
| To restrict who can access your Preview URLs, you can enable [Cloudflare Access](/cloudflare-one/access-controls/policies/) with a single click in your Worker's settings. This protects both Preview URLs and Deployment URLs. |
There was a problem hiding this comment.
| To restrict who can access your Preview URLs, you can enable [Cloudflare Access](/cloudflare-one/access-controls/policies/) with a single click in your Worker's settings. This protects both Preview URLs and Deployment URLs. | |
| To restrict who can access your Previews, you can enable [Cloudflare Access](/cloudflare-one/access-controls/policies/) with a single click in your Worker's settings. This protects both Preview URLs and Deployment URLs. |
| To restrict who can access your Preview URLs, you can enable [Cloudflare Access](/cloudflare-one/access-controls/policies/) with a single click in your Worker's settings. This protects both Preview URLs and Deployment URLs. | ||
|
|
||
| 1. Go to **Workers & Pages** > your Worker > **Settings** > **Domains & Routes**. | ||
| 2. For Preview URLs, select **Enable Cloudflare Access**. |
There was a problem hiding this comment.
| 2. For Preview URLs, select **Enable Cloudflare Access**. | |
| 2. Select **Enable Cloudflare Access** within the actions menu of **Preview URLs**. |
|
|
||
| ## Observability and logging | ||
|
|
||
| Each Preview runs its own observability and logging settings, independent of your production Worker. This means you can: |
There was a problem hiding this comment.
| Each Preview runs its own observability and logging settings, independent of your production Worker. This means you can: | |
| Each Preview has its own observability and logging settings, independent of your production Worker. This means you can: |
| - Enable [Logpush](/workers/observability/logpush/) to send a Preview's logs to your own storage for debugging. | ||
| - Attach [Tail Workers](/workers/observability/logs/tail-workers/) to a Preview to pipe its logs into a custom analysis pipeline. | ||
|
|
||
| Configure these in the dashboard under **Workers & Pages** > your Worker > **Settings** > **Preview Defaults**, and Cloudflare applies them to every Preview created for that Worker. For details on how observability settings are structured, refer to the [Preview object](/workers/previews/api/#preview-object). |
There was a problem hiding this comment.
| Configure these in the dashboard under **Workers & Pages** > your Worker > **Settings** > **Preview Defaults**, and Cloudflare applies them to every Preview created for that Worker. For details on how observability settings are structured, refer to the [Preview object](/workers/previews/api/#preview-object). | |
| Configure observability settings for all Previews in the dashboard under **Workers & Pages** > your Worker > **Settings** > **Observability**. You can also configure these settings for an individual Preview under **Workers & Pages** > your Worker > **Previews** > your Preview > **Settings**. |
| Run `wrangler preview` from your project directory to build your code locally and deploy it as a Preview: | ||
|
|
||
| <PackageManagers type="exec" pkg="wrangler" args="preview" /> | ||
|
|
||
| By default, Wrangler names the Preview after your current Git branch. You can also provide a name explicitly: | ||
|
|
||
| <PackageManagers type="exec" pkg="wrangler" args="preview --name my-feature" /> | ||
|
|
||
| If a Preview with that name does not exist yet, Wrangler creates it. If it already exists, Wrangler creates a new deployment within it. Each time you run `wrangler preview`, Wrangler prints the Preview URL and Deployment URL to your terminal. | ||
|
|
||
| Use this for ad-hoc testing, external CI/CD pipelines, or when you are not using a Git-based workflow. |
There was a problem hiding this comment.
| Run `wrangler preview` from your project directory to build your code locally and deploy it as a Preview: | |
| <PackageManagers type="exec" pkg="wrangler" args="preview" /> | |
| By default, Wrangler names the Preview after your current Git branch. You can also provide a name explicitly: | |
| <PackageManagers type="exec" pkg="wrangler" args="preview --name my-feature" /> | |
| If a Preview with that name does not exist yet, Wrangler creates it. If it already exists, Wrangler creates a new deployment within it. Each time you run `wrangler preview`, Wrangler prints the Preview URL and Deployment URL to your terminal. | |
| Use this for ad-hoc testing, external CI/CD pipelines, or when you are not using a Git-based workflow. | |
| Run `wrangler preview` from your project directory to build your code locally and deploy it as a Preview. Use this for ad-hoc testing, external CI/CD pipelines, or when you are not using a Git-based workflow. | |
| <PackageManagers type="exec" pkg="wrangler" args="preview" /> | |
| By default, Wrangler names the Preview after your current Git branch. You can also provide a name explicitly: | |
| <PackageManagers type="exec" pkg="wrangler" args="preview --name my-feature" /> |
|
Hey there, we've marked this pull request as stale because there's no recent activity on it. This label is helps us identify PRs that might need updates (or to be closed out by our team if no longer relevant). |
Summary
Draft documentation for Worker Previews
To dos
wrangler secretput for previews