├── .gitignore ├── .yardopts ├── Gemfile ├── LICENSE ├── README.md └── Vagrantfile.sample /.gitignore: -------------------------------------------------------------------------------- 1 | *# 2 | #* 3 | ~* 4 | *~ 5 | *.rbc 6 | *.class 7 | *.gem 8 | # makes it possible to clone cookbooks from any fork. MK. 9 | cookbooks/* 10 | Vagrantfile 11 | .vagrant 12 | Gemfile.lock 13 | 14 | 15 | .yardoc/* 16 | doc/* 17 | tmp/* 18 | 19 | cookbooks 20 | cookbooks/* 21 | .rvmrc 22 | .ruby-version 23 | tmp/* 24 | 25 | .bundle/* 26 | bin/* 27 | -------------------------------------------------------------------------------- /.yardopts: -------------------------------------------------------------------------------- 1 | --no-private 2 | --protected 3 | --markup="markdown" 4 | --main README.md 5 | --hide-tag todo 6 | - 7 | LICENSE 8 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "http://rubygems.org" 2 | 3 | gem "vagrant", "~> 1.0.7" 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT LICENSE 2 | 3 | Copyright (c) 2011 Michael S. Klishin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # What is Travis Sous Chef 2 | 3 | Travis Sous Chef is a repository that makes development and testing of [Chef](http://www.opscode.com/chef/) cookbooks (for [Travis CI](http://travis-ci.org) but 4 | not just) easy. It brings practices that the [Travis Development Team](https://github.com/travis-ci) uses to develop 5 | new and test modified [cookbooks](https://github.com/travis-ci/travis-cookbooks/tree/master/ci_environment) for 6 | [Travis CI](http://travis-ci.org) to the masses. 7 | 8 | Sous Chef intentionally focuses on automating away as many distractions as possible so you can focus on developing your Chef cookbooks. It does just one thing but does it well. 9 | 10 | 11 | ## How it works 12 | 13 | With Sous Chef, you use Vagrant and a locally running VirtualBox VM to develop and test your cookbooks. Sous Chef can use any collection of cookbooks: [those we use for travis-ci.org](https://github.com/travis-ci/travis-cookbooks/tree/master/ci_environment), cookbooks you are using for 14 | commercial projects, cookbooks from the [official OpsCode repository](http://github.com/opscode/cookbooks) or anything else. 15 | 16 | With Sous Chef, you provision a locally running virtual machine managed by [Vagrant](http://vagrantup.com) in just one command. The process is 17 | set up to shorten the feedback loop: 18 | 19 | * Modify your cookbook recipes (or templates/files in them) 20 | * Run provisioning 21 | * See and verify the result 22 | * Rinse and repeat 23 | 24 | Once you are done with your cookbooks, just push them to a source control repository or rsync them to your server. Then destroy VM environment 25 | you were using in one command. Or just power off the VM and come back to work with it later. 26 | 27 | 28 | ## Dependencies 29 | 30 | Sous Chef uses [Vagrant](http://vagrantup.com) and thus relies on [Virtual Box](http://virtualbox.org) being installed. Note that you do not 31 | need to have Chef installed locally. It will only be run in a virtual machine. 32 | 33 | 34 | ## Getting started with Sous Chef 35 | 36 | First install [VirtualBox 4.1.x](https://www.virtualbox.org/wiki/Downloads): 37 | 38 | * For [Mac OS X](http://download.virtualbox.org/virtualbox/4.1.12/VirtualBox-4.1.12-77245-OSX.dmg) 39 | * For [64-bit Linux distributions](http://download.virtualbox.org/virtualbox/4.1.12/) 40 | 41 | Then [install Vagrant](http://www.vagrantup.com/downloads.html). 42 | 43 | Copy sample Vagrant file: 44 | 45 | cp Vagrantfile.sample Vagrantfile 46 | 47 | Create a cookbooks directory or clone an existing collection of cookbooks like [Travis CI cookbooks](https://github.com/travis-ci/travis-cookbooks): 48 | 49 | mkdir cookbooks 50 | # or 51 | git clone git://github.com/travis-ci/travis-cookbooks.git cookbooks 52 | 53 | To allow provisioning with chef you need to uncomment the following line 54 | (including its associated end statement) 55 | 56 | config.vm.provision :chef_solo do |chef| 57 | 58 | 59 | After that point Vagrant at the cookbooks location by editing Vagrantfile. For Travis CI cookbooks, you just need to uncomment 60 | 61 | # this assumes you have travis-ci/travis-cookbooks cloned at ./cookbooks 62 | chef.cookbooks_path = ["cookbooks/ci_environment"] 63 | 64 | for other cookbook collections, provide a local path (or several) like so 65 | 66 | chef.cookbooks_path = ["cookbooks"] 67 | 68 | You can use multiple cookbook locations if necessary. 69 | For example, to develop both shared OSS cookbooks and your private product/company-specific ones: 70 | 71 | chef.cookbooks_path = ["cookbooks/ci_environment", "megacorp/cookbooks"] 72 | 73 | Next choose some cookbooks to provision. In the case of Travis CI cookbooks, build-essential is a good one to start with, so uncomment 74 | 75 | # chef.add_recipe "build-essential" 76 | 77 | Your Vagrantfile then will look like this: 78 | 79 | Vagrant::Config.run do |config| 80 | config.vm.box = "precise64_base" 81 | config.vm.box_url = "http://files.vagrantup.com/precise64.box" 82 | 83 | config.vm.provision :chef_solo do |chef| 84 | # point Vagrant at the location of cookbooks you are going to use, 85 | # for example, a clone of your fork of github.com/travis-ci/travis-cookbooks 86 | chef.cookbooks_path = ["cookbooks/ci_environment"] 87 | 88 | # Turn on verbose Chef logging if necessary 89 | # chef.log_level = :debug 90 | 91 | # List the recipies you are going to work on/need. 92 | chef.add_recipe "build-essential" 93 | # chef.add_recipe "networking_basic" 94 | # chef.add_recipe "kerl" 95 | 96 | # chef.json.merge!({ 97 | # :kerl => { 98 | # :user => "vagrant", 99 | # :group => "vagrant" 100 | # } 101 | # }) 102 | end 103 | end 104 | 105 | 106 | Create an Ubuntu virtual machine you will be developing cookbooks in: 107 | 108 | vagrant up 109 | 110 | To provision the VM ("provisioning" means running chef-solo to converge the VM to the state you want using Chef recipes you'd chosen to use): 111 | 112 | vagrant provision 113 | 114 | 115 | Running chef-solo may take from several seconds to several minutes, dependeing on what selected recipes do. Building 13 Ruby versions/implementations 116 | for travis-ci.org, for example, takes over 50 minutes but most of recipes run in under 30 seconds. 117 | 118 | Once provisioning finishes, ssh into the VM to check what the environment looks like: 119 | 120 | vagrant ssh 121 | 122 | When you are done with your work on the cookbook you can either power off the VM to use it later with 123 | 124 | vagrant halt 125 | 126 | or destroy it completely with 127 | 128 | vagrant destroy 129 | 130 | 131 | ## Developing a new cookbook with Sous Chef 132 | 133 | TBD 134 | 135 | 136 | ## Copyright 137 | 138 | Michael S. Klishin & Travis CI Development Team, 2011-2014 139 | 140 | 141 | ## License 142 | 143 | The MIT license. See LICENSE file in the repository root. 144 | 145 | 146 | [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/michaelklishin/sous-chef/trend.png)](https://bitdeli.com/free "Bitdeli Badge") 147 | 148 | -------------------------------------------------------------------------------- /Vagrantfile.sample: -------------------------------------------------------------------------------- 1 | Vagrant.configure "2" do |config| 2 | 3 | # See https://github.com/mitchellh/vagrant/wiki/Available-Vagrant-Boxes for more boxes. 4 | config.vm.box = "precise64_base" 5 | config.vm.box_url = "http://files.vagrantup.com/precise64.box" 6 | 7 | # change default username if needed 8 | # config.ssh.username = "travis" 9 | 10 | # requires installing a plugin with 11 | # vagrant gem install vagrant-vbguest 12 | # config.vbguest.auto_update = true 13 | 14 | config.vm.provider "virtualbox" do |vm| 15 | # changing nictype partially helps with Vagrant issue #516, VirtualBox NAT interface chokes when 16 | # # of slow outgoing connections is large (in dozens or more). 17 | vm.customize ["modifyvm", :id, "--nictype1", "Am79C973", "--memory", "1536", "--cpus", "2", "--ioapic", "on"] 18 | 19 | # see https://github.com/mitchellh/vagrant/issues/912 20 | vm.customize ["modifyvm", :id, "--rtcuseutc", "on"] 21 | end 22 | config.vm.provision :shell do |sh| 23 | sh.inline = <<-EOF 24 | sudo apt-get install ruby1.9.1-dev 25 | gem install chef --no-ri --no-rdoc --no-user-install 26 | EOF 27 | end 28 | 29 | config.vm.provision :chef_solo do |chef| 30 | # this assumes you have travis-ci/travis-cookbooks cloned at ./cookbooks 31 | chef.cookbooks_path = ["cookbooks/ci_environment"] 32 | chef.log_level = :debug 33 | 34 | # Highly recommended to keep apt packages metadata in sync and 35 | # be able to use apt mirrors. 36 | chef.add_recipe "apt" 37 | 38 | # List the recipies you are going to work on/need. 39 | # chef.add_recipe "build-essential" 40 | # chef.add_recipe "networking_basic" 41 | 42 | # chef.add_recipe "travis_build_environment" 43 | # chef.add_recipe "git" 44 | 45 | # chef.add_recipe "java::openjdk7" 46 | # chef.add_recipe "leiningen" 47 | 48 | # chef.add_recipe "rabbitmq::with_management_plugin" 49 | 50 | # chef.add_recipe "rvm" 51 | # chef.add_recipe "rvm::multi" 52 | # chef.add_recipe "nodejs::multi" 53 | # chef.add_recipe "python::multi" 54 | 55 | # chef.add_recipe "libqt4" 56 | # chef.add_recipe "xserver" 57 | # chef.add_recipe "firefox" 58 | 59 | # chef.add_recipe "memcached" 60 | # chef.add_recipe "redis" 61 | # chef.add_recipe "riak" 62 | # chef.add_recipe "mongodb" 63 | # chef.add_recipe "mysql::client" 64 | # chef.add_recipe "mysql::server" 65 | # chef.add_recipe "postgresql::client" 66 | # chef.add_recipe "postgresql::all_packages" 67 | # chef.add_recipe "couchdb::ppa" 68 | # chef.add_recipe "neo4j-server::tarball" 69 | # chef.add_recipe "firebird" 70 | 71 | # chef.add_recipe "elasticsearch" 72 | # chef.add_recipe "cassandra::datastax" 73 | # chef.add_recipe "hbase::ppa" 74 | # chef.add_recipe "pypy::ppa" 75 | 76 | 77 | # chef.json.merge!({ 78 | # :apt => { 79 | # :mirror => :ru 80 | # }, 81 | # :rvm => { 82 | # :rubies => [ 83 | # { :name => "1.8.7" }, 84 | # { :name => "rbx-head", :arguments => "--branch 2.0.testing", :using => "1.8.7" }, 85 | # { :name => "jruby-d19", :arguments => "--19" }, 86 | # { :name => "ruby-head-s92b6597be67738490c0ab759303a0e81a421b89a" }, 87 | # { :name => "1.9.3" }, 88 | # { :name => "rbx-head-d19", :arguments => "--branch 2.0.testing --19", :using => "1.9.3" }, 89 | # { :name => "jruby" }, 90 | # { :name => "jruby-head" }, 91 | # { :name => "1.9.2" }, 92 | # ], 93 | # :aliases => { 94 | # "rbx" => "rbx-head", 95 | # "rbx-2.0" => "rbx-head", 96 | # "rbx-2.0.pre" => "rbx-head" 97 | # } 98 | # }, 99 | # :mysql => { 100 | # :server_root_password => "" 101 | # }, 102 | # :postgresql => { 103 | # :max_connections => 256 104 | # } 105 | # }) 106 | end 107 | end 108 | --------------------------------------------------------------------------------