Skip to content

Commit f893ce7

Browse files
committed
Add component
1 parent f401c9d commit f893ce7

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

src/content/docs/workers/deploy-buttons.mdx

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,73 +6,74 @@ sidebar:
66
head: []
77
description: Set Up a Deploy to Cloudflare Button
88
---
9+
import { Tabs, TabItem } from "~/components"
910

1011
# Using a Deploy to Cloudflare Button
1112
If you're building a Workers application and would like to share it with other developers, you can embed a Deploy to Cloudflare button in your README, blog post, or documentation to enable others to quickly bootstrap your application on their own Cloudflare account. Deploy to Cloudflare buttons eliminate the need for complex setup, allowing developers to get started with your public GitHub or GitLab repository in just a few clicks.
1213

1314
<insert deploy button here that links to example/>
1415

15-
## What are Deploy to Cloudflare Buttons?
16+
## What are Deploy to Cloudflare Buttons?
1617
Deploy to Cloudflare buttons simplify the deployment of a Workers application by enabling Cloudflare to:
17-
* **Clone a Git repository**: Cloudflare clones your source repository into the user's GitHub/GitLab account where they can continue development after deploying.
18-
* **Configure a project**: Your users can customize key details such as repository name, Worker name, and required resource names in a single setup page with customizations reflected in the newly created Git repository.
18+
* **Clone a Git repository**: Cloudflare clones your source repository into the user's GitHub/GitLab account where they can continue development after deploying.
19+
* **Configure a project**: Your users can customize key details such as repository name, Worker name, and required resource names in a single setup page with customizations reflected in the newly created Git repository.
1920
* **Build & deploy**: Cloudflare builds the application using Workers Builds and deploys it to the Cloudflare network. Any required resources are automatically provisioned and bound to the Worker without additional setup.
2021

2122
<insert flow with screenshots/>
2223

23-
## How to Set Up Deploy to Cloudflare buttons
24-
Deploy to Cloudflare buttons can be embedded anywhere developers might want to launch your project. To add a Deploy to Cloudflare button, copy the following snippet and replace the Git repository URL with your project's URL. You can also optionally specify a subdirectory.
24+
## How to Set Up Deploy to Cloudflare buttons
25+
Deploy to Cloudflare buttons can be embedded anywhere developers might want to launch your project. To add a Deploy to Cloudflare button, copy the following snippet and replace the Git repository URL with your project's URL. You can also optionally specify a subdirectory.
2526

2627

2728
<Tabs syncKey="DeployButtonSnippet"> <TabItem label="HTML">
2829
```html
2930
<a href="https://deploy.workers.cloudflare.com/?url=<your git repo URL>"><img src="https://deploy.workers.cloudflare.com/button" alt="Deploy to Cloudflare"/></a>
3031
```
3132

32-
</TabItem>
33+
</TabItem>
3334

3435
<TabItem label="Markdown">
3536
```md
3637
[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=<git repo URL>)
3738
```
3839

39-
</TabItem>
40+
</TabItem>
4041
</Tabs>
4142

42-
If you have already deployed your application using Workers Builds, you can generate a Deploy to Cloudflare button directly from the Cloudflare dashboard by clicking the share button and copying the provided snippet.
43+
If you have already deployed your application using Workers Builds, you can generate a Deploy to Cloudflare button directly from the Cloudflare dashboard by clicking the share button and copying the provided snippet.
4344

4445
<insert image of share icon pop out/>
4546

46-
Once you have your snippet, you can paste this wherever you would like your button to be displayed.
47+
Once you have your snippet, you can paste this wherever you would like your button to be displayed.
4748

48-
## Automatic Resource Provisioning
49+
## Automatic Resource Provisioning
4950
If your Worker application requires Cloudflare resources, they will be automatically provisioned as part of the deployment. Currently, supported resources include:
5051
* **Storage**: KV namespaces, D1 databases, R2 buckets, Hyperdrive and Vectorize
5152
* **Compute**: Durable Objects, Workers AI, Containers and Queues
5253

5354
Cloudflare will read the Wrangler configuration file of your source repo to determine resource requirements for your application. During deployment, Cloudflare will provision any necessary resources and update the Wrangler configuration where applicable for newly created resources (for example, database IDs, namespace IDs). To ensure successful deployment, please make sure your source repository includes default values for resource names, resource IDs and any other properties for each binding.
5455

55-
## Best Practices
56-
**Configuring Build/Deploy commands**: If you are using custom `build` and `deploy` scripts in your package.json (e.g. if using a full stack framework or running D1 migrations), Cloudfare will automatically detect and pre-populate the build and deploy fields. Users can choose to modify or accept the custom commands during deployment configuration.
56+
## Best Practices
57+
**Configuring Build/Deploy commands**: If you are using custom `build` and `deploy` scripts in your package.json (e.g. if using a full stack framework or running D1 migrations), Cloudfare will automatically detect and pre-populate the build and deploy fields. Users can choose to modify or accept the custom commands during deployment configuration.
5758

5859
<insert screenshot of build and deploy command UI/>
5960

60-
If no `deploy` script is specified, Cloudflare will preconfigure `npx wrangler deploy` by default. If no `build` script is specified, Cloudflare will leave this field blank.
61+
If no `deploy` script is specified, Cloudflare will preconfigure `npx wrangler deploy` by default. If no `build` script is specified, Cloudflare will leave this field blank.
6162

6263
** Running D1 Migrations**: If you would like to run migrations as part of your set up, you can specify this in your `package.json` by running your migrations as part of your `deploy` script. The migration command should reference the binding name rather than the database name to ensure migrations are successful when users specify a database name that is different from that of your source repository. The following is an example of how you can set up the scripts section of your `package.json`:
6364

6465
```json
6566
{
6667
"scripts": {
67-
"build": "astro build",
68+
"build": "astro build",
6869
"deploy": "npm run db:migrations:apply && wrangler deploy"
6970
"db:migrations:apply": "wrangler d1 migrations apply DB_BINDING --remote",
7071
}
7172
}
7273
```
7374

74-
## Not currently supported
75+
## Not currently supported
7576
* **Monorepos**: Cloudflare does not fully support monorepos unless your application is completely isolated within a subdirectory and has no dependencies outside of that subdirectory (for example, [a monorepo of example applications](https://github.com/cloudflare/templates)). If your application relies on dependencies outside its subdirectory, the build will fail. Additionally, if your monorepo contains multiple Workers applications, they will not be deployed together. You must configure a separate Deploy to Cloudflare button for each application. The user will manually create a distinct Workers application for each subdirectory.
7677
* **Pages applications**: Deploy to Cloudflare buttons only support Workers applications today.
77-
* **Non gitHub.com/gitLab.com repositories**: Source repositories from anything other than gitHub.com and gitLab.com are not supported. Self-hosted versions of GitHub and GitLab are also not supported.
78-
* **Private repositories**: Repositories must be public in order for others to successfully use your Deploy to Cloudflare button.
78+
* **Non gitHub.com/gitLab.com repositories**: Source repositories from anything other than gitHub.com and gitLab.com are not supported. Self-hosted versions of GitHub and GitLab are also not supported.
79+
* **Private repositories**: Repositories must be public in order for others to successfully use your Deploy to Cloudflare button.

0 commit comments

Comments
 (0)