Veewee for Ruby Rubes
Tags: devops
Let’s talk about installing Veewee to build virtual machines on multiple platforms from templates with little to no ruby background. Ruby professionals will probably do just fine with the install instructions provided by the project. Stick around if you’re a system administrator, operations engineer, or non-ruby developer interested in installing veewee.
We’re going to follow along with veewee’s installation instructions, but I’m also going to provide some commentary and direction as I received it from someone who writes software with ruby on a daily basis.
After installing required operating system packages we come to the first fork in the road. Two options with a silent third option exist for managing our Ruby environment:
- RVM (preferred by Veewee)
- rbenv (preferred by Joe)
- No environment management (preferred by no one sane)
Number three is an option in the technical sense only. Don’t think it’s a wise idea to stink up the system Ruby installation with custom gems. You’re entering a world of pain.
RVM felt a little weird to me, but I chalked that up to being a Ruby rube. Joe told me that he dropped RVM years ago for rbenv and hasn’t looked back. Those two factors pushed me to switch to rbenv, but your mileage may vary. For the python folks in the room, you can equate (RVM || rbenv) + Bundler to virtualenv + pip.
I followed the rest of the
installation,
command
options,
and
basics
pages. Everything worked, and I created several virtual machines using
the KVM plugin, but it didn’t quite feel right. I didn’t see anywhere in
the docs an explanation of how to separate my work from their work.
Templates and definitions lived inside of the veewee source directory,
and “bundle exec veewee” only worked within that directory.
Aside from the ugliness of polluting a directory full of upstream source with my own stuff that I never intended to contribute back, I really wanted a nice way to manage separate repositories of templates and definitions for my personal use and work use.
I saw reference to Veeweefiles in the docs, but not much information
on how to use them to customize runtime configuration. Digging in to
the code, environment.rb specifically, there was a reference to a
VEEWEE_DIR environment variable. Setting that allowed me to run
bundle exec veewee
from the veewee source directory, but use
templates, definitions, and isos in a separate directory. Excited
about this new development, I shared the news with some folks in IRC.
Joe again stepped in to let me know that I was just barely catching up to the crowd, and not even in a very ideal way.
“make a gemfile that includes veewee, run bundle it, then the above command [works in your personal directory for templates and definitions]”
I ended up with a directory structure like so:
With a very short Gemfile:
And a minimal Veeweefile
And it seems to all work. Just to be clear:
- Create a new directory for your veewee work.
- Drop the Gemfile and Veeweefile above in the directory.
- Run bundle install
- Optionally alias veewee=”bundle exec veewee”
- Create templates and define boxes to your heart’s content.