fix(deploy): preserve legacy environment and diagnose prepared plans safely
The old initializer defaults HN_ENVIRONMENT to development, while migration validation required the literal production and combined database/platform prerequisites into one opaque error. Preserve supported environment identity namespaces without editing the live .env; still require PostgreSQL and fixed HTTPS/WSS endpoints for every existing-server migration. Match supported boolean spellings and report failing field names without credential values. Add read-only diagnose for an existing prepared plan so an earlier failed prepare can be reviewed without deleting or regenerating its keyring. Move future prerequisite validation before private directory/key generation. Validation: 253 passed, 3 skipped (real PostgreSQL unavailable), 30 existing warnings; 40 deployment-tool tests including 11 new compatibility/redaction cases. Python 3.7 syntax and staged diff checks pass. Actual ECS diagnosis must still confirm the current failing field; no live config or key changed.
This commit is contained in:
@@ -53,6 +53,17 @@ prepare生成独立的root私有目录、随机AES密钥keyring、独立router
|
||||
|
||||
## 4. 检查与离线构建:仍不切换
|
||||
|
||||
如果旧版prepare返回`broker production platform/database configuration incomplete`,不要删除目录或重跑prepare。旧初始化器曾使用`HN_ENVIRONMENT=development`,首版工具把production写死,且把多个条件合并成同一错误。新版保留经过校验的原environment命名空间(production/development/test),所有模式仍要求PostgreSQL及HTTPS/WSS;不会为通过检查修改运行.env或将凭据换一个身份空间。
|
||||
|
||||
先更新暂存仓库,再对已经生成的计划执行只读诊断:
|
||||
|
||||
```bash
|
||||
sudo python3 deployable/scripts/broker_deploy.py diagnose \
|
||||
--plan /home/cnooc/hainuo-broker-prepared-20261104
|
||||
```
|
||||
|
||||
只显示environment合法枚举、数据库类型及开关状态,不显示URL、账号密码、Secret或Token。通过后原地继续check,沿用原keyring和配置;若仍有错误按字段处理,不关闭HTTPS校验、不改用SQLite。新prepare在生成密钥前检查这些条件;旧目录因原检查失败留下的密钥不会被自动覆盖。
|
||||
|
||||
```bash
|
||||
cd /home/cnooc/ecs-relay-service-staging
|
||||
sudo python3 deployable/scripts/broker_deploy.py check \
|
||||
|
||||
Reference in New Issue
Block a user