3.8 KiB
Deployment configuration
Bedrock reads a YAML deployment file from BEDROCK_DB_CONFIG. See local SQLite and multiple SQL roles with S3 settings. The loader also accepts TOML and existing JSON files.
- SQLite uses a persistent, writable path for
sqlite_path. - PostgreSQL on the existing host uses Gitea Actions variables
BEDROCK_PG_HOST,BEDROCK_PG_PORT,BEDROCK_PG_DATABASE,BEDROCK_PG_USERand secretBEDROCK_PG_PASSWORD. The release invokespython3 deploy/render-postgres.py /path/to/private/bedrock.yaml --deployment production --config-version RELEASE_ID. The renderer writes a private file. The database must already exist and present a trusted certificate for the selected endpoint. - Kubernetes deploys each database and its Service separately. An in-cluster address can use the Service DNS name, such as
pg-main:5432in the same namespace. Render the final YAML with deployment credentials, store it in a Secret, mount it into the Bedrock workload and setBEDROCK_DB_CONFIGto the mounted file. The catalog ConfigMap example shows how to package a catalog for the library import API without credentials. Declare the resource kind and driver in the catalog and bind its role in the deployment file. A Service name, port, or Kubernetes object kind alone does not describe the backend or its purpose. - Terraform or cloud inventory can export the chosen endpoints. Map those results into the Bedrock resource schema before importing.
ImportFormat::TerraformOutputsreads a namedbedrock_resourcesoutput fromterraform output -json. Generic catalogs use names as keys and the samekindfields shown in the Kubernetes example. Role bindings are assigned in the deployment configuration.
Publish the same versioned configuration to every instance in a deployment. Use a new configuration version and restart instances to apply changes. Rollouts can temporarily contain two versions. The catalog APIs edit an in-process draft. Publish the validated YAML through the deployment system to apply it across instances.
S3 entries describe endpoints and buckets. Keep access credentials in the deployment's secret store for the eventual object storage client.
Pull requests currently run without an automatic storage check. The optional ci/check-sql.sh script uses isolated database containers and generated fixture credentials when run on an approved remote runner.
Release on the existing deployment host
Gitea builds a release on ces-control when a commit lands on main. The deploy step renders the private PostgreSQL configuration and runs the current one-shot Rust storage initializer on the existing endoleap-dev_default network. It publishes releases under /opt/endoleap-infra/bedrock-rust/releases and switches /opt/endoleap-infra/bedrock-rust/current after successful initialization. The Go service retains its own containers and routes.
Automatic deployment
flowchart TD
M["main 收到提交"] --> W["deploy.yml 在 ces-control 上启动"]
W --> B["build-release.sh 编译发布版"]
B -->|Bedrock 二进制和 Git SHA| R["release.sh 暂存待发布版本"]
R --> P["render-postgres.py 生成私有 bedrock.yaml"]
E["Gitea PostgreSQL Variables 和 Secret"] -->|部署参数| P
P -->|配置就绪| I["临时容器运行 Bedrock,由 Bedrock 初始化 PostgreSQL"]
I -->|成功| S["保存版本并原子切换 current"]
P -->|失败| F["清理暂存目录,保留现有 current"]
I -->|失败| F
Manual SQL checks
flowchart TD
H["在远程 runner 手动运行"] --> C["ci/check-sql.sh 创建临时网络和数据库容器"]
C --> T["测试 SQLite、PostgreSQL 和 MySQL"]
T -->|退出时| U["清理测试容器和临时网络"]