feat: 合并 genehub 基因库到主仓库统一维护#250
Conversation
- 将 NoDeskAI/genehub 仓库完整复制为 genehub/ 顶层目录 - docker-compose.yml: 新增 genehub-registry + genehub-gitea 服务,共享 Postgres - dev.sh: 集成 genehub 本地开发(registry 4520 + web 5173),支持 --skip-genehub - deploy: 构建/发布/部署脚本支持 genehub 组件(镜像 genehub-registry) - deploy/k8s/genehub.yaml: 统一的 K8s 部署清单(Deployment + Service + Gitea) - backend config: GENEHUB_REGISTRY_URL 默认指向内部服务 - 新增 scripts/init-multi-db.sh: Postgres 启动时自动创建 genehub 数据库 - .env.example: 补充 GeneHub 相关配置项文档 - AGENTS.md: 更新开发指南反映 GeneHub 组件 Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8dcf943e53
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| valueFrom: | ||
| secretKeyRef: | ||
| name: nodeskclaw-backend-env | ||
| key: GENEHUB_DATABASE_URL |
There was a problem hiding this comment.
Use a provisioned DB secret for GeneHub registry
DATABASE_URL is sourced from secret key GENEHUB_DATABASE_URL, but the default init flow builds nodeskclaw-backend-env from nodeskclaw-backend/.env and the provided .env.example does not define this key, so the variable is typically absent. In that case the registry falls back to its localhost default DB URL and cannot connect in K8s, which leaves the new genehub deployment failing out-of-the-box unless operators discover and add an undocumented secret key manually.
Useful? React with 👍 / 👎.
| periodSeconds: 10 | ||
| volumes: | ||
| - name: gitea-data | ||
| emptyDir: {} |
There was a problem hiding this comment.
Persist Gitea storage instead of ephemeral emptyDir
The genehub-gitea Deployment mounts its data volume from emptyDir, so all repositories are erased whenever the pod is recreated (restart, reschedule, node drain). Because GeneHub relies on Gitea as the source of truth for gene files, this causes irreversible data loss and breaks registry consistency after routine cluster operations.
Useful? React with 👍 / 👎.
| wait "$pid" 2>/dev/null || true | ||
| done | ||
| for port in 4510 4511; do | ||
| for port in 4510 4511 4520 5173; do |
There was a problem hiding this comment.
Avoid killing unrelated processes on port 5173
Cleanup unconditionally force-kills every PID listening on port 5173, but startup never checks that port is free. If a developer already has another app on 5173, dev.sh will still run (GeneHub web may fail to bind) and Ctrl+C later kills the unrelated process with kill -9, which is an unexpected destructive side effect.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ea1db588d3
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| containers: | ||
| - name: genehub | ||
| image: <YOUR_REGISTRY>/<YOUR_NAMESPACE>/genehub-registry:latest |
There was a problem hiding this comment.
Run GeneHub schema migrations before serving traffic
This deployment starts genehub-registry directly, but the image command (genehub/Dockerfile runs node dist/index.js) does not apply Drizzle migrations, and the only bootstrap script added here (scripts/init-multi-db.sh) creates databases only, not tables. On a fresh cluster, /api/health will still pass while API routes that query genes/gene_versions fail at runtime because the schema from genehub/packages/registry/drizzle/*.sql was never applied; add an initContainer or startup migration step before the app is marked ready.
Useful? React with 👍 / 👎.
| image: postgres:16-alpine | ||
| volumes: | ||
| - pg_data:/var/lib/postgresql/data | ||
| - ./scripts/init-multi-db.sh:/docker-entrypoint-initdb.d/init-multi-db.sh:ro |
There was a problem hiding this comment.
Ensure GeneHub DB is created for existing Compose volumes
The new DB bootstrap relies on mounting init-multi-db.sh into /docker-entrypoint-initdb.d, but that hook only runs when PostgreSQL initializes an empty data directory; users upgrading with an existing pg_data volume will skip this script, so ${GENEHUB_DB} is never created and genehub-registry cannot connect to postgres:5432/${GENEHUB_DB}. This needs a runtime/upgrade-safe DB creation path instead of an initdb-only hook.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9300fae951
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| labels: | ||
| app: genehub | ||
| spec: | ||
| initContainers: |
There was a problem hiding this comment.
Add imagePullSecrets to GeneHub pod template
The new genehub Deployment omits imagePullSecrets, while the other workloads in this repo (for example deploy/k8s/backend.yaml and deploy/k8s/portal.yaml) explicitly use cr-pull-secret. In clusters where REGISTRY/PUBLIC_REGISTRY points to a private registry, both the genehub-migrate initContainer and main genehub container will fail with image pull errors (ImagePullBackOff), so GeneHub never becomes available.
Useful? React with 👍 / 👎.
| spec: | ||
| initContainers: | ||
| - name: genehub-migrate | ||
| image: <YOUR_REGISTRY>/<YOUR_NAMESPACE>/genehub-registry:latest |
There was a problem hiding this comment.
Pin migration initContainer to the same release image
The migration initContainer is hardcoded to genehub-registry:latest, which can diverge from the app version deployed by release tags. During rollouts, this can run migrations from a different build than the main container, causing schema/app mismatches (for example, latest ahead of the tagged app) and startup failures that are hard to reproduce.
Useful? React with 👍 / 👎.
Summary
将 NoDeskAI/genehub 仓库完整合并到主项目中,统一维护和部署,降低多仓库管理成本。
变更内容
genehub/— 完整的 GeneHub 基因库代码(Registry API + Web 前端 + CLI + SDK + 基因内容)docker-compose.yml— 新增genehub-registry+genehub-gitea服务,与主项目共享 Postgres 实例dev.sh— 集成 GeneHub 本地开发:Registry 端口 4520、Web 端口 5173,支持--skip-genehub跳过deploy/— 构建/发布/部署脚本新增genehub组件(镜像名genehub-registry),支持--skip-genehubdeploy/k8s/genehub.yaml— K8s 部署清单(GeneHub Deployment + Service + Gitea)deploy/k8s/ingress.yaml— 新增 GeneHub Ingress 规则GENEHUB_REGISTRY_URL默认指向内部服务(Docker Compose:http://genehub-registry:3000,本地开发:http://localhost:4520)scripts/init-multi-db.sh— Postgres 启动时自动创建genehub数据库.env.example— 补充 GeneHub 相关环境变量文档AGENTS.md— 更新开发指南,加入 GeneHub 组件说明架构决策
genehub),通过init-multi-db.sh自动创建http://genehub-registry:3000直连 GeneHub API,无需外网API 兼容性验证
已逐一对照
GeneHubAdapter调用的 9 条 API 路径与 genehub registry 路由,全部匹配:GET /api/v1/genes(搜索) ✓GET /api/v1/genes/:slug(详情) ✓GET /api/v1/genes/:slug/manifest✓GET /api/v1/genes/featured✓GET /api/v1/genes/tags✓GET /api/v1/genes/:slug/synergies✓POST /api/v1/genes(发布) ✓POST /api/v1/genes/:slug/installed✓POST /api/v1/genes/:slug/effectiveness✓Test plan
docker compose up验证所有服务正常启动(含 genehub-registry + genehub-gitea)GENEHUB_REGISTRY_URL正常连接 GeneHub Registry API./dev.sh验证本地开发所有服务启动正常./dev.sh --skip-genehub验证跳过 GeneHub 功能正常GET /api/health响应正常./deploy/release.sh create <version>验证 genehub 镜像构建正常Made with Cursor