@microck/raft 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -10
- package/deploy/deploy.py +112 -19
- package/deploy/install-incus.sh +10 -0
- package/deploy/verify-controls.py +34 -48
- package/deploy/verify-features.py +350 -4
- package/deploy/verify-fresh-host.py +64 -1
- package/deploy/verify-limits.py +325 -71
- package/deploy/verify-live.py +38 -29
- package/deploy/verify-self-update.py +372 -0
- package/docs/boat-capabilities.md +8 -7
- package/docs/boot-performance.mdx +1 -1
- package/docs/contract.md +28 -17
- package/docs/guides/backup-recovery.mdx +1 -1
- package/docs/guides/config-policy.mdx +179 -0
- package/docs/guides/docker.mdx +9 -1
- package/docs/guides/long-running-services.mdx +2 -2
- package/docs/guides/meta.json +1 -0
- package/docs/guides/project-setup.mdx +4 -3
- package/docs/guides/scripting-ci.mdx +25 -10
- package/docs/guides/snapshots-forks.mdx +9 -3
- package/docs/guides/troubleshooting.mdx +18 -6
- package/docs/guides/upgrades.mdx +13 -3
- package/docs/index.mdx +1 -0
- package/docs/operations.mdx +16 -14
- package/docs/reference/capacity.mdx +198 -0
- package/docs/reference/cli.md +166 -29
- package/docs/reference/configuration.mdx +36 -2
- package/docs/reference/meta.json +1 -1
- package/docs/releases/0.4.0.md +15 -0
- package/docs/releases/0.5.0.md +19 -0
- package/docs/requirements.mdx +2 -2
- package/docs/verification.mdx +14 -8
- package/package.json +1 -1
- package/raft.py +1105 -125
- package/skills/raft-cli/SKILL.md +76 -12
- package/docs/reference/capacity-limits.mdx +0 -92
package/skills/raft-cli/SKILL.md
CHANGED
|
@@ -11,15 +11,40 @@ The current deployment does not implement Incus VMs. Do not describe these boxes
|
|
|
11
11
|
`raft host add` installs packages and services on a machine. Run it only when the
|
|
12
12
|
user explicitly asks to onboard that host, and show its `--dry-run` plan first.
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Do not run `raft self-update` unless the user asks; an update in the middle of a
|
|
15
|
+
task changes the CLI under it. Report a `raft X is available` stderr notice
|
|
16
|
+
instead of acting on it. For pinned or scripted runs, set
|
|
17
|
+
`RAFT_NO_UPDATE_CHECK=1` to suppress the notice.
|
|
18
|
+
|
|
19
|
+
Run `raft locations`, `raft config`, `raft doctor` and `raft list` before allocating.
|
|
20
|
+
`raft config` shows the defaults `new` will use on this controller and each
|
|
21
|
+
location's note policy: the box note fields its host requires.
|
|
15
22
|
Follow each location's `note`: the operator uses it to mark preferred hosts and
|
|
16
23
|
hosts to avoid for some work. Pass `--location` explicitly when a note rules out
|
|
17
24
|
the default. Do not change notes unless the user asks; `raft note LOCATION TEXT`
|
|
18
25
|
sets one and `raft note LOCATION --clear` removes it. Keep the exact
|
|
19
26
|
location-qualified handle returned by `new`. There is no implicit current box.
|
|
20
27
|
|
|
28
|
+
Note every box you create. Box notes follow one template so the next agent can
|
|
29
|
+
tell whether a box is in use:
|
|
30
|
+
|
|
31
|
+
- `--purpose`: what the box is for (required), e.g. `Integration tests for PR 42`
|
|
32
|
+
- `--owner`: who uses it, e.g. `codex session in ~/work/app`
|
|
33
|
+
- `--next`: what happens next, e.g. `Destroy after the tests pass`
|
|
34
|
+
|
|
35
|
+
Pass them to `new`, and run `raft note "$box" --purpose ...` when the plan
|
|
36
|
+
changes; each call replaces the whole note. If a command fails with
|
|
37
|
+
`requires --owner (host policy)` or similar, rerun it with the fields it names;
|
|
38
|
+
the error prints the corrected command. Never change or clear a policy with
|
|
39
|
+
`raft policy`, or the defaults with `raft config set/unset`, to get past an
|
|
40
|
+
error; only do so when the user asks. `fork` and `recover` accept the same note
|
|
41
|
+
flags, which replace the whole note on the copy. `raft list` shows every box's
|
|
42
|
+
`note`. Read it before you resume, stop, fork or destroy a box. Treat a box whose
|
|
43
|
+
note names another owner or a job unrelated to your task as not yours. Forks
|
|
44
|
+
keep the source note, so update a fork's note when its job differs.
|
|
45
|
+
|
|
21
46
|
```sh
|
|
22
|
-
box=$(raft new --location lab --ttl 600)
|
|
47
|
+
box=$(raft new --location lab --ttl 600 --purpose "Run the project tests" --owner "codex task 123" --next "Destroy when the tests finish")
|
|
23
48
|
raft exec "$box" -- timeout 240 bash -lc 'git clone <url> /workspace/project && cd /workspace/project && <test-command>'
|
|
24
49
|
raft download "$box" /workspace/project/report.json ./report.json
|
|
25
50
|
raft destroy "$box"
|
|
@@ -37,14 +62,45 @@ Exec passes literal arguments; use `bash -lc` for shell syntax. A failed command
|
|
|
37
62
|
retains its exit status. `raft ssh "$box"` opens a root terminal through native
|
|
38
63
|
Incus execution over verified host SSH. It does not expose a guest SSH port.
|
|
39
64
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
boxes
|
|
43
|
-
and
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
65
|
+
## Sizing boxes
|
|
66
|
+
|
|
67
|
+
Create the boxes your task needs, sized for the work. Raft has no box count
|
|
68
|
+
limit and no size budget. Decide what the task needs and why, then ask for it:
|
|
69
|
+
|
|
70
|
+
- `--cpu N`: any whole number of CPUs up to the host's count (default 1). Use
|
|
71
|
+
more for parallel builds and test suites.
|
|
72
|
+
- `--memory SIZE`: any whole GiB up to the host's RAM, e.g. `8GiB` or `32GiB`
|
|
73
|
+
(default `2GiB`). Use more for large compiles, browsers or databases.
|
|
74
|
+
- `--disk SIZE`: its own disk, e.g. `30GiB`, instead of the shared 60 GiB pool.
|
|
75
|
+
The box and Docker inside it cannot write past SIZE, and other boxes cannot
|
|
76
|
+
take its space. Use it for Docker builds, large datasets or anything that
|
|
77
|
+
could fill the shared pool. The image needs about 5 GiB, so use at least
|
|
78
|
+
`8GiB`; 10 GiB or more starts fastest. Only hosts deployed with
|
|
79
|
+
`--disk-pool` have own disks; elsewhere `--disk` fails and names the command
|
|
80
|
+
that enables them. Own disks, their snapshots, forks and templates are
|
|
81
|
+
copy-on-write, so copying one is fast, but each reserves its full size in
|
|
82
|
+
the pool.
|
|
83
|
+
|
|
84
|
+
```sh
|
|
85
|
+
box=$(raft new --cpu 4 --memory 16GiB --disk 20GiB --ttl 3600 --purpose "Build and test the monorepo" --owner "codex task 123" --next "Destroy when CI passes")
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Built-in defaults are the first configured location, one CPU, 2 GiB RAM, the
|
|
89
|
+
shared pool and 600 seconds; the operator can change them per controller, so
|
|
90
|
+
pass `--location`, `--ttl`, `--cpu`, `--memory` and `--disk` (`--disk shared`
|
|
91
|
+
for the shared pool) when the values matter. `new --from` and `fork` keep the
|
|
92
|
+
source's CPU, RAM and disk instead of any default; each flag overrides only its
|
|
93
|
+
own value. TTL accepts 60 seconds to 30
|
|
94
|
+
days. A request larger than the whole host fails with the host's real size;
|
|
95
|
+
retry with what it reports. If the own-disk pool has too little unreserved
|
|
96
|
+
space for `--disk`, a snapshot or a copy, destroy own-disk boxes or snapshots
|
|
97
|
+
the task no longer needs, or pick a smaller disk or the shared pool.
|
|
98
|
+
`raft list` shows each box's `disk` (`"shared"` or its size).
|
|
99
|
+
|
|
100
|
+
`raft capacity --location lab --json` is an advisory estimate of host CPU/RAM
|
|
101
|
+
headroom and free disk. It is advice, never a reason to skip creating a box or
|
|
102
|
+
to shrink one below what the task needs. Boxes share host CPUs; an estimate of
|
|
103
|
+
zero means new boxes may run slower, not that they are refused.
|
|
48
104
|
|
|
49
105
|
## Persistence and cleanup
|
|
50
106
|
|
|
@@ -78,6 +134,11 @@ only when the user requested that rollback. A fork copies filesystem data, inclu
|
|
|
78
134
|
credentials installed there. Forks stay on the same host. `new --from "$box/prepared"` starts from a named
|
|
79
135
|
snapshot; `snapshot-delete "$box" prepared` removes it. Resume and fork accept
|
|
80
136
|
optional `--cpu` and `--memory` overrides. Omitted values retain the source limits.
|
|
137
|
+
Forks and `new --from` keep the source's CPU, RAM and disk unless a flag
|
|
138
|
+
overrides them; `new --from "$box/prepared" --disk 60GiB` copies the snapshot onto
|
|
139
|
+
a bigger own disk when a box runs out of space. To spawn many agents from one
|
|
140
|
+
prepared own-disk snapshot, run `new --from` once per agent: each copy is a thin
|
|
141
|
+
snapshot created in seconds.
|
|
81
142
|
Forks default to persistent; use `--disposable` explicitly for temporary clones.
|
|
82
143
|
|
|
83
144
|
`upload/download --recursive` copy directory trees into new destinations without
|
|
@@ -92,7 +153,8 @@ status and output. `raft cancel "$box" <job>` stops the job and its child proces
|
|
|
92
153
|
terminates running jobs; this is not automatic checkpointing of processes.
|
|
93
154
|
`raft extend "$box" --ttl 1800` resets a running box's deadline without
|
|
94
155
|
restarting its work. Use resume for stopped boxes. `raft usage "$box"` reports
|
|
95
|
-
cgroup memory/CPU and
|
|
156
|
+
cgroup memory/CPU and disk space; `filesystemScope` says whether that is the
|
|
157
|
+
shared pool or the box's own disk.
|
|
96
158
|
|
|
97
159
|
`raft forward "$box" --remote 8080 --local 8080` opens a foreground private
|
|
98
160
|
tunnel. `raft desktop "$box" --local 6080` starts the desktop on demand and
|
|
@@ -116,7 +178,9 @@ raft resume "$recovered" --ttl 600
|
|
|
116
178
|
```
|
|
117
179
|
|
|
118
180
|
Recovery creates a fresh stopped handle and clears the inherited deadline. It
|
|
119
|
-
never overwrites another box.
|
|
181
|
+
never overwrites another box. A box with its own disk comes back on an own disk
|
|
182
|
+
of the same size, so the destination needs own box disks enabled and room for the
|
|
183
|
+
box and each of its snapshots. Only import trusted Raft exports; archives retain
|
|
120
184
|
native configuration and guest secrets. Store them privately and check free
|
|
121
185
|
space on the controller and destination host. Large backups hold the host
|
|
122
186
|
lifecycle lock and delay expiry checks. A controller crash can leave an owned
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Capacity limits and planning
|
|
3
|
-
description: Host resource reserves, sizing profiles, advisory calculations, and admission limits.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Capacity limits and planning
|
|
7
|
-
|
|
8
|
-
Raft provides capacity inspection and allocation policies designed to keep dedicated hosts stable while running concurrent workspaces.
|
|
9
|
-
|
|
10
|
-
## Inspecting capacity with `raft limits`
|
|
11
|
-
|
|
12
|
-
Run `raft limits` to view host resources and workspace allocation calculations:
|
|
13
|
-
|
|
14
|
-
```sh title="CONTROLLER: View host capacity report"
|
|
15
|
-
raft limits
|
|
16
|
-
|
|
17
|
-
# Output JSON for programmatic inspection
|
|
18
|
-
raft limits --location lab --json
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
The output displays host CPU count, total RAM, configured limits, available RAM, disk headroom, and advisory recommendations across all eight sizing profiles:
|
|
22
|
-
|
|
23
|
-
### Illustrative host sizing
|
|
24
|
-
|
|
25
|
-
Illustrative totals for 1 CPU / 2 GiB boxes on an empty host, using exact usable RAM values:
|
|
26
|
-
|
|
27
|
-
| Host CPUs | Host RAM | Recommended running | Enforced saved maximum |
|
|
28
|
-
| ---: | ---: | ---: | ---: |
|
|
29
|
-
| 2 | 8 GiB | 1 | 4 |
|
|
30
|
-
| 4 | 8 GiB | 3 | 4 |
|
|
31
|
-
| 4 | 16 GiB | 3 | 4 |
|
|
32
|
-
| 8 | 32 GiB | 4 | 4 |
|
|
33
|
-
|
|
34
|
-
Operating systems report less usable RAM than advertised hardware size. Near sizing boundaries, `raft limits` may calculate fewer recommended boxes. Available RAM and host processes can further reduce running capacity. These values are point-in-time advisory estimates, not hardware reservations.
|
|
35
|
-
|
|
36
|
-
### Column definitions and algorithms
|
|
37
|
-
|
|
38
|
-
| Column | Calculation |
|
|
39
|
-
| --- | --- |
|
|
40
|
-
| Total running | `min(4, floor(CPU budget / box CPU), floor(Memory budget / box memory))` |
|
|
41
|
-
| More running | Bounded by remaining CPU, memory, available RAM, and active slots |
|
|
42
|
-
| New boxes | `min(more running, max(0, 4 - saved boxes))` |
|
|
43
|
-
|
|
44
|
-
**Total running** assumes an empty host. **More running** accounts for current allocations, `MemAvailable - Memory reserve`, and `4 - active boxes`. Active limits are not subtracted twice.
|
|
45
|
-
|
|
46
|
-
## Sizing profiles
|
|
47
|
-
|
|
48
|
-
Select CPU and memory limits when launching with `raft new`:
|
|
49
|
-
|
|
50
|
-
- `--cpu`: `1` or `2` shared vCPUs managed by Incus (default: `1`).
|
|
51
|
-
- `--memory`: `1GiB`, `2GiB`, `4GiB`, or `8GiB` cgroup limit (default: `2GiB`). An 8 GiB box needs at least 10 GiB of usable host RAM before `raft limits` recommends running one; like other recommendations, this is advisory and not enforced.
|
|
52
|
-
|
|
53
|
-
Change supported CPU/RAM limits when resuming a stopped box or creating a fork:
|
|
54
|
-
|
|
55
|
-
```sh
|
|
56
|
-
raft resume "$box" --ttl 1800 --cpu 2 --memory 4GiB
|
|
57
|
-
copy=$(raft fork "$box" --ttl 1800 --memory 2GiB)
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Resume requires a stopped box; fork requires a stopped source. Omitted limits
|
|
61
|
-
stay unchanged on resume and inherit the source limits on fork. Live resizing is
|
|
62
|
-
not exposed by the CLI. See [Snapshots and forks](../guides/snapshots-forks.mdx).
|
|
63
|
-
|
|
64
|
-
## Host resource reserves and active states
|
|
65
|
-
|
|
66
|
-
Raft calculates advisory host safety margins:
|
|
67
|
-
- **CPU reserve**: 1 CPU core reserved for the host OS.
|
|
68
|
-
- **Memory reserve**: The larger of `2 GiB` or `10%` of host RAM.
|
|
69
|
-
|
|
70
|
-
These reserves are advisory estimates for planning, not hard cgroup locks.
|
|
71
|
-
|
|
72
|
-
All non-`Stopped` states (such as `Running` or `Frozen`) count as active allocations. Stopped containers release CPU and RAM allocations while retaining their saved slot and disk storage.
|
|
73
|
-
|
|
74
|
-
## Enforced admission limits
|
|
75
|
-
|
|
76
|
-
<Callout type="warn" title="Hard limit: four saved boxes per location">
|
|
77
|
-
Raft enforces a hard limit of four saved boxes per location. Both running and stopped containers occupy storage and count against this limit.
|
|
78
|
-
</Callout>
|
|
79
|
-
|
|
80
|
-
Exceeding four saved boxes fails with an admission error:
|
|
81
|
-
```text
|
|
82
|
-
Location already holds four boxes
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
Destroy unused containers with `raft destroy <box>` to free slots. Advisory CPU and memory calculations do not block container creation or resumption.
|
|
86
|
-
|
|
87
|
-
## Storage capacity
|
|
88
|
-
|
|
89
|
-
Every Raft host provisions a dedicated 60 GiB Btrfs pool (`raft-data`):
|
|
90
|
-
- **Shared pool**: All containers, snapshots, and Docker layers share this 60 GiB pool.
|
|
91
|
-
- **No strict per-box quotas**: Nested subvolumes prevent strict per-box quota enforcement.
|
|
92
|
-
- **Disk warnings**: `raft limits` warns when free space on host disk or `raft-data` falls below 5 GiB. Warnings are diagnostic and do not block operations. `raft doctor` reports storage usage without emitting 5 GiB warnings.
|