Manage the RSKj node config so upgrades can't mis-network nodes #715

Merged
raucao merged 1 commits from fix/rsk-manage-node-config into master 2026-11-30 06:00:10 +00:00
Owner

rsk-testnet-6 was found syncing the mainnet chain and filling its disk. This PR fixes the underlying cookbook gap.

What happened: the rskj package owns /etc/rsk/node.conf. Its postinst re-asks the shared/config debconf question on every configure, then re-points node.conf at the selected network's shipped config. That debconf state is not reliably preserved across upgrades: after the plain 9.0.1 → 9.0.5 upgrade on 2026-11-28, the question fell back to the template default (mainnet), the newly added restart notification restarted the service, and the node began syncing mainnet from genesis into a fresh database while its real 156 GB testnet database sat idle. The cookbook only ever pinned the network with debconf-set-selections, and never managed node.conf or the config file itself.

Fix: stop relying on debconf. After the package is configured, the recipe templates our own /etc/rsk/kosmos-<network>.conf (including the RPC bind/CORS settings the openresty proxies need, which were previously only hand-edited on the node) and manages /etc/rsk/node.conf as a symlink to it, with the service restart ordered after that. A package upgrade can no longer mis-network the node.

Validation: the live node was recovered (wrong-network DB removed, repointed to testnet, resumed syncing normally) and converged twice — the second run is idempotent. The kosmos_rsk InSpec suite was run against the recovered node: 17/17 pass. The public rsk-testnet.kosmos.org API reports net_version 31 (testnet). Cookbook bumped to 0.6.1.

`rsk-testnet-6` was found syncing the **mainnet** chain and filling its disk. This PR fixes the underlying cookbook gap. **What happened:** the rskj package owns `/etc/rsk/node.conf`. Its `postinst` re-asks the `shared/config` debconf question on every configure, then re-points `node.conf` at the selected network's shipped config. That debconf state is not reliably preserved across upgrades: after the plain 9.0.1 → 9.0.5 upgrade on 2026-11-28, the question fell back to the template default (`mainnet`), the newly added restart notification restarted the service, and the node began syncing mainnet from genesis into a fresh database while its real 156 GB testnet database sat idle. The cookbook only ever pinned the network with `debconf-set-selections`, and never managed `node.conf` or the config file itself. **Fix:** stop relying on debconf. After the package is configured, the recipe templates our own `/etc/rsk/kosmos-<network>.conf` (including the RPC bind/CORS settings the openresty proxies need, which were previously only hand-edited on the node) and manages `/etc/rsk/node.conf` as a symlink to it, with the service restart ordered after that. A package upgrade can no longer mis-network the node. **Validation:** the live node was recovered (wrong-network DB removed, repointed to testnet, resumed syncing normally) and converged twice — the second run is idempotent. The `kosmos_rsk` InSpec suite was run against the recovered node: 17/17 pass. The public `rsk-testnet.kosmos.org` API reports `net_version` 31 (testnet). Cookbook bumped to 0.6.1.
raucao added 1 commit 2026-11-30 05:56:50 +00:00
The rskj package owns /etc/rsk/node.conf: its postinst re-asks the
`shared/config` debconf question on every configure and re-points node.conf at
the selected network's shipped config. That debconf state is not reliably
preserved across upgrades. After the plain 9.0.1 -> 9.0.5 upgrade, the question
fell back to the template default ("mainnet"), the service was restarted, and
rsk-testnet-6 started syncing the mainnet chain from genesis into a fresh
database while its real testnet data sat idle.

Stop relying on debconf: template our own node config (with the RPC bind/CORS
settings the openresty proxies need) and manage the node.conf symlink from Chef,
after the package has been configured. The restart then happens with the correct
config, and a package upgrade can no longer flip the network.

Bump the cookbook to 0.6.1 and extend the InSpec test to assert the managed
config and the symlink target.
raucao added the kredits-1ops labels 2026-11-30 05:59:58 +00:00
raucao merged commit a2a8748f20 into master 2026-11-30 06:00:10 +00:00
raucao deleted branch fix/rsk-manage-node-config 2026-11-30 06:00:10 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kosmos/chef#715