Introducing WVM
Introducing Westley's Virtual Machine Manager: a simple CLI and declarative configuration for portable QEMU virtual machines.
Running applications over the years
When I run Linux, I feel a strange power, that anything is possible. However, sometimes it's impossible to remember the commands for a lot of Linux tools, expert users know the strange incantation or piece it together to make these commands do their bidding, but everyone else gets frustrated and gives up. I tried to run qemu to run virtual machines in college out of curiosity, but I came away remembering the commands were unbelievably complicated and arcane, I think I lost those scripts when a computer died, but that's probably fine, what I built wasn't very good at the time.
Earlier this year, I wanted to fulfill my dream of having a CLI virtual machine management tool that I could run on any computer in my house or in the cloud, to move my hosted services between devices. I will announce this today, but first let me run you through the many ways I failed to achieve the same goal.
I host a lot of application such as Gitea (Github alternative), PiHole (DNS + ad blocking), FreshRSS for reading blogs (I don't use social media), and NextCloud for backing up my phone. This ends up being a lot of work, I'm not sure if I would recommend it, but it doesn't keep my subscription costs down (and my server bills up!).
-
Volume mounting: you can volume mount important files and folders in docker compose then do
docker compose upon the new computer, but getting all the data and year old images you need is risky. Also the database imports and exports somehow have issues. -
A slightly better way if you are going from the same architecture to another is first doing
docker image save, copying the file over, then doingdocker image load. I learned about this a few years ago from a talented DevOps team member. -
I found a third way that worked surprisingly well recently, give gpt-5.6 level agents access to both servers and tell them to migrate all the applications after you verify they found everything important. I've had ~less success~ terrible problems with giving agents SSH access before, last November a well meaning Anthropic model ssh'ed into my raspberry pi without asking and ran some commands that bricked it. But recently, they seem to be better. Only risking a 1% chance of failure is pretty good when days of tedious work is the alternative, and I have backups.
-
Virtual Machines - You can skip a lot of this per application if you just make a big virtualbox or proxmox VM, then you can move all your applications at once between computers! The only issue here is transferring it, a 100 gigabyte VM takes 45 minutes if you have 300mbps, the US average speed, but upload speed is usually not 300mbps! So your VM needs to be pretty optimized so you can keep it a reasonable size. This can be hard to do as it's easy to download a lot of files on a computer you use regularly.
The Push
Earlier this year, Hetzner announced they were raising rates 30% on some of the servers I was running. This made me research how I could save more money on servers and I realized Hetzner sold dedicated servers with 64gb of ram for 40 euro, they raised the prices for too, but by a much smaller percentage than their VPSes. I was paying 20 euro for a 16gb arm server that required a lot of architecture headaches, but I could get 4x that for only 20 euro more. I was sold. The main issue was most of the servers I was replacing had a few dedicated services on them, and running them all on a big box would lead to eventual disk or CPU contention issues. They had KVM available, so I thought I would do some research and see if I could run some simple virtual machines.
Introducing WVM
This is how it starts, a simple goal balloons into a giant project. Let me introduce you to WVM (Westley's Virtual Machine Manager), written in Ruby and Bash. It has an easy to remember interface:
wvm create--cpus N --disk 10000 --ram 3000wvm start- destroys the virtual machine, like Terraform
wvm destroy
So it has the ease of use of docker compose commands, but manages qemu virtual machines, and it works on Linux and Mac.
But that's not all, I wanted to make it possible to move these VMs between computers, so:
wvm export my_vm exports the VM into a tar.gz named after the vm, my_vm.tar.gz
wvm import my_vm allows that to be exported anywhere with the same architecture, even between Mac OS and Linux.
And I setup cloud_init startup scripts that start and install applications! So all these VMs can now be checked into source control and one they are started everything installs.
This all worked, but I added something easier to understand, a docker compose like declarative setup. A wvm.yaml file.
vms:
wireguard-vnc-demo:
distro: ubuntu:24.04
cpus: 2
ram: 3072
disk: 30G
network: nat
password: raw-vnc-demo
graphics: vnc-tcp
vnc_port: 5901
vnc_listen: auto
# Demo password; replace before use. VNC authentication is limited to 8 chars.
vnc_password: password
packages:
- ruby
- file-roller
run_script: desktop-bootstrap.rb
This lets me setup and change via wvm up any values about the VM and wvm decides how to accomplish that change. Memory changes restart the VM so it updates, etc.
I then got VNC (a type of remote desktop software) working so I can run multiple browser agents can use, and then even GPU passthrough in a VM for playing games with Steam and Sunshine on my main laptop, a 8gb Macbook Neo that barely can run a few browsers.
I have a mode for isolated networking for VPS style hosting (no host network access). Every application I run is setup inside these VMs now, and coding agents can setup everything for a new one themselves too. I run more than 20 WVM vms on a variety of hosting providers and my mac and linux computers at home. I dropped my costs hosting the applications I previous ran around 50%, so it's actually cheaper than before Hetzner raised the prices.
One more big advantage of having your own virtual machine management tool is you can actually change hosting providers easily! Multi-cloud is easy, no proprietary image formats from a cloud provider to lock you in. Many people aim to have infrastructure as code and setting everything up the right way, but in practice it usually doesn't turn out that way.
And you can resize your instances at any time! Right-sizing them to whatever resources you actually use/need. And this can change based on how you use your applications. 1,2,4,8,16 might be clean numbers, but if the application your using requires a strange number or needs a lot more CPU or disk, often VPS or EC2 instances don't support it. I've been loving the flexibility.
Obscure tools talented programmers wrote over decades can now be skinned with a user interface that lets a simple web developer setup Heroku style sleeping VMs in less than a day. Before AI such projects would have never been possible, but now the only limitation is: what can you imagine? My college dream became possible a decade later! I hope this inspires you to imagine more too.