Skip to content

Commit b98e4d8

Browse files
author
Gabriel Monroy
committed
new vagrantfile for container-based deployment
1 parent fd9bbcf commit b98e4d8

1 file changed

Lines changed: 30 additions & 5 deletions

File tree

Vagrantfile

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
21
Vagrant.configure("2") do |config|
3-
config.vm.box = "deis-node"
2+
config.vm.box = "precise64"
43

54
# This is a preloaded Deis Ubuntu 12.04 Precise box. It's about 1GB
6-
config.vm.box_url = "https://s3-us-west-2.amazonaws.com/opdemand/deis-node.box"
5+
#config.vm.box_url = "https://s3-us-west-2.amazonaws.com/opdemand/deis-node.box"
76

87
# Avahi-daemon will broadcast the server's address as deis-controller.local
98
config.vm.host_name = "deis-controller"
109

1110
# IP will be associated to 'deis-controller.local' using avahi-daemon
1211
config.vm.network :private_network, ip: "192.168.61.100"
13-
12+
1413
# The Deis Controller requires at least 2G of RAM to install.
1514
config.vm.provider :virtualbox do |vb|
1615
vb.customize ["modifyvm", :id, "--memory", "2048"]
@@ -23,12 +22,38 @@ Vagrant.configure("2") do |config|
2322
nodes_dir = File.dirname(__FILE__) + '/contrib/vagrant/nodes'
2423

2524
config.vm.provision :shell, inline: <<-SCRIPT
25+
# install latest stable chef for subsequent provision blocks
26+
sudo apt-get install -yq curl
27+
chef-client -v | grep 10.14.2 && curl -L https://www.opscode.com/chef/install.sh | sudo bash
2628
# Avahi-daemon broadcasts the machine's hostname to local DNS.
2729
# Therefore 'deis-controller.local' in this case.
28-
sudo service avahi-daemon restart
30+
sudo apt-get install -yq avahi-daemon
2931
# Make a record of where the deis code base is on the host machine
3032
echo "#{nodes_dir}" > /home/vagrant/.host_nodes_dir
3133
SCRIPT
34+
35+
# load chef config from ~/.chef/knife.rb (requires `vagrant plugin install chef`)
36+
Chef::Config.from_file(File.join(ENV['HOME'], '.chef', 'knife.rb'))
37+
38+
config.vm.provision "chef_client" do |chef|
39+
chef.chef_server_url = Chef::Config[:chef_server_url]
40+
chef.client_key_path = Chef::Config[:client_key]
41+
chef.validation_client_name = Chef::Config[:validation_client_name]
42+
chef.validation_key_path = Chef::Config[:validation_key]
43+
chef.log_level = Chef::Config[:log_level]
44+
# TODO: replace with in-recipe public_ip lookup that handles vagrant/ec2/metal
45+
chef.json = {
46+
"deis" => {
47+
"public_ip" => "192.168.61.100"
48+
}
49+
}
50+
# define the run list
51+
chef.add_recipe 'deis::controller'
52+
# cleanup records on teardown
53+
chef.delete_node = true
54+
chef.delete_client = true
55+
end
56+
3257
end
3358

3459
# If you want to do some funky custom stuff to your box, but don't want those things tracked by git,

0 commit comments

Comments
 (0)