Skip to content

Instantly share code, notes, and snippets.

@botchagalupe
Forked from seancribbs/Vagrantfile.rb
Created February 4, 2011 21:02
Show Gist options
  • Save botchagalupe/811764 to your computer and use it in GitHub Desktop.
Save botchagalupe/811764 to your computer and use it in GitHub Desktop.
$ curl -i http://localhost:8091/
HTTP/1.1 200 OK
Vary: Accept
Server: MochiWeb/1.1 WebMachine/1.7.3 (participate in the frantic)
Link: </riak>; rel="riak_kv_wm_link_walker",</mapred>; rel="riak_kv_wm_mapred",</ping>; rel="riak_kv_wm_ping",</riak>; rel="riak_kv_wm_raw",</stats>; rel="riak_kv_wm_stats"
Date: Fri, 04 Feb 2011 19:36:17 GMT
Content-Type: text/html
Content-Length: 267
<html><body><ul><li><a href="/riak">riak_kv_wm_link_walker</a></li><li><a href="/mapred">riak_kv_wm_mapred</a></li><li><a href="/ping">riak_kv_wm_ping</a></li><li><a href="/riak">riak_kv_wm_raw</a></li><li><a href="/stats">riak_kv_wm_stats</a></li></ul></body></html>
$ gem install vagrant chef
Building native extensions. This could take a while...
Building native extensions. This could take a while...
Successfully installed archive-tar-minitar-0.5.2
Successfully installed abstract-1.0.0
Successfully installed erubis-2.6.6
Successfully installed json-1.4.6
Successfully installed mario-0.0.6
Successfully installed net-ssh-2.1.0
Successfully installed net-scp-1.0.4
Successfully installed i18n-0.5.0
Successfully installed thor-0.14.6
Successfully installed ffi-0.6.3
Successfully installed virtualbox-0.8.3
Successfully installed vagrant-0.7.1
Successfully installed mixlib-config-1.1.2
Successfully installed mixlib-cli-1.2.0
Successfully installed mixlib-log-1.2.0
Successfully installed mixlib-authentication-1.1.4
Successfully installed extlib-0.9.15
Successfully installed systemu-1.2.0
Successfully installed ohai-0.5.8
Successfully installed mime-types-1.16
Successfully installed rest-client-1.6.1
Successfully installed bunny-0.6.0
Successfully installed moneta-0.6.0
Successfully installed highline-1.6.1
Successfully installed uuidtools-2.1.2
Successfully installed chef-0.9.12
26 gems installed
$ knife role create riak-vagrant
Waiting for Emacs...
WARN: HTTP Request Returned 404 Not Found: Cannot load role riak-vagrant
Created (or updated) role[riak-vagrant]
{
"name": "riak-vagrant",
"default_attributes": {
},
"json_class": "Chef::Role",
"run_list": [
// These are all the Chef recipes that will be run. We want to
// configure the firewall, install riak and auto-join.
"recipe[iptables]",
"recipe[riak]",
"recipe[riak::iptables]",
"recipe[riak::autoconf]"
],
"description": "Role for firing up a Vagrant VM with Riak autoconfigured",
"chef_type": "role",
"override_attributes": {
"riak":{
"core":{
// This is optional, but helpful to distinguish from other clusters.
"cluster_name":"vagrant",
// This binds HTTP to all network interfaces
"http":[["0.0.0.0",8098]]
},
"kv":{
// This binds PBC to all network interfaces
"pb_ip":"0.0.0.0"
},
"package":{
// This makes sure we don't download the package every
// time. The SHA256 digest of the Debian i386 package.
"source_checksum":"dfe45da061bb530aba25fae831475bdf0473f778290c4e8f1947dc1bea63e246"
}
}
}
}
$ vagrant box add chef-ubuntu http://opscode-vagrant-boxes.s3.amazonaws.com/ubuntu10.04-gems.box
[vagrant] Downloading with Vagrant::Downloaders::HTTP...
[vagrant] Downloading box: http://opscode-vagrant-boxes.s3.amazonaws.com/ubuntu10.04-gems.box
[vagrant] Extracting box...
[vagrant] Verifying box...
[vagrant] Cleaning up downloaded box...
Vagrant::Config.run do |config|
# Use the Opscode box that we downloaded.
config.vm.box = "chef-ubuntu"
# Let's give the box an IP that is accessible by the other nodes we
# will spin up.
config.vm.network "33.33.33.11"
# Forward the Riak HTTP and Protobufs ports so we can access them
# locally.
config.vm.forward_port("riak http", 8098, 8091)
config.vm.forward_port("riak pbc", 8087, 8081)
# The default box has a really tiny memory size, which might prevent
# Riak from starting. Let's give it 1GB to start. If you have less
# RAM, give it 512MB.
config.vm.customize do |vm|
vm.memory_size = 1024
end
# We're using Opscode Platform, so the provisioning method is chef_server.
config.vm.provision :chef_server do |chef|
# Substitute "ORGNAME" at the end of the URL with your organization.
chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME"
# This is the validation key you should be able to download from
# the Opscode Platform. Again, substitute "ORGNAME" with your
# organization name.
chef.validation_key_path = "../.chef/ORGNAME-validator.pem"
# Again, substitute "ORGNAME" with your organization name.
chef.validation_client_name = "ORGNAME-validator"
# Using /etc/chef will allow you to run chef-client without
# specifying the path to the config.
chef.provisioning_path = "/etc/chef"
# Let's set the node name for Chef so we can keep our local nodes
# separate from one another.
chef.node_name = "riak-fast-track-1"
# Here's where we set the role that we created earlier so the node
# will automatically install and start Riak.
chef.add_role "riak-vagrant"
# We need to set the Riak node name to use the host-only IP
# address we set above.
chef.json.merge!(:riak => {:erlang => {:node_name => "riak@33.33.33.11"}})
end
end
$ vagrant up
[default] Provisioning enabled with chef_server...
[default] Importing base box 'chef-ubuntu'...
[default] Matching MAC address for NAT networking...
[default] The guest additions on this VM do not match the install version of
VirtualBox! This may cause things such as forwarded ports, shared
folders, and more to not work properly. If any of those things fail on
this machine, please update the guest additions and repackage the
box.
Guest Additions Version: 3.2.10
VirtualBox Version: 4.0.2
[default] Running any VM customizations...
[default] Clearing any previously set forwarded ports...
[default] Forwarding ports...
[default] -- riak http: 8098 => 8091 (adapter 1)
[default] -- ssh: 22 => 2222 (adapter 1)
[default] -- riak pbc: 8087 => 8081 (adapter 1)
[default] Creating shared folders metadata...
[default] Preparing host only network...
[default] Creating new host only network for environment...
[default] Booting VM...
[default] Waiting for VM to boot. This can take a few minutes.
[default] VM booted and ready for use!
[default] Enabling host only network...
[default] Mounting shared folders...
[default] -- v-root: /vagrant
[default] Running provisioner: Vagrant::Provisioners::ChefServer...
[default] Creating folder to hold client key...
[default] Uploading chef client validation key...
[default] Generating chef JSON and uploading...
[default] Running chef-client...
[default] stdin: is not a tty
: stderr
# [snipped Chef output]
[default] [Fri, 04 Feb 2011 20:18:38 +0100] INFO: service[riak]: restarted successfully
[Fri, 04 Feb 2011 20:18:40 +0100] INFO: Chef Run complete in 48.563324 seconds
[Fri, 04 Feb 2011 20:18:40 +0100] INFO: cleaning the checksum cache
[Fri, 04 Feb 2011 20:18:40 +0100] INFO: Running report handlers
[Fri, 04 Feb 2011 20:18:40 +0100] INFO: Report handlers complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment