bsdkrun 0.2.0 → 0.3.1
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.
- checksums.yaml +4 -4
- data/README.md +7 -4
- data/lib/bsdkrun/args.rb +20 -0
- data/lib/bsdkrun/client.rb +24 -3
- data/lib/bsdkrun/sandbox.rb +1 -1
- data/lib/bsdkrun/version.rb +1 -1
- data/lib/bsdkrun.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fe9ff0a423b1c2c2a7e2c61517396210b49e375dcb476f0fa33ab256e2d4a615
|
|
4
|
+
data.tar.gz: cb19ed673cc77aeca248eda87d51cba7d8952f3be4396a797d625e6a1e644b8f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: da14cb176e1f9aacb27c7689d267a7f551f3aa94dd261fb4a5b4d0c1935c8e07c76bf9f6e9bf52600642a96f76bb8664e3e932a29105f22bf9dca15ca3b8bdd7
|
|
7
|
+
data.tar.gz: 7ae4a5af1c196da907d593aa20f7a4db241250186ab7609e5494e8328876bf1e47383472421da12ea8c4c9dda90e9687a8bb76ff202798beb56989bc7690d65e
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# bsdkrun (Ruby SDK)
|
|
2
2
|
|
|
3
|
-
A Ruby SDK for [**bsdkrun**](https://github.com/tsirysndr/bsdkrun) — a Firecracker-style microVM launcher for **BSD and
|
|
3
|
+
A Ruby SDK for [**bsdkrun**](https://github.com/tsirysndr/bsdkrun) — a Firecracker-style microVM launcher for **BSD, Linux, and unikernel** guests on macOS and
|
|
4
4
|
Linux, built on [libkrun](https://github.com/containers/libkrun). Boot and drive microVMs programmatically, inspired by the **Vercel** and **Deno** Sandbox SDKs.
|
|
5
5
|
|
|
6
6
|
The SDK shells out to the `bsdkrun` binary, so it has **zero runtime
|
|
@@ -213,10 +213,13 @@ client.stop(id)
|
|
|
213
213
|
client.remove([id])
|
|
214
214
|
```
|
|
215
215
|
|
|
216
|
-
`client.run_linux`/`run_bsd`/`run_nanos`/`run_unikraft`/`run_osv
|
|
217
|
-
each take the same options as the corresponding GraphQL mutation
|
|
216
|
+
`client.run_linux`/`run_bsd`/`run_nanos`/`run_unikraft`/`run_solo5`/`run_osv`/
|
|
217
|
+
`run_flavor` each take the same options as the corresponding GraphQL mutation
|
|
218
218
|
(`daemon/src/graphql.rs`) — `run_bsd(os: "freebsd", ...)`, etc. — and return
|
|
219
|
-
the new machine's id. `
|
|
219
|
+
the new machine's id. `run_solo5` boots a MirageOS unikernel under the
|
|
220
|
+
`solo5-hvt` tender rather than libkrun:
|
|
221
|
+
`run_solo5(path: "dist/hello.hvt", args: ["--ipv4=10.0.0.2/24"])`.
|
|
222
|
+
`stop`/`start`/`remove`/`update`/`commit` return a
|
|
220
223
|
`CommandResult` (`exit_code`, `stdout`, `stderr`).
|
|
221
224
|
|
|
222
225
|
For a live terminal instead of a one-shot `exec`, use `shell`:
|
data/lib/bsdkrun/args.rb
CHANGED
|
@@ -66,6 +66,7 @@ module Bsdkrun
|
|
|
66
66
|
when "firmware" then firmware_args(opts)
|
|
67
67
|
when "kernel" then kernel_args(opts)
|
|
68
68
|
when "unikraft" then unikraft_args(opts)
|
|
69
|
+
when "solo5" then solo5_args(opts)
|
|
69
70
|
when "nanos" then nanos_args(opts)
|
|
70
71
|
when "osv" then osv_args(opts)
|
|
71
72
|
else raise ArgumentError, "unknown os: #{opts[:os].inspect}"
|
|
@@ -167,5 +168,24 @@ module Bsdkrun
|
|
|
167
168
|
a.concat(net_args(opts[:net])).concat(name_args(opts)).concat(vm_args(opts))
|
|
168
169
|
a.push((opts[:path] || ".").to_s)
|
|
169
170
|
end
|
|
171
|
+
|
|
172
|
+
# @!visibility private
|
|
173
|
+
#
|
|
174
|
+
# Solo5 (MirageOS): runs under the +solo5-hvt+ tender rather than libkrun.
|
|
175
|
+
# The unikernel declares its devices in its own MFT1 manifest, so only the
|
|
176
|
+
# +:block+ backing files (+NAME=FILE+) are passed. +:path+ is a +.hvt+
|
|
177
|
+
# binary or a project dir whose +dist/+ holds one; default +.+. Guest
|
|
178
|
+
# +:args+ go last, after a literal +--+ — MirageOS options look like
|
|
179
|
+
# bsdkrun's own (e.g. +--ipv4=...+), so the CLI takes them as trailing
|
|
180
|
+
# args.
|
|
181
|
+
def solo5_args(opts)
|
|
182
|
+
a = ["solo5", "-d"]
|
|
183
|
+
Array(opts[:block]).each { |b| a.push("--block", b) }
|
|
184
|
+
a.concat(net_args(opts[:net])).concat(name_args(opts)).concat(vm_args(opts))
|
|
185
|
+
a.push((opts[:path] || ".").to_s)
|
|
186
|
+
args = Array(opts[:args])
|
|
187
|
+
a.push("--", *args) unless args.empty?
|
|
188
|
+
a
|
|
189
|
+
end
|
|
170
190
|
end
|
|
171
191
|
end
|
data/lib/bsdkrun/client.rb
CHANGED
|
@@ -274,10 +274,11 @@ module Bsdkrun
|
|
|
274
274
|
|
|
275
275
|
# ---- booting ------------------------------------------------------------
|
|
276
276
|
#
|
|
277
|
-
#
|
|
277
|
+
# Seven variants, one per daemon mutation — see +daemon/src/graphql.rs+ for
|
|
278
278
|
# the exact input field names this transcribes (RunLinuxInput ~L384,
|
|
279
|
-
# RunBsdInput ~L406, RunNanosInput ~
|
|
280
|
-
#
|
|
279
|
+
# RunBsdInput ~L406, RunNanosInput ~L429, RunUnikraftInput ~L445,
|
|
280
|
+
# RunSolo5Input ~L465, RunOsvInput ~L498, RunFlavorInput ~L541,
|
|
281
|
+
# NetInput ~L360). Each accepts
|
|
281
282
|
# an options Hash and/or keyword arguments, merged — the same convention
|
|
282
283
|
# {Sandbox.create} uses — with snake_case Ruby keys mapped 1:1 to the
|
|
283
284
|
# camelCase GraphQL fields on the wire.
|
|
@@ -359,6 +360,26 @@ module Bsdkrun
|
|
|
359
360
|
request("mutation($i:RunUnikraftInput!){ runUnikraft(input:$i) }", { i: input })["runUnikraft"]
|
|
360
361
|
end
|
|
361
362
|
|
|
363
|
+
# Solo5 (MirageOS): runs under the +solo5-hvt+ tender rather than libkrun.
|
|
364
|
+
# The unikernel declares its own network and block devices in its +MFT1+
|
|
365
|
+
# manifest note, so only what the host alone can know is asked for —
|
|
366
|
+
# +block:+ backing files (+NAME=FILE+) and the unikernel's own +args:+
|
|
367
|
+
# (e.g. "--ipv4=10.0.0.2/24"). Like Unikraft, no disk and no agent, so no
|
|
368
|
+
# volume/persist/repo/command fields.
|
|
369
|
+
# @return [String] the new machine's id.
|
|
370
|
+
def run_solo5(opts = {}, **kwargs)
|
|
371
|
+
o = merge_opts(opts, kwargs)
|
|
372
|
+
input = {
|
|
373
|
+
path: o[:path],
|
|
374
|
+
cpus: o[:cpus],
|
|
375
|
+
mem: o[:mem],
|
|
376
|
+
net: net_input(o[:net]),
|
|
377
|
+
block: o[:block] || [],
|
|
378
|
+
args: o[:args] || []
|
|
379
|
+
}
|
|
380
|
+
request("mutation($i:RunSolo5Input!){ runSolo5(input:$i) }", { i: input })["runSolo5"]
|
|
381
|
+
end
|
|
382
|
+
|
|
362
383
|
# Like Nanos, no agent, but it does have a root filesystem, so the disk
|
|
363
384
|
# options apply — +disk:+ in particular, how an x86_64 guest gets a
|
|
364
385
|
# filesystem (its loader ELF is kernel only).
|
data/lib/bsdkrun/sandbox.rb
CHANGED
|
@@ -69,7 +69,7 @@ module Bsdkrun
|
|
|
69
69
|
# @return [Sandbox]
|
|
70
70
|
# @raise [SandboxNotFound]
|
|
71
71
|
def get(id)
|
|
72
|
-
row = list(all: true).find { |m| m.id == id || m.id.start_with?(id) }
|
|
72
|
+
row = list(all: true).find { |m| m.id == id || m.id.start_with?(id) || m.name == id }
|
|
73
73
|
raise SandboxNotFound, id unless row
|
|
74
74
|
|
|
75
75
|
new(row.id)
|
data/lib/bsdkrun/version.rb
CHANGED
data/lib/bsdkrun.rb
CHANGED
|
@@ -17,7 +17,7 @@ require_relative "bsdkrun/shell_session"
|
|
|
17
17
|
require_relative "bsdkrun/client"
|
|
18
18
|
|
|
19
19
|
# bsdkrun — a Ruby SDK for {https://github.com/tsirysndr/bsdkrun bsdkrun}, a
|
|
20
|
-
# Firecracker-style microVM launcher for BSD and
|
|
20
|
+
# Firecracker-style microVM launcher for BSD, Linux, and unikernel guests. A thin wrapper
|
|
21
21
|
# around the +bsdkrun+ CLI: it builds argv, shells out, and parses JSON output.
|
|
22
22
|
#
|
|
23
23
|
# @example
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bsdkrun
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tsiry Sandratraina
|
|
@@ -39,10 +39,10 @@ dependencies:
|
|
|
39
39
|
version: '13.0'
|
|
40
40
|
description: |
|
|
41
41
|
A thin, dependency-free Ruby wrapper around the `bsdkrun` CLI. Boot and drive
|
|
42
|
-
BSD/Linux microVMs programmatically: create sandboxes, exec commands, manage
|
|
42
|
+
BSD/Linux/unikernel microVMs programmatically: create sandboxes, exec commands, manage
|
|
43
43
|
lifecycle, and wire up global networks, volumes and images.
|
|
44
44
|
email:
|
|
45
|
-
- tsiry.sndr@
|
|
45
|
+
- tsiry.sndr@rocksky.app
|
|
46
46
|
executables: []
|
|
47
47
|
extensions: []
|
|
48
48
|
extra_rdoc_files: []
|
|
@@ -87,6 +87,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
87
87
|
requirements: []
|
|
88
88
|
rubygems_version: 4.0.10
|
|
89
89
|
specification_version: 4
|
|
90
|
-
summary: Ruby SDK for bsdkrun — a Firecracker-style microVM launcher for BSD
|
|
91
|
-
guests.
|
|
90
|
+
summary: Ruby SDK for bsdkrun — a Firecracker-style microVM launcher for BSD, Linux,
|
|
91
|
+
and unikernel guests.
|
|
92
92
|
test_files: []
|