Show a separate flow for each deployment method

This commit is contained in:
2026-11-30 20:13:51 +08:00
parent df2fff7a80
commit 01023404be
+39 -11
View File
@@ -8,23 +8,26 @@ Bedrock reads a YAML deployment file from `BEDROCK_DB_CONFIG`. The loader also a
| Gitea release to the existing host | [gitea/](gitea/) | | Gitea release to the existing host | [gitea/](gitea/) |
| Kubernetes | [kubernetes/](kubernetes/) | | Kubernetes | [kubernetes/](kubernetes/) |
- **Local SQLite** uses the [SQLite configuration](local/sqlite.yaml). Set a persistent, writable path in the SQL resource's `primary` field. ## Local SQLite
- **PostgreSQL on the existing host** uses Gitea Actions variables `BEDROCK_PG_HOST`, `BEDROCK_PG_PORT`, `BEDROCK_PG_DATABASE`, `BEDROCK_PG_USER` and secret `BEDROCK_PG_PASSWORD`. The release invokes `python3 deploy/gitea/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:5432` in the same namespace. The [multi-storage example](kubernetes/multi-storage.yaml) shows such addresses in the Bedrock configuration. Render the final YAML with deployment credentials, store it in a Secret, mount it into the Bedrock workload and set `BEDROCK_DB_CONFIG` to the mounted file. The [catalog ConfigMap example](kubernetes/kubernetes-catalog.yaml) 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::TerraformOutputs` reads a named `bedrock_resources` output from `terraform output -json`. Generic catalogs use names as keys and the same `kind` fields shown in the Kubernetes example. Role bindings are assigned in the deployment configuration under `bindings`.
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. Bedrock defaults to `bedrock.sqlite3` in the working directory. To choose another path, set `BEDROCK_DB_CONFIG` to a [SQLite configuration](local/sqlite.yaml) and set the resource's `primary` to a persistent, writable path.
S3 entries describe endpoints and buckets. Keep access credentials in the deployment's secret store for the eventual object storage client. ```mermaid
flowchart TD
A["在本机启动 Bedrock"] --> B{"是否设置 BEDROCK_DB_CONFIG"}
B -->|是| C["读取指定的 SQLite 配置,取得文件路径"]
B -->|否| D["使用工作目录下的 bedrock.sqlite3"]
C --> E["打开或创建 SQLite 文件"]
D --> E
E --> F["Bedrock 初始化文档存储"]
```
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. ## Gitea release to the existing host
## Release on the existing deployment host PostgreSQL on the existing host uses Gitea Actions variables `BEDROCK_PG_HOST`, `BEDROCK_PG_PORT`, `BEDROCK_PG_DATABASE`, `BEDROCK_PG_USER` and secret `BEDROCK_PG_PASSWORD`. The release invokes `python3 deploy/gitea/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.
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. 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
```mermaid ```mermaid
flowchart TD flowchart TD
M["main 收到提交"] --> W["deploy.yml 在 ces-control 上启动"] M["main 收到提交"] --> W["deploy.yml 在 ces-control 上启动"]
@@ -38,7 +41,32 @@ flowchart TD
I -->|失败| F I -->|失败| F
``` ```
### Manual SQL checks ## Kubernetes
The database and Bedrock workload manifests are supplied by the deployment. Use each database's Service DNS name as its address, such as `pg-main:5432` within the same namespace. The [multi-storage example](kubernetes/multi-storage.yaml) shows how to declare resource kinds, drivers and role bindings. Render the final YAML with deployment credentials, store it in a Secret, and mount it into the Bedrock workload at the path set in `BEDROCK_DB_CONFIG`. The optional [catalog ConfigMap](kubernetes/kubernetes-catalog.yaml) packages named resources for the library import API.
```mermaid
flowchart TD
A["准备 Kubernetes 工作负载和数据库 Service"] --> B["用 Service 名称配置数据库连接地址"]
B --> C["用 multi-storage.yaml 的结构准备 Bedrock 配置和用途绑定"]
D["可选:从 ConfigMap 导入命名资源"] -.-> C
E["部署时提供数据库凭据"] --> C
C --> F["把私有 bedrock.yaml 写入 Kubernetes Secret"]
F --> G["Bedrock Pod 挂载配置,设置 BEDROCK_DB_CONFIG"]
G --> H["Bedrock 通过 Service 地址连接数据库"]
```
## Shared deployment settings
Terraform or cloud inventory can export the chosen endpoints. Map those results into the Bedrock resource schema before importing. `ImportFormat::TerraformOutputs` reads a named `bedrock_resources` output from `terraform output -json`. Generic catalogs use names as keys and the same `kind` fields shown in the Kubernetes example. Role bindings are assigned in the deployment configuration under `bindings`.
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.
## Manual SQL checks
```mermaid ```mermaid
flowchart TD flowchart TD