Skip to content

Instantly share code, notes, and snippets.

@thbar
Created January 9, 2011 21:23
Show Gist options
  • Save thbar/772034 to your computer and use it in GitHub Desktop.
Save thbar/772034 to your computer and use it in GitHub Desktop.
Rakefile
# apt update first or the build-essential will meet issues
include_recipe "apt"
include_recipe "build-essential"
include_recipe "rvm"
# upgrade the lucid32 box to 0.9.12
gem_package "chef" do
action :install
version "0.9.12"
end
# require for nokogiri, which is required for sunspot-installer
['libxslt1-dev','libxml2-dev'].each do |pkg|
package pkg do
action :install
end
end
# Rakefile allowing a two-phase work with Vagrant:
# - first bootstrap from the lucid32 box but applies what's missing
# - then regular cookbook development
def system!(cmd)
puts "Running #{cmd}"
raise "Error running #{cmd}!" unless system(cmd)
end
task :bootstrap do
system!("vagrant destroy")
ENV['HACKER_BOOTSTRAP'] = '1'
system!("vagrant up")
ENV['HACKER_BOOTSTRAP'] = nil
system!("vagrant package")
system("vagrant box remove hackerbooks")
system!("vagrant box add hackerbooks package.box")
system!("rm package.box")
system!("vagrant destroy")
system!("vagrant up")
end
Vagrant::Config.run do |config|
if ENV['HACKER_BOOTSTRAP']
# initial bootstrapping
config.vm.box = "lucid32"
config.vm.provisioner = :chef_solo
config.chef.cookbooks_path = "../chef-solo/cookbooks"
# config.chef.log_level = :debug
config.chef.add_recipe "vagrant-tweaks"
else
config.vm.box = "hackerbooks"
config.vm.provisioner = :chef_solo
config.chef.cookbooks_path = File.expand_path("../chef-solo/cookbooks")
# config.chef.log_level = :debug
config.chef.add_recipe "jetty-sunspot"
config.vm.forward_port("solr-admin", 8983, 8984)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment