Skip to content

Setup a local development repository using a Vagrant VM

iperdomo edited this page Oct 8, 2014 · 6 revisions

NOTE: this document is deprecated

We will use Vagrant & Virtualbox to do local development with a VM..

Everyday

Once all is setup (below) this is a normal workflow

Start & stop VM and Javaserver

$ vagrant resume
$ vagrant ssh
€ ./start.sh

... work ...

€ ctrl c (to kill the Java server)
€ exit
$ vagrant suspend

Setup

For clarity I used $ to represent the host computers terminal and € for the VM.

Virtualbox

Download latest .dmg package and install from https://www.virtualbox.org/wiki/Downloads

Vagrant

Download latest .dmg package and install from http://downloads.vagrantup.com

VM box

In Vagrant a VM that is used to create other VMs to use for development is called a "base box" (or just box). The VM's where are using contains non public files so the VM files are keept within the walled garden of Google Drive. If you have permission a FLOW box can be downloaded from Google Drive: Akvo Dev > FLOW > Deployment & setup > boxes. At the time the current box to download is called akvo-flow_precise64_4.2.6_v2 and the file name is akvo-flow_precise64_4.2.6_v2.box. Download the file to your harddrive. This guide will use the ~/Downloads/ directory as the place where the file was downloaded to.

akvo-flow_precise64_4.2.6_v2.box (Akvo FLOW, Ubuntu Precise, 64 bit, Virtualbox 4.2.6, version 2 of the box)

Add the box to Vagrant

$ cd ~/Download
$ vagrant box add akvo-flow_precise64_4.2.6_v2 ./akvo-flow_precise64_4.2.6_v2.box

Checkout the FLOW repo for use

$ cd 
$ git clone git@github.com:akvo/akvo-flow.git
$ git checkout -b feature/frontend origin/feature/frontend

We know have the feature/frontend branch "active", this is needed since there is code in that branch that helps Vagrant to operate.

Now lets start the VM

$ vagrant up 

This will prompt from your password, this for Vagrant to be able to share a NFS folder with the host computer If all is fine we can now connect to our VM and fire up the Java server

$ vagrant ssh
€ ./start.sh (on VM. Convenience script that runs "ant runserver")

Once the server is running we can open an other terminal session on the host computer and navigate to our repo

$ cd 
$ cd Dashboard
$ rake build && rake watch

You should now be able to see the local flow instance on http://33.33.33.6/dashboard.html. Do notice that you should set the Ember app to use Local VM as data source in the Admin section if that is wanted.

We can now shut down the VM with

€ exit
$ vagrant suspend

if you want to resume the VM session you do

$ vagrant resume

You can always check the status of the VM with

$ vagrant status
Clone this wiki locally