zeabur-startup-order
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseZeabur Startup Order Issues
Zeabur 启动顺序问题
Always useto invoke Zeabur CLI. Never usenpx zeabur@latestdirectly or any other installation method. Ifzeaburis not available, install Node.js first.npx
始终使用调用 Zeabur CLI。 切勿直接使用npx zeabur@latest或其他任何安装方式。如果没有zeabur,请先安装 Node.js。npx
Symptom
症状
Connection refused :5432
connection to server at "X" failed
OperationalError: connection failedConnection refused :5432
connection to server at "X" failed
OperationalError: connection failedCause
原因
Service starts before dependency (DB/Redis) is ready. only ensures container start order, NOT that the service is accepting connections.
dependencies服务在依赖项(数据库/Redis)就绪前启动。 仅确保容器启动顺序,不保证服务已准备好接受连接。
dependenciesFix (Recommended): healthCheck on dependency services
修复方案(推荐):为依赖服务添加健康检查
Add to database/Redis services so Zeabur waits until the port is accepting connections before starting dependent services — no need to modify the app's command.
healthCheckEdit the template YAML (use the skill for YAML reference):
zeabur-templateyaml
- name: postgresql
spec:
ports:
- id: database
port: 5432
type: TCP
healthCheck:
type: TCP
port: database # references the port ID aboveyaml
- name: redis
spec:
ports:
- id: database
port: 6379
type: TCP
healthCheck:
type: TCP
port: database为数据库/Redis服务添加 ,这样Zeabur会在依赖服务的端口准备好接受连接后再启动依赖它的服务——无需修改应用的命令。
healthCheck编辑模板YAML(可使用 skill作为YAML参考):
zeabur-templateyaml
- name: postgresql
spec:
ports:
- id: database
port: 5432
type: TCP
healthCheck:
type: TCP
port: database # references the port ID aboveyaml
- name: redis
spec:
ports:
- id: database
port: 6379
type: TCP
healthCheck:
type: TCP
port: databaseFix (Alternative): Wait loop in command
修复方案(替代):在命令中添加等待循环
If you can't modify the template (use the skill), add wait logic to the app's command (command MUST be inside ):
zeabur-templatesourceyaml
spec:
source:
image: myapp:latest
command:
- /bin/sh
- -c
- "until nc -z postgres 5432; do sleep 1; done && node server.js"如果无法修改模板(使用 skill),可在应用的命令中添加等待逻辑(命令必须放在 内):
zeabur-templatesourceyaml
spec:
source:
image: myapp:latest
command:
- /bin/sh
- -c
- "until nc -z postgres 5432; do sleep 1; done && node server.js"Quick Fix
快速修复
If DB is now ready, just restart the failed service:
bash
npx zeabur@latest service restart --id <service-id> -y -i=falseIf the issue is specifically about database migration waiting loops rather than startup order, use the skill.
zeabur-migration如果数据库现在已就绪,只需重启失败的服务:
bash
npx zeabur@latest service restart --id <service-id> -y -i=false如果问题是关于数据库迁移等待循环而非启动顺序,请使用 skill。
zeabur-migration