| index b71b3a319..1c03d91c5 100644 |
| --- a/docs/region-ha-runbook.md |
| +++ b/docs/region-ha-runbook.md |
| @@ -55,7 +55,7 @@ With neither provider nor token configured, `%s` is `CARLOS_DNSIMPLE_TOKEN missi |
| |
| ## Replacing, resizing or removing a group member |
| |
| -The roll tool (`scripts/region-group-roll.py`) changes one group member at a time. Before it rolls, replaces or removes a member, it drains it: each awake host moves to another member, and requests for that host wait a few seconds instead of failing. A member that dies without warning is different. Its hosts still answer 503 with `Retry-After: 10` until their leases expire. |
| +`carlos system group` changes one group member at a time. Before it rolls, replaces or removes a member, it drains it: each awake host moves to another member, and requests for that host wait a few seconds instead of failing. A member that dies without warning is different. Its hosts still answer 503 with `Retry-After: 10` until their leases expire. |
| |
| ### Before you start |
| |
| @@ -71,17 +71,64 @@ Add three keys to the tool's JSON config: |
| |
| The operator's credentials need the grants in the region-host module's `group_operator_policy_json` output, and the region's session document must be at the release that adds the drain commands. |
| |
| +### Setting up the operator account |
| + |
| +Run `carlos system group` from the deployment's operator account on the operator machine named in the card. Never run it as root or on a box. |
| + |
| +Do this once on that account: |
| + |
| +1. Install the Session Manager plugin, version 1.2.497.1 or later, on the account's PATH. |
| +2. Create the state directory and make it private: |
| + |
| + ```sh |
| + mkdir -p ~/.local/state/carlos/group |
| + chmod 700 ~/.local/state/carlos/group |
| + ``` |
| + |
| + If `XDG_STATE_HOME` is set, use `$XDG_STATE_HOME/carlos/group` instead. The tool refuses to start if this directory is missing, is not owned by the account, or is not mode 700. Its ancestors must not be group- or world-writable. They must be owned by root or the operator account. |
| +3. Put the group's JSON config where the account can read it. Pass its path with `--config`. |
| + |
| +The tool keeps one directory per group inside the state directory. Its name is the first 32 hex characters of the SHA-256 of the group ARN. The first run creates it. |
| + |
| +### Recording the provider observation |
| + |
| +The tool refuses to change a group until that group's directory holds `provider-observation.json`. Run the probe on one member first: |
| + |
| +```sh |
| +carlos system group probe start --config dev-ie.json --member i-0123456789abcdef0 |
| +``` |
| + |
| +When the probe passes, it prints the observation record. The controller reviews the probe's result and places the record as `provider-observation.json` in the group's directory, owned by the operator account and mode 600. The group directory is `<state_dir>/<hash>` from above. |
| + |
| +### Switching a group from the script |
| + |
| +Each group switches from `region-group-roll.py` to `carlos system group` once and never goes back. The two tools do not share state, so this step makes sure the script left nothing open. Do it on the operator host as root while holding the script's group lock: |
| + |
| +1. Find the group's script directory: `<state_dir>/<hash>`, where `state_dir` comes from the script's config and `<hash>` is the first 32 hex characters of the SHA-256 of the group ARN. |
| +2. Take the lock and open a shell that holds it: |
| + |
| + ```sh |
| + flock <state_dir>/<hash>/group.lock sh |
| + ``` |
| + |
| + Do the next steps in that shell. |
| +3. Check that `active.json` and `provider-divergence.json` are both absent from that directory. If either is present, stop and tell the controller. |
| +4. Rename the directory to `<hash>.retired-<date>`, for example `<hash>.retired-2026-11-12`. |
| +5. Delete the group's JSON config file that the script was run with (the card names it) from the operator host so the script cannot run on this group again. |
| + |
| +Exit the shell. Only then run `carlos system group` on that group as the operator account. |
| + |
| ### Running a change |
| |
| -Run one of these as root on the operator host, for one member at a time: |
| +Run one of these from the operator account, for one member at a time: |
| |
| ```sh |
| -region-group-roll.py --config dev-ie.json roll --member i-0123456789abcdef0 --to-sha256 <artifact sha256> |
| -region-group-roll.py --config dev-ie.json replace --member i-0123456789abcdef0 |
| -region-group-roll.py --config dev-ie.json remove --member i-0123456789abcdef0 |
| +carlos system group roll --config dev-ie.json --member i-0123456789abcdef0 --to-sha256 <artifact sha256> |
| +carlos system group replace --config dev-ie.json --member i-0123456789abcdef0 |
| +carlos system group remove --config dev-ie.json --member i-0123456789abcdef0 |
| ``` |
| |
| -These commands change when the Go roll verb ships. |
| +For a roll, run `plan` first with the same `--config`, `--member` and `--to-sha256` values. It lists refusals without changing anything. If a command stops, it keeps the transaction. Read it with `status --config <file> --transaction <id>`, then continue it with `resume --config <file> --transaction <id>`. The full list of commands is in [the CLI reference](site/cli.md#carlos-system-group-maintain-one-group-member). |
| |
| Each one lowers the group's minimum, puts the member in Standby, drains it, checks that no lock still names it, then acts: `roll` installs the new release and returns the member, `replace` terminates it and lets the group launch a new one, and `remove` terminates it for good. At the end the tool prints one line of JSON with what moved. |
| |