Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions deployments/production/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -55,7 +55,7 @@ services:
redis:
condition: service_healthy
environment:
# Local PostgreSQL 16 (127.0.0.1:<port>). PG_PASSWORD required;
# Operator-managed PostgreSQL (127.0.0.1:<port>). 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.
Expand Down
14 changes: 8 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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 # 首次:复制环境变量(已提供默认值)
Expand All @@ -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}
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down
6 changes: 4 additions & 2 deletions docs/developer-quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 合同校验 |
Expand Down Expand Up @@ -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/<pkg> -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:
Expand Down
2 changes: 1 addition & 1 deletion hub-server/scripts/generate-secrets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion scripts/dev/dev-up.py
Original file line number Diff line number Diff line change
@@ -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。

Expand Down
2 changes: 1 addition & 1 deletion scripts/dev/dev-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion scripts/e2e/run-real-e2e-lane.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down
4 changes: 2 additions & 2 deletions scripts/e2e/wsl-full-stack-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ generate_compose() {
cat >"$COMPOSE" <<EOF
services:
pg:
image: postgres:16-alpine
image: postgres:18.6-alpine@sha256:10a5c69a83035ab5239f5620d708520e8b28f5aa1f2b20143e6024532edadfb5
container_name: ${PROJECT_NAME}-pg
environment:
POSTGRES_USER: agenthub
Expand Down Expand Up @@ -566,7 +566,7 @@ doc = {
"stack": [
"account-oidc-fixture",
"hub-server",
"postgres:16-alpine",
"postgres:18.6-alpine",
"redis:7-alpine",
],
"checks": {
Expand Down
2 changes: 1 addition & 1 deletion scripts/verify/tests/test_verify_real_e2e_lane_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"hub": {"base_url": "http://localhost:8080", "state": "up"},
"edge": {"base_url": "http://127.0.0.1:3210", "state": "up"},
"web": {"base_url": "http://127.0.0.1:5174", "state": "up"},
"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)",
Expand Down
2 changes: 1 addition & 1 deletion scripts/verify/verify-real-e2e-lane-manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def assert_no_private_names(manifest, context="manifest"):
* 内网后缀 hostname(*.internal / *.local / *.corp / *.lan)

允许(不误报):loopback/localhost URL、相对路径(tests/artifacts/...、
app/web)、镜像引用 postgres:16 / redis:7、报告 basename、枚举值。
app/web)、镜像引用 postgres:18.6 / redis:7、报告 basename、枚举值。
单标签内网 host 仅在 URL host 位置判定(唯一无歧义位置);裸单标签
token(web/up/none/passed 等)不视作 hostname,避免把枚举误报为泄漏。
"""
Expand Down
Loading