daytona machine provider reaches a running
Daytona sandbox, by ID, and runs the programs it
captures in it. You create and size the
sandbox; Mirage only runs programs in it. Python SDK and Node.
Installation
- Python
- TypeScript
api_key in the config, or DAYTONA_API_KEY.
Usage
captures defaults to @external:
every program Mirage does not have itself. Name @python to run
Python in the sandbox too.
- Python
- TypeScript
- YAML
Connecting the workspace
Mirage does not serve mounts into a Daytona sandbox. Use the machine image and thefuse steps, then start Mirage in the
sandbox:
Pausing the sandbox
To pause the sandbox when the workspace pauses, seton_pause: pause on the
machine:
workspace.pause() closes the workspace, then pauses the sandbox: Daytona
keeps its disk and memory, and it uses no CPU while paused. The next line’s
connect starts it again. Daytona pauses only VM sandboxes; for any other,
workspace.pause() raises Daytona’s error and the sandbox keeps running.
Without on_pause, workspace.pause() leaves the sandbox running unless the
call names the machine. See Pause.
Notes
- Stopping or closing the workspace leaves the sandbox running.
- Daytona’s exec takes no input, so a line given piped input, or a program
that reads a
<(...), exits 126 before it runs, withmirage: daytona:<name>: the machine takes no input. - Output comes back as the program wrote it, binary included: the
sandbox base64-encodes it on the way out, so the image needs
ddandbase64(Debian, Ubuntu and Alpine images have both), and output takes about a third more to transfer. Without them a line runs nothing, prints why and exits 127. - Sizing, GPUs, snapshots, networking, idle-stop and auto-delete stay Daytona settings. The Daytona example covers baking a snapshot and a full read and write round trip.
- A Daytona sandbox has no timeout of its own. After a Mirage timeout, Python stops the program; in TypeScript it keeps running and billing until you stop it.