Skip to content
This repository has been archived by the owner on May 25, 2022. It is now read-only.

Develop with Vagrant

alxndrsn edited this page Sep 18, 2014 · 13 revisions

Develop with Vagrant

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.

Getting Started

  • Install:

  • Boot the VM:

      # Download source code:
      git clone git://github.com/rapidftr/RapidFTR.git
      cd RapidFTR
      git submodule update --init
    
      # Start the VM
      vagrant plugin install vagrant-omnibus
      vagrant plugin install vagrant-faster
      vagrant up
    
    • Beware, the box file is large. It should only have to download once.
    • The first time vagrant up is run the Chef recipes will be executed to provision the VM. This involves downloading and installing CouchDB, Ruby, Java, etc, so it will take some time. But the good thing is, once they are downloaded, they are all cached in shared folders so you'll have much less d
    • Once that command completes, the VM is running, headless, in the background.
    • NOTE: This may ask you to install some additional plugins, just follow the instructions on the screen and copy/paste whatever it tells you to do.
    • NOTE: If you feel the VM is very slow, use vagrant-faster: vagrant plugin install vagrant-faster
  • Once the VM is up, login and start RapidFTR:

      vagrant ssh
      cd /vagrant
      rake sunspot:solr:start
      rails server
    
  • Once the Rails server is running on the VM the RapidFTR website can be accessed from the standard port via a web browser on the host machine (http://localhost:3000/)

  • CouchDB is automatically started on the VM and does not need to be started manually. It can be accessed from the standard port via a web browser on the host machine (http://localhost:5984/).

  • 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).

Sharing Downloaded Files

Once you've got the VM up and provisioned in one machine, you don't really want to download everything again in another machine, especially in code jams! To quickly share the downloaded files across multiple machines, do the following:

  • The VM image is stored in $HOME/.vagrant.d/boxes. Just copy over this folder to other machines
  • Everything downloaded and installed inside the VM (CouchDB, JDK, Ruby, Gems, etc) are all cached with your host machine. So even if you delete the VM and re-create it, it won't download everything again. All this is present inside the tmp/vagrant folder in RapidFTR (i.e. the folder where you cloned RapidFTR and ran vagrant up). Share this tmp/vagrant folder with other machines

Managing the VM

  • vagrant halt will shut down the machine. You can come back up from this with vagrant up.

  • vagrant destroy will completely destroy the machine. Next time you run vagrant up it will create a new VM

  • vagrant provision will run the Chef scripts again on the VM. This can be used when there are changes to the infrastructure, like Ruby/CouchDB upgrades, etc.

  • vagrant up prod will boot a Production quality VM - one that is a real replica of a Production RapidFTR server. This is good for testing real production deployments

  • Similarly, vagrant halt prod, vagrant destroy prod, vagrant provision prod will all work on the Production VM