@r5n/hydra 0.12.0 → 1.0.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 CHANGED
@@ -6,50 +6,77 @@
6
6
 
7
7
  **One machine. Many runners.**
8
8
 
9
- Create and manage local self-hosted GitHub Actions runners for a repository or organisation. Hydra downloads each runner version once, shares its binaries across the fleet and registers runners through your authenticated `gh` CLI.
9
+ Run self-hosted GitHub Actions runners on your own machine, each job in a fresh guest that Hydra creates for it and destroys afterwards. Pools take their demand from GitHub's runner scale sets, as Actions Runner Controller does, mint a just-in-time runner for every job and keep no guest waiting idle. A host daemon admits each guest against the host's memory, CPU and disk, and leaves the jobs that do not fit in GitHub's queue.
10
10
 
11
- [![npm version](https://img.shields.io/npm/v/@r5n/hydra.svg)](https://www.npmjs.com/package/@r5n/hydra) [![License](https://img.shields.io/npm/l/@r5n/hydra.svg)](./LICENSE)
12
-
13
- Each working directory has its own fleet, with profiles and runner state in `.hydra/`.
11
+ Hydra's 0.x profiles, persistent runners that share one host user, are deprecated. They still work beside pools under `hydra legacy`, and [migrating from profiles](https://github.com/r5n-labs/clis/blob/develop/packages/hydra/docs/migrating.md) moves a fleet over without cutting off a job.
14
12
 
15
- ## Quick start
13
+ [![npm version](https://img.shields.io/npm/v/@r5n/hydra.svg)](https://www.npmjs.com/package/@r5n/hydra) [![License](https://img.shields.io/npm/l/@r5n/hydra.svg)](./LICENSE)
16
14
 
17
15
  ```sh
18
16
  bun add -g @r5n/hydra
19
- mkdir ~/runners
20
- cd ~/runners
21
- hydra init https://github.com/owner/repo -c 2
22
- hydra create
23
- hydra start
24
- hydra status
25
17
  ```
26
18
 
27
- `hydra -i` opens the interactive menu. Bare `hydra` prints help; `hydra <command> --help` shows that command's options.
19
+ Hydra keeps its configuration, ledger and runner state in one home, `~/.hydra` by default, whichever directory you run it from. Set `HYDRA_HOME` or pass `--home <absolute path>` to use another one. `hydra -i` opens the interactive menu. Bare `hydra` prints help; `hydra <command> --help` shows that command's options.
20
+
21
+ ## Pools
22
+
23
+ A pool is a label set and a runner group that Hydra serves with one guest per job:
28
24
 
29
- ## Everyday commands
25
+ - **Drivers** create the guests: `apple-container` runs each Linux job in its own Apple container VM, and `tart` each macOS job in its own Tart VM, at most two per host. Neither shares host files with a guest, and both keep guests off the host and its networks with a host-side filter.
26
+ - **Demand** comes from a runner scale set, so GitHub assigns jobs and a pool scales from zero to its ceiling, or from polling queued jobs, for pools whose fixed slots share capacity by priority, such as macOS VMs.
27
+ - **Admission** is the host daemon's: every guest needs a lease, granted from a root-owned budget and the host's live state, in priority order with a fair share between fleets.
28
+ - **Isolation** keeps jobs apart from each other and from the host: the runner's configuration travels on standard input only, every guest is verified gone after its job, and a guard drains a pool when its runner group or organisation policy changes.
29
+
30
+ [How pools work](https://github.com/r5n-labs/clis/blob/develop/packages/hydra/docs/pools.md) explains each part, what each driver guarantees and what the model does not cover. [Migrating from profiles](https://github.com/r5n-labs/clis/blob/develop/packages/hydra/docs/migrating.md) walks through setting up a host, step by step; on a host without a 0.x fleet, skip its first and last steps.
30
31
 
31
32
  | Task | Command |
32
33
  | --- | --- |
33
- | Configure a repository or organisation | `hydra init [url]` |
34
- | Create runners up to the target count | `hydra create [profile] [count]` |
35
- | Start or stop runners | `hydra start [profile] [ids...]` / `hydra stop [profile] [ids...]` |
36
- | Inspect local runner state | `hydra status` |
37
- | Tail the latest job log | `hydra logs [id]` |
38
- | Check DNS and each runner's job hooks | `hydra doctor` |
39
- | Preview disk cleanup | `hydra cleanup --dry-run` |
40
- | Update runner binaries and job hooks | `hydra update` |
41
- | Deregister and remove runners | `hydra remove [profile] [ids...]` |
42
- | Manage fleet profiles | `hydra profile` |
43
-
44
- Runners are background processes; start them again after a reboot. Cleanup preserves job workspaces by default, and automatic runner updates are disabled in favour of `hydra update`. Every job first waits for DNS to resolve the GitHub hosts, so a brief resolver outage delays the job instead of failing its checkout. New profiles also remove each job's workspace when it finishes; runners still share one user, so keep them to private repositories you trust.
34
+ | Show slot drivers and check this host for them | `hydra driver list` / `hydra driver check [driver]` |
35
+ | Print pools for this home's profiles | `hydra migrate --dry-run` |
36
+ | Add, change or remove a pool and its scale set | `hydra pool add <pool>` / `hydra pool set <pool>` / `hydra pool remove <pool>` |
37
+ | Build the pinned Linux runner image for container drivers | `hydra image build linux [--docker]` |
38
+ | Build and promote a Tart golden for macOS VM slots | `hydra image build macos --base <image@sha256:digest>` / `hydra image promote <golden>` |
39
+ | Record the pools' runner groups and fork pull request policy, or compare them with the record | `hydra guard record` / `hydra guard check` |
40
+ | Run the pools: a fresh guest for each job, destroyed after it | `hydra serve` |
41
+ | List, or remove, the runner images and slot logs Hydra no longer needs | `hydra prune [--yes]` |
42
+ | Send alerts to Discord or a fixed command, and test them | `hydra alerts set discord \| command` / `hydra alerts test [--burst <n>]` |
43
+ | Run the host daemon that admits guests, or ask it for leases and offers | `hydra host serve` / `hydra host status` |
44
+ | Print or check the host budget | `hydra host-budget print` / `hydra host-budget check` |
45
+ | Print the pf anchor for container guests, or verify the loaded one | `hydra net print` / `hydra net verify` |
46
+ | Print the pinned host toolchain and its root install script, or verify the installed one | `hydra toolchain print [--script]` / `hydra toolchain verify` |
47
+ | Print the LaunchDaemons for the host daemon and this fleet | `hydra service print [--host] [--script]` |
48
+ | Check the home, credentials, alert sinks, host toolchain, DNS and each runner's job hooks | `hydra doctor` |
49
+
50
+ ## Profiles (deprecated)
51
+
52
+ Profiles are Hydra's 0.x model: persistent runners for a repository or organisation that share one host user. Hydra downloads each runner version once, shares its binaries across the fleet and registers runners through the GitHub API.
53
+
54
+ Hydra 1.0 keeps the profile commands under `hydra legacy`, and each warns that profiles are deprecated when it runs: `hydra start` is now `hydra legacy start`, and so on. `hydra stop` is now `hydra legacy halt`, because `hydra legacy stop` is the retirement step that stops only drained runners once they are idle. The old names exit with code 1 and name the new ones.
45
55
 
46
- See the [command and configuration reference](https://github.com/r5n-labs/clis/blob/develop/packages/hydra/docs/reference.md) for flags, profiles, cleanup policy and storage details.
56
+ | Task | Command |
57
+ | --- | --- |
58
+ | Configure a repository or organisation | `hydra legacy init [url]` |
59
+ | Create runners up to the target count | `hydra legacy create [profile] [count]` |
60
+ | Start or stop runners | `hydra legacy start [profile] [ids...]` / `hydra legacy halt [profile] [ids...]` |
61
+ | Inspect runner state, here and on GitHub | `hydra legacy status [--github]` |
62
+ | Delete stale GitHub registrations of removed runners | `hydra legacy reconcile --dry-run` / `hydra legacy reconcile --yes` |
63
+ | Tail the latest job log | `hydra legacy logs [id]` |
64
+ | Preview disk cleanup | `hydra legacy cleanup --dry-run` |
65
+ | Update runner binaries and job hooks | `hydra legacy update` |
66
+ | Deregister and remove runners | `hydra legacy remove [profile] [ids...]` |
67
+ | Manage fleet profiles | `hydra legacy profile` |
68
+ | Retire a 0.x fleet without cutting off a job | `hydra legacy inventory \| drain \| stop \| deregister \| wipe` |
69
+
70
+ Runners are background processes; start them again after a reboot. Cleanup preserves job workspaces by default, and automatic runner updates are disabled in favour of `hydra legacy update`. Every job first waits for DNS to resolve the GitHub hosts, so a brief resolver outage delays the job instead of failing its checkout. New profiles also remove each job's workspace when it finishes; runners still share one user, so keep them to private repositories you trust.
71
+
72
+ See the [command and configuration reference](https://github.com/r5n-labs/clis/blob/develop/packages/hydra/docs/reference.md) for flags, profiles, pools, cleanup policy and storage details. Hydra 0.12 and earlier kept state in `.hydra` of the working directory; [upgrading](https://github.com/r5n-labs/clis/blob/develop/packages/hydra/docs/reference.md#upgrading-from-012-or-earlier) shows how to keep using such a fleet.
47
73
 
48
74
  ## Requirements
49
75
 
50
- - Bun, `bash`, `curl` and `tar`.
51
- - Authenticated `gh` (`gh auth login`). Repository runners require repository admin access; organisation runners require the `admin:org` scope. Hydra obtains registration and removal tokens through `gh api` without storing them.
52
- - macOS on Apple Silicon or Linux on x64. Windows is not supported: registration and startup use the runner's Bash scripts.
76
+ - Bun.
77
+ - An authenticated `gh` (`gh auth login`), or a GitHub App configured as [credentials](https://github.com/r5n-labs/clis/blob/develop/packages/hydra/docs/reference.md#github-credentials). Repository runners require repository admin access; organisation runners and scale sets require the `admin:org` scope, or the App's Self-hosted runners permission. Hydra mints tokens in memory and never puts one on a command line: a profile's runner gets its token in `config.sh`'s environment, and a pool's guest gets its just-in-time configuration on standard input.
78
+ - Pools: a macOS host on Apple silicon, macOS 26 or later for Linux guests and macOS 13 or later for macOS guests; root once, to install the [host toolchain](https://github.com/r5n-labs/clis/blob/develop/packages/hydra/docs/reference.md#host-toolchain), the host budget and the services.
79
+ - Profiles: `bash`, `curl` and `tar`, on macOS on Apple Silicon or Linux on x64. Windows is not supported: registration and startup use the runner's Bash scripts.
53
80
 
54
81
  ## Licence
55
82
 
@@ -0,0 +1,30 @@
1
+ # Third-party notices
2
+
3
+ ## actions/scaleset v0.5.0
4
+
5
+ https://github.com/actions/scaleset
6
+
7
+ Hydra's runner scale set client (`src/github/scaleset`) is a TypeScript port of the calls and listener contract of
8
+ this Go client at the tag above.
9
+
10
+ MIT License
11
+
12
+ Copyright GitHub, Inc.
13
+
14
+ Permission is hereby granted, free of charge, to any person obtaining a copy
15
+ of this software and associated documentation files (the "Software"), to deal
16
+ in the Software without restriction, including without limitation the rights
17
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
+ copies of the Software, and to permit persons to whom the Software is
19
+ furnished to do so, subject to the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be included in all
22
+ copies or substantial portions of the Software.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
+ SOFTWARE.