From 225a93b36826890e61df6a5d45ecd9ab6b89681e Mon Sep 17 00:00:00 2001
From: Austin King <shout@ozten.com>
Date: Fri, 16 Sep 2011 21:58:49 -0700
Subject: [PATCH] Setting up Vagrant for BrowserID

---
 README.md   | 25 +++++++++++++++++++++++++
 Vagrantfile | 25 +++++++++++++++++++++++++
 2 files changed, 50 insertions(+)
 create mode 100644 Vagrantfile

diff --git a/README.md b/README.md
index bec3d664e..f8b50acfd 100644
--- a/README.md
+++ b/README.md
@@ -12,6 +12,30 @@ This repository contains several distinct things related to BrowserID:
   * **the browserid.org website** - the templates, css, and javascript that make up the visible part of browserid.org
   * **the javascript/HTML dialog & include library** - this is include.js and the code that it includes, the bit that someone using browserid will include.
 
+## Quick Start Virtual Machine
+
+We've prepared a VM so you can test/hack/have fun with BrowserID without modifying your local computer (too much). Skip to the next section "Dependencies", for detailed instructions to install this codebase locally, instead of using Vagrant.
+
+1. Install [Vagrant](http://vagrantup.com/docs/getting-started/index.html).
+
+This does add ruby, ruby-gems, and VirtualBox to your local desktop computer. No other software 
+or changes will be made.
+
+2. Boot up the VM:
+
+    $ cd browserid
+    $ vagrant up
+    $ vagrant ssh
+    vagrant@lucid32:browserid$ node ./run.js
+
+`vagrant up` will take a while. Go get a cup of coffee. This is because it downloads the 500MB VM.
+
+You can now browse to http://localhost:10001 and http://localhost:10002.
+
+Any changes to the source code on your local computer are immediately mirrored in the VM.
+
+Handy for dev and QA tasks, but if you want to install from scratch...
+
 ## Dependencies
 
 Here's the software you'll need installed:
@@ -20,6 +44,7 @@ Here's the software you'll need installed:
 * npm: http://npmjs.org/
 * Several node.js 3rd party libraries - see `package.json` for details
 * browserify which will be installed globally.
+* git, g++
 
 ## Getting started:
 
diff --git a/Vagrantfile b/Vagrantfile
new file mode 100644
index 000000000..342703d1e
--- /dev/null
+++ b/Vagrantfile
@@ -0,0 +1,25 @@
+Vagrant::Config.run do |config|
+
+    config.vm.box = "lucid32_2.box"
+    config.vm.box_url = "http://people.mozilla.org/~aking/browserid/lucid32_2.box"
+
+    #                      name      vagrant  desktop
+    config.vm.forward_port("readme",   10000, 10000)
+    config.vm.forward_port("verifier", 10001, 10001)
+    config.vm.forward_port("server",   10002, 10002)
+
+
+
+    # Increase vagrant's patience during hang-y CentOS bootup
+    # see: https://github.com/jedi4ever/veewee/issues/14
+    config.ssh.max_tries = 50
+    config.ssh.timeout   = 300
+
+    # nfs needs to be explicitly enabled to run.
+
+    config.vm.share_folder("v-root", "/home/vagrant/browserid", ".")
+
+    # Add to /etc/hosts: 33.33.33.27 dev.browserid.org
+    config.vm.network "33.33.33.27"
+
+end
-- 
GitLab