Skip to content

Commit 232fa27

Browse files
committed
docs: expand pig v1.8.0 native workflows
1 parent 8e1bbd8 commit 232fa27

4 files changed

Lines changed: 433 additions & 111 deletions

File tree

content/blog/release/pig-1.8.0.md

Lines changed: 91 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,49 +17,111 @@ Pigsty `4.5.0`.
1717

1818
## Native `pig sty boot`
1919

20-
- Bootstraps the controller end to end: repairs the Debian 12/13 locale when needed,
21-
verifies Ansible and its Python dependencies, installs controller packages, repairs
22-
localhost SSH on a best-effort basis, and can initialize a missing `~/pigsty` tree.
23-
- Supports online repositories, an explicit local package or HTTP(S) URL, a trusted
24-
automatically discovered offline package, and an already prepared `/www/pigsty`
25-
repository.
26-
- Backs up replaced repository definitions and restores them when package setup fails.
27-
Explicit offline-input errors are hard failures, while optional final conveniences
28-
are reported as warnings. JSON and YAML output expose the selected mode, repository
29-
policy, rollback state, warnings, and recommended next commands.
20+
`pig sty boot` is now one native, failure-aware controller bootstrap transaction. It does not
21+
execute `<PIGSTY_HOME>/bootstrap`, and its HTTP download and archive extraction paths do not
22+
depend on `curl`, `wget`, `tar`, or `gzip`.
23+
24+
### Privilege and readiness
25+
26+
- The command can be launched as an ordinary user. Pig resolves and downloads an explicit source
27+
before a single sudo re-exec; `PIG_NO_SUDO=1` disables elevation and
28+
`PIG_NON_INTERACTIVE=1` requests non-interactive sudo.
29+
- On Debian 12/13, locale preparation is attempted before and, when useful, after controller
30+
package installation.
31+
- Readiness is proven by executing `ansible-playbook`, discovering its Python interpreter, and
32+
checking `yaml`, `jmespath`, and either `cryptography` or `OpenSSL`. A present but unusable
33+
Ansible binary no longer produces a false success.
34+
35+
### Repository sources and transactions
36+
37+
- Source selection covers a local archive, an HTTP(S) URL, a permission-checked automatic
38+
`/tmp/pkg.tgz`, an already committed `/www/pigsty` repository, and regional online
39+
repositories. A bad explicit source is a hard error and never silently becomes an online boot.
40+
- A completed `/www/pigsty` repository wins over a selected package. Pig can create the expected
41+
`/www -> /data/nginx` layout itself, uses restricted extraction for offline content, and enables
42+
only the strict `pigsty-local` repository in offline mode. Online setup installs the embedded
43+
Pigsty key and keeps repository signature checks enabled.
44+
- The default overwrite policy backs up repository definitions and restores them when repository
45+
or package setup fails. `--keep` selects an additive policy and can retry a failed online
46+
refresh against existing definitions.
47+
- The reported mode is explicit: `ready`, `offline`, `online`, or `existing`. An explicit,
48+
automatically discovered, or committed offline source is prepared even when Ansible is already
49+
usable.
50+
51+
### Finishing checks and automation
52+
53+
- Pig probes controller helpers, repairs key-based SSH to `127.0.0.1` for the invoking admin user,
54+
and initializes a missing `~/pigsty` from online or local content when possible.
55+
- Locale, helper, localhost-SSH, and Pigsty-tree finishing failures are warnings. Invalid explicit
56+
input, repository/package failures, unsupported installation paths, and unusable post-install
57+
Ansible remain hard failures.
58+
- JSON and YAML use the `pig.sty.boot/v2` result contract, including the selected mode and package
59+
manager, repository policy and rollback state, source paths, locale, SSH and initialization
60+
status, changes, warnings, and the next `conf`, `inventory`, and `deploy` commands.
3061

3162
## Native `pig sty conf`
3263

33-
- Generates Inventory from a safe template below `<PIGSTY_HOME>/conf`, supports both
34-
`pig sty conf MODE` and `--conf MODE`, and can map up to ten ordered IPv4 addresses
35-
plus the exact `i.pigsty` placeholder domain.
36-
- Adds deterministic interactive and non-interactive IP selection, structural proxy,
37-
region, PostgreSQL-version, and secret-generation mutations, followed by complete
38-
Inventory validation.
39-
- Refuses source/output aliasing through direct paths, symlinks, symlinked parents, or
40-
hard links. A validated result is written atomically with mode `0600`; structured
41-
output reports generated secret identifiers but never their values.
64+
`pig sty conf` is now a complete native Inventory compiler. It does not execute `./configure` or
65+
fall back to raw Shell behavior: Pig resolves one template, performs bounded structural changes,
66+
validates the full candidate, and only then commits the output.
67+
68+
### Safe configuration pipeline
69+
70+
- The default template is `conf/meta.yml`; a safe slash-separated relative mode may be supplied
71+
positionally or with `--conf`. Absolute paths, traversal, path escape, and source/output
72+
aliasing through direct paths, symlinks, symlinked parents, or hard links are rejected.
73+
- Source parsing and IP-collision checks happen before external preflight. Parse, mutation,
74+
preflight, or validation failure leaves the destination unchanged.
75+
- Pig performs native Inventory validation and, when available, a bounded `ansible-inventory`
76+
parse. Successful output is atomically written with mode `0600`.
77+
78+
### Structural Inventory changes
79+
80+
- Up to ten distinct `--ip` values map simultaneously to slots `10.10.10.10` through
81+
`10.10.10.19`; unrelated VIPs remain intact. Without `--ip`, interface selection is explicit
82+
and deterministic in interactive, non-interactive, and closed-input execution.
83+
- `--domain` replaces only the exact `i.pigsty` token. Controllers with fewer than four CPUs are
84+
automatically switched from the `oltp` node and PostgreSQL tuning profiles to `tiny`.
85+
- Region changes update `all.vars.region`; `china` activates Docker and pip mirrors already
86+
supplied by the template. `--proxy` materializes available proxy environment variables under
87+
`all.vars.proxy_env`.
88+
- Generic templates support PostgreSQL 14-18 and explicit 19 beta, including matching locale and
89+
beta repository selection. Version-pinned `mssql`, `polar`, and `pgNN` modes keep their
90+
effective template version and emit a warning.
91+
- `--generate` assigns one random 24-character value to each known credential identifier and
92+
updates active values and documented placeholders consistently. Result output lists generated
93+
identifiers but never secret values.
94+
95+
### Preflight and result contract
96+
97+
- Unless `--skip` is selected, preflight covers the platform, package manager, controller
98+
resources, sudo/admin access, localhost SSH, and Ansible availability. Build templates under
99+
`conf/build/` intentionally bypass IP mapping and admin preflight.
100+
- JSON and YAML use `pig.sty.configure/v1` and report the template and output, selected and
101+
discarded addresses, requested and effective PostgreSQL versions, applied options, generated
102+
secret identifiers, and warnings.
42103

43104
## Other Updates
44105

45-
- EL8 and newer package operations consistently prefer DNF, local RPM requirements are
46-
resolved by provider capability, fresh repository bootstraps restore the expected
47-
`/www -> /data/nginx` layout, and self-update tolerates whitespace in the latest marker.
48-
- The extension catalog, package versions, metadata, and availability matrices receive
49-
their routine refresh while the published PostgreSQL-extension count remains **575**.
106+
- EL8 and newer package operations consistently prefer DNF, local RPM requirements are resolved
107+
by provider capability, fresh repository bootstraps restore the expected `/www` layout, and
108+
self-update tolerates whitespace in the latest marker.
109+
- The extension catalog, package versions, metadata, and availability matrices receive their
110+
routine refresh while the published PostgreSQL-extension count remains **575**.
50111
- CI and release builds use Go `1.26.6`, pinned analysis tools and GoReleaser, dependency
51112
verification, workflow linting, vulnerability scanning, and a full release snapshot.
52113

53114
## Compatibility Notes
54115

55116
- `pig sty boot` no longer executes `<PIGSTY_HOME>/bootstrap`. Automation that relied on
56-
shell-script side effects should consume the native command result instead.
117+
shell-script side effects should consume the native command and its structured result.
57118
- `pig sty conf --raw` has been removed. Use the native workflow; `--conf MODE` remains
58119
available, with `pig sty conf MODE` as the equivalent positional form.
59-
- `pig sty conf --ip` accepts up to ten comma-separated IPv4 addresses; `--skip` and
60-
`--ip` remain mutually exclusive.
61-
- EL8 and newer use DNF. The limited EL7 compatibility catalog retains its separate
62-
legacy YUM path.
120+
- `pig sty conf --ip` accepts up to ten comma-separated IPv4 addresses; `--skip` and `--ip`
121+
remain mutually exclusive. Uppercase `-O` chooses the Inventory file, while global lowercase
122+
`-o` chooses the command output format.
123+
- EL8 and newer use DNF. The limited EL7 compatibility catalog retains its separate legacy
124+
YUM path.
63125

64126
## Checksums
65127

content/blog/release/pig-1.8.0.zh.md

Lines changed: 70 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,78 @@ Pig `v1.8.0` 将 Pigsty 控制节点的准备过程原生化。两条核心安
1616

1717
## 原生 `pig sty boot`
1818

19-
- 端到端引导控制节点:按需修复 Debian 12/13 locale,校验 Ansible 及其 Python
20-
依赖,安装控制节点软件包,尽力修复本机免密 SSH,并可初始化缺失的 `~/pigsty`
21-
- 支持在线仓库、显式本地软件包或 HTTP(S) URL、可信的自动发现离线包,以及已经
22-
准备好的 `/www/pigsty` 软件仓库。
23-
- 替换仓库定义前自动备份,软件包准备失败时自动恢复。显式离线输入错误会直接失败,
24-
可选的收尾便利步骤则以告警呈现。JSON/YAML 输出会报告工作模式、仓库策略、回滚状态、
25-
告警与后续建议命令。
19+
`pig sty boot` 现在是一套具备事务语义与完整失败处理的原生控制节点引导流程。它不再执行
20+
`<PIGSTY_HOME>/bootstrap`,HTTP 下载与归档解压也不依赖 `curl``wget``tar``gzip`
21+
22+
### 权限与就绪检查
23+
24+
- 普通用户可以直接发起命令。Pig 会在一次 sudo 自重启前解析并下载显式来源;
25+
`PIG_NO_SUDO=1` 可禁用提权,`PIG_NON_INTERACTIVE=1` 可要求非交互 sudo。
26+
- Debian 12/13 会在安装控制节点软件包前检查 locale,并在新软件包可能补齐工具后按需重试。
27+
- 就绪判定会实际执行 `ansible-playbook`,发现其 Python 解释器,并检查 `yaml``jmespath`
28+
以及 `cryptography``OpenSSL` 两者之一;只有二进制文件但无法运行的 Ansible 不再产生假成功。
29+
30+
### 仓库来源与事务
31+
32+
- 来源覆盖本地归档、HTTP(S) URL、经过权限检查的自动 `/tmp/pkg.tgz`、已经提交的
33+
`/www/pigsty` 仓库,以及区域在线仓库。显式来源无效时直接失败,不会悄悄转为在线引导。
34+
- 已完成的 `/www/pigsty` 优先于选中的离线包。Pig 可以自行建立预期的
35+
`/www -> /data/nginx` 布局,以受限解压提交离线内容,并在离线模式下只启用严格的
36+
`pigsty-local` 仓库;在线模式会安装内嵌的 Pigsty 密钥,并保持仓库签名校验开启。
37+
- 默认覆盖策略会备份仓库定义,仓库或软件包准备失败时自动恢复;`--keep` 使用增量策略,
38+
在线刷新失败时可以利用现有定义重试。
39+
- 结果会明确标记 `ready``offline``online``existing` 模式。即使 Ansible 已经可用,
40+
显式、自动发现或已提交的离线来源仍会被准备。
41+
42+
### 收尾检查与自动化
43+
44+
- Pig 会探测控制节点辅助工具,为发起调用的管理员用户修复到 `127.0.0.1` 的密钥 SSH,
45+
并尽可能从在线或本地内容初始化缺失的 `~/pigsty`
46+
- locale、辅助工具、本机 SSH 与 Pigsty 目录初始化失败属于告警;显式输入无效、仓库或软件包
47+
操作失败、安装路径不受支持,以及安装后 Ansible 仍不可用,仍然是硬错误。
48+
- JSON/YAML 使用 `pig.sty.boot/v2` 结果契约,包含模式与软件包管理器、仓库策略与回滚状态、
49+
来源路径、locale、SSH 与初始化状态、变更、告警,以及后续 `conf``inventory`
50+
`deploy` 命令。
2651

2752
## 原生 `pig sty conf`
2853

29-
-`<PIGSTY_HOME>/conf` 下的安全模板生成 Inventory,同时支持
30-
`pig sty conf MODE``--conf MODE`,可按顺序映射最多十个 IPv4 地址,并替换
31-
精确的 `i.pigsty` 占位域名。
32-
- 提供确定性的交互与非交互 IP 选择,结构化处理代理、区域、PostgreSQL 版本与随机
33-
口令变更,最后对完整 Inventory 执行校验。
34-
- 拒绝通过直接路径、符号链接、带符号链接的父目录或硬链接让输出指回源模板。
35-
校验通过后以 `0600` 权限原子写入;结构化输出只报告生成的机密标识符,不泄露其值。
54+
`pig sty conf` 现在是一套完整的原生 Inventory 编译流程。它不执行 `./configure`,也不会
55+
回退到原始 Shell 行为:Pig 解析一个模板、执行有边界的结构化变更、校验完整候选,最后才提交
56+
输出文件。
57+
58+
### 安全配置流水线
59+
60+
- 默认模板为 `conf/meta.yml`;安全的斜杠分隔相对模式既可作为位置参数,也可通过 `--conf`
61+
指定。绝对路径、目录穿越、路径逃逸,以及通过直接路径、符号链接、带符号链接父目录或硬链接
62+
造成的源/输出别名都会被拒绝。
63+
- 源模板解析与 IP 冲突检查先于外部预检;解析、变更、预检或校验失败都不会改动目标文件。
64+
- Pig 执行原生 Inventory 校验,并在 `ansible-inventory` 可用时进行一次有时间边界的外部
65+
解析;成功结果以 `0600` 权限原子写入。
66+
67+
### Inventory 结构化变更
68+
69+
- 最多十个互不相同的 `--ip` 地址会同时映射到 `10.10.10.10``10.10.10.19`,VIP 等
70+
无关地址保持不变。未指定 `--ip` 时,交互、非交互与输入关闭场景都有明确且确定的选择行为。
71+
- `--domain` 只替换精确的 `i.pigsty`;CPU 少于四核的控制节点会自动从 `oltp` 节点与
72+
PostgreSQL 调优配置切换为 `tiny`
73+
- 区域变更会更新 `all.vars.region``china` 会启用模板中已有的 Docker 与 pip 镜像。
74+
`--proxy` 将可用的代理环境变量写入 `all.vars.proxy_env`
75+
- 通用模板支持 PostgreSQL 14-18 与显式指定的 19 beta,包括匹配的 locale 与 beta 仓库;
76+
固定版本的 `mssql``polar``pgNN` 模式保留模板实际版本并产生告警。
77+
- `--generate` 为每个已知凭据标识符分配一个 24 位随机值,并一致更新生效值与文档占位符;
78+
结果只列出生成的标识符,绝不输出机密值。
79+
80+
### 预检与结果契约
81+
82+
- 未指定 `--skip` 时,预检覆盖平台、软件包管理器、控制节点资源、sudo/管理员权限、本机 SSH
83+
与 Ansible 可用性;`conf/build/` 下的构建模板有意绕过 IP 映射与管理员预检。
84+
- JSON/YAML 使用 `pig.sty.configure/v1`,报告模板与输出、已选择和丢弃的地址、请求与实际
85+
PostgreSQL 版本、已应用选项、生成的机密标识符及告警。
3686

3787
## 其他更新
3888

39-
- EL8 及以上软件包操作统一优先使用 DNF;本地 RPM 依赖按提供能力解析;新建软件仓库时
40-
恢复预期的 `/www -> /data/nginx` 布局;自更新可容忍 latest 标记中的空白字符。
89+
- EL8 及以上软件包操作统一优先使用 DNF;本地 RPM 依赖按提供能力解析;新建软件仓库时恢复
90+
预期的 `/www` 布局;自更新可容忍 latest 标记中的空白字符。
4191
- 例行刷新扩展目录、软件包版本、元数据与可用性矩阵,发布的 PostgreSQL 扩展数量保持
4292
**575**
4393
- CI 与发布构建使用 Go `1.26.6`、固定版本的分析工具与 GoReleaser,并执行依赖校验、
@@ -46,10 +96,11 @@ Pig `v1.8.0` 将 Pigsty 控制节点的准备过程原生化。两条核心安
4696
## 兼容性提醒
4797

4898
- `pig sty boot` 不再执行 `<PIGSTY_HOME>/bootstrap`;依赖 Shell 脚本副作用的自动化应改为
49-
使用原生命令结果
50-
- `pig sty conf --raw` 已移除。请直接使用原生工作流`--conf MODE` 仍然可用,等价的位置
51-
参数形式为 `pig sty conf MODE`
99+
使用原生命令及其结构化结果
100+
- `pig sty conf --raw` 已移除。请使用原生工作流`--conf MODE` 仍然可用,等价的位置参数
101+
形式为 `pig sty conf MODE`
52102
- `pig sty conf --ip` 可接受最多十个逗号分隔的 IPv4 地址;`--skip``--ip` 仍互斥。
103+
大写 `-O` 选择 Inventory 文件,全局小写 `-o` 选择命令输出格式。
53104
- EL8 及以上使用 DNF;有限的 EL7 兼容目录继续保留独立的传统 YUM 路径。
54105

55106
## 校验和

0 commit comments

Comments
 (0)