aboutsummaryrefslogtreecommitdiffstats
path: root/notes/vagrant.md
blob: 0ef9202f7d824bd878660542cafcbaa85f6eba78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Using Vagrant

Vagrant provides an easy method to setup virtual development environments, for
further information see [their website](http://www.vagrantup.com).

The included steps will use vagrant to create a dev environment where you can
run the test suite, the development server and of course make changes to the
codebase.

The basic process is to create a "base" vm, and then "provision" it with the
software packages and setup needed. There are several ways to do this, including
Chef, Puppet, or the existing FixMyStreet install script which we will use. The
supplied scripts will create you a Vagrant VM based on the server edition of
Ubuntu 12.04 LTS that contains everything you need to work on FixMyStreet.

## Pre-requisites

1. Install [VirtualBox](http://www.virtualbox.org/wiki/Downloads)
2. Install [Vagrant](http://downloads.vagrantup.com/)

## Get the FixMyStreet code

Create a folder somewhere that you'll be doing your work from and clone the repo
into it.

``` bash
mkdir FMS-vagrant
cd FMS-vagrant
git clone --recursive https://github.com/mysociety/fixmystreet.git
```

## Set up the Vagrant box

The vagrant configuration needs to be placed in the correct place.

``` bash
# NOTE - you need to be in the 'FMS-vagrant' dir

cp fixmystreet/conf/Vagrantfile.example Vagrantfile

# start the vagrant box. This will provision the system and can take a long time.
vagrant up --no-color
```

## Working with the vagrant box

You should now have a local FixMyStreet development server to work with. You
can edit the files locally and the changes will be reflected on the virtual
machine.

To start the dev server:

``` bash
vagrant ssh

# You are now in a terminal on the virtual machine
cd /vagrant/fixmystreet

# run the dev server
bin/cron-wrapper script/fixmystreet_app_server.pl -d -r --fork
```

The server should now be running and you can visit it at the address
http://127.0.0.1.xip.io:3000/

Enjoy!