astro / microvm.nix

NixOS MicroVMs
https://astro.github.io/microvm.nix/
MIT License
1.42k stars 103 forks source link

[Question / Feature request] Dynamic / API based scheduling #156

Closed malt3 closed 1 year ago

malt3 commented 1 year ago

If I understand the current implementation correctly, it is possible to either start microvms statically (as part of the hosts nixos configuration), or start them manually (using the microvm command).

Is there any form of dynamic or API based scheduling available for microvms? I'm looking for a way to schedule ephemeral CI runners. They should boot on demand, run some code and be destroyed. Preferably using some tcp / unix socket and a daemon.

Is this generally within the scope of this project? And if so, where would I start? My current idea is to build my own daemon around the microvm command.

astro commented 1 year ago

Sure. Start by building and running VMs as packages, then integrate that into your setup.

astro commented 1 year ago

For running something automatically you may create a systemd service.

For communication with the host we now support vsock on some hypervisor. It's another socket address family that is faster and requires no network configuration.

Give some consideration into whether you want to build a VM for each job, or if you can pass the workload at run-time to a "master VM image", eg. through a shared directory or through a communication channel like vsock or the network.

I am running microvm.nix on nomad. Others use the project for CI, I think.