|
1 | | -# -*- mode: ruby -*- |
2 | | -# vi: set ft=ruby : |
3 | 1 |
|
4 | | -VAGRANTFILE_API_VERSION = "2" |
5 | | - |
6 | | -Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| |
7 | | - |
8 | | - # Give each controller and node additional memory |
9 | | - config.vm.provider :virtualbox do |v| |
10 | | - v.customize ["modifyvm", :id, "--memory", 2048] |
11 | | - end |
| 2 | +Vagrant.configure("2") do |config| |
| 3 | + config.vm.box = "deis-node" |
12 | 4 |
|
13 | | - # Deis Nodes |
| 5 | + # This is the vanilla Ubunutu 12.04 Precise box. It's about 350MB |
14 | 6 | config.vm.box_url = "https://s3-us-west-2.amazonaws.com/opdemand/deis-node.box" |
15 | | - config.vm.box = "deis-node" |
16 | 7 |
|
17 | | - # Deis Controller |
18 | | - config.vm.define "deis-controller", primary: true do |controller| |
19 | | - controller.vm.hostname = "deis-controller" |
20 | | - controller.vm.network "private_network", ip: "192.168.61.100" |
21 | | - end |
| 8 | + # This is a premade Deis controller box, probably 12.04, need to check. It's about 1.1GB |
| 9 | + # config.vm.box_url = "https://s3-us-west-2.amazonaws.com/opdemand/deis-controller.box" |
22 | 10 |
|
23 | | - # Node 1 |
24 | | - config.vm.define "deis-node-1" do |node1| |
25 | | - node1.vm.hostname = "deis-node-1" |
26 | | - node1.vm.network "private_network", ip: "192.168.61.101" |
27 | | - end |
| 11 | + # Avahi-daemon will broadcast the server's address as deis-controller.local |
| 12 | + config.vm.host_name = "deis-controller" |
28 | 13 |
|
29 | | - # Node 2 |
30 | | - config.vm.define "deis-node-2" do |node2| |
31 | | - node2.vm.hostname = "deis-node-2" |
32 | | - node2.vm.network "private_network", ip: "192.168.61.102" |
| 14 | + # IP will be associated to 'deis-controller.local' using avahi-daemon |
| 15 | + config.vm.network :private_network, ip: "192.168.61.100" |
| 16 | + |
| 17 | + # The Deis Controller requires at least 1G of RAM to install. |
| 18 | + # You may be able to run it with less once it's installed. |
| 19 | + config.vm.provider :virtualbox do |vb| |
| 20 | + vb.customize ["modifyvm", :id, "--memory", "1024"] |
33 | 21 | end |
34 | 22 |
|
| 23 | + # 'deis provider:discover' detects the host machine's user and IP address, however, that command cannot |
| 24 | + # be guareteed to run inside the deis codebase. Therefore we can't use that opportunity to discover |
| 25 | + # the path of the codebase on the host machine. Therefore we do it now as this Vagrantfile has to exist |
| 26 | + # inside the codebase. |
| 27 | + nodes_dir = File.dirname(__FILE__) + '/contrib/vagrant/nodes' |
| 28 | + |
| 29 | + config.vm.provision :shell, inline: <<-SCRIPT |
| 30 | + # Avahi-daemon broadcasts the machine's hostname to local DNS. |
| 31 | + # Therefore 'deis-controller.local' in this case. |
| 32 | + sudo service avahi-daemon restart |
| 33 | + # Make a record of where the deis code base is on the host machine |
| 34 | + echo "#{nodes_dir}" > /home/vagrant/.host_nodes_dir |
| 35 | + SCRIPT |
35 | 36 | end |
| 37 | + |
| 38 | +# If you want to do some funky custom stuff to your box, but don't want those things tracked by git, |
| 39 | +# add a Vagrantfile.local and it will be included. You can use the exact same syntax as above. For |
| 40 | +# example you could mount your dev version of deis onto the VM and hack live on the VM; |
| 41 | +# `config.vm.share_folder "deis", "/opt/deis", "~/myworkspace/deis" |
| 42 | +# Or if you're low on RAM you can boot the VM with less RAM. Note that at least 1GB is needed for |
| 43 | +# installation, but you may be able to get away with 512MB once everything is installed. |
| 44 | +load "Vagrantfile.local" if File.exists? "Vagrantfile.local" |
0 commit comments