Skip to content

Using a VM for development

duelinmarkers edited this page Mar 14, 2012 · 7 revisions

Rather than installing and running RapidFTR directly on your workstation/laptop/what-have-you, you can develop using a virtual machine. This will get you up and running more quickly than trying to install the components yourself. Performance may be slower than if you run "native." We'd recommend starting with a VM and setting up RapidFTR natively only once you understand a bit about how the system works and only if you find the performance of the VM annoying.

The development VM is run using Vagrant, which uses VirtualBox. It should work regardless of the OS you're running (Mac OS X, Linux, or Windows) so long as you have VirtualBox installed.

Here are the instructions to get up and running.

  • Set up Vagrant using these instructions, stopping before running any command starting with vagrant (in the section "Your First Vagrant Virtual Environment") so that you have VirtualBox and Vagrant installed.
  • Clone the RapidFTR repository. (This assumes you have git on your host machine. If you don't and don't want to install it, see below.) git clone git://github.com/jorgej/RapidFTR.git or for read-write access to your own fork git clone [email protected]:duelinmarkers/RapidFTR.git substituting your own git username after the colon.
  • From the root of the RapidFTR clone, run vagrant up to download and boot the VM.
    • Beware, the box file is large (about 700MB). It should only have to download once.
    • Once that command completes, the VM is running, headless, in the background.
  • vagrant ssh to log into the VM. (You can do this from as many terminal windows as you like.)
  • cd /vagrant
  • bundle install
  • rake couchdb:create db:seed app:run to start your dev server on port 3000. This can be accessed from your host machine (i.e. via your normal browser) on http://localhost:3000/ because port 3000 is forwarded from the host machine to the guest machine.
    • The VM also has port 5984 forwarded, so this URL http://localhost:5984/_utils/ will work from the host machine to give you access to Futon, the CouchDB UI.
  • Shut down the server with Ctrl-C (or open a new terminal window, go to your working directory, and use vagrant ssh to open a new connection).
  • Run rake from /vagrant to see the test suite run and (hopefully) pass. You'll do this again whenever you think you've finished some work to be sure the test suite is passing.

When you're finished working on RapidFTR for a bit, you'll want to shut down the box.

  • vagrant suspend will save the current running state of the machine. You can come back up from this with vagrant resume.
  • vagrant halt will shut down the machine. You can come back up from this with vagrant up.

If you want to trash the VM completely (and recover disk space), use vagrant destroy. After doing this you'll need to download the box again to run it again.

I don't have Git on my host machine, and I don't want to install it

Ok, then download the Vagrantfile from the root of the repo, put it in an empty directory where you want to do your work, and proceed with the instructions. Once you're ssh'd into the VM, use git from within the VM to clone the repo. You'll want to generate an ssh keypair on the VM and attach the public key to your Github account. Do you need an ssh keypair before cloning a public repo?