Permalink
Browse files

Update the README

  • Loading branch information...
1 parent e91b2a5 commit 812a4a63c25ca876cd51b8516881dbe4f9c4b5e6 @michaelklishin michaelklishin committed Jul 19, 2011
Showing with 97 additions and 36 deletions.
  1. +97 −36 README.md
View
133 README.md
@@ -8,45 +8,106 @@ Travis cookbooks are collections of Chef cookbooks for setting up
## Installing inside Vagrant Box using Chef-solo, sample Vagrantfile
+``` ruby
+$: << 'lib'
+require 'yaml'
+require 'travis/worker'
- Vagrant::Config.run do |config|
- config.vm.box = "lucid32"
- config.vm.box_url = "http://files.vagrantup.com/lucid32.box"
-
- config.vm.provision :chef_solo do |chef|
- chef.cookbooks_path = "vendor/cookbooks/vagrant_base"
-
- chef.add_recipe "apt"
- chef.add_recipe "build-essential"
- chef.add_recipe "networking_basic"
- chef.add_recipe "openssl"
-
- chef.add_recipe "git"
-
- chef.add_recipe "rvm"
- chef.add_recipe "rvm::ruby_187"
- chef.add_recipe "rvm::ruby_192"
- chef.add_recipe "rvm::ree"
-
- chef.add_recipe "java::sun"
-
- chef.add_recipe "mysql::client"
- chef.add_recipe "mysql::server"
-
- chef.add_recipe "memcached"
-
- chef.add_recipe "postgresql::client"
- chef.add_recipe "postgresql::server"
-
- chef.add_recipe "redis"
- chef.add_recipe "rabbitmq"
- chef.add_recipe "mongodb::apt"
- chef.add_recipe "mongodb::server"
-
- # You may also specify custom JSON attributes:
- # chef.json.merge!({ :mysql_password => "foo" })
+config = Travis::Worker.config.vms
+with_base = ENV['WITH_BASE'] == 'true'
+
+Vagrant::Config.run do |c|
+ config.vms.each_with_index do |name, num|
+ next if name == 'base' && !with_base
+
+ c.vm.define(name) do |c|
+ c.vm.box = name == 'base' ? 'base' : "worker-#{num}"
+ c.vm.forward_port('ssh', 22, 2220 + num)
+
+ c.vm.customize do |vm|
+ vm.memory_size = config.memory.to_i
+ end
+
+ if config.recipes?
+ c.vm.provision :chef_solo do |chef|
+ chef.cookbooks_path = config.cookbooks
+ chef.log_level = :debug # config.log_level
+
+ config.recipes.each do |recipe|
+ chef.add_recipe(recipe)
+ end
+
+ chef.json.merge!(config.json)
+ end
end
end
+ end
+end
+```
+
+then in .worker.yml, add :vms section that lists the cookbooks you want to provision:
+
+``` yaml
+vms:
+ count: 3
+ base: lucid32
+ memory: 1536
+ cookbooks: 'vendor/cookbooks/vagrant_base'
+ json:
+ rvm:
+ rubies:
+ - 1.8.6
+ - 1.8.7
+ - 1.8.7-p174
+ - 1.8.7-p249
+ - 1.9.2
+ - 1.9.1-p378
+ - jruby
+ - rbx
+ - rbx-2.0.0pre
+ - ree
+ - ruby-head
+ gems:
+ - bundler
+ - rake
+ - chef
+ aliases:
+ rbx-2.0.0pre: rbx-2.0
+ 1.9.1-p378: 1.9.1
+ mysql:
+ server_root_password: ""
+ postgresql:
+ max_connections: 256
+ recipes:
+ - travis_build_environment
+ - apt
+ - build-essential
+ - scons
+ - networking_basic
+ - openssl
+ - sysctl
+ - libyaml # libyaml MUST be installed before rubies. MK.
+ - emacs::nox
+ - vim
+ - timetrap
+ - git
+ - java::openjdk
+ - libqt4
+ - libv8
+ - nodejs
+ - rvm
+ - rvm::multi
+ - sqlite
+ - postgresql::client
+ - postgresql::server
+ - redis
+ - mysql::client
+ - mysql::server
+ - mongodb
+ - memcached
+ - rabbitmq
+ - imagemagick
+```
## License

0 comments on commit 812a4a6

Please sign in to comment.