Fábio Rehm bio photo

Fábio Rehm

Software Developer and Open Source Enthusiast

Github Twitter LinkedIn Feed

Ventriloquist demo

A while ago I stumbled across this benchmark by Brandon Liu on StackMachine’s blog comparing the numbers for performing some typical tasks on his physical machine and doing the same thing using virtual machines.

The measurements were made using Discourse and compared the numbers of doing things on VirtualBox and VMware Fusion so I got curious to see how well vagrant-lxc shared folders would perform. What I ended up finding is that it seems that Discourse provides a base box that was configured by hand and the Chef cookbooks used only deal with some basic stuff and I’d have to either do things by hand or write some provisioning scripts on my own.

That was actually one of the reasons that made me push Ventriloquist development forward on its “last miles” before open sourcing it (and it is the reason why it is used as an example on the project’s README BTW ;) While I could contribute back a set of Chef cookbooks, I decided to set Discourse needs as my target for deciding when to open source Ventriloquist.

If you want to see the Ventriloquist in action check out the following Asciicast or read the step by step right below it.

Try it out

First things first, so given you have Vagrant around, do a vagrant plugin install ventriloquist, git clone https://github.com/discourse/discourse.git and replace the [Chef provisioner]() code on the Vagrantfile with the code below:

config.vm.provision :ventriloquist do |env|
  env.services  << %w( redis pg:9.1 mailcatcher )
  env.platforms << %w( nodejs ruby )
end

You’ll also need to change the base box used to an Ubuntu 13.04 machine, in my case I’ve used this vagrant-lxc box, so the related Vagrant section looks like:

config.vm.box = 'raring64'
config.vm.box_url = 'http://bit.ly/vagrant-lxc-raring64-2013-09-28-'

At this point your Vagrantfile should look like this one and you should be able to vagrant up the machine to watch Ventriloquist provisioning take place. It will take a while to finish depending on your internet connection so grab a coffee while it does its magic.

Once provisioning has finished, go ahead and vagrant ssh into the VM and run the following commands to set things up:

cd /vagrant
./script/setup_dev
rake db:test:prepare
gem install foreman --no-ri --no-rdoc
cp .env.sample .env
echo -e "\nPORT=3000" >> .env

To test that things are set up properly, run the specs with rake spec and fire up a server with foreman start. If everything went fine, you should see a green build and verify that Discourse is running by visiting http://localhost:4000 on your browser and signing up. To read the confirmation mail, please visit [MailCatcher]()’s web interface at http://localhost:4080.

Coming up

Since Ventriloquist can be used to set things up across multiple Vagrant providers, I’ll soon try to get the numbers comparing VirtualBox with vagrant-lxc and vagrant-digitalocean to see how it goes.

UPDATE (26 AUG 2014): I’ve stepped down as a maintainer of the plugin, feel free to reach out in case you want to take over responsibility for the project


Comments

comments powered by   Disqus