# Deploy Platform Standalone Deployment 本目录用于把当前 `deploy-platform` 前端项目单独部署到 CVM。运行形态是 systemd 托管 Docker 容器,容器内通过 `node deploy/server.mjs` 同源托管 Vite 构建后的静态文件和 `/deploy/api/*` 运维查询接口。 ## Runtime - 镜像:`deploy-platform` - 容器:`hyapp-deploy-platform` - systemd unit:`hyapp-deploy-platform` - 监听端口:`29200` - 健康检查:`http://127.0.0.1:29200/deploy/api/health` 同源接口: - `GET /deploy/api/health` - `GET /deploy/api/hyapp/inventory` - `GET /deploy/api/hyapp/plan?services=gateway-service,room-service` - `GET /deploy/api/hyapp/discover?services=gateway-service&remote=0` - `GET /deploy/api/hyapp/discover?services=user-service&remote=1` - `GET /deploy/api/hyapp/discover?services=user-service&remote=1&includeConfig=1` - `GET /deploy/api/hyapp/resources?remote=1` - `POST /deploy/api/hyapp/deploy` - `POST /deploy/api/hyapp/restart` - `GET /deploy/api/hyapp/testbox/status` - `POST /deploy/api/hyapp/testbox/service` - `POST /deploy/api/hyapp/testbox/timer` - `POST /deploy/api/hyapp/testbox/config` - `GET /deploy/api/hyapp/testbox/migrations` - `POST /deploy/api/hyapp/testbox/migrations/apply` `resources?remote=1`:TAT -> deploy;业务服务器配置 SSH 失败后 TAT 兜底;不开放 SQL/Mongo 查询入口。`deploy` 和 `restart` 是真实操作接口,必须在 JSON body 中显式传入 `confirmed: true`。联调和验收使用 `dryRun: true`。 ## Build Image 在发布机执行: ```bash cd /opt/deploy/sources/deploy-platform TAG="$(date -u +%Y%m%d%H%M%S)-$(git rev-parse --short HEAD)" REGISTRY="10.2.1.3:18082/hyapp" docker build -t "$REGISTRY/deploy-platform:$TAG" . docker push "$REGISTRY/deploy-platform:$TAG" ``` ## Install On Target Host ```bash sudo mkdir -p /etc/hyapp/deploy-platform sudo cp deploy/standalone/docker/deploy-platform.env.example /etc/hyapp/deploy-platform/docker.env sudo vi /etc/hyapp/deploy-platform/docker.env sudo cp deploy/standalone/systemd/hyapp-deploy-platform.service /etc/systemd/system/ sudo systemctl daemon-reload sudo systemctl enable --now hyapp-deploy-platform sudo systemctl status hyapp-deploy-platform curl -fsS http://127.0.0.1:29200/deploy/api/health ``` `docker.env` 只保存镜像、容器名和停止等待时间。腾讯云凭据不写入镜像;需要执行远端 discover 时,通过容器环境变量或 `TENCENT_ENV_FILE` 挂载注入。