Skip to content
This repository has been archived by the owner on Jul 11, 2018. It is now read-only.

Vagrant and Veewee

gvanderploeg edited this page Dec 10, 2012 · 3 revisions

This tutorial creates a VM using Vagrant and Veewee, to use as an OpenConext-VM. If you just want to use an existing VM or you want to create it manually (using VirtualBox for example), do NOT use this tutorial, but follow the instructions in the README.

Introduction

This tutorial uses Vagrant and Veewee to create VMs. The advantage of using these is that you can easily create, terminate, boot, provision and connect to VMs. Especially when doing OpenConext development, this might come handy.

Prerequisites

And on Debian/Ubuntu install these required packages (for using rbenv):

$ sudo apt-get install git libssl-dev libopenssl-ruby zlib zlib1g-dev libxslt-dev libxml2-dev

Installation steps

The installation script uses Ruby, Vagrant and VeeWee for building up the VM. You don't have to install these dependencies as we use Bundler to install these.

To use Ruby and use gemsets we first need to install rbenv. The instructions on the github page are simple to follow. We also make use of the following plugins for rbenv to manage ruby versions and the gems:

With the two plugins installed (and of course rbenv) you can simply tell rbenv to install the version of ruby we use:

$ rbenv install 1.9.3-p286
$ rbenv rehash

Verify the correct installation by typing:

$ rbenv versions

You should see (at least):

  • 1.9.3-p286

Now get the source code of the OpenConext VM:

$ git clone git://github.com/OpenConext/OpenConext-vm.git
$ cd OpenConext-vm

Now install bundler as gem in your ruby version (managed by rbenv):

$ gem install bundler

Next use the gems defined in the Gemfile to install vagrant and veewee:

$ bundle install

Verify that Vagrant and VeeWee are setup correctly with the following commands (should not return an error):

$ vagrant -v
$ vagrant basebox templates

Then build a basebox (one time):

$ vagrant basebox build -f demo.openconext.org 

Make sure you answer Yes and not Y when asked to download the box file. Please let all the commands run untill your prompt is back (e.g. don't go start typing in the pop-ups of the VM)

$ vagrant basebox export demo.openconext.org
$ vagrant box remove demo.openconext.org
$ vagrant box add demo.openconext.org demo.openconext.org.box

The third command is necessary to clean up previous boxes. If this is the first time you can ignore the following:

$ Box 'demo.openconext.org' could not be found

Then instantiate the box:

$ vagrant destroy
$ vagrant up

Finally copy host/hosts to your hosts file and point your browser to https://demo.openconext.org. Follow the on-screen instruction to import the root CA in your browser.

VM usage, once setup

We use Vagrant to manage the VM sp please refer to the their documentation for an quick overview of the available commands, or type

$ vagrant

SSH & SCP

To connect to the VM with ssh or copy files with scp you can inspect the ssh settings with:

$ vagrant ssh-config

which will print the ssh configuration used with vagrant ssh:

Host default
HostName 127.0.0.1
User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /Users/user/.vagrant.d/insecure_private_key
IdentitiesOnly yes

You can (as an alternative to ssh vagrant) use this information to ssh or scp (mind to replace the key file with the path of the vagrant ssh-config setting):

ssh -i /Users/user/.vagrant.d/insecure_private_key vagrant@localhost -p 2222
scp -P 2222 -i /Users/user/.vagrant.d/insecure_private_key some_local_file vagrant@localhost:

If you add the output of vagrant ssh-config to your ~/.ssh/config file you can ease the copying of files or connecting to the VM:

ssh default
scp some-local-file default: