feat: add SelfMedia YAML-first operations skill
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
---
|
||||
name: unidesk-selfmedia
|
||||
description: UniDesk SelfMedia 工厂的 YAML-first 运维技能,覆盖 NC01 生产 Secret 分发与消费者生效、GitHub 到 Gitea/PaC/Tekton/GitOps/Argo 自动交付、WebTerm/Codex 权限边界、公网 IP 健康与登录鉴权验收。用户提到 SelfMedia、自媒体工厂、selfmedia-nc01、管理员账号密码更新、WebTerm、微信公众号文章、4317 公网入口、SelfMedia 部署或流水线运维时使用。
|
||||
---
|
||||
|
||||
# UniDesk SelfMedia 运维
|
||||
|
||||
遵循 `Skill(cli-spec)`,只通过 UniDesk owning YAML 和受控 CLI 操作 NC01 运行面。
|
||||
|
||||
## 固定边界
|
||||
|
||||
- 把 `config/selfmedia.yaml` 作为部署、存储、运行时、权限和公网暴露真相。
|
||||
- 把 `config/secrets-distribution.yaml` 作为管理员凭据、API key、Codex 凭据和消费者 rollout 真相。
|
||||
- 把 `config/platform-infra/pipelines-as-code.yaml` 与 `config/platform-infra/gitea.yaml` 作为自动交付真相。
|
||||
- 通过 `trans NC01:<workspace>` 在 NC01 选中的最新干净 UniDesk worktree 执行命令。
|
||||
- 只披露 sourceRef、键名、presence、fingerprint、字节数和步骤摘要;不得读取、打印或从运行面反解 Secret 值。
|
||||
- SelfMedia 源码交付只由 `pikainc/selfmedia` PR merge 触发;不得人工创建 PipelineRun、推送 Gitea、刷新 Argo 或 patch 运行时。
|
||||
|
||||
## 高频流程
|
||||
|
||||
1. 管理员凭据更新时,按[运维入口](references/operations.md#管理员凭据分发)依次执行 `plan`、`sync`、job 查询和 `status`。
|
||||
2. 确认 `selfmedia-nc01` 的 `consumerRollout` 已声明 `selfmedia` Deployment;应用启动时读取 Secret,缺少 rollout 不能判定新凭据已生效。
|
||||
3. 代码发布只观察 PR merge 后的自动 PaC/GitOps 收敛;只有自动链失败时才下钻 status/history/debug-step。
|
||||
4. 最后从 YAML 解析公网地址,验证 `/` 与 `/healthz` 可达、匿名业务 API 返回 `401`,再用用户提供的新账号完成登录。
|
||||
|
||||
## 验收判定
|
||||
|
||||
- Secret 同步结果必须为 `succeeded`、`valuesPrinted=false`,并且消费者 restart/status 均为 `exitCode=0`。
|
||||
- `secrets status` 必须确认 `selfmedia-access`、`selfmedia-runtime`、`selfmedia-codex` 的声明键完整。
|
||||
- WebTerm 必须保留 PVC session、restart/resume、统一 SelfMedia CLI 与非 root、无 ServiceAccount token/Kubernetes/Docker/宿主权限边界。
|
||||
- 公网验收只记录 HTTP 状态、session/job/trace、fingerprint 和 artifact SHA,不记录 cookie、账号、密码或 API key。
|
||||
|
||||
## 相关技能
|
||||
|
||||
- Secret/YAML 归属或 renderer 修改同时使用 `$unidesk-ymalops`。
|
||||
- PaC、Tekton、GitOps、Argo 或自动交付排障同时使用 `$unidesk-cicd`。
|
||||
- 跨节点现场闭环同时使用 `$dad-dev` 与 `$unidesk-trans`。
|
||||
- 公网页面、布局或浏览器原入口验收同时使用 `$unidesk-webdev`。
|
||||
|
||||
## 详细入口
|
||||
|
||||
- 凭据分发、自动交付和公网验收命令见[运维入口](references/operations.md)。
|
||||
@@ -0,0 +1,4 @@
|
||||
interface:
|
||||
display_name: "UniDesk SelfMedia 运维"
|
||||
short_description: "SelfMedia YAML-first 部署、凭据与公网验收"
|
||||
default_prompt: "使用 $unidesk-selfmedia 完成 SelfMedia 的 YAML-first 运维和原入口验收。"
|
||||
@@ -0,0 +1,70 @@
|
||||
# SelfMedia 运维入口
|
||||
|
||||
## 管理员凭据分发
|
||||
|
||||
- 在 owner-only `/root/.unidesk/.env/selfmedia-access.env` 中维护以下键:
|
||||
- `SELFMEDIA_ADMIN_USERNAME`;
|
||||
- `SELFMEDIA_ADMIN_PASSWORD`;
|
||||
- `SELFMEDIA_API_KEY`;
|
||||
- `SELFMEDIA_SESSION_SECRET`。
|
||||
- 不用 `cat`、`source`、`env`、Pod env 或 Secret decode 检查值。
|
||||
- 先预检 sourceRef、键和 fingerprint:
|
||||
|
||||
```bash
|
||||
bun scripts/cli.ts secrets plan --config config/secrets-distribution.yaml --scope selfmedia --target selfmedia-nc01
|
||||
```
|
||||
|
||||
- 提交异步同步作业:
|
||||
|
||||
```bash
|
||||
bun scripts/cli.ts secrets sync --config config/secrets-distribution.yaml --scope selfmedia --target selfmedia-nc01 --confirm
|
||||
```
|
||||
|
||||
- 使用返回的 job ID 查询,直到终态:
|
||||
|
||||
```bash
|
||||
bun scripts/cli.ts job status <job-id> --tail-bytes 12000
|
||||
```
|
||||
|
||||
- confirmed sync 默认只返回 source/Secret fingerprint、键和 rollout 摘要;只有一次性下钻时才使用 `--full`,不得让默认输出因超限隐藏 ready 证据。
|
||||
|
||||
- 再核对目标 Secret 的键存在性:
|
||||
|
||||
```bash
|
||||
bun scripts/cli.ts secrets status --config config/secrets-distribution.yaml --scope selfmedia --target selfmedia-nc01
|
||||
```
|
||||
|
||||
- `consumerRollout` 是凭据生效合同:
|
||||
- `selfmedia` Deployment 通过 Secret `subPath` 挂载凭据;
|
||||
- 后端在启动时加载管理员凭据和 session secret;
|
||||
- `sync` 必须按 YAML 重启消费者,并通过多次短连接轮询等待 ready;
|
||||
- 总等待时限和轮询间隔分别由 `timeoutSeconds`、`pollIntervalSeconds` 声明;
|
||||
- 只更新 Secret 而没有成功 rollout 时,不得声称新账号已生效。
|
||||
|
||||
## 自动交付观察
|
||||
|
||||
- SelfMedia PaC consumer 为 `selfmedia-nc01`:
|
||||
|
||||
```bash
|
||||
bun scripts/cli.ts platform-infra pipelines-as-code status --target NC01 --consumer selfmedia-nc01
|
||||
bun scripts/cli.ts platform-infra pipelines-as-code history --target NC01 --consumer selfmedia-nc01 --limit 10
|
||||
```
|
||||
|
||||
- 只有失败归因时才按具体 PipelineRun 下钻:
|
||||
|
||||
```bash
|
||||
bun scripts/cli.ts platform-infra pipelines-as-code debug-step --target NC01 --consumer selfmedia-nc01 --id <pipeline-run-id>
|
||||
```
|
||||
|
||||
- 正常发布只由 `pikainc/selfmedia` 的 GitHub PR merge 触发,不执行 bootstrap、apply、trigger-current、mirror sync、人工 PipelineRun 或 Argo refresh/sync。
|
||||
|
||||
## 公网原入口验收
|
||||
|
||||
- 从 `config/selfmedia.yaml#delivery.targets.NC01.deployment` 读取公网 host、端口和健康路径,不在脚本中复制配置值。
|
||||
- 无凭据检查:
|
||||
- `/` 返回 `200`;
|
||||
- `/healthz` 返回 `200`;
|
||||
- `/api/v1/system` 返回 `401`;
|
||||
- `/api/v1/terminal/status` 返回 `401`。
|
||||
- 使用 owner 提供的新账号完成浏览器登录;不得把账号密码写入命令历史、截图、报告、issue 或日志。
|
||||
- 登录后核对 WebTerm 打开、Codex session resume、统一 CLI 请求和流水线 job 状态;不使用终端访问 Kubernetes、Docker socket、ServiceAccount token 或宿主路径。
|
||||
Reference in New Issue
Block a user