@multiplayer-app/sandbox 6.0.0-sandbox-docker-image.0 → 7.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 +63 -6
- package/dist/cli.js +1056 -152
- package/dist/cli.js.map +4 -4
- package/dist/config.d.ts +5 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/executor/detect.d.ts.map +1 -1
- package/dist/executor/docker-executor.d.ts +16 -2
- package/dist/executor/docker-executor.d.ts.map +1 -1
- package/dist/executor/docker-sandbox-executor.d.ts +13 -1
- package/dist/executor/docker-sandbox-executor.d.ts.map +1 -1
- package/dist/executor/env-encoding.d.ts +9 -0
- package/dist/executor/env-encoding.d.ts.map +1 -0
- package/dist/executor/fargate-executor.d.ts +13 -1
- package/dist/executor/fargate-executor.d.ts.map +1 -1
- package/dist/executor/firecracker-executor.d.ts +7 -1
- package/dist/executor/firecracker-executor.d.ts.map +1 -1
- package/dist/executor/index.d.ts +2 -1
- package/dist/executor/index.d.ts.map +1 -1
- package/dist/executor/lambda-microvm-executor.d.ts +9 -0
- package/dist/executor/lambda-microvm-executor.d.ts.map +1 -1
- package/dist/executor/mock-executor.d.ts +4 -1
- package/dist/executor/mock-executor.d.ts.map +1 -1
- package/dist/executor/qemu-executor.d.ts +7 -1
- package/dist/executor/qemu-executor.d.ts.map +1 -1
- package/dist/executor/remote-executor.d.ts +10 -1
- package/dist/executor/remote-executor.d.ts.map +1 -1
- package/dist/executor/types.d.ts +12 -1
- package/dist/executor/types.d.ts.map +1 -1
- package/dist/health-server.d.ts +10 -0
- package/dist/health-server.d.ts.map +1 -0
- package/dist/images.d.ts +2 -0
- package/dist/images.d.ts.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +991 -150
- package/dist/index.js.map +4 -4
- package/dist/prepare-images.d.ts +14 -0
- package/dist/prepare-images.d.ts.map +1 -0
- package/dist/services/serial-relay.d.ts.map +1 -1
- package/dist/services/vnc-relay.d.ts.map +1 -1
- package/dist/socket-client.d.ts.map +1 -1
- package/dist/vendor/builder-types/access.d.ts +1 -1
- package/dist/vendor/builder-types/deployment.d.ts +58 -0
- package/dist/vendor/builder-types/deployment.d.ts.map +1 -0
- package/dist/vendor/builder-types/events.d.ts +6 -1
- package/dist/vendor/builder-types/events.d.ts.map +1 -1
- package/dist/vendor/builder-types/index.d.ts +1 -0
- package/dist/vendor/builder-types/index.d.ts.map +1 -1
- package/dist/vendor/builder-types/release.d.ts +7 -3
- package/dist/vendor/builder-types/release.d.ts.map +1 -1
- package/dist/vendor/builder-types/vm.d.ts +28 -1
- package/dist/vendor/builder-types/vm.d.ts.map +1 -1
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -14,11 +14,22 @@ Supported engines (auto-detected): `qemu`, `firecracker`, `docker`, `docker-sand
|
|
|
14
14
|
`WORKER_ID`, `WORKER_TOKEN`, `SANDBOX_URL`, `MAX_VMS`, `WORKER_REGION`, plus per-engine
|
|
15
15
|
vars like `QEMU_IMAGES_DIR`, `DOCKER_STACK_IMAGES`, `MICROVM_IMAGE_ARN`,
|
|
16
16
|
`FARGATE_CLUSTER`, `AGENT_URL` — see `src/config.ts` for the full list.
|
|
17
|
-
`WORKER_TOKEN` is
|
|
18
|
-
|
|
17
|
+
`WORKER_TOKEN` is optional for trusted self-hosted control planes and required
|
|
18
|
+
for the public worker endpoint. Create one with the control plane's
|
|
19
|
+
`POST /v0/sapi/api-keys` endpoint and use the returned key as `WORKER_TOKEN`.
|
|
20
|
+
`WORKER_ID` is optional and
|
|
21
|
+
defaults to the machine hostname; set it explicitly when multiple workers could
|
|
22
|
+
report the same hostname.
|
|
19
23
|
`SANDBOX_URL` is optional and defaults to
|
|
20
|
-
`https://api.sandbox.filingramp.com`; set it explicitly for local or
|
|
21
|
-
control planes.
|
|
24
|
+
`https://api.sandbox.filingramp.com/v0`; set it explicitly for local or
|
|
25
|
+
self-hosted control planes. Its pathname selects the API base: `/v0` uses the
|
|
26
|
+
public authenticated worker endpoint, while `/internal/v0` uses the private
|
|
27
|
+
tokenless endpoint.
|
|
28
|
+
|
|
29
|
+
The sandbox worker exposes probes on `SANDBOX_HEALTH_PORT` (default `3000`)
|
|
30
|
+
under `API_PREFIX` (default `/v0/api`): `GET /v0/api/healthz` is its
|
|
31
|
+
liveness endpoint, and `GET /v0/api/health` is its readiness endpoint.
|
|
32
|
+
Readiness returns `503` until the worker connects to the control plane.
|
|
22
33
|
|
|
23
34
|
## Start a worker
|
|
24
35
|
|
|
@@ -29,17 +40,25 @@ npm install --global @multiplayer-app/sandbox
|
|
|
29
40
|
WORKER_TOKEN=<token> sandbox start
|
|
30
41
|
```
|
|
31
42
|
|
|
43
|
+
For a trusted deployment on the same Kubernetes cluster or private Docker
|
|
44
|
+
Compose network, leave `WORKER_TOKEN` unset and set
|
|
45
|
+
`SANDBOX_URL=http://builder-api-service:3000/internal/v0`. This resolves to
|
|
46
|
+
`/internal/v0/sapi/workers/ws`, which does not require a token and must not be
|
|
47
|
+
exposed by the public ingress. A client URL such as
|
|
48
|
+
`https://api.sandbox.filingramp.com/v0` resolves to `/v0/sapi/workers/ws`, which
|
|
49
|
+
requires a valid, user-created API key as `WORKER_TOKEN`.
|
|
50
|
+
|
|
32
51
|
The published runtime bundles the repository's internal `builder-types` and
|
|
33
52
|
`logger` libraries, so installing the CLI does not require those workspace
|
|
34
53
|
packages to be published separately.
|
|
35
54
|
|
|
36
55
|
The worker ID defaults to the hostname and the control-plane URL defaults to
|
|
37
|
-
`https://api.sandbox.filingramp.com`. Both can be overridden with environment
|
|
56
|
+
`https://api.sandbox.filingramp.com/v0`. Both can be overridden with environment
|
|
38
57
|
variables or flags:
|
|
39
58
|
|
|
40
59
|
```sh
|
|
41
60
|
sandbox start --token <token> --worker-id worker-eu-01 \
|
|
42
|
-
--sandbox-url http://localhost:3011 --max-vms 5
|
|
61
|
+
--sandbox-url http://localhost:3011/v0 --max-vms 5
|
|
43
62
|
```
|
|
44
63
|
|
|
45
64
|
## Run as a Docker container
|
|
@@ -59,6 +78,20 @@ docker run --rm \
|
|
|
59
78
|
multiplayer-sandbox-worker:local
|
|
60
79
|
```
|
|
61
80
|
|
|
81
|
+
Published worker images default to the matching published Docker Hub guest
|
|
82
|
+
images (`<repository>-node:<version>`, `-python`, and `-static`) and pull any
|
|
83
|
+
that are missing before engine detection. Override `DOCKER_IMAGE_PREFIX` and
|
|
84
|
+
`DOCKER_IMAGE_TAG` for another registry/version, use `DOCKER_STACK_IMAGES` for
|
|
85
|
+
per-stack references, or set `DOCKER_PULL_IMAGES=false` to require local images.
|
|
86
|
+
|
|
87
|
+
For QEMU and Firecracker, set `S3_BUCKET_ARTIFACTS` to the artifact bucket name
|
|
88
|
+
only, for example `my-test-artifacts` (without `s3://`, a path, or a trailing
|
|
89
|
+
slash). The worker derives `<version>/qemu` (`local/qemu` in development). On
|
|
90
|
+
startup the worker downloads
|
|
91
|
+
`<arch>/<stack>/{vmlinuz,initramfs.img}` into `VM_IMAGES_DIR` before detecting
|
|
92
|
+
engines. AWS SDK workload credentials are used automatically. Set the optional
|
|
93
|
+
`S3_ARTIFACTS_ENDPOINT` only for an S3-compatible service such as MinIO.
|
|
94
|
+
|
|
62
95
|
To let the worker launch ordinary Docker executors, mount the host daemon:
|
|
63
96
|
|
|
64
97
|
```sh
|
|
@@ -144,6 +177,30 @@ RUNNERS="qemu docker" ARCH=x86_64 STACKS="node python" \
|
|
|
144
177
|
|
|
145
178
|
The underlying script lives at `libs/sandbox/scripts/build-base-images.sh`.
|
|
146
179
|
|
|
180
|
+
For local development, build only the non-Docker VM artifacts and upload them
|
|
181
|
+
to the Compose MinIO bucket with:
|
|
182
|
+
|
|
183
|
+
```sh
|
|
184
|
+
npm run publish:base-images:local
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
This builds QEMU, Firecracker, and Lambda MicroVM artifacts for the host
|
|
188
|
+
architecture under `libs/sandbox/dist-base-images`, then runs a short-lived
|
|
189
|
+
MinIO client container to mirror them to `s3://builder-base-images/local/`.
|
|
190
|
+
It connects to the already-running MinIO host port at
|
|
191
|
+
`http://host.docker.internal:9000`, so it does not start another Compose stack.
|
|
192
|
+
Override `MINIO_ENDPOINT`, `MINIO_ACCESS_KEY`, `MINIO_SECRET_KEY`, or
|
|
193
|
+
`MINIO_BUCKET` when needed. After a successful upload it restarts an active PM2
|
|
194
|
+
sandbox worker, or otherwise restarts/starts the Compose sandbox service;
|
|
195
|
+
`VM_IMAGES_REFRESH=true` makes that worker replace its cached QEMU/Firecracker
|
|
196
|
+
images from MinIO before advertising its engines.
|
|
197
|
+
|
|
198
|
+
If the build already succeeded and only the upload needs retrying, run:
|
|
199
|
+
|
|
200
|
+
```sh
|
|
201
|
+
npm run upload:base-images:local
|
|
202
|
+
```
|
|
203
|
+
|
|
147
204
|
The default output is `libs/sandbox/dist-base-images/<runner>/<arch>/<stack>/` with a
|
|
148
205
|
root `SHA256SUMS` file. QEMU and Firecracker entries contain `vmlinuz` and
|
|
149
206
|
`initramfs.img`, while Lambda MicroVM entries contain `app.zip`. Docker, Docker
|