Like SimCity, but for virtual machines!
ssh-hypervisor is an SSH server that dynamically provisions Linux microVMs with Firecracker. Once set up, you can just SSH into it from anywhere to instantly allocate a fresh VM.
# Dynamically create a microVM, or restore from past state.
ssh yourname@vmcity.ekzhang.com
$ whoami # You are now SSH'd into the VM!Just for fun! Not intended to be used in production at this time.
I could see it potentially becoming a useful building block for provisioning lightweight VMs, since many languages have SSH client libraries. Let's discuss if you want to make this happen.
The ssh-hypervisor binary is statically linked and written in Go.
System requirements:
- Linux running x86-64 or ARM64 architectures
- KVM – check
stat /dev/kvm - iproute2 – the
ipcommand - iptables
To build the project:
# Download platform-specific Firecracker binary
go generate ./...
# Build the binary (static linking, no CGO dependencies)
CGO_ENABLED=0 go build ./cmd/ssh-hypervisor
# Grant required CAP_NET_ADMIN to the binary
sudo setcap cap_net_admin+ep ./ssh-hypervisorTo run tests, just use go test directly.
go test -v -exec sudo ./...Then, you will need to build a rootfs once, and run the server:
# Build a rootfs, requires docker. Produces 'rootfs.ext4' file.
scripts/create-rootfs.sh
./ssh-hypervisor -rootfs rootfs.ext4