Manage an entire fleet of macOS VMs with HashiCorp Nomad

Building a Nomad driver plugin to integrate with Tart macOS VMs

To learn how Nomad driver plugins work, I built a driver plugin for Tart. It lets Nomad manage Tart macOS VMs in much the same way that it manages Docker containers.

Disclaimer: This driver is a proof of concept and is not ready for production use. For a production-ready option built by Tart's developers, consider Orchard.

Tart

Tart is a VM manager for macOS VMs on Apple Silicon. It integrates with OCI-compatible container registries, so VM images can be stored and distributed like Docker container images.

The driver experiment

One of the ways I learn a new technology is by building something with it. Nomad already has drivers for workloads such as Docker, so I chose Tart while learning the plugin system. Tart manages VMs on one machine rather than orchestrating them across several, which made it a useful fit for a driver. Tart also has its own orchestration manager, Orchard, but Nomad can manage other workloads alongside the VMs. Potential uses include CI/CD workflows, ephemeral development environments, and testing infrastructure.

Sample Nomad job

This job starts a macOS VM:

job "tart-demo" {
  datacenters = ["dc1"]
  type        = "service"

  group "demo" {
    task "vm" {
      driver = "tart"

      config {
        image     = "ghcr.io/cirruslabs/macos-sequoia-base:latest"
        cpu       = 4
        memory    = 8192
        disk_size = 50
        command   = "echo 'Hello from Tart VM'"
      }
    }
  }
}