4 ms·
Vagrant is quite extensible; you can plug in KVM via QEMU and Libvirt as a VM "provider", and use Ansible to provision the guest out of the box. vagrant-libvir
by jitl 8y ago
Vagrant is quite extensible; you can plug in KVM via QEMU and Libvirt as a VM "provider", and use Ansible to provision the guest out of the box.
vagrant-libvirt (3rd party): https://github.com/vagrant-libvirt/vagrant-libvirt https://github.com/vagrant-libvirt/vagrant-libvirt
ansible provisioning (built in): https://www.vagrantup.com/docs/provisioning/ansible.html https://www.vagrantup.com/docs/provisioning/ansible.html
This isn't to say these will make the guest filesystem more performant than NFS; you'll probably hit the same bottlenecks with mounting host filesystems into the guest. The solution many users arrived at with Vagrant is to use a user-space synchronization program like Unison that watches for filesystem events (eg, inotify) on both the guest and the host. This is its own can of worms: O(size of files monitored) resource use on both hosts, file ignore lists, async races, etc. There's even a Unison plugin for vagrant, but I found it quite finicky and thus unsuitable for large-scale deployment
unison: https://www.cis.upenn.edu/~bcpierce/unison/ https://www.cis.upenn.edu/~bcpierce/unison/
unison-vagrant2: https://github.com/dcosson/vagrant-unison2 https://github.com/dcosson/vagrant-unison2
At Airbnb, we eventually wrote our own wrapper around Unison to make it easier to use, and saw 90x better perf for filesystem-heavy loads like Webpack once we switched off of NFS in our local VMs.
- noir_lord 8y agoThanks for the info, I was aware of vagrant-libvirt and ansible (already use that to deploy vagrant guests) but unison I hadn't seen. Funnily enough webpack is where I had the most problems (it certainly surfaces "what happens when we smack the FS in the face repeatedly" issues better than most) which is what got me thinking down the KVM route in the first place. In terms of hacking around on vagrant, it's ruby which isn't on the list of languages I'm fluent in and its flexibility makes it more complex than what I need for my use case. There is something to be said sometimes for rolling your own for your own itch but I'll certainly have a look at unison as part of vagrant first.
- RussianCow 8y ago> At Airbnb, we eventually wrote our own wrapper around Unison to make it easier to use Is there any chance you guys open sourced this wrapper, or have any plans to? :)
- jitl 8y agoUnlikely. 1. I no longer work at Airbnb, so I can't help you there. 2. The wrapper is somewhat deeply embedded in the dev tools swiss army knife, and is written in Ruby, so (a) it's difficult to extract since its tied with other Airbnb specific concerns and support libraries, and (b) distributing perf-sensitive Ruby code to end-users is challenging so you might not want it anyways. You might want to take a look at Mutagen, a unison replacement written in Go which seems to avoid most of what makes Unison annoying to work with. I haven't tested it, though, so I can't vouch for it. https://github.com/havoc-io/mutagen https://github.com/havoc-io/mutagen
- RussianCow 8y agoThat makes sense. I hadn't heard of Mutagen before, but it seems like it would solve a lot of the issues that drove me away from Unison. Thanks for mentioning it!
- crgwbr 8y agoHere’s a similar project we made for syncing stuff to remote docker hosts: https://github.com/crgwbr/accordance https://github.com/crgwbr/accordance
- jitl 8y agoVery cool. I always thought a node/TypeScript implementation would be easier than our Ruby one because of the natural event-orientation of Node.