Skip to content
unflores edited this page Mar 24, 2011 · 10 revisions

Development Environment Setup

Testing

If you are planning on contributing to the project's wishlist of features, please keep in mind that you need to test your code.

Our development setup for Cloudspace Mockups consists of:

  • VirtualBox accessed via Vagrant
  • Chef for the setup of the development box

Once set up, your virtual box will have:

  • nginx
  • mongo
  • nodejs
  • npm + required packages
  • git

####Virtual Box

Download a new virtual box from: http://www.virtualbox.org/wiki/Downloads

Start a new virtual box using Ubuntu 10.04 64 bit server edition

####Install vagrant

http://vagrantup.com/docs/getting-started/index.html

Clone the Cloudspace Mockups repo:

git clone [email protected]:cloudspace/mockups.git

In the Cloudspace Mockups project directory:

cp Vagrantfile.default Vagrantfile

Update the Vagrantfile with your server specific settings

####Set up Chef

gem install chef

You can get a lot of good cookbooks by cloning the opscode repo

git clone https://github.com/opscode/cookbooks.git

All of the recipes that you need in order to get a development box up and running are in two places.

  1. Vagrantfile.default

    Any recipes that appear as follows chef.add_recipe('[recipe name]') will need to be added your opscode user account

  2. There are site-specific cookbooks in [project_root]/site-cookbooks/ that contain site specific overrides for the default chef recipes. These can be added by editing your knife.rb config to include the path to site-cookbooks.

    EX. ~/.chef/knife.rb

    .
    .
    cookbook_path   ["#{ENV['HOME']}/cookbooks",'./site-cookbooks']
    .

Here I have added a secondary directory based on the current directory I'm in that will look in site-cookbooks.

Now you're going to need to edit [site_dir]/site-cookbooks/mockups/templates/default/authorized_keys and add the public keys of whoever will be deploying the app.

At this point you should change your working directory to [site_dir] and call:

knife cookbook upload [recipe]

Now you will be ready to deploy to a development environment.

vagrant up #will run all of the chef commands necessary to create a working environment

####Deploy the Application

If you would like to test the deployment through capistrano then run:

cap deploy:check_dependencies #will check to see if you have what you need
cap deploy:setup && cap deploy #will set up and start up your application on the box you just set up

Otherwise, log in to the box and run:

git checkout [email protected]:cloudspace/mockups.git
cd mockups
sudo mongod &    #run mongo as a daemon
sudo node app.js #call node on the file that controls the application
Clone this wiki locally