zygo-sdk 0.1.4 → 0.1.6
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 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,6 +7,29 @@ namespaces, cgroups and seccomp, and answers in about a millisecond.
|
|
|
7
7
|
This package is the Node side of that: register a script once, then call it
|
|
8
8
|
with JSON in and JSON out.
|
|
9
9
|
|
|
10
|
+
## Before you start
|
|
11
|
+
|
|
12
|
+
This package is a client. The sandboxes are run by `zygo`, one static binary
|
|
13
|
+
for Linux; on macOS it runs everything in a Linux VM it manages, and the API
|
|
14
|
+
it starts there answers on the Mac at the same address. Install it as
|
|
15
|
+
[the project's README](https://github.com/mhmtskrc2/zygo#install) shows, then:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
zygo doctor # can this host run sandboxes?
|
|
19
|
+
zygo pull node:22-slim # the API never pulls an image itself
|
|
20
|
+
export ZYGO_API_TOKEN=$(openssl rand -hex 16) # `zygo api` will not start without one
|
|
21
|
+
zygo api --allow-deploy # 127.0.0.1:7700; leave it running
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
`--allow-deploy` lets a client start functions and one-shot sandboxes.
|
|
25
|
+
The first example calls a function named `resize` that a `sandbox.toml`
|
|
26
|
+
declares and `zygo up` starts; [chapter 11 of the Zygo book](https://github.com/mhmtskrc2/zygo/blob/main/docs/book/11-getting-started.md)
|
|
27
|
+
walks through one. `connect()` finds the API at `ZYGO_API_URL`, or
|
|
28
|
+
`http://127.0.0.1:7700`, and sends `ZYGO_API_TOKEN`, so a program started
|
|
29
|
+
from the same shell needs no settings.
|
|
30
|
+
|
|
31
|
+
## Using it
|
|
32
|
+
|
|
10
33
|
```bash
|
|
11
34
|
npm install zygo-sdk
|
|
12
35
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zygo-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Run untrusted code safely from Node: a client for Zygo, which gives every request a fresh, kernel-isolated sandbox in about a millisecond",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|