Skip to content
leibowitz edited this page Mar 13, 2013 · 28 revisions

Requirements

  • PHP >= 5.3
  • MongoDB >= 2.2
  • Python
  • Apache2, Nginx or any webserver
  • RabbitMQ
  • PhantomJS >= 1.5

Optional

  • Supervisor

Installation

The easiest way to install is to use chef. This will install all the components for you and supports multiple distributions.

Install ruby, chef and librarian-chef

Using chef 11.x seems to be resulting in errors, so make sure you use chef 10.x

sudo apt-get install ruby
sudo gem install chef -v 10.24.0
sudo gem install librarian

Create Cheffile

site 'http://community.opscode.com/api/v1'

cookbook 'chef-client'

cookbook 'apache2', '>= 1.0.0'
cookbook 'git'
cookbook 'rvm',
   :git => 'https://github.com/fnichol/chef-rvm'
cookbook 'php'
cookbook 'composer'
cookbook 'rabbitmq'
cookbook 'mongodb-10gen'
cookbook 'python'
cookbook 'supervisor'
cookbook 'phantomjs'

Librarian Chef

Use librarian-chef to download all cookbooks on your machine.

librarian-chef update

You are ready to use these recipes with whatever you choose, for example with Vagrant.

sudo gem install vagrant
vagrant box add precise64 http://files.vagrantup.com/precise64.box
vagrant init precise64

Copy this to a file called Vagrantfile

Vagrant::Config.run do |config|
  # Setup the box
  config.vm.define :perf do |perf_config|
      perf_config.vm.box = "precise64"
      perf_config.vm.forward_port 80, 4567
      perf_config.vm.network :hostonly, "10.0.0.5"
      perf_config.vm.provision :chef_solo do |chef|
      chef.cookbooks_path = ["cookbooks", "site-cookbooks"]
         # chef.roles_path = "roles"
         # chef.data_bags_path = "data_bags"
         chef.add_recipe "php"
         chef.add_recipe "apache2"
         chef.add_recipe "apache2::mod_php5"
         chef.add_recipe "python"
         chef.add_recipe "mongodb-10gen"
         chef.add_recipe "mongodb-10gen::single"
         chef.add_recipe "rabbitmq"
         chef.add_recipe "supervisor"
         chef.add_recipe "git"
         chef.add_recipe "composer"
         chef.add_recipe "phantomjs"
         chef.add_recipe "php-mongo"
         chef.add_recipe "python-libs"
      end
  end
end

The last two lines, php-mongo and python-libs, refers to two custom recipes. Place them in a different directory, like site-cookbooks, as otherwise librarian-chef will delete them when you do librarian-chef install/update.

site-cookbooks/php-mongo/recipes/default.rb

php_pear "mongo" do
    action :install
end 

site-cookbooks/python-libs/recipes/default.rb

python_pip "pika" do
    action :install
end

python_pip "pymongo" do
    action :install
end

Now you are all set to spawn your box.

Clone this wiki locally