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
33 changes: 20 additions & 13 deletions src/content/docs/workers/ci-cd/builds/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ pcx_content_type: concept
title: Builds
description: Use Workers Builds to integrate with Git and automatically build and deploy your Worker when pushing a change
sidebar:
group:
badge:
text: Beta
---
import { DashButton } from "~/components";

The Cloudflare [Git integration](/workers/ci-cd/builds/git-integration/) lets you connect a new or existing Worker to a GitHub or GitLab repository, enabling automated builds and deployments for your Worker on push.

Expand All @@ -15,9 +15,12 @@ The Cloudflare [Git integration](/workers/ci-cd/builds/git-integration/) lets yo
### Connect a new Worker

To create a new Worker and connect it to a GitHub or GitLab repository:
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account.
2. Go to **Workers & Pages**.
3. Select **Create**.
1. In the Cloudflare dashboard, go to the **Workers & Pages** page.

<DashButton url="/?to=/:account/workers-and-pages" />

2. Select **Create application**.
3. Select **Get started** next to **Import a repository**.
4. Under **Import a repository**, select a **Git account**.
5. Select the repository you want to import from the list. You can also use the search bar to narrow the results.
6. Configure your project and select **Save and Deploy**.
Expand All @@ -26,12 +29,14 @@ To create a new Worker and connect it to a GitHub or GitLab repository:
### Connect an existing Worker

To connect an existing Worker to a GitHub or GitLab repository:
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account.
2. Go to **Workers & Pages**.
3. Select the Worker you want to connect to a repository.
4. Select **Settings** and then **Builds**.
5. Select **Connect** and follow the prompts to connect the repository to your Worker and configure your [build settings](/workers/ci-cd/builds/configuration/).
6. Push a commit to your Git repository to trigger a build and deploy to your Worker.
1. In the Cloudflare dashboard, go to the **Workers & Pages** page.

<DashButton url="/?to=/:account/workers-and-pages" />

2. Select the Worker you want to connect to a repository.
3. Select **Settings** and then **Builds**.
4. Select **Connect** and follow the prompts to connect the repository to your Worker and configure your [build settings](/workers/ci-cd/builds/configuration/).
5. Push a commit to your Git repository to trigger a build and deploy to your Worker.

:::caution

Expand All @@ -54,9 +59,11 @@ If a build succeeds, it is uploaded as a version. If the build is configured to
## Disconnecting builds

To disconnect a Worker from a GitHub or GitLab repository:
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account.
2. Go to **Workers & Pages**.
3. Select the Worker you want to disconnect from a repository.
1. In the Cloudflare dashboard, go to the **Workers & Pages** page.

<DashButton url="/?to=/:account/workers-and-pages" />

2. Select the Worker you want to disconnect from a repository.
4. Select **Settings** and then **Builds**.
5. Select **Disconnect**.

Expand Down
13 changes: 8 additions & 5 deletions src/content/docs/workers/ci-cd/external-cicd/gitlab-cicd.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pcx_content_type: how-to
title: GitLab CI/CD
description: Integrate Workers development into your existing GitLab Pipelines workflows.
---
import { DashButton } from "~/components";

You can deploy Workers with [GitLab CI/CD](https://docs.gitlab.com/ee/ci/pipelines/index.html). Here is how you can set up your GitHub Actions workflow.

Expand All @@ -18,11 +19,13 @@ To find your Cloudflare account ID, refer to [Find account and zone IDs](/fundam

To create an API token to authenticate Wrangler in your CI job:

1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com).
2. Select **My Profile** > **API Tokens**.
3. Select **Create Token** > find **Edit Cloudflare Workers** > select **Use Template**.
4. Customize your token name.
5. Scope your token.
1. In the Cloudflare dashboard, go to the **Account API tokens** page.

<DashButton url="/?to=/:account/api-tokens" />

2. Select **Create Token** > find **Edit Cloudflare Workers** > select **Use Template**.
3. Customize your token name.
4. Scope your token.

You will need to choose the account and zone resources that the generated API token will have access to. We recommend scoping these down as much as possible to limit the access of your token. For example, if you have access to three different Cloudflare accounts, you should restrict the generated API token to only the account on which you will be deploying a Worker.

Expand Down
19 changes: 11 additions & 8 deletions src/content/docs/workers/configuration/integrations/momento.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pcx_content_type: configuration
title: Momento

---
import { DashButton } from "~/components";

[Momento](https://gomomento.com/) is a truly serverless caching service. It automatically optimizes, scales, and manages your cache for you.

Expand All @@ -18,14 +19,16 @@ To set up an integration with Momento Cache:

3. Add the Momento database integration to your Worker:

1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account.
2. In **Account Home**, select **Workers & Pages**.
3. In **Overview**, select your Worker.
4. Select **Integrations** > **Momento**.
5. Follow the setup flow, review and grant permissions needed to add secrets to your Worker.
6. Next, connect to Momento.
7. Select a preferred region.
8. Click **Add integration**.
1. In the Cloudflare dashboard, go to the **Workers & Pages** page.

<DashButton url="/?to=/:account/workers-and-pages" />

2. In **Overview**, select your Worker.
3. Select **Integrations** > **Momento**.
4. Follow the setup flow, review and grant permissions needed to add secrets to your Worker.
5. Next, connect to Momento.
6. Select a preferred region.
7. Click **Add integration**.

4. The following example code show how to set an item in your cache, get it, and return it as a JSON object. The credentials needed to connect to Momento Cache have been automatically added as [secrets](/workers/configuration/secrets/) to your Worker through the integration.

Expand Down
25 changes: 16 additions & 9 deletions src/content/docs/workers/configuration/previews.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sidebar:
description: Preview URLs allow you to preview new versions of your project without deploying it to production.
---

import { Render, WranglerConfig } from "~/components";
import { Render, WranglerConfig, DashButton } from "~/components";

# Overview

Expand Down Expand Up @@ -57,7 +57,11 @@ The [`wrangler versions upload`](/workers/wrangler/commands/#upload) command upl

#### View versioned preview URLs on the Workers dashboard

1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/?to=/:account/workers) and select your project.
1. In the Cloudflare dashboard, go to the **Workers & Pages** page.

<DashButton url="/?to=/:account/workers-and-pages" />

2. Select your Worker.
2. Go to the **Deployments** tab, and find the version you would like to view.

### Aliased preview URLs
Expand Down Expand Up @@ -93,12 +97,13 @@ The resulting alias would be associated with this version, and immediately avail
When enabled, all preview URLs are available publicly. You can use [Cloudflare Access](/cloudflare-one/policies/access/) to require visitors to authenticate before accessing preview URLs. You can limit access to yourself, your teammates, your organization, or anyone else you specify in your [access policy](/cloudflare-one/policies/access).

To limit your preview URLs to authorized emails only:
1. In the Cloudflare dashboard, go to the **Workers & Pages** page.

1. Log in to the [Cloudflare Access dashboard](https://one.dash.cloudflare.com/?to=/:account/access/apps).
2. Select your account.
3. Add an application.
4. Select **Self Hosted**.
5. Name your application (for example, "my-worker") and add your `workers.dev` subdomain as the **Application domain**.
<DashButton url="/?to=/:account/workers-and-pages" />

2. Select **Create application**.
3. Select **Self Hosted**.
4. Name your application (for example, "my-worker") and add your `workers.dev` subdomain as the **Application domain**.

For example, if you want to secure preview URLs for a Worker running on `my-worker.my-subdomain.workers.dev`.

Expand Down Expand Up @@ -126,9 +131,11 @@ Note:
### From the Dashboard

To toggle Preview URLs for a Worker:
1. In the Cloudflare dashboard, go to the **Workers & Pages** page.

<DashButton url="/?to=/:account/workers-and-pages" />

1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account.
2. Go to **Workers & Pages** and in **Overview**, select your Worker.
2. In **Overview**, select your Worker.
3. Go to **Settings** > **Domains & Routes**.
4. For Preview URLs, click **Enable** or **Disable**.
5. Confirm your action.
Expand Down
17 changes: 11 additions & 6 deletions src/content/docs/workers/configuration/routing/workers-dev.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pcx_content_type: concept
title: workers.dev
---

import { WranglerConfig } from "~/components";
import { WranglerConfig, DashButton } from "~/components";

Cloudflare Workers accounts come with a `workers.dev` subdomain that is configurable in the Cloudflare dashboard. Your `workers.dev` subdomain allows you getting started quickly by deploying Workers without first onboarding your custom domain to Cloudflare.

Expand All @@ -13,9 +13,11 @@ It's recommended to run production Workers on a [Workers route or custom domain]

`workers.dev` subdomains take the format: `<YOUR_ACCOUNT_SUBDOMAIN>.workers.dev`. To change your `workers.dev` subdomain:

1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account.
2. Select **Workers & Pages**.
3. Select **Change** next to **Your subdomain**.
1. In the Cloudflare dashboard, go to the **Workers & Pages** page.

<DashButton url="/?to=/:account/workers-and-pages" />

2. Select **Change** next to **Your subdomain**.

All Workers are assigned a `workers.dev` route when they are created or renamed following the syntax `<YOUR_WORKER_NAME>.<YOUR_SUBDOMAIN>.workers.dev`. The [`name`](/workers/wrangler/configuration/#inheritable-keys) field in your Worker configuration is used as the subdomain for the deployed Worker.

Expand All @@ -25,8 +27,11 @@ All Workers are assigned a `workers.dev` route when they are created or renamed

To disable the `workers.dev` route for a Worker:

1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account.
2. Go to **Workers & Pages** and in **Overview**, select your Worker.
1. In the Cloudflare dashboard, go to the **Workers & Pages** page.

<DashButton url="/?to=/:account/workers-and-pages" />

2. In **Overview**, select your Worker.
3. Go to **Settings** > **Domains & Routes**.
4. On `workers.dev` click "Disable".
5. Confirm you want to disable.
Expand Down
33 changes: 18 additions & 15 deletions src/content/docs/workers/configuration/secrets.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ head: []
description: Store sensitive information, like API keys and auth tokens, in your Worker.
---

import { Render } from "~/components";
import { Render,DashButton } from "~/components";

## Background

Expand Down Expand Up @@ -66,14 +66,15 @@ npx wrangler versions secret put <KEY>
#### Via the dashboard

To add a secret via the dashboard:
1. In the Cloudflare dashboard, go to the **Workers & Pages** page.

1. Log in to [Cloudflare dashboard](https://dash.cloudflare.com/) and select your account.
2. Select **Workers & Pages**.
3. In **Overview**, select your Worker > **Settings**.
4. Under **Variables and Secrets**, select **Add**.
5. Select the type **Secret**, input a **Variable name**, and input its **Value**. This secret will be made available to your Worker but the value will be hidden in Wrangler and the dashboard.
6. (Optional) To add more secrets, select **Add variable**.
7. Select **Deploy** to implement your changes.
<DashButton url="/?to=/:account/workers-and-pages" />

2. In **Overview**, select your Worker > **Settings**.
3. Under **Variables and Secrets**, select **Add**.
4. Select the type **Secret**, input a **Variable name**, and input its **Value**. This secret will be made available to your Worker but the value will be hidden in Wrangler and the dashboard.
5. (Optional) To add more secrets, select **Add variable**.
6. Select **Deploy** to implement your changes.

### Delete secrets from your project

Expand All @@ -97,13 +98,15 @@ npx wrangler versions secret delete <KEY>

To delete a secret from your Worker project via the dashboard:

1. Log in to [Cloudflare dashboard](https://dash.cloudflare.com/) and select your account.
2. Select **Workers & Pages**.
3. In **Overview**, select your Worker > **Settings**.
4. Under **Variables and Secrets**, select **Edit**.
5. In the **Edit** drawer, select **X** next to the secret you want to delete.
6. Select **Deploy** to implement your changes.
7. (Optional) Instead of using the edit drawer, you can click the delete icon next to the secret.
1. In the Cloudflare dashboard, go to the **Workers & Pages** page.

<DashButton url="/?to=/:account/workers-and-pages" />

2. In **Overview**, select your Worker > **Settings**.
3. Under **Variables and Secrets**, select **Edit**.
4. In the **Edit** drawer, select **X** next to the secret you want to delete.
5. Select **Deploy** to implement your changes.
6. (Optional) Instead of using the edit drawer, you can click the delete icon next to the secret.

<Render file="env_and_secrets" product="workers" />

Expand Down
18 changes: 10 additions & 8 deletions src/content/docs/workers/configuration/smart-placement.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sidebar:
text: Beta
---

import { WranglerConfig } from "~/components";
import { WranglerConfig, DashButton } from "~/components";

By default, [Workers](/workers/) and [Pages Functions](/pages/functions/) are invoked in a data center closest to where the request was received. If you are running back-end logic in a Worker, it may be more performant to run that Worker closer to your back-end infrastructure rather than the end user. Smart Placement automatically places your workloads in an optimal location that minimizes latency and speeds up your applications.

Expand Down Expand Up @@ -64,13 +64,15 @@ To enable Smart Placement via Wrangler:

To enable Smart Placement via the dashboard:

1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account.
2. In **Account Home**, select **Workers & Pages**.
3. In **Overview**,select your Worker.
4. Select **Settings** > **General**.
5. Under **Placement**, choose **Smart**.
6. Wait for Smart Placement to analyze your Worker. Smart Placement requires consistent traffic to the Worker from multiple locations around the world to make a placement decision. The analysis process may take up to 15 minutes.
7. View your Worker's [request duration analytics](/workers/observability/metrics-and-analytics/#request-duration)
1. In the Cloudflare dashboard, go to the **Workers & Pages** page.

<DashButton url="/?to=/:account/workers-and-pages" />

2. In **Overview**,select your Worker.
3. Select **Settings** > **General**.
4. Under **Placement**, choose **Smart**.
5. Wait for Smart Placement to analyze your Worker. Smart Placement requires consistent traffic to the Worker from multiple locations around the world to make a placement decision. The analysis process may take up to 15 minutes.
6. View your Worker's [request duration analytics](/workers/observability/metrics-and-analytics/#request-duration)

## Observability

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ title: Rollbacks
head: []
description: Revert to an older version of your Worker.
---
import { DashButton } from "~/components";

You can roll back to a previously deployed [version](/workers/configuration/versions-and-deployments/#versions) of your Worker using [Wrangler](/workers/wrangler/commands/#rollback) or the Cloudflare dashboard. Rolling back to a previous version of your Worker will immediately create a new [deployment](/workers/configuration/versions-and-deployments/#deployments) with the version specified and become the active deployment across all your deployed routes and domains.

Expand All @@ -14,9 +15,11 @@ To roll back to a specified version of your Worker via Wrangler, use the [`wrang
## Via the Cloudflare Dashboard

To roll back to a specified version of your Worker via the Cloudflare dashboard:
1. In the Cloudflare dashboard, go to the **Workers & Pages** page.

1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/?to=/:account/workers) and select your account.
2. Go to **Workers & Pages** > select your Worker > **Deployments**.
<DashButton url="/?to=/:account/workers-and-pages" />

2. Select your Worker > **Deployments**.
3. Select the three dot icon on the right of the version you would like to roll back to and select **Rollback**.

:::caution
Expand Down
9 changes: 5 additions & 4 deletions src/content/docs/workers/observability/errors.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ head: []
description: Review Workers errors and exceptions.
---

import { TabItem, Tabs } from "~/components";
import { TabItem, Tabs, DashButton } from "~/components";

Review Workers errors and exceptions.

Expand Down Expand Up @@ -230,10 +230,11 @@ Runtime errors will occur within the runtime, do not throw up an error page, and
## Identify errors: Workers Metrics

To review whether your application is experiencing any downtime or returning any errors:
1. In the Cloudflare dashboard, go to the **Workers & Pages** page.

1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account.
2. In **Account Home**, select **Workers & Pages**.
3. In **Overview**, select your Worker and review your Worker's metrics.
<DashButton url="/?to=/:account/workers-and-pages" />

2. In **Overview**, select your Worker and review your Worker's metrics.

### Worker Errors

Expand Down
Loading