zeabur-template
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseZeabur Template Knowledge Base
Zeabur模板知识库
Always useto invoke Zeabur CLI. Never usenpx zeabur@latestdirectly or any other installation method. Ifzeaburis not available, install Node.js first.npx
This skill provides comprehensive knowledge for creating, debugging, and publishing Zeabur templates. It combines reference documentation with battle-tested patterns from real template development.
请始终使用调用Zeabur CLI。 切勿直接使用npx zeabur@latest或其他安装方式。如果没有zeabur,请先安装Node.js。npx
本技能提供创建、调试和发布Zeabur模板的全面知识,结合了参考文档与实际模板开发中经过验证的模式。
External Documentation
外部文档
For the latest schema and detailed docs, fetch from :
https://raw.githubusercontent.com/zeabur/zeabur-template-doc/main/| User Need | Document to Fetch | Path |
|---|---|---|
| Create a template from scratch | Step-by-step guide | |
| Convert docker-compose.yml | Migration guide | |
| Look up YAML fields or built-in variables | Technical reference | |
| Naming, design patterns, best practices | Best practices | |
| Debug template errors | Troubleshooting | |
| Pre-deployment checklist | Checklist | |
| Quick all-in-one overview | Comprehensive prompt | |
The template YAML schema is also available at https://schema.zeabur.app/template.json and the prebuilt service schema at https://schema.zeabur.app/prebuilt.json.
如需获取最新的Schema和详细文档,请从 获取:
https://raw.githubusercontent.com/zeabur/zeabur-template-doc/main/| 用户需求 | 需获取的文档 | 路径 |
|---|---|---|
| 从零开始创建模板 | 分步指南 | |
| 转换docker-compose.yml | 迁移指南 | |
| 查询YAML字段或内置变量 | 技术参考 | |
| 命名、设计模式、最佳实践 | 最佳实践 | |
| 排查模板错误 | 故障排除 | |
| 部署前检查清单 | 检查清单 | |
| 快速全面概览 | 综合提示 | |
模板YAML Schema也可通过以下链接获取:https://schema.zeabur.app/template.json,预构建服务Schema地址为https://schema.zeabur.app/prebuilt.json。
Core Principles
核心原则
0. All services MUST use PREBUILT_V2 with Docker images
0. 所有服务必须使用带有Docker镜像的PREBUILT_V2
Every service in a template MUST be with a Docker image as the source. Never use , , or source — these are NOT supported in templates.
template: PREBUILT_V2template: GITARBITRARY_GITGITHUBIf the project does not have a published Docker image (on Docker Hub, GHCR, etc.), tell the user they need to build and publish a Docker image first before a template can be created. Do not attempt to work around this.
If the user asks you to build the image, follow this workflow:
- Clone the project repo and find its (usually at repo root)
Dockerfile - Study the Dockerfile to understand build stages — use the production stage (often named or
runner)production - Study or
docker-compose.ymlfor the correct startup command, env vars, and volumes — this is the battle-tested production configdocker-compose.fullapp.yml - Build for amd64 (Zeabur servers are amd64, local Macs are arm64):
bash
docker buildx build --platform linux/amd64 --target runner -t org/image:tag --push . - After pushing, verify the Docker Hub repo is public:
New repos under org accounts often default to private. Ifbash
curl -s "https://hub.docker.com/v2/repositories/ORG/IMAGE/" | grep is_private, the user must make it public on Docker Hub.is_private: true
模板中的每个服务必须设置为 ,并以Docker镜像作为源。 切勿使用 、 或 作为源——这些在模板中不受支持。
template: PREBUILT_V2template: GITARBITRARY_GITGITHUB如果项目没有已发布的Docker镜像(在Docker Hub、GHCR等平台),请告知用户需要先构建并发布Docker镜像,然后才能创建模板。请勿尝试绕过此步骤。
如果用户要求你构建镜像,请遵循以下流程:
- 克隆项目仓库并找到其 (通常位于仓库根目录)
Dockerfile - 研究Dockerfile以了解构建阶段——使用生产阶段(通常命名为或
runner)production - 查看 或
docker-compose.yml获取正确的启动命令、环境变量和卷配置——这是经过验证的生产配置docker-compose.fullapp.yml - 为amd64架构构建镜像(Zeabur服务器为amd64架构,本地Mac通常为arm64):
bash
docker buildx build --platform linux/amd64 --target runner -t org/image:tag --push . - 推送后,验证Docker Hub仓库是否公开:
组织账户下的新仓库通常默认设为私有。如果返回bash
curl -s "https://hub.docker.com/v2/repositories/ORG/IMAGE/" | grep is_private,用户必须在Docker Hub上将其设为公开。is_private: true
1. Never start from scratch
1. 切勿从零开始
When asked to create a template, always look for existing configuration first:
- First check if a Docker image exists — search Docker Hub, GHCR (), or the project's CI/CD for published images. If none exists, stop and inform the user.
ghcr.io/org/repo - Search for the project's ,
docker-compose.yml, ordocker-compose.yamlcompose.yml - Look for Helm charts (,
Chart.yaml)values.yaml - Check the project's GitHub repo for any deployment YAML files
- Use these as the foundation to build the Zeabur template, not as a loose reference — they contain battle-tested environment variables, port mappings, volume mounts, and service dependencies
当被要求创建模板时,务必先寻找现有配置:
- 首先检查是否存在Docker镜像——搜索Docker Hub、GHCR()或项目的CI/CD流程中是否有已发布的镜像。如果没有,请告知用户并停止操作。
ghcr.io/org/repo - 搜索项目的 、
docker-compose.yml或docker-compose.yaml文件compose.yml - 查找Helm Chart(、
Chart.yaml)values.yaml - 检查项目的GitHub仓库中是否有任何部署YAML文件
- 将这些作为构建Zeabur模板的基础,而非松散参考——它们包含经过验证的环境变量、端口映射、卷挂载和服务依赖关系
2. Iterate via runtime logs — never expect one-shot success
2. 通过运行时日志迭代——切勿期望一次性成功
Even experienced humans cannot create a working template in one shot. The workflow is an iterative loop:
- Write/update the template YAML
- Deploy the template
- It will likely fail — check runtime logs to find the cause
- Fix the issue in the template
- Delete the project and redeploy from scratch
- Repeat until the template achieves one-click deployment success
This is the normal process, not a sign of failure. Do not try to get everything perfect before deploying — deploy early, read logs, and iterate.
即使是经验丰富的开发者也无法一次性创建可用的模板。工作流程是一个迭代循环:
- 编写/更新模板YAML
- 部署模板
- 很可能会失败——查看运行时日志找出原因
- 在模板中修复问题
- 删除项目并重新部署
- 重复直到模板实现一键部署成功
这是正常流程,并非失败的标志。不要试图在部署前做到完美——尽早部署、读取日志并迭代。
3. Reuse from existing templates — never write common services from scratch
3. 复用现有模板——切勿从零编写通用服务
When your template needs a common service (PostgreSQL, Redis, MySQL, MongoDB, etc.), do not write the service definition yourself. Instead:
- Search for existing templates that already use that service:
bash
npx zeabur@latest template search postgres - Find a template that includes the service you need
- Get the raw template YAML to see the exact service definition:
bash
npx zeabur@latest template get -c TEMPLATE_CODE --raw - Copy the service definition directly from that template into yours
How to judge template trustworthiness:
- Many templates are created by regular users and may not work correctly
- Prefer templates with more deployments — higher deployment count = more battle-tested
- Prefer official templates over user-submitted ones — official templates are vetted by Zeabur team
当你的模板需要通用服务(PostgreSQL、Redis、MySQL、MongoDB等)时,请勿自行编写服务定义。请按以下步骤操作:
- 搜索已使用该服务的现有模板:
bash
npx zeabur@latest template search postgres - 找到包含所需服务的模板
- 获取原始模板YAML以查看确切的服务定义:
bash
npx zeabur@latest template get -c TEMPLATE_CODE --raw - 将该服务定义直接复制到你的模板中
如何判断模板的可信度:
- 许多模板由普通用户创建,可能无法正常工作
- 优先选择部署次数更多的模板——部署次数越多,经过的验证越充分
- 优先选择官方模板而非用户提交的模板——官方模板经过Zeabur团队审核
CLI Commands for the Iteration Loop
迭代循环中的CLI命令
Deploy a template:
bash
npx zeabur@latest template deploy -f YOUR_TEMPLATE.yamlFor non-interactive mode (automation):
bash
npx zeabur@latest template deploy -i=false \
-f YOUR_TEMPLATE.yaml \
--project-id PROJECT_ID \
--var PUBLIC_DOMAIN=myappList services (to get SERVICE_ID):
bash
npx zeabur@latest service list --project-id PROJECT_IDCheck runtime logs:
bash
npx zeabur@latest deployment log --service-id SERVICE_IDExecute a command inside a running service (like ):
docker execbash
npx zeabur@latest service exec --id SERVICE_ID -- SHELL_COMMANDThis is extremely useful for debugging — check file paths, env vars, test connectivity, inspect the filesystem, etc. Examples:
bash
npx zeabur@latest service exec --id SERVICE_ID -- ls /app
npx zeabur@latest service exec --id SERVICE_ID -- env | grep DATABASE
npx zeabur@latest service exec --id SERVICE_ID -- nc -z localhost 5432Restart a service (useful to clear ImagePullBackOff or force re-pull):
bash
npx zeabur@latest service restart --id SERVICE_ID -i=false -yDelete the project and start over:
bash
npx zeabur@latest project delete --id PROJECT_IDDANGEROUS OPERATION — Before deleting a project, you MUST ask the user for explicit confirmation, clearly stating the Project ID, Name, and createdAt timestamp. Never delete without confirmation.
Publish a new template:
bash
npx zeabur@latest template create -f YOUR_TEMPLATE.yamlThis returns a template URL like with a template code.
https://zeabur.com/templates/XXXXXXUpdate an existing template:
bash
npx zeabur@latest template update -c TEMPLATE_CODE -f YOUR_TEMPLATE.yaml部署模板:
bash
npx zeabur@latest template deploy -f YOUR_TEMPLATE.yaml非交互模式(自动化):
bash
npx zeabur@latest template deploy -i=false \
-f YOUR_TEMPLATE.yaml \
--project-id PROJECT_ID \
--var PUBLIC_DOMAIN=myapp列出服务(获取SERVICE_ID):
bash
npx zeabur@latest service list --project-id PROJECT_ID查看运行时日志:
bash
npx zeabur@latest deployment log --service-id SERVICE_ID在运行中的服务内执行命令(类似):
docker execbash
npx zeabur@latest service exec --id SERVICE_ID -- SHELL_COMMAND这对调试非常有用——检查文件路径、环境变量、测试连接、检查文件系统等。示例:
bash
npx zeabur@latest service exec --id SERVICE_ID -- ls /app
npx zeabur@latest service exec --id SERVICE_ID -- env | grep DATABASE
npx zeabur@latest service exec --id SERVICE_ID -- nc -z localhost 5432重启服务(用于清除ImagePullBackOff或强制重新拉取镜像):
bash
npx zeabur@latest service restart --id SERVICE_ID -i=false -y删除项目并重新开始:
bash
npx zeabur@latest project delete --id PROJECT_ID危险操作——删除项目前,必须向用户确认,明确说明项目ID、名称和创建时间。未经确认切勿删除。
发布新模板:
bash
npx zeabur@latest template create -f YOUR_TEMPLATE.yaml这会返回一个模板URL,例如 ,并附带一个模板代码。
https://zeabur.com/templates/XXXXXX更新现有模板:
bash
npx zeabur@latest template update -c TEMPLATE_CODE -f YOUR_TEMPLATE.yamlQuick Reference: Template Skeleton
快速参考:模板骨架
yaml
undefinedyaml
undefinedyaml-language-server: $schema=https://schema.zeabur.app/template.json
yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
name: ServiceName
spec:
description: |
English description (1-3 sentences)
icon: https://raw.githubusercontent.com/zeabur/service-icons/main/marketplace/service.svg
coverImage: https://example.com/cover.webp
tags:
- Category
variables: []
readme: |
# Service Name
English documentation...
services:
- name: service-name
icon: https://raw.githubusercontent.com/zeabur/service-icons/main/marketplace/service.svg
template: PREBUILT_V2
spec:
source:
image: image:tag
command: # MUST be inside source, alongside image
- /bin/sh
- -c
- /opt/app/startup.sh
ports:
- id: web
port: 8080
type: HTTP
portForwarding:
enabled: true # Auto-expose TCP/UDP ports externally (default: true)
healthCheck: # ensures port is ready before dependents start
type: TCP
port: web # references the port ID above
volumes:
- id: data
dir: /path/to/data
configs:
- path: /opt/app/startup.sh
permission: 493 # 0755
envsubst: false
template: |
#!/bin/sh
exec node server.js
env:
VAR_NAME:
default: value
expose: true
localization:
zh-TW:
description: ...
variables: []
readme: |
# ...
zh-CN:
description: ...
variables: []
readme: |
# ...
ja-JP:
description: ...
variables: []
readme: |
# ...
es-ES:
description: ...
variables: []
readme: |
# ...
id-ID:
description: ...
variables: []
readme: |
# ...
undefinedapiVersion: zeabur.com/v1
kind: Template
metadata:
name: ServiceName
spec:
description: |
英文描述(1-3句话)
icon: https://raw.githubusercontent.com/zeabur/service-icons/main/marketplace/service.svg
coverImage: https://example.com/cover.webp
tags:
- Category
variables: []
readme: |
# 服务名称
英文文档...
services:
- name: service-name
icon: https://raw.githubusercontent.com/zeabur/service-icons/main/marketplace/service.svg
template: PREBUILT_V2
spec:
source:
image: image:tag
command: # 必须在source内,与image同级
- /bin/sh
- -c
- /opt/app/startup.sh
ports:
- id: web
port: 8080
type: HTTP
portForwarding:
enabled: true # 自动向外暴露TCP/UDP端口(默认:true)
healthCheck: # 确保端口就绪后再启动依赖服务
type: TCP
port: web # 引用上方的端口ID
volumes:
- id: data
dir: /path/to/data
configs:
- path: /opt/app/startup.sh
permission: 493 # 0755
envsubst: false
template: |
#!/bin/sh
exec node server.js
env:
VAR_NAME:
default: value
expose: true
localization:
zh-TW:
description: ...
variables: []
readme: |
# ...
zh-CN:
description: ...
variables: []
readme: |
# ...
ja-JP:
description: ...
variables: []
readme: |
# ...
es-ES:
description: ...
variables: []
readme: |
# ...
id-ID:
description: ...
variables: []
readme: |
# ...
undefinedQuick Reference: Built-in Variables
快速参考:内置变量
| Variable | Purpose |
|---|---|
| Auto-generated secure password |
| Full public URL (e.g. |
| Domain only (e.g. |
| Internal hostname for inter-service communication |
| Port value by port ID (e.g. |
| External hostname for port forwarding (auto-set when enabled, usable in env vars and |
| External forwarded port number (auto-set when enabled, usable in env vars and |
The pattern: for a port named , it becomes ; for , it becomes .
ZEABUR_<PORT_ID>_URLweb${ZEABUR_WEB_URL}console${ZEABUR_CONSOLE_URL}| 变量 | 用途 |
|---|---|
| 自动生成的安全密码 |
| 完整的公共URL(例如 |
| 仅域名(例如 |
| 服务间通信的内部主机名 |
| 通过端口ID获取端口值(例如 |
| 端口转发的外部主机名(启用时自动设置,可用于环境变量和 |
| 端口转发的外部端口号(启用时自动设置,可用于环境变量和 |
ZEABUR_<PORT_ID>_URLweb${ZEABUR_WEB_URL}console${ZEABUR_CONSOLE_URL}Quick Reference: command Placement
快速参考:command的位置
IMPORTANT: MUST be inside , alongside . NOT at level.
commandsourceimagespecyaml
undefined重要提示:必须在内,与同级。不能在层级。
commandsourceimagespecyaml
undefinedWRONG -- command at spec level (will be IGNORED, container uses default CMD)
错误写法 -- command在spec层级(会被忽略,容器使用默认CMD)
spec:
source:
image: python:3.12-slim
command:
- /bin/sh
- -c
- /opt/app/start.sh
spec:
source:
image: python:3.12-slim
command:
- /bin/sh
- -c
- /opt/app/start.sh
CORRECT -- command inside source
正确写法 -- command在source内
spec:
source:
image: python:3.12-slim
command:
- /bin/sh
- -c
- /opt/app/start.sh
> **Note:** The external docs may show `command` at `spec` level. This is incorrect. Always place `command` inside `source` as confirmed by the JSON schema at `schema.zeabur.app/prebuilt.json`.spec:
source:
image: python:3.12-slim
command:
- /bin/sh
- -c
- /opt/app/start.sh
> **注意:** 外部文档可能显示`command`在`spec`层级,这是错误的。请始终按照`schema.zeabur.app/prebuilt.json`中的JSON Schema要求,将`command`放在`source`内。Quick Reference: YAML Gotchas
快速参考:YAML陷阱
yaml
undefinedyaml
undefinedRISKY -- @ at start of value is a YAML reserved indicator (may cause parse errors)
风险 -- 值以@开头是YAML保留标识符(可能导致解析错误)
description: @BotFather token
description: @BotFather token
SAFE -- quote the value or avoid @ at start
安全写法 -- 给值加引号或避免@开头
description: "Token from @BotFather for Telegram bot"
description: Telegram bot token from BotFather
undefineddescription: "来自@BotFather的Telegram机器人令牌"
description: Telegram机器人令牌(来自BotFather)
undefinedQuick Reference: Docker Image ENTRYPOINT
快速参考:Docker镜像ENTRYPOINT
Some base images have ENTRYPOINT set, which conflicts with .
command| Image | ENTRYPOINT | Problem |
|---|---|---|
| | |
| none | Safe to use |
| none | Safe to use |
If using an image with ENTRYPOINT, switch to a plain base image (e.g. ) or one without ENTRYPOINT.
python:3.12-slim-bookworm某些基础镜像设置了ENTRYPOINT,这会与冲突。
command| 镜像 | ENTRYPOINT | 问题 |
|---|---|---|
| | |
| 无 | 可安全使用 |
| 无 | 可安全使用 |
如果使用带有ENTRYPOINT的镜像,请切换到纯基础镜像(例如)或无ENTRYPOINT的镜像。
python:3.12-slim-bookwormQuick Reference: TCP Services (proxy, database, game server, etc.)
快速参考:TCP服务(代理、数据库、游戏服务器等)
Services that are NOT web apps — such as HTTP proxies (Tinyproxy, Squid), databases, game servers, VPN servers, or any service that clients connect to directly via TCP/UDP — should NOT use HTTP port type or . Instead:
domainKey- Use (or
type: TCP) — this prevents Zeabur's reverse proxy (Ingress) from intercepting trafficUDP - Set — this auto-exposes the port externally so clients can connect directly
portForwarding: enabled: true - Do NOT use — TCP services don't need a domain; users connect via the forwarded hostname:port
domainKey
yaml
undefined非Web应用服务——例如HTTP代理(Tinyproxy、Squid)、数据库、游戏服务器、VPN服务器或任何客户端直接通过TCP/UDP连接的服务——不应使用HTTP端口类型或。请按以下步骤操作:
domainKey- 使用(或
type: TCP)——这可防止Zeabur的反向代理(Ingress)拦截流量UDP - 设置——这会自动向外暴露端口,以便客户端直接连接
portForwarding: enabled: true - 不要使用——TCP服务不需要域名;用户通过转发的主机名:端口连接
domainKey
yaml
undefinedCORRECT -- TCP service (e.g. HTTP proxy, database, game server)
正确写法 -- TCP服务(例如HTTP代理、数据库、游戏服务器)
spec:
source:
image: some/tcp-service:latest
ports:
- id: proxy
port: 8888
type: TCP # NOT HTTP — clients connect directly
portForwarding:
enabled: true # Auto-expose this port externally
env:
# ...
spec:
source:
image: some/tcp-service:latest
ports:
- id: proxy
port: 8888
type: TCP # 不要用HTTP——客户端直接连接
portForwarding:
enabled: true # 自动向外暴露此端口
env:
# ...
WRONG -- using HTTP type for a TCP proxy
错误写法 -- 为TCP代理使用HTTP类型
spec:
ports:
- id: proxy
port: 8888
type: HTTP # Zeabur's Ingress will intercept CONNECT requests
Missing portForwarding — users must manually enable in Dashboard
**Why not HTTP?** Zeabur's HTTP port type routes traffic through a reverse proxy (Ingress/Envoy) that terminates TLS and performs Host-based routing. This breaks protocols like HTTP CONNECT (used by proxies), raw TCP streams (databases), and custom binary protocols (game servers).
**Port Forwarding variables** (for use in `instructions` or readme):
- `${PORT_FORWARDED_HOSTNAME}` — the external hostname
- `${PROXY_PORT_FORWARDED_PORT}` — the external port (pattern: `${[PORTID]_PORT_FORWARDED_PORT}`)
**Post-deployment testing for TCP services:**
After deploying a TCP service, verify port forwarding is working:
1. Check internal connectivity first (from inside the container):
```bash
npx zeabur@latest service exec --id SERVICE_ID -- curl -x http://127.0.0.1:8888 https://ifconfig.co-
Get the forwarded host:port from the Dashboard's Networking tab, or use:bash
npx zeabur@latest service network --id SERVICE_ID -
Test external connectivity:bash
curl -x http://FORWARDED_HOST:FORWARDED_PORT https://ifconfig.co
If port forwarding shows as DISABLED, enable it:
bash
npx zeabur@latest service port-forward --id SERVICE_ID --enablespec:
ports:
- id: proxy
port: 8888
type: HTTP # Zeabur的Ingress会拦截CONNECT请求
缺少portForwarding——用户必须在控制台手动启用
**为什么不使用HTTP?** Zeabur的HTTP端口类型通过反向代理(Ingress/Envoy)路由流量,终止TLS并基于主机名进行路由。这会破坏HTTP CONNECT(代理使用)、原始TCP流(数据库)和自定义二进制协议(游戏服务器)等协议。
**端口转发变量**(用于`instructions`或readme):
- `${PORT_FORWARDED_HOSTNAME}` —— 外部主机名
- `${PROXY_PORT_FORWARDED_PORT}` —— 外部端口(模式:`${[PORTID]_PORT_FORWARDED_PORT}`)
**TCP服务部署后测试:**
部署TCP服务后,验证端口转发是否正常工作:
1. 首先检查内部连通性(从容器内部):
```bash
npx zeabur@latest service exec --id SERVICE_ID -- curl -x http://127.0.0.1:8888 https://ifconfig.co-
从控制台的网络选项卡获取转发的主机:端口,或使用以下命令:bash
npx zeabur@latest service network --id SERVICE_ID -
测试外部连通性:bash
curl -x http://FORWARDED_HOST:FORWARDED_PORT https://ifconfig.co
如果端口转发显示为禁用,启用它:
bash
npx zeabur@latest service port-forward --id SERVICE_ID --enableQuick Reference: Headless Services (no HTTP)
快速参考:无头服务(无HTTP)
If a service does NOT listen on any HTTP port (502 Bad Gateway), see skill for the fix.
zeabur-port-mismatch如果服务未监听任何HTTP端口(出现502 Bad Gateway错误),请查看技能获取解决方案。
zeabur-port-mismatchQuick Reference: Critical Rules
快速参考:关键规则
yaml
undefinedyaml
undefinedWRONG -- using :latest tag (may serve cached/stale image)
错误写法 -- 使用:latest标签(可能提供缓存/过时的镜像)
image: rajnandan1/kener:latest
image: rajnandan1/kener:latest
CORRECT -- pin to specific version
正确写法 -- 固定到特定版本
image: rajnandan1/kener:4.0.16
image: rajnandan1/kener:4.0.16
WRONG -- hardcoded password
错误写法 -- 硬编码密码
POSTGRES_PASSWORD:
default: mypassword123
POSTGRES_PASSWORD:
default: mypassword123
CORRECT -- use ${PASSWORD}
正确写法 -- 使用${PASSWORD}
POSTGRES_PASSWORD:
default: ${PASSWORD}
expose: true
POSTGRES_PASSWORD:
default: ${PASSWORD}
expose: true
WRONG -- PUBLIC_DOMAIN gives incomplete URL
错误写法 -- PUBLIC_DOMAIN提供不完整的URL
APP_URL:
default: https://${PUBLIC_DOMAIN}
APP_URL:
default: https://${PUBLIC_DOMAIN}
CORRECT -- ZEABUR_WEB_URL gives full URL
正确写法 -- ZEABUR_WEB_URL提供完整URL
APP_URL:
default: ${ZEABUR_WEB_URL}
readonly: true
APP_URL:
default: ${ZEABUR_WEB_URL}
readonly: true
WRONG -- other services can't reference without expose
错误写法 -- 未声明依赖就引用变量
POSTGRES_HOST:
default: ${CONTAINER_HOSTNAME}
- name: app spec: env: DB: ${POSTGRES_HOST}
CORRECT -- expose + readonly for connection info
正确写法 -- 先声明依赖
POSTGRES_HOST:
default: ${CONTAINER_HOSTNAME}
expose: true
readonly: true
- name: app
dependencies:
- postgresql spec: env: DB: ${POSTGRES_HOST}
WRONG -- referencing variables without declaring dependency
错误写法 -- 为TCP代理/数据库/游戏服务器使用HTTP类型
- name: app spec: env: DB: ${POSTGRES_HOST}
ports:
- id: proxy port: 8888 type: HTTP
CORRECT -- declare dependency first
正确写法 -- 非Web服务使用TCP类型+portForwarding
- name: app
dependencies:
- postgresql spec: env: DB: ${POSTGRES_HOST}
ports:
- id: proxy port: 8888 type: TCP portForwarding: enabled: true
---WRONG -- HTTP type for a TCP proxy/database/game server
域名绑定
ports:
- id: proxy port: 8888 type: HTTP
在需要公共域名的服务上使用。它会映射到中定义的类型的变量。
domainKeyspec.variablestype: DOMAIN单个域名:
yaml
domainKey: PUBLIC_DOMAIN多个域名(不同端口):
yaml
domainKey:
- port: web
variable: ENDPOINT_DOMAIN
- port: console
variable: ADMIN_ENDPOINT_DOMAINCORRECT -- TCP type + portForwarding for non-web services
常见数据库配置
ports:
- id: proxy port: 8888 type: TCP portForwarding: enabled: true
---请查看获取可直接复制的PostgreSQL、MySQL/MariaDB、Redis配置和标准卷路径。
references/database-configs.mdDomain Binding
模板复杂度等级
Use on the service that needs a public domain. It maps to a variable defined in with .
domainKeyspec.variablestype: DOMAINSingle domain:
yaml
domainKey: PUBLIC_DOMAINMultiple domains (different ports):
yaml
domainKey:
- port: web
variable: ENDPOINT_DOMAIN
- port: console
variable: ADMIN_ENDPOINT_DOMAIN请查看获取5级复杂度指南(从单服务到大规模多服务平台)。
references/complexity-levels.mdCommon Database Configs
编写名称、描述、readme、图标和封面图
See for copy-paste PostgreSQL, MySQL/MariaDB, Redis configs and standard volume paths.
references/database-configs.md信息收集来源(优先级排序):
- 项目的GitHub仓库README
- 项目的官方网站
- 其他公开来源(博客文章、文档网站等)
关键规则:
- 请勿直接复制原始README。 请为该项目的Zeabur模板编写介绍,而非项目本身的介绍。readme应:
- 简要介绍项目是什么
- 重点说明如何使用此模板(部署步骤、配置、域名绑定)
- 包含与Zeabur部署相关的重要注意事项和故障排除提示
- 始终包含许可和归属信息。 如果原始项目采用MIT、Apache或其他许可证:
- 在readme中提及许可证
- 链接到原始仓库
- 如果有官方网站,也请链接
- 这是法律要求——切勿遗漏
- 图标和封面图:从项目的GitHub仓库或官方网站获取项目标志。使用直接的图片URL(SVG、PNG或WebP格式)。始终验证URL返回HTTP 200状态码:
常见陷阱:bash
curl -s -o /dev/null -w "%{http_code}" "URL"URL中的分支名称错误(raw.githubusercontent.com、develop或main混淆)。master
Template Complexity Levels
本地化要求
See for the 5-level complexity guide (single service → large-scale multi-service platform).
references/complexity-levels.md需要支持6种语言:en-US(在中)、zh-TW、zh-CN、ja-JP、es-ES、id-ID。
spec需要翻译的内容: 、、、
descriptionvariables[].namevariables[].descriptionreadme请勿翻译的内容: 、、、URL
keytype${VARIABLE_NAMES}Writing name, description, readme, icon, and coverImage
经验教训
Where to collect information (in priority order):
- The project's GitHub repo README
- The project's official website
- Other public sources (blog posts, documentation sites, etc.)
Key rules:
- Do NOT copy-paste the original README. Write the introduction for this project's Zeabur template, not for the project itself. The readme should:
- Briefly introduce what the project is
- Focus on how to use this template (deployment steps, configuration, domain binding)
- Include important caveats and troubleshooting tips specific to Zeabur deployment
- Always include licensing and attribution. If the original project has an MIT, Apache, or other license:
- Mention the license in the readme
- Link to the original repo
- Link to the official website if available
- This is legally required -- never skip it
- icon and coverImage: Find the project's logo from their GitHub repo or official website. Use a direct URL to an image (SVG, PNG, or WebP). Always verify the URL returns HTTP 200:
Common pitfall: wrong branch name inbash
curl -s -o /dev/null -w "%{http_code}" "URL"URLs (raw.githubusercontent.comvsdevelopvsmain).master
请查看获取经过验证的模式:等待数据库就绪、首次运行初始化标记、OOM恢复、ImagePullBackOff等内容。
references/hard-won-lessons.mdLocalization Requirements
—
6 languages required: en-US (in ), zh-TW, zh-CN, ja-JP, es-ES, id-ID.
specTranslate: , , ,
descriptionvariables[].namevariables[].descriptionreadmeDo NOT translate: , , , URLs
keytype${VARIABLE_NAMES}—
Hard-Won Lessons
—
See for battle-tested patterns: wait-for-db, first-run init markers, OOM recovery, ImagePullBackOff, and more.
references/hard-won-lessons.md—