AgentSkillsCN

zeabur-startup-order

当服务因无法连接数据库或 Redis 而失败时,可选用此功能。若 API 因数据库尚未就绪而崩溃,也可选用此功能。

SKILL.md
--- frontmatter
name: zeabur-startup-order
description: Use when service fails with Connection refused to database or redis. Use when API crashes because DB not ready.

Zeabur Startup Order Issues

Symptom

code
Connection refused :5432
connection to server at "X" failed
OperationalError: connection failed

Cause

Service starts before dependency (DB/Redis) is ready.

Fix

Add wait logic to service command (command MUST be inside source):

yaml
# Python example
spec:
  source:
    image: myapp:latest
    command:
      - /bin/sh
      - -c
      - "python manage.py wait_for_db && exec ./entrypoint.sh"

Or for Node.js:

yaml
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 <id> --env-id <env-id> -y