Rename shared backend to Bedrock [skip ci]
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# 分支推送和 PR 检查:格式/编译、隔离数据库回归、固定版本 headless 客户端以及 HTTP smoke。
|
||||
name: Foundry Go checks
|
||||
name: Bedrock Go checks
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
@@ -19,7 +19,7 @@ jobs:
|
||||
set -eu
|
||||
test -z "$(gofmt -l cmd internal)"
|
||||
go test -mod=readonly ./...
|
||||
go build -mod=readonly -o bin/foundry ./cmd/foundry
|
||||
go build -mod=readonly -o bin/bedrock ./cmd/bedrock
|
||||
# 仅 push 可使用已配置秘密做占位码探测,不能替代真实用户 OAuth 登录。
|
||||
- name: Check Slack OAuth configuration and endpoint
|
||||
if: gitea.event_name == 'push'
|
||||
@@ -98,7 +98,7 @@ jobs:
|
||||
PORT: '18080'
|
||||
run: |
|
||||
set -eu
|
||||
./bin/foundry &
|
||||
./bin/bedrock &
|
||||
server_pid=$!
|
||||
trap 'kill "$server_pid" 2>/dev/null || true' EXIT
|
||||
curl --silent --show-error --fail --retry 5 --retry-connrefused http://127.0.0.1:18080/healthz
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# 仅 main 的相关路径变更触发发布;工作分支验证不应运行此生产切换。
|
||||
name: Deploy Foundry Core
|
||||
name: Deploy Bedrock
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
@@ -34,7 +34,7 @@ jobs:
|
||||
set -eu
|
||||
test -z "$(gofmt -l cmd internal)"
|
||||
go test -mod=readonly ./...
|
||||
CGO_ENABLED=0 go build -mod=readonly -o bin/foundry ./cmd/foundry
|
||||
CGO_ENABLED=0 go build -mod=readonly -o bin/bedrock ./cmd/bedrock
|
||||
# secrets 仅注入进程环境,项目/引导 JSON 来自 Actions Variables,release 再检查内容。
|
||||
- name: Deploy and verify backend readiness
|
||||
env:
|
||||
@@ -44,4 +44,4 @@ jobs:
|
||||
SLACK_CLIENT_SECRET: ${{ secrets.SLACK_CLIENT_SECRET }}
|
||||
FOUNDRY_PROJECTS: ${{ vars.FOUNDRY_PROJECTS }}
|
||||
FOUNDRY_ONBOARDING: ${{ vars.FOUNDRY_ONBOARDING }}
|
||||
run: bash deploy/release.sh bin/foundry
|
||||
run: bash deploy/release.sh bin/bedrock
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
# 造物工坊 · Foundry Core
|
||||
# 基岩 · Bedrock
|
||||
|
||||
基岩(Bedrock,原 Foundry Core)为多个项目提供共享后端。现有部署继续使用原 API 域名、环境变量和已发布的 HTTP 协议标识。
|
||||
|
||||
共享后端的第一版提供 Google 登录。各项目通过同一个 HTTPS API 登录,在私有 PostgreSQL 的认证库中维护独立账号和会话。项目业务库可分别配置独立的数据库和角色。
|
||||
|
||||
@@ -343,7 +345,7 @@ generation failures are terminal step/run results, not successful empty content.
|
||||
#### Remote verification and deployment
|
||||
|
||||
Normal `ces-control` CI runs formatting, tests, builds, migration checks and
|
||||
isolated PostgreSQL integration tests. `deploy/check-canvas-real.sh bin/foundry`
|
||||
isolated PostgreSQL integration tests. `deploy/check-canvas-real.sh bin/bedrock`
|
||||
is an explicit remote-runner-only real-model verification; it does not run in
|
||||
normal CI. Set `FOUNDRY_CANVAS_IMAGE_MODELS` to backend names already verified for
|
||||
image output. The check starts a temporary CLI worker and database and removes
|
||||
@@ -368,9 +370,9 @@ numbered migrations and confirm capabilities before migrating a real canvas.
|
||||
|
||||
Production deployment of merge commit `b4e537b4adedeb524971cbbdd3f52c61257b10da`
|
||||
succeeded on the confirmed ECS runner on 2026-11-06. Main checks
|
||||
[run 912](https://gitea.entroia.com/Zayden-Jung/foundry-core/actions/runs/912)
|
||||
[run 912](https://gitea.entroia.com/Zayden-Jung/Bedrock/actions/runs/912)
|
||||
and deployment
|
||||
[run 913](https://gitea.entroia.com/Zayden-Jung/foundry-core/actions/runs/913)
|
||||
[run 913](https://gitea.entroia.com/Zayden-Jung/Bedrock/actions/runs/913)
|
||||
both succeeded. The base URL is `https://api.foundry.entroia.com`.
|
||||
The deployed capabilities endpoint reported contract `canvas-v2-2026-11-06`
|
||||
with both text and image available; the worker uses the backend verified above.
|
||||
|
||||
@@ -11,10 +11,10 @@ import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"gitea.entroia.com/Zayden-Jung/foundry-core/internal/auth"
|
||||
"gitea.entroia.com/Zayden-Jung/foundry-core/internal/codex"
|
||||
"gitea.entroia.com/Zayden-Jung/foundry-core/internal/platform"
|
||||
"gitea.entroia.com/Zayden-Jung/foundry-core/internal/research"
|
||||
"gitea.entroia.com/Zayden-Jung/Bedrock/internal/auth"
|
||||
"gitea.entroia.com/Zayden-Jung/Bedrock/internal/codex"
|
||||
"gitea.entroia.com/Zayden-Jung/Bedrock/internal/platform"
|
||||
"gitea.entroia.com/Zayden-Jung/Bedrock/internal/research"
|
||||
"github.com/jackc/pgx/v5"
|
||||
"github.com/jackc/pgx/v5/stdlib"
|
||||
)
|
||||
@@ -46,13 +46,13 @@ docker run -d --name "$worker" --init --network bridge --user 1000:1000 \
|
||||
--tmpfs /tmp:rw,nosuid,nodev,size=128m --tmpfs /work:ro,nosuid,nodev \
|
||||
--tmpfs /home/node/.codex:rw,nosuid,nodev,size=32m,uid=1000,gid=1000 --workdir /work \
|
||||
-e "FOUNDRY_CANVAS_IMAGE_MODELS=$FOUNDRY_CANVAS_IMAGE_MODELS" \
|
||||
--mount "type=bind,source=$binary,target=/opt/foundry,readonly" \
|
||||
--mount "type=bind,source=$binary,target=/opt/bedrock,readonly" \
|
||||
--mount "type=bind,source=$cli,target=/opt/codex,readonly" \
|
||||
--mount "type=bind,source=$login/auth.json,target=/home/node/.codex/auth.json,readonly" \
|
||||
--mount "type=bind,source=$login/models_cache.json,target=/home/node/.codex/models_cache.json,readonly" \
|
||||
--mount "type=bind,source=$scratch/run,target=/run/foundry-codex" \
|
||||
--mount type=bind,source=/etc/ssl/certs/ca-certificates.crt,target=/etc/ssl/certs/ca-certificates.crt,readonly \
|
||||
node:24-bookworm-slim /opt/foundry codex-worker >/dev/null
|
||||
node:24-bookworm-slim /opt/bedrock codex-worker >/dev/null
|
||||
for attempt in {1..30}; do if [[ -S "$scratch/run/worker.sock" ]]; then break; fi; sleep 1; done
|
||||
test -S "$scratch/run/worker.sock"
|
||||
|
||||
|
||||
@@ -27,16 +27,16 @@ if [[ -s "$dir/canvas.env" ]]; then canvas_env=(--env-file "$dir/canvas.env"); f
|
||||
# CLI/二进制只读挂载,Core 只看到 socket,不共享本登录目录。
|
||||
# 容器参数分工:--init 负责子进程收尾,资源上限限制进程数/内存,cap-drop 与 no-new-privileges 收紧权限。
|
||||
# /tmp 可写用于临时任务,/work 只读且设为工作目录;没有 -p,因此不向宿主发布 worker 的 TCP 端口。
|
||||
# 挂载中 /opt/foundry 是 Go worker,/opt/codex 是预装 Node CLI;执行 CLI 才是这里需要 Node 环境的原因。
|
||||
# 挂载中 /opt/bedrock 是 Go worker,/opt/codex 是预装 Node CLI;执行 CLI 才是这里需要 Node 环境的原因。
|
||||
# 最后一行的 codex-worker 参数选中 main.go 的 worker 分支,而不是启动普通 Foundry HTTP API。
|
||||
docker run -d --name foundry-codex-worker --restart unless-stopped --init \
|
||||
--network bridge --user 1000:1000 --cap-drop ALL --security-opt no-new-privileges \
|
||||
--read-only --pids-limit 128 --memory 1g --tmpfs /tmp:rw,nosuid,nodev \
|
||||
--tmpfs /work:ro,nosuid,nodev --workdir /work \
|
||||
--mount "type=bind,source=$binary,target=/opt/foundry,readonly" \
|
||||
--mount "type=bind,source=$binary,target=/opt/bedrock,readonly" \
|
||||
--mount "type=bind,source=$base/codex-cli,target=/opt/codex,readonly" \
|
||||
--mount "type=bind,source=$dir/home,target=/home/node/.codex" \
|
||||
--mount "type=bind,source=$dir/run,target=/run/foundry-codex" \
|
||||
--mount "type=bind,source=/etc/ssl/certs/ca-certificates.crt,target=/etc/ssl/certs/ca-certificates.crt,readonly" \
|
||||
"${canvas_env[@]}" \
|
||||
node:24-bookworm-slim /opt/foundry codex-worker
|
||||
node:24-bookworm-slim /opt/bedrock codex-worker
|
||||
|
||||
+5
-5
@@ -63,7 +63,7 @@ python3 "$(dirname "$0")/migrate.py"
|
||||
|
||||
# 每次发布使用独立二进制目录供只读挂载;本脚本不清除旧 release 目录。
|
||||
release=$(mktemp -d "$foundry/release.XXXXXXXX")
|
||||
install -m 755 "$1" "$release/foundry"
|
||||
install -m 755 "$1" "$release/bedrock"
|
||||
|
||||
# 容器内监听全部接口供同网络的代理访问;端口 8080 没有在此发布到宿主公网,TLS 由 Traefik 处理。
|
||||
export HOST=0.0.0.0 PORT=8080 PUBLIC_ORIGIN="$origin"
|
||||
@@ -113,7 +113,7 @@ if [[ -d "$codex_dir" ]]; then
|
||||
# 用当前 release 的同一份 Go 二进制启动 worker,避免 Core/worker 的画布产物协议不一致。
|
||||
# 目录探测只验证 socket 和非空模型目录,不执行一次真实生成,也不验证模型账户额度。
|
||||
worker_ready=false
|
||||
if bash "$(dirname "$0")/codex-worker.sh" "$release/foundry" >/dev/null; then
|
||||
if bash "$(dirname "$0")/codex-worker.sh" "$release/bedrock" >/dev/null; then
|
||||
for attempt in {1..20}; do
|
||||
if docker exec foundry-codex-worker node -e '
|
||||
const http = require("node:http");
|
||||
@@ -157,7 +157,7 @@ if [[ -d "$codex_dir" ]]; then
|
||||
)
|
||||
fi
|
||||
|
||||
# 使用现成 node 镜像作为运行载体,实际启动 /opt/foundry 这个 Go 可执行文件,不在此 docker build。
|
||||
# 使用现成 node 镜像作为运行载体,实际启动 /opt/bedrock 这个 Go 可执行文件,不在此 docker build。
|
||||
# Node 供就绪探测使用;CA bundle 供 Go 的 HTTPS 客户端使用,二者的证书来源不能混为一谈。
|
||||
# Core 只挂载 IPC/授权表,不挂载 CLI 登录;以非 root、只读根文件系统和裁剪能力运行。
|
||||
docker run -d --name "$candidate" "${codex_mounts[@]}" "${mail_env[@]}" "${slack_env[@]}" "${research_env[@]}" --network "$network" \
|
||||
@@ -167,8 +167,8 @@ docker run -d --name "$candidate" "${codex_mounts[@]}" "${mail_env[@]}" "${slack
|
||||
--read-only --memory 1g \
|
||||
--mount "type=bind,source=$ca_bundle,target=/etc/ssl/certs/ca-certificates.crt,readonly" \
|
||||
-e SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt \
|
||||
--mount "type=bind,source=$release/foundry,target=/opt/foundry,readonly" \
|
||||
node:24-bookworm-slim /opt/foundry >/dev/null
|
||||
--mount "type=bind,source=$release/bedrock,target=/opt/bedrock,readonly" \
|
||||
node:24-bookworm-slim /opt/bedrock >/dev/null
|
||||
|
||||
# 候选或路由失败时删除本次新 Core;旧 Core 由 route 成功探测后才停止。
|
||||
cleanup_candidate() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Shared research API
|
||||
|
||||
This work belongs to Thesisly 研迹 and uses Foundry Core rather than a separate
|
||||
This work belongs to Thesisly 研迹 and uses Bedrock rather than a separate
|
||||
application backend. The corpus is public; account sessions and future private
|
||||
collections remain project scoped.
|
||||
|
||||
@@ -8,7 +8,7 @@ collections remain project scoped.
|
||||
|
||||
`internal/research` implements the HTTP contract and a PostgreSQL repository
|
||||
based on the fixed Paper Atlas `a3b677b` schema (TEXT/BIGINT columns, native
|
||||
English title/abstract search index). `cmd/foundry` enables it only when
|
||||
English title/abstract search index). `cmd/bedrock` enables it only when
|
||||
`FOUNDRY_RESEARCH_DATABASE_URL` is configured. The Paper Atlas migration is now published: 21 tables passed its independent
|
||||
count/content-hash acceptance. A dedicated `foundry_research_reader` role has
|
||||
SELECT on the ten tables consumed here, schema USAGE, and read-only defaults.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Foundry Go 模块身份,internal 包的导入前缀必须与此一致。
|
||||
module gitea.entroia.com/Zayden-Jung/foundry-core
|
||||
module gitea.entroia.com/Zayden-Jung/Bedrock
|
||||
|
||||
// CI 从此读取工具链版本,避免开发和远程构建使用不同语言契约。
|
||||
go 1.25.0
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"database/sql"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"gitea.entroia.com/Zayden-Jung/foundry-core/internal/codex"
|
||||
"gitea.entroia.com/Zayden-Jung/Bedrock/internal/codex"
|
||||
)
|
||||
|
||||
// startCanvasStep 持工作区锁解析目标当前 owner,再检查租约、编辑权限与内容指纹,成功才将 queued 改 running。
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"gitea.entroia.com/Zayden-Jung/foundry-core/internal/codex"
|
||||
"gitea.entroia.com/Zayden-Jung/Bedrock/internal/codex"
|
||||
)
|
||||
|
||||
// canvasPublicIP 排除本地/私有/链路/保留测试网和已列元数据地址,IPv4 映射先 Unmap 再检查。
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
|
||||
"gitea.entroia.com/Zayden-Jung/foundry-core/internal/codex"
|
||||
"gitea.entroia.com/Zayden-Jung/Bedrock/internal/codex"
|
||||
)
|
||||
|
||||
// persistCanvasImage 完整解码 worker 图片并核对 MIME,以 outputID 作为幂等键存原图。
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
|
||||
"gitea.entroia.com/Zayden-Jung/foundry-core/internal/codex"
|
||||
"gitea.entroia.com/Zayden-Jung/Bedrock/internal/codex"
|
||||
)
|
||||
|
||||
// TestCanvasAIJobLifecycle 通过真实准入/认领/写回验证几何并发、内容冲突、取消、租约恢复、图片和传播失败分支。
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
|
||||
"gitea.entroia.com/Zayden-Jung/foundry-core/internal/codex"
|
||||
"gitea.entroia.com/Zayden-Jung/Bedrock/internal/codex"
|
||||
)
|
||||
|
||||
// TestCanonicalAIAdmissionAndLifecycle 需隔离 PLATFORM_TEST_DATABASE_URL,覆盖 owner 迁移、代数失效及 v2 确定拒绝恢复。
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"gitea.entroia.com/Zayden-Jung/foundry-core/internal/codex"
|
||||
"gitea.entroia.com/Zayden-Jung/Bedrock/internal/codex"
|
||||
)
|
||||
|
||||
// canvasAIModels 要求 board 可读;worker 不可用时返回空目录及原因,不把基础能力发现变成请求失败。
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"gitea.entroia.com/Zayden-Jung/foundry-core/internal/codex"
|
||||
"gitea.entroia.com/Zayden-Jung/Bedrock/internal/codex"
|
||||
)
|
||||
|
||||
// Opt in only on the confirmed remote runner with its dedicated CLI worker.
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
"gitea.entroia.com/Zayden-Jung/foundry-core/internal/codex"
|
||||
"gitea.entroia.com/Zayden-Jung/Bedrock/internal/codex"
|
||||
)
|
||||
|
||||
// appendAIEvent 用单条 SQL 原子递增 run.last_seq 并插入事件,序号与业务状态一起提交。
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
"gitea.entroia.com/Zayden-Jung/foundry-core/internal/codex"
|
||||
"gitea.entroia.com/Zayden-Jung/Bedrock/internal/codex"
|
||||
)
|
||||
|
||||
// canvasQueueRun 保存本轮认领租约,后续状态写入必须匹配 Lease,旧执行者不能冒充新认领者。
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
|
||||
"gitea.entroia.com/Zayden-Jung/foundry-core/internal/codex"
|
||||
"gitea.entroia.com/Zayden-Jung/Bedrock/internal/codex"
|
||||
)
|
||||
|
||||
// Only the generation transport is deterministic. Admission, claims, events,
|
||||
|
||||
@@ -13,8 +13,8 @@ import (
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"gitea.entroia.com/Zayden-Jung/foundry-core/internal/auth"
|
||||
"gitea.entroia.com/Zayden-Jung/foundry-core/internal/codex"
|
||||
"gitea.entroia.com/Zayden-Jung/Bedrock/internal/auth"
|
||||
"gitea.entroia.com/Zayden-Jung/Bedrock/internal/codex"
|
||||
"github.com/jackc/pgx/v5/pgconn"
|
||||
)
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
"encoding/base64"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"gitea.entroia.com/Zayden-Jung/foundry-core/internal/auth"
|
||||
"gitea.entroia.com/Zayden-Jung/Bedrock/internal/auth"
|
||||
"image"
|
||||
"image/png"
|
||||
"io"
|
||||
|
||||
Reference in New Issue
Block a user