Files
probably-rendering-one-more…/README.md
T
codex-bot 68419e3852
PROMPT CI and deployment / verify-and-deploy (push) Successful in 3m53s
Initialize PROMPT environment and ces-control deployment pipeline
2026-10-22 20:43:02 +08:00

61 lines
2.7 KiB
Markdown
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.
# PROMPT
仓库全名:**Probably Rendering One More Pixel Tonight**。日常名称、包名和服务名统一使用 PROMPT / `prompt`。
个人图文、动效与视频实验项目。当前仅搭建开发环境及 CI/CD,没有业务页面;访问 `/` 返回 404 是预期行为。
## 技术栈
Next.js Pages Router、React、TypeScript(strict)、Tailwind CSS、Node.js 24。依赖版本由 `package-lock.json` 固定。
```bash
nvm use
npm ci
npm run dev
```
健康检查:`GET /api/health`。支持 HEAD,拒绝写入请求,并返回当前部署 commit。
## 验证
```bash
npm run typecheck
npm test
npm run build
npm run test:smoke
```
Smoke test 会启动 standalone 生产服务,验证 HTTP 健康检查、release 标识及不支持的方法,随后停止测试进程。默认自动选择可用测试端口,可设置 `SMOKE_PORT` 覆盖。
## Gitea Actions 与持久部署
工作流为 `.gitea/workflows/ci.yml`,使用 `runs-on: ces-control`。PR 运行验证;main 分支 push 或在 main 上手动执行会在全部检查通过后部署。
Runner 前提:Linux 宿主机可访问 systemd,提供 Bash、Git、flock、基础文件工具及 root 或免密 sudo。Runner 的 label 必须让 Job 在该宿主机环境执行;容器里的 host 模式不一定就是物理宿主机。如果这些条件不满足,部署会明确失败,不能将 CI 中临时启动的进程当成持久服务。
仓库需要开启 Actions,且 `ces-control` runner 对仓库可用。Checkout 使用 Gitea Actions 提供的临时凭据,不在仓库保存密码或长期 token。
部署约定:
| 项目 | 值 |
| --- | --- |
| 服务 | `prompt.service` |
| 系统用户 | `prompt` |
| HTTP 端口 | `18131` |
| 发布目录 | `/opt/prompt/releases/<commit>` |
| 当前发布 | `/opt/prompt/current` |
| 持久数据目录 | `/var/lib/prompt` |
| 健康检查 | `http://127.0.0.1:18131/api/health` |
发布包含独立 Node 运行时。systemd 负责开机启动和故障重启;部署使用宿主机文件锁串行执行,跳过落后的 commit,通过原子软链接切换版本。新版本健康检查失败时恢复旧版本;首次发布失败则停止服务。数据目录不随 checkout 清理或版本切换而删除,当前尚未引入数据库或用户素材。
端口对外可达性取决于目标机器网络和防火墙;工作流不会修改防火墙。CI 日志会输出部署主机名及地址。当前没有业务接口或 UI,后续再确定图文、视频模块的包和设计系统。
维护命令(在目标宿主机执行):
```bash
sudo systemctl status prompt.service
sudo journalctl -u prompt.service -n 100 --no-pager
curl -fsS http://127.0.0.1:18131/api/health
```