From a65bfaedd2b63be3591e009e68e23a09309a701b Mon Sep 17 00:00:00 2001 From: Delicious233 <101502465+DeliciousBuding@users.noreply.github.com> Date: Fri, 30 Oct 2026 17:17:32 +0800 Subject: [PATCH] chore(postgres): use verified stable PostgreSQL 18.6 Co-authored-by: Codex --- .github/workflows/checks.yml | 2 +- deployments/production/docker-compose.yml | 4 ++-- docker-compose.yml | 14 ++++++++------ docs/developer-quickstart.md | 6 ++++-- hub-server/scripts/generate-secrets.sh | 2 +- scripts/dev/dev-up.py | 2 +- scripts/dev/dev-up.sh | 2 +- scripts/e2e/run-real-e2e-lane.sh | 2 +- scripts/e2e/wsl-full-stack-e2e.sh | 4 ++-- .../tests/test_verify_real_e2e_lane_manifest.py | 2 +- scripts/verify/verify-real-e2e-lane-manifest.py | 2 +- 11 files changed, 23 insertions(+), 19 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index e114d5239..f08d59cd0 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -845,7 +845,7 @@ jobs: timeout-minutes: 25 services: postgres: - image: postgres:16-alpine + image: postgres:18.6-alpine@sha256:10a5c69a83035ab5239f5620d708520e8b28f5aa1f2b20143e6024532edadfb5 env: POSTGRES_USER: agenthub POSTGRES_PASSWORD: agenthub diff --git a/deployments/production/docker-compose.yml b/deployments/production/docker-compose.yml index 8a5803f7e..60a1bd21a 100644 --- a/deployments/production/docker-compose.yml +++ b/deployments/production/docker-compose.yml @@ -42,7 +42,7 @@ services: max-size: "5m" max-file: "2" - # ── Hub Server(Go 后端 API — 本地 PG16)── + # ── Hub Server(Go 后端 API — 操作者管理的 PostgreSQL)── hub-server: image: ghcr.io/tokendancelab/agenthub-hub-server:latest container_name: agenthub-hub @@ -55,7 +55,7 @@ services: redis: condition: service_healthy environment: - # Local PostgreSQL 16 (127.0.0.1:). PG_PASSWORD required; + # Operator-managed PostgreSQL (127.0.0.1:). PG_PASSWORD required; # remaining defaults are deployment-neutral. # NOTE: PG_HOST default is host-only (no port); port via PG_PORT (default 5433). # Do not include a port in PG_HOST: DSN() uses PG_PORT separately. diff --git a/docker-compose.yml b/docker-compose.yml index 8785c9d79..d553d3672 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ # ────────────────────────────────────────────── # AgentHub Hub Server — Docker Compose 开发环境 # ────────────────────────────────────────────── -# 启动完整 Hub 技术栈:PostgreSQL 16 + Redis 7 + Hub Server。 +# 启动完整 Hub 技术栈:PostgreSQL 18.6 + Redis 7 + Hub Server。 # # 快速开始: # cp .env.example .env # 首次:复制环境变量(已提供默认值) @@ -23,9 +23,9 @@ # ────────────────────────────────────────────── services: - # ── PostgreSQL 16 ────────────────────────── + # ── PostgreSQL 18.6 ──────────────────────── postgres: - image: postgres:16-alpine + image: postgres:18.6-alpine@sha256:10a5c69a83035ab5239f5620d708520e8b28f5aa1f2b20143e6024532edadfb5 container_name: agenthub-postgres restart: unless-stopped mem_limit: ${AGENTHUB_POSTGRES_MEM_LIMIT:-512m} @@ -38,7 +38,9 @@ services: ports: - "${AGENTHUB_BIND_HOST:-127.0.0.1}:${AGENTHUB_DB_PORT:-5432}:5432" volumes: - - pg_data:/var/lib/postgresql/data + # PG18 uses a versioned PGDATA under this parent. Never mount a PG16 + # data directory into PG18; retain the old volume for explicit migration. + - pg18_data:/var/lib/postgresql healthcheck: test: ["CMD-SHELL", "pg_isready -U ${AGENTHUB_DB_USER:-agenthub} -d ${AGENTHUB_DB_NAME:-agenthub}"] interval: 5s @@ -170,8 +172,8 @@ services: max-file: "3" volumes: - pg_data: - name: agenthub_pg_data + pg18_data: + name: agenthub_pg18_data redis_data: name: agenthub_redis_data uploads_data: diff --git a/docs/developer-quickstart.md b/docs/developer-quickstart.md index c4527957b..e19cb4d9f 100644 --- a/docs/developer-quickstart.md +++ b/docs/developer-quickstart.md @@ -10,7 +10,7 @@ |---|---| | Go 1.27.3 | Hub Server / Edge Server | | Node.js 24+ + corepack | pnpm workspace 和前端构建 | -| PostgreSQL 16+ | Hub 数据库 | +| PostgreSQL 18.6 | Hub 数据库(当前开发/CI默认稳定版本) | | Redis 7+ | Hub cache/session | | Git 2.40+;OpenSSL | 分支和 worktree;POSIX shell 生成本地 JWT secret | | Python 3.10+ + PyYAML | 文档、OpenAPI 与 E2E 合同校验 | @@ -127,12 +127,14 @@ Web 当前把 Hub access/refresh token 存在 tab-scoped `sessionStorage`,不 |---|---|---| | L0 后端 | `make test`(复用 Go test cache)/ `make test-ci`(`-count=1`) | `test-edge` + `test-hub`,均为 `go test -short` | | L0 前端 | `make fe-test` / `make fe-test-changed` | 单个 Vitest 进程跑全部 project;`--changed` 只跑受 git 变更影响的用例 | -| L1 集成 | `scripts/dev/dev-up.sh --full`(容器启动后返回)后执行 `make test-hub-integration` | 真实 PostgreSQL 16 + Redis 7;`-tags integration` | +| L1 集成 | `scripts/dev/dev-up.sh --full`(容器启动后返回)后执行 `make test-hub-integration` | 真实 PostgreSQL 18.6 + Redis 7;`-tags integration` | | L2 fixture | `make test-edge-e2e` / `make e2e-local` | callback mock hub;后者组合 teamrun + OIDC/scenarios smoke | | 全量本地 | `make test-all` | Edge/Hub 非 `-short` race + L1,需 PostgreSQL + Redis | 本机只跑改动相关的最小集:后端在模块目录执行 `cd hub-server && go test ./internal/ -short`(Edge 同理),前端 `make fe-test-changed`;`-race`、L1、打包和浏览器 lane 放 L3/CI。 +PostgreSQL 默认版本与 Docker 官方镜像固定在根 Compose、CI 和 fixture E2E。PG18 的卷挂载父目录是 `/var/lib/postgresql`,内部 `PGDATA` 带主版本;开发默认使用全新 `agenthub_pg18_data`,不复用或删除旧 `agenthub_pg_data`。已有 PG16 数据需要停写后的可验证 dump/restore 或 `pg_upgrade`,不能只换镜像。迁移前保留旧卷、配置和备份;新库验收与业务切换前可保持旧库服务,切换后不得用旧快照覆盖新写入。此仓默认版本变化不表示任何外部运行数据库已升级;运行事实与部署门禁归运维 STATE。最新稳定版以 [PostgreSQL 官方版本表](https://www.postgresql.org/support/versioning/) 为准。 + L3 需要单独准备的全栈环境。`scripts/dev/dev-up.sh` 默认启动 PostgreSQL/Redis 后在前台运行 Hub;`--full` 构建并启动 Hub 容器后返回;两者都不启动 Account、Edge 或 Web。真实 Account L3 需要可达的真实 Account issuer、已注册的 confidential client、真实浏览器 Authorization Code + PKCE、UserInfo 和 Hub session。fixture、stub、自签 Hub JWT 或只验证 OIDC 配置形状的运行只能算较低证据层;在 Account 专用 lane 未产出通过的 manifest 前,该项保持 pending。 文档/API: diff --git a/hub-server/scripts/generate-secrets.sh b/hub-server/scripts/generate-secrets.sh index 7128de836..cca563ea2 100644 --- a/hub-server/scripts/generate-secrets.sh +++ b/hub-server/scripts/generate-secrets.sh @@ -28,7 +28,7 @@ cat > "$OUTPUT" << EOF # Generated: $(date -u +"%Y-%m-%dT%H:%M:%SZ") # WARNING: Keep this file secure. Do not commit to version control. -# ── Database (host PostgreSQL 16) ─────────────────────────────────────── +# ── Database (operator-managed PostgreSQL) ────────────────────────────── PG_HOST=${PG_HOST} PG_PORT=${PG_PORT} PG_USER=${PG_USER} diff --git a/scripts/dev/dev-up.py b/scripts/dev/dev-up.py index e5a0f7524..8a2c2992f 100644 --- a/scripts/dev/dev-up.py +++ b/scripts/dev/dev-up.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 """dev-up — 一键本地开发环境。 -Docker Compose 启动 PostgreSQL 16 + Redis 7,等待健康后 go run 启动 Hub +Docker Compose 启动 PostgreSQL 18.6 + Redis 7,等待健康后 go run 启动 Hub Server。--full 连带构建并启动 hub-server 镜像,等待 Hub health 后打印服务表, 不 go run。 diff --git a/scripts/dev/dev-up.sh b/scripts/dev/dev-up.sh index 9d0d5d633..dd8eab5ab 100755 --- a/scripts/dev/dev-up.sh +++ b/scripts/dev/dev-up.sh @@ -3,7 +3,7 @@ # AgentHub Docker Compose — 一键启动开发环境 # (兼容 launcher;实现见同名 .py) # ─────────────────────────────────────────────── -# 启动 PostgreSQL 16 + Redis 7,然后在前台运行 Hub Server(--full 改为构建并启动 Hub 容器后返回)。 +# 启动 PostgreSQL 18.6 + Redis 7,然后在前台运行 Hub Server(--full 改为构建并启动 Hub 容器后返回)。 # # 用法: # ./scripts/dev/dev-up.sh # 启动 postgres + redis,然后前台 go run hub-server diff --git a/scripts/e2e/run-real-e2e-lane.sh b/scripts/e2e/run-real-e2e-lane.sh index eddea5b0d..370a06eb0 100644 --- a/scripts/e2e/run-real-e2e-lane.sh +++ b/scripts/e2e/run-real-e2e-lane.sh @@ -351,7 +351,7 @@ manifest = { "hub": {"base_url": os.environ["MANIFEST_HUB_BASE_URL"], "state": os.environ["MANIFEST_HUB_STATE"]}, "edge": {"base_url": os.environ["MANIFEST_EDGE_BASE_URL"], "state": os.environ["MANIFEST_EDGE_STATE"]}, "web": {"base_url": os.environ["MANIFEST_WEB_BASE_URL"], "state": os.environ["MANIFEST_WEB_STATE"]}, - "backend_services": ["postgres:16", "redis:7"], + "backend_services": ["postgres:18.6", "redis:7"], }, "secret_handling": { "account_mode": "operator-supplied external identities (provision-real-e2e-stack.sh)", diff --git a/scripts/e2e/wsl-full-stack-e2e.sh b/scripts/e2e/wsl-full-stack-e2e.sh index f274321bd..779296b98 100644 --- a/scripts/e2e/wsl-full-stack-e2e.sh +++ b/scripts/e2e/wsl-full-stack-e2e.sh @@ -362,7 +362,7 @@ generate_compose() { cat >"$COMPOSE" <