smolvm machine provider reaches a running
smolvm microVM, by name, and runs the programs it
captures in it. Each machine has its own guest kernel, on macOS, Linux and
Windows. You create and start the machine; Mirage only runs programs in it.
Python SDK and Node.
Installation
Install thesmolvm CLI. Create and start a machine from an image that
has what connecting the workspace needs:
Usage
captures defaults to @external:
every program Mirage does not have itself. Name @python to run
Python in the machine too.
- Python
- TypeScript
- YAML
Connecting the workspace
Pick amount_type. With ssh, the guest needs sshfs; with mirage, mirage-fuse. With own,
put sandbox.yaml in the machine, in its image or a directory passed with
--volume, and start Mirage:
Pausing the machine
To pause the machine when the workspace pauses, seton_pause: pause on it:
workspace.pause() closes the workspace, then runs smolvm machine pause,
which saves the machine’s memory and disks to its data directory and stops
its VM. The next line resumes it with smolvm machine resume, running
processes included. This needs smolvm 1.18 or later, and a host that can
take smolvm’s portable checkpoints; where smolvm refuses the pause,
workspace.pause() raises smolvm’s error and the machine keeps running.
Without on_pause,
workspace.pause() leaves the machine running unless the call names it. See
Pause.
Notes
- Host files reach the machine only through directories passed with
--volumeat boot. - The machine must be
runningorpaused; Mirage resumes apausedone. Start astoppedorcreatedmachine, or clone afrozenmachine before using it. Mirage cannot run commands while a machine isunreachable. - Lines sent to one machine share its files and processes. Give each tenant its own machine.