Files
Bedrock/deploy/bedrock-deployment.svg
T

105 lines
7.4 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<svg xmlns="http://www.w3.org/2000/svg" width="1160" height="1000" viewBox="0 0 1160 1000" role="img" aria-labelledby="title description">
<title id="title">Bedrock 的部署与手动验证流程</title>
<desc id="description">main 提交触发 Gitea CD。release.sh 调用配置渲染器并启动临时容器。容器内 Rust Bedrock 初始化已有 PostgreSQL 数据库中的 Bedrock 表。另有独立手动检查路径。</desc>
<defs>
<marker id="arrow" viewBox="0 0 9 9" refX="8" refY="4.5" markerWidth="9" markerHeight="9" orient="auto" markerUnits="userSpaceOnUse"><path d="M0 0 9 4.5 0 9z" fill="#557866"/></marker>
<marker id="arrow-red" viewBox="0 0 9 9" refX="8" refY="4.5" markerWidth="9" markerHeight="9" orient="auto" markerUnits="userSpaceOnUse"><path d="M0 0 9 4.5 0 9z" fill="#976752"/></marker>
<pattern id="grid" width="16" height="16" patternUnits="userSpaceOnUse"><circle cx="2" cy="2" r=".7" fill="#a4b2a3" opacity=".28"/></pattern>
</defs>
<style>
text{font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;fill:#1e3328}
.title{font-size:37px;font-weight:720;letter-spacing:-.4px}
.kicker,.code{font-family:ui-monospace,"SF Mono",Consolas,monospace}
.kicker{font-size:13px;letter-spacing:2px;font-weight:650;fill:#426251}
.lane{font-size:23px;font-weight:700}
.headline,.code{font-size:17px;font-weight:700}
.detail{font-size:14px;fill:#475d50}
.badge{font-size:14px;font-weight:650;fill:#325541}
.result{font-size:15px;font-weight:700;fill:#38624b}
.failed{fill:#8b5642}
.flow{fill:none;stroke:#557866;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;marker-end:url(#arrow)}
.flow-fail{fill:none;stroke:#976752;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;marker-end:url(#arrow-red)}
.side{stroke-dasharray:4 4}
</style>
<rect width="1160" height="1000" rx="23" fill="#f8f8f1"/>
<rect x=".5" y=".5" width="1159" height="999" rx="22.5" fill="none" stroke="#d9dfd3"/>
<path d="M34 103H1126" stroke="#d9dfd3"/>
<rect x="34" y="123" width="738" height="842" rx="17" fill="#eef2e9" stroke="#d9e1d5"/>
<rect x="34" y="123" width="738" height="842" rx="17" fill="url(#grid)"/>
<rect x="792" y="123" width="334" height="842" rx="17" fill="#f1f1e9" stroke="#dfe1d6"/>
<text x="34" y="36" class="kicker">BEDROCK / DEPLOYMENT</text>
<text x="34" y="81" class="title">Bedrock 的部署与手动验证流程</text>
<text x="55" y="159" class="lane">CD · 原部署机</text>
<text x="813" y="159" class="lane">手动验证</text>
<path d="M310 215 V235" class="flow"/>
<path d="M310 298 V318" class="flow"/>
<path d="M310 381 V414" class="flow"/>
<path d="M310 477 V497" class="flow"/>
<path d="M310 560 V580" class="flow"/>
<path d="M310 643 V663" class="flow"/>
<path d="M310 740 V821" class="flow"/>
<path d="M564 447 H536" class="flow side"/>
<path d="M310 896 V906 H224 V919" class="flow"/>
<path d="M310 896 V906 H568 V919" class="flow-fail"/>
<path d="M959 215 V235" class="flow"/>
<path d="M959 298 V318" class="flow"/>
<path d="M959 396 V416" class="flow"/>
<path d="M959 494 V522" class="flow"/>
<rect x="84" y="171" width="452" height="44" rx="9" fill="#e0eee0" stroke="#8eaf98"/>
<path d="M93 183v20" stroke="#8bac94" stroke-width="2" stroke-linecap="round"/>
<text x="104" y="199.0" class="headline">main 收到提交</text>
<rect x="84" y="235" width="452" height="63" rx="9" fill="#fbfbf6" stroke="#bfcec0"/>
<text x="104" y="264" class="code">deploy.yml</text>
<text x="104" y="285" class="detail">Gitea 在 ces-control 上检出代码并编排部署。</text>
<rect x="84" y="318" width="452" height="63" rx="9" fill="#fbfbf6" stroke="#bfcec0"/>
<text x="104" y="347" class="code">build-release.sh</text>
<text x="104" y="368" class="detail">在 Rust 容器内编译 release,输出 Bedrock 二进制。</text>
<text x="327" y="402" class="detail">二进制路径与 Git SHA 交给发布脚本</text>
<rect x="84" y="414" width="452" height="63" rx="9" fill="#fbfbf6" stroke="#bfcec0"/>
<text x="104" y="443" class="code">release.sh</text>
<text x="104" y="464" class="detail">建立暂存目录,放入二进制。</text>
<rect x="564" y="412" width="185" height="70" rx="9" fill="#edf1e8" stroke="#c1ccbf"/>
<text x="584" y="441" class="headline">Gitea 部署配置</text>
<text x="584" y="462" class="detail">PostgreSQL Variables</text>
<text x="584" y="481" class="detail">和密码 Secret</text>
<rect x="84" y="497" width="452" height="63" rx="9" fill="#fbfbf6" stroke="#bfcec0"/>
<text x="104" y="526" class="code">render-postgres.py</text>
<text x="104" y="547" class="detail">由 release.sh 调用,生成权限为 0600 的 bedrock.json。</text>
<rect x="84" y="580" width="452" height="63" rx="9" fill="#fbfbf6" stroke="#bfcec0"/>
<text x="104" y="609" class="headline">release.sh 启动临时容器</text>
<text x="104" y="630" class="detail">挂载二进制和配置,运行 Rust bedrock。</text>
<rect x="84" y="663" width="452" height="77" rx="9" fill="#e0eee0" stroke="#8eaf98"/>
<path d="M93 675v53" stroke="#8bac94" stroke-width="2" stroke-linecap="round"/>
<text x="104" y="692" class="headline">Rust Bedrock 读取配置</text>
<text x="104" y="713" class="detail">通过 db_connection 选择 postgres。</text>
<text x="104" y="732" class="detail">配置由 BEDROCK_DB_CONFIG 指定。</text>
<rect x="84" y="821" width="452" height="75" rx="9" fill="#e0eee0" stroke="#8eaf98"/>
<text x="104" y="847" class="headline">在已有 PostgreSQL 数据库内初始化</text>
<text x="104" y="869" class="detail">postgres 提供 SQL,persistence 在事务里执行。</text>
<text x="104" y="887" class="detail">创建 Bedrock 表并登记 production 部署。</text>
<text x="328" y="787" class="detail">进入 Store::initialize()</text>
<text x="118" y="909" class="result">成功</text>
<text x="614" y="909" class="result failed">失败</text>
<rect x="84" y="919" width="280" height="32" rx="9" fill="#e0eee0" stroke="#8eaf98"/>
<path d="M93 931v8" stroke="#8bac94" stroke-width="2" stroke-linecap="round"/>
<text x="104" y="941.0" class="headline">保存版本并切换 current</text>
<rect x="401" y="919" width="348" height="32" rx="9" fill="#f7eee6" stroke="#d4b7a6"/>
<text x="421" y="941.0" class="headline">清理暂存目录,保留上一版 current</text>
<rect x="813" y="171" width="292" height="44" rx="9" fill="#fbfbf6" stroke="#bfcec0"/>
<text x="833" y="199.0" class="headline">手动运行</text>
<rect x="813" y="235" width="292" height="63" rx="9" fill="#fbfbf6" stroke="#bfcec0"/>
<text x="833" y="264" class="code">ci/check-sql.sh</text>
<text x="833" y="285" class="detail">脚本独立于部署工作流。</text>
<rect x="813" y="318" width="292" height="78" rx="9" fill="#fbfbf6" stroke="#bfcec0"/>
<text x="833" y="347" class="headline">准备隔离环境</text>
<text x="833" y="368" class="detail">启动临时 PostgreSQL 和 MySQL。</text>
<text x="833" y="387" class="detail">SQLite 使用临时本地文件。</text>
<rect x="813" y="416" width="292" height="78" rx="9" fill="#fbfbf6" stroke="#bfcec0"/>
<text x="833" y="445" class="headline">运行三库检查</text>
<text x="833" y="466" class="detail">执行格式检查、测试、构建,</text>
<text x="833" y="485" class="detail">验证 SQLite 默认启动。</text>
<rect x="813" y="522" width="292" height="63" rx="9" fill="#edf1e8" stroke="#c1ccbf"/>
<text x="833" y="551" class="headline">退出时清理</text>
<text x="833" y="572" class="detail">删除测试容器和临时网络。</text>
</svg>