Diffinery

homeflare/celldpublic

32 lines · 1.2 KBRaw History
1# Sandbox
2
3The Cloudflare Sandbox SDK on celld: each sandbox is a Durable Object that
4supervises a container built from the `cloudflare/sandbox` image, and the
5`@cloudflare/sandbox` package drives it from the Worker. Commands, files,
6and background processes run inside the container.
7
8Install the dependency, then run the example. The first request pulls the
9base image, which is about 225 MB, so it takes a while:
10
11```sh
12npm install
13celld dev
14curl 'http://127.0.0.1:9876/exec?cmd=uname+-a'
15curl 'http://127.0.0.1:9876/write'
16curl 'http://127.0.0.1:9876/serve'
17curl 'http://127.0.0.1:9876/processes'
18curl 'http://127.0.0.1:9876/exec?id=other&cmd=ls+/workspace'
19```
20
21Each `id` is one sandbox with its own filesystem, so the second `ls` shows
22an empty workspace. Deploy to a fleet from this directory:
23
24```sh
25celld deploy . --bucket s3://my-cells-bucket
26```
27
28`celld deploy` saves the image to the bucket once, and each node loads it
29the first time one of its sandboxes starts. Preview URLs, tunnels, and
30bucket mounts are features of the package and of the container; see the
31[Cloudflare compatibility](../../docs/cloudflare-compat.md#containers)
32notes for what celld does not provide.