b6def0f25b
103 Colima goosed 依赖宿主机 postgresql@17;库停止时 /agent/start 会 pool timeout 约 60s。新增 ensure 脚本、接入监控与发布前检查,并补充拓扑文档。 Co-authored-by: Cursor <cursoragent@cursor.com>
29 lines
1.1 KiB
Bash
Executable File
29 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# 103 Colima goosed 通过 host.docker.internal:5432 访问本机 PostgreSQL。
|
|
# 该库停止时,/agent/start 会在约 60s 后返回 pool timeout,H5 会卡在「正在创建新对话…」。
|
|
export PATH="/opt/homebrew/bin:/opt/homebrew/opt/postgresql@17/bin:${PATH:-/usr/bin:/bin}"
|
|
|
|
PGDATA="${GOOSE_SESSION_PGDATA:-/opt/homebrew/var/postgresql@17}"
|
|
PG_LOG="${GOOSE_SESSION_PG_LOG:-${HOME}/Library/Logs/postgresql@17.log}"
|
|
PG_HOST="${GOOSE_SESSION_PG_HOST:-127.0.0.1}"
|
|
PG_PORT="${GOOSE_SESSION_PG_PORT:-5432}"
|
|
|
|
if pg_isready -h "${PG_HOST}" -p "${PG_PORT}" -q 2>/dev/null; then
|
|
exit 0
|
|
fi
|
|
|
|
echo "$(date -u +%Y-%m-%dT%H:%M:%SZ) goose session postgres not ready; starting (${PGDATA})"
|
|
mkdir -p "$(dirname "${PG_LOG}")"
|
|
pg_ctl -D "${PGDATA}" -l "${PG_LOG}" start 2>/dev/null || true
|
|
sleep 2
|
|
|
|
if pg_isready -h "${PG_HOST}" -p "${PG_PORT}" -q 2>/dev/null; then
|
|
echo "$(date -u +%Y-%m-%dT%H:%M:%SZ) goose session postgres ready"
|
|
exit 0
|
|
fi
|
|
|
|
echo "$(date -u +%Y-%m-%dT%H:%M:%SZ) goose session postgres still down (${PG_HOST}:${PG_PORT})" >&2
|
|
exit 1
|