cloudflare-deploy
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCloudflare Deploy
Cloudflare 部署
Consolidated skill for building on the Cloudflare platform. Use decision trees below to find the right product, then load detailed references.
这是用于在Cloudflare平台上构建项目的综合技能。使用下方的决策树选择合适的产品,然后查看详细参考文档。
Prerequisites
前置条件
- When sandboxing blocks the deployment network calls, rerun with .
sandbox_permissions=require_escalated - The deployment might take a few minutes. Use appropriate timeout values.
- 当沙箱阻止部署网络调用时,使用重新运行部署命令。
sandbox_permissions=require_escalated - 部署可能需要几分钟,请设置合适的超时值。
Authentication (Required Before Deploy)
身份验证(部署前必须完成)
Verify auth before , , or :
wrangler deploywrangler pages deploynpm run deploybash
npx wrangler whoami # Shows account if authenticatedNot authenticated? →
references/wrangler/auth.md- Interactive/local: (one-time OAuth)
wrangler login - CI/CD: Set env var
CLOUDFLARE_API_TOKEN
在执行、或之前,先验证身份:
wrangler deploywrangler pages deploynpm run deploybash
npx wrangler whoami # 已认证的话会显示账户信息未认证?→ 查看
references/wrangler/auth.md- 交互式/本地环境:(一次性OAuth认证)
wrangler login - CI/CD环境:设置环境变量
CLOUDFLARE_API_TOKEN
Quick Decision Trees
快速决策树
"I need to run code"
"我需要运行代码"
Need to run code?
├─ Serverless functions at the edge → workers/
├─ Full-stack web app with Git deploys → pages/
├─ Stateful coordination/real-time → durable-objects/
├─ Long-running multi-step jobs → workflows/
├─ Run containers → containers/
├─ Multi-tenant (customers deploy code) → workers-for-platforms/
├─ Scheduled tasks (cron) → cron-triggers/
├─ Lightweight edge logic (modify HTTP) → snippets/
├─ Process Worker execution events (logs/observability) → tail-workers/
└─ Optimize latency to backend infrastructure → smart-placement/需要运行代码?
├─ 边缘无服务器函数 → workers/
├─ 支持Git部署的全栈Web应用 → pages/
├─ 有状态协调/实时服务 → durable-objects/
├─ 长期运行的多步骤任务 → workflows/
├─ 运行容器 → containers/
├─ 多租户(客户部署代码) → workers-for-platforms/
├─ 定时任务(Cron) → cron-triggers/
├─ 轻量级边缘逻辑(修改HTTP请求) → snippets/
├─ 处理Worker执行事件(日志/可观测性) → tail-workers/
└─ 优化后端基础设施的延迟 → smart-placement/"I need to store data"
"我需要存储数据"
Need storage?
├─ Key-value (config, sessions, cache) → kv/
├─ Relational SQL → d1/ (SQLite) or hyperdrive/ (existing Postgres/MySQL)
├─ Object/file storage (S3-compatible) → r2/
├─ Message queue (async processing) → queues/
├─ Vector embeddings (AI/semantic search) → vectorize/
├─ Strongly-consistent per-entity state → durable-objects/ (DO storage)
├─ Secrets management → secrets-store/
├─ Streaming ETL to R2 → pipelines/
└─ Persistent cache (long-term retention) → cache-reserve/需要存储数据?
├─ 键值存储(配置、会话、缓存) → kv/
├─ 关系型SQL → d1/(SQLite兼容)或 hyperdrive/(对接现有Postgres/MySQL)
├─ 对象/文件存储(兼容S3) → r2/
├─ 消息队列(异步处理) → queues/
├─ 向量嵌入(AI/语义搜索) → vectorize/
├─ 强一致性的单实体状态存储 → durable-objects/(DO存储)
├─ 密钥管理 → secrets-store/
├─ 流式ETL到R2 → pipelines/
└─ 持久化缓存(长期保留) → cache-reserve/"I need AI/ML"
"我需要AI/ML能力"
Need AI?
├─ Run inference (LLMs, embeddings, images) → workers-ai/
├─ Vector database for RAG/search → vectorize/
├─ Build stateful AI agents → agents-sdk/
├─ Gateway for any AI provider (caching, routing) → ai-gateway/
└─ AI-powered search widget → ai-search/需要AI能力?
├─ 运行推理(大语言模型、向量嵌入、图像处理) → workers-ai/
├─ 用于RAG/搜索的向量数据库 → vectorize/
├─ 构建有状态AI代理 → agents-sdk/
├─ 任意AI提供商的网关(缓存、路由) → ai-gateway/
└─ AI驱动的搜索组件 → ai-search/"I need networking/connectivity"
"我需要网络/连接能力"
Need networking?
├─ Expose local service to internet → tunnel/
├─ TCP/UDP proxy (non-HTTP) → spectrum/
├─ WebRTC TURN server → turn/
├─ Private network connectivity → network-interconnect/
├─ Optimize routing → argo-smart-routing/
├─ Optimize latency to backend (not user) → smart-placement/
└─ Real-time video/audio → realtimekit/ or realtime-sfu/需要网络能力?
├─ 将本地服务暴露到公网 → tunnel/
├─ TCP/UDP代理(非HTTP) → spectrum/
├─ WebRTC TURN服务器 → turn/
├─ 私有网络连接 → network-interconnect/
├─ 优化路由 → argo-smart-routing/
├─ 优化到后端的延迟(非用户侧) → smart-placement/
└─ 实时音视频 → realtimekit/ 或 realtime-sfu/"I need security"
"我需要安全能力"
Need security?
├─ Web Application Firewall → waf/
├─ DDoS protection → ddos/
├─ Bot detection/management → bot-management/
├─ API protection → api-shield/
├─ CAPTCHA alternative → turnstile/
└─ Credential leak detection → waf/ (managed ruleset)需要安全能力?
├─ Web应用防火墙 → waf/
├─ DDoS防护 → ddos/
├─ 机器人检测/管理 → bot-management/
├─ API防护 → api-shield/
├─ CAPTCHA替代方案 → turnstile/
└─ 凭证泄露检测 → waf/(托管规则集)"I need media/content"
"我需要媒体/内容处理"
Need media?
├─ Image optimization/transformation → images/
├─ Video streaming/encoding → stream/
├─ Browser automation/screenshots → browser-rendering/
└─ Third-party script management → zaraz/需要媒体能力?
├─ 图片优化/转换 → images/
├─ 视频流/编码 → stream/
├─ 浏览器自动化/截图 → browser-rendering/
└─ 第三方脚本管理 → zaraz/"I need infrastructure-as-code"
"我需要基础设施即代码(IaC)"
Need IaC? → pulumi/ (Pulumi), terraform/ (Terraform), or api/ (REST API)需要IaC? → pulumi/(Pulumi)、terraform/(Terraform)或 api/(REST API)Product Index
产品索引
Compute & Runtime
计算与运行时
| Product | Reference |
|---|---|
| Workers | |
| Pages | |
| Pages Functions | |
| Durable Objects | |
| Workflows | |
| Containers | |
| Workers for Platforms | |
| Cron Triggers | |
| Tail Workers | |
| Snippets | |
| Smart Placement | |
| 产品 | 参考文档路径 |
|---|---|
| Workers | |
| Pages | |
| Pages Functions | |
| Durable Objects | |
| Workflows | |
| Containers | |
| Workers for Platforms | |
| Cron Triggers | |
| Tail Workers | |
| Snippets | |
| Smart Placement | |
Storage & Data
存储与数据
| Product | Reference |
|---|---|
| KV | |
| D1 | |
| R2 | |
| Queues | |
| Hyperdrive | |
| DO Storage | |
| Secrets Store | |
| Pipelines | |
| R2 Data Catalog | |
| R2 SQL | |
| 产品 | 参考文档路径 |
|---|---|
| KV | |
| D1 | |
| R2 | |
| Queues | |
| Hyperdrive | |
| DO Storage | |
| Secrets Store | |
| Pipelines | |
| R2 Data Catalog | |
| R2 SQL | |
AI & Machine Learning
AI与机器学习
| Product | Reference |
|---|---|
| Workers AI | |
| Vectorize | |
| Agents SDK | |
| AI Gateway | |
| AI Search | |
| 产品 | 参考文档路径 |
|---|---|
| Workers AI | |
| Vectorize | |
| Agents SDK | |
| AI Gateway | |
| AI Search | |
Networking & Connectivity
网络与连接
| Product | Reference |
|---|---|
| Tunnel | |
| Spectrum | |
| TURN | |
| Network Interconnect | |
| Argo Smart Routing | |
| Workers VPC | |
| 产品 | 参考文档路径 |
|---|---|
| Tunnel | |
| Spectrum | |
| TURN | |
| Network Interconnect | |
| Argo Smart Routing | |
| Workers VPC | |
Security
安全
| Product | Reference |
|---|---|
| WAF | |
| DDoS Protection | |
| Bot Management | |
| API Shield | |
| Turnstile | |
| 产品 | 参考文档路径 |
|---|---|
| WAF | |
| DDoS Protection | |
| Bot Management | |
| API Shield | |
| Turnstile | |
Media & Content
媒体与内容
| Product | Reference |
|---|---|
| Images | |
| Stream | |
| Browser Rendering | |
| Zaraz | |
| 产品 | 参考文档路径 |
|---|---|
| Images | |
| Stream | |
| Browser Rendering | |
| Zaraz | |
Real-Time Communication
实时通信
| Product | Reference |
|---|---|
| RealtimeKit | |
| Realtime SFU | |
| 产品 | 参考文档路径 |
|---|---|
| RealtimeKit | |
| Realtime SFU | |
Developer Tools
开发者工具
| Product | Reference |
|---|---|
| Wrangler | |
| Miniflare | |
| C3 | |
| Observability | |
| Analytics Engine | |
| Web Analytics | |
| Sandbox | |
| Workerd | |
| Workers Playground | |
| 产品 | 参考文档路径 |
|---|---|
| Wrangler | |
| Miniflare | |
| C3 | |
| Observability | |
| Analytics Engine | |
| Web Analytics | |
| Sandbox | |
| Workerd | |
| Workers Playground | |
Infrastructure as Code
基础设施即代码
| Product | Reference |
|---|---|
| Pulumi | |
| Terraform | |
| API | |
| 产品 | 参考文档路径 |
|---|---|
| Pulumi | |
| Terraform | |
| API | |
Other Services
其他服务
| Product | Reference |
|---|---|
| Email Routing | |
| Email Workers | |
| Static Assets | |
| Bindings | |
| Cache Reserve | |
| 产品 | 参考文档路径 |
|---|---|
| Email Routing | |
| Email Workers | |
| Static Assets | |
| Bindings | |
| Cache Reserve | |
Troubleshooting
故障排除
Escalated Network Access
提升网络权限
If deployment fails due to network issues (timeouts, DNS errors, connection resets), rerun the deploy with escalated permissions (use ). The deploy requires escalated network access when sandbox networking blocks outbound requests.
sandbox_permissions=require_escalatedExample guidance to the user:
The deploy needs escalated network access to deploy to Cloudflare. I can rerun the command with escalated permissions—want me to proceed?如果部署因网络问题(超时、DNS错误、连接重置)失败,请使用提升的权限重新运行部署(添加参数)。当沙箱网络阻止出站请求时,部署需要提升的网络权限。
sandbox_permissions=require_escalated给用户的示例指导:
部署到Cloudflare需要提升网络权限。我可以使用提升的权限重新运行命令——是否继续?