render-web-services
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRender Web Services
Render Web服务
This skill covers Web Service behavior on Render: how traffic reaches your process, how deploys go live, and how optional features (domains, disks, auto-deploy) interact. Use it alongside Blueprint and networking skills when wiring or Dashboard settings.
render.yaml本技能涵盖Render上的Web服务行为:流量如何到达你的进程、部署如何上线,以及可选功能(域名、磁盘、自动部署)之间的交互方式。在配置或控制台设置时,可结合Blueprint和网络相关技能使用。
render.yamlWhen to Use
使用场景
- Configuring or debugging port binding, PORT, or multi-port web services
- TLS/HTTPS expectations at the edge vs inside the container
- Health checks blocking or rolling back deploys
- Custom domains, DNS, and certificate provisioning
- Auto-deploy, CI-gated deploys, and PR preview generation
- Persistent disks and their impact on scaling and zero-downtime
- Deploy lifecycle: build, pre-deploy, swap, drain, rollback, shutdown delay
Deeper patterns live under (health checks, domains, deploy phases).
references/- 配置或调试端口绑定、PORT或多端口Web服务
- 边缘节点与容器内部的TLS/HTTPS配置预期
- 健康检查阻止部署或触发回滚的情况
- 自定义域名、DNS及证书颁发
- 自动部署、CI校验部署和PR预览生成
- 持久化磁盘及其对扩容和零停机的影响
- 部署生命周期:构建、预部署、切换、流量排空、回滚、关机延迟
更深入的模式请查看目录下的内容(健康检查、域名、部署阶段)。
references/Port Binding
端口绑定
- Listen on (all interfaces). Binding only to
0.0.0.0orlocalhostprevents Render’s proxy from reaching your app.127.0.0.1 - Use the environment variable for the HTTP listen port. Render sets it for you; the default is often
PORTand you can change the configured value in the service Settings in the Dashboard.10000 - Reserved ports (do not bind your application to these for normal traffic): ,
18012,18013.19099
- 监听**(所有网络接口)。仅绑定到
0.0.0.0或localhost**会导致Render的代理无法访问你的应用。127.0.0.1 - 使用**环境变量指定HTTP监听端口。Render会自动设置该变量,默认值通常为
PORT,你可以在控制台的服务设置**中修改配置值。10000 - 保留端口(正常流量请勿将应用绑定到这些端口):、
18012、18013。19099
Multi-port Web Services
多端口Web服务
- Only one port receives public HTTP traffic: the port aligned with .
PORT - Additional open ports are reachable on Render’s private network only (not from the public internet through the same public URL pattern).
- 只有与**一致的端口会接收公开**HTTP流量。
PORT - 其他开放端口仅能在Render的私有网络内访问(无法通过公网URL模式从互联网访问)。
TLS and HTTPS
TLS与HTTPS
- TLS terminates at Render’s edge. The edge speaks HTTPS to clients; your process typically receives plain HTTP on .
PORT - HTTPS redirect for clients is handled by the platform; users hitting HTTP are redirected appropriately at the edge.
- Do not terminate TLS inside the app for the primary public listener unless you have a rare, explicit need—standard Web Services assume HTTP behind the proxy.
- TLS在Render边缘节点终止。边缘节点与客户端通过HTTPS通信;你的进程通常在上接收纯HTTP请求。
PORT - 客户端的HTTPS重定向由平台处理;访问HTTP的用户会在边缘节点被自动重定向。
- 除非有特殊明确需求,否则不要在应用内部为主公开监听器终止TLS——标准Web服务默认代理后使用HTTP。
Health Checks
健康检查
- Configure a path via in a Blueprint or the Health Check Path field in the Dashboard.
healthCheckPath - Render issues HTTP GET requests to that path. Responses must be or
2xxfor success.3xx - Failed health checks prevent a new deploy from going live (the deploy does not succeed in taking production traffic as expected).
- Render probes on a repeat interval with a per-request timeout; both are configurable in service settings (see Dashboard). Failed checks during rollout prevent the new revision from receiving traffic.
- Check frequency, timeouts, and tuning guidance in .
references/health-check-patterns.md
- 通过Blueprint中的**或控制台的健康检查路径**字段配置检查路径。
healthCheckPath - Render会向该路径发送HTTP GET请求。响应状态码为**或
2xx**时视为检查成功。3xx - 健康检查失败会阻止新部署上线(部署无法按预期接管生产流量)。
- Render会按照重复间隔进行探测,每个请求有超时时间;两者均可在服务设置中配置(请查看控制台)。部署过程中检查失败会阻止新版本接收流量。
- 检查频率、超时时间及调优指南请查看。
references/health-check-patterns.md
Custom Domains
自定义域名
- Point DNS with a CNAME to (use your service’s hostname from the Dashboard).
[service-name].onrender.com - Render automatically provisions and renews TLS certificates for verified domains.
- Apex (root) domains need provider-specific CNAME-like or flattened records where plain CNAME at is unsupported.
@ - Wildcard domains (e.g. ) are supported when configured and verified.
*.example.com - Multiple custom domains per service are supported; Blueprints can list them under the field.
domains
See for Dashboard steps, verification, and troubleshooting.
references/custom-domains.md- 将DNS的CNAME记录指向****(使用控制台中你的服务主机名)。
[service-name].onrender.com - Render会为已验证的域名自动颁发并续期TLS证书。
- 顶级(根)域名在不支持记录使用纯CNAME的情况下,需要使用服务商特定的类CNAME或扁平化记录。
@ - 配置并验证后,支持通配符域名(例如)。
*.example.com - 每个服务支持多个自定义域名;Blueprint可在****字段中列出这些域名。
domains
控制台操作步骤、验证及排查方法请查看。
references/custom-domains.mdAuto-Deploy and PR Previews
自动部署与PR预览
- (Blueprint) / auto-deploy settings control when production deploys run:
autoDeployTrigger- — deploy on every push to the tracked branch
commit - — deploy only when required Git checks pass
checksPass - — manual deploys only (Dashboard, CLI, hooks)
off
- PR previews are configured under Blueprint (and related preview settings); generation behavior depends on repo integration and plan.
previews.generation
- (Blueprint)/自动部署设置控制生产环境部署的触发时机:
autoDeployTrigger- — 每次向跟踪分支推送代码时触发部署
commit - — 仅当所需Git检查通过时触发部署
checksPass - — 仅支持手动部署(控制台、CLI、钩子)
off
- PR预览在Blueprint的****(及相关预览设置)中配置;生成行为取决于仓库集成和套餐计划。
previews.generation
Persistent Disks
持久化磁盘
- Attach disks via the field in a Blueprint (or equivalent Dashboard storage settings).
disk - A service with an attached persistent disk is single-instance only: horizontal scaling is not available in that configuration.
- Zero-downtime deploys are disabled when a persistent disk is attached—deploys follow a different rollout pattern.
- Disk size increases are allowed; decreases are not.
- The disk is not mounted during the build phase—only at runtime in the running service.
- 通过Blueprint中的****字段(或控制台中对应的存储设置)挂载磁盘。
disk - 挂载了持久化磁盘的服务只能是单实例:该配置下不支持水平扩容。
- 挂载持久化磁盘时零停机部署会被禁用——部署将遵循不同的发布模式。
- 允许增大磁盘容量;不允许减小。
- 磁盘不会在构建阶段挂载——仅在运行中的服务运行时挂载。
Deploy Lifecycle
部署生命周期
Typical flow:
- Build — clone repo, run , produce the runnable artifact/image.
buildCommand - Pre-deploy command (optional) — runs in the new image before traffic switches; use for migrations. If it fails, the deploy is canceled.
- Deploy — new instances start; health checks must pass before traffic moves.
- Zero-downtime swap (when applicable) — traffic shifts to new instances; old instances drain in-flight work.
- (range 1–300, default 30) bounds how long old instances may continue handling requests during drain before shutdown.
maxShutdownDelaySeconds - Rollbacks — revert to a previous successful deploy from the Dashboard.
Full sequence, hooks, filters, and CLI notes: .
references/deploy-lifecycle.md典型流程:
- 构建 — 克隆仓库,执行****,生成可运行的工件/镜像。
buildCommand - 预部署命令(可选)——在流量切换前在新镜像中执行;用于数据迁移。如果命令执行失败,部署将被取消。
- 部署 — 启动新实例;健康检查通过后才会切换流量。
- 零停机切换(适用时)——流量转移到新实例;旧实例排空正在处理的请求。
- (范围1–300,默认30)限制旧实例在排空期间处理请求的最长时间,超时后将关机。
maxShutdownDelaySeconds - 回滚 — 从控制台恢复到之前的成功部署版本。
完整流程、钩子、过滤器及CLI说明请查看。
references/deploy-lifecycle.mdFree Tier Notes
免费套餐说明
Free Web Services have separate limits: services spin down after inactivity (cold starts on the next request), and they do not support scaling beyond a single instance or persistent disks. Treat free-tier behavior as distinct from paid Web Service defaults when advising on uptime and scaling.
免费Web服务有单独的限制:服务在闲置后会自动停止(下次请求时会冷启动),且不支持单实例以外的扩容或持久化磁盘。在提供可用性和扩容建议时,请区分免费套餐与付费Web服务的默认行为。
References
参考资料
| Topic | File |
|---|---|
| Health check design, timeouts, pitfalls | |
| Domains, DNS, TLS verification | |
| Build, pre-deploy, drain, rollbacks, triggers | |
| 主题 | 文件 |
|---|---|
| 健康检查设计、超时、常见问题 | |
| 域名、DNS、TLS验证 | |
| 构建、预部署、流量排空、回滚、触发器 | |
Related Skills
相关技能
- render-deploy — Blueprints, first-time deploy, structure
render.yaml - render-docker — Docker-based Web Services and image/runtime details
- render-networking — Private network, internal URLs, multi-port private listeners
- render-scaling — Instance counts, plans, and scaling constraints (including disk interactions)
- render-deploy — Blueprint、首次部署、结构
render.yaml - render-docker — 基于Docker的Web服务及镜像/运行时细节
- render-networking — 私有网络、内部URL、多端口私有监听器
- render-scaling — 实例数量、套餐计划及扩容限制(包括磁盘交互)