Skip to content
PurityControl edited this page Sep 14, 2014 · 1 revision

Requirements

In order to use vagrant you will need software that can run virtual machines. Vagrant comes with out of the box support for virtualbox, making this the best way to go if you have little previous experience with vagrant.

Install the following bits of software in order:

  1. Virtualbox

  2. Vagrant

When you have installed these packages if you type vagrant at the command line you should get a help message. If you don't refer to the documentation at the above links to work out what has gone wrong.

Installing osra

Now that you have vagrant up and running, download the vagrantfile and its corresponding provisioning file for the operating system of your choice.

Then

  • make a directory where you want to setup the vagrant vm from
  • copy the two files you have downloaded into this directory
  • cd into this directory in a terminal
  • issue the command vagrant up and go and have a cup of coffee while it downloads the vagrant box file and sets up the osra provisioning.
  • when it has done all this type vagrant ssh in the shell to ssh into the machine

Things you should know

Port forwarding

Port forwarding can be set up in vagrant. The Vagrant environments for osra are designed to forward port 3000. So when you ssh into your vagrant machine and run rails server you will be able to open the page in the web browser of your host machine and work there at http://localhost:3000. If another vagrant instance or some other process is using port 3000, vagrant is configured to use an alternative port. This information is displayed in the console when you run vagrant up. If you cannot access the website from your main machine check the output to see if this has happened and you need to change the browser to point to the appropriate port.

folder sharing

Vagrant sets up folder sharing. After provisioning the vagrant machine. The virtual machine has the osra directory put in to /vagrant. This folder can be seen in the directory you set up vagrant on in your host machine. Any changes you make to the files on the host are changed in the virtual machine and vice versa. This means you can use your preferred editing tools on your host machine to work on the project and view it in your host machines browser.

ssh connection

Although all your editing and browsing can be done on the host machine you will still need to set up an ssh connection through vagrant ssh so you can run the rails server command, and also to run your cucumber and rspec tests.