forked from cloudfoundry-attic/lattice-release
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Vagrantfile
49 lines (39 loc) · 1.96 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
system_ip = ENV["LATTICE_SYSTEM_IP"] || "192.168.11.11"
system_domain = ENV["LATTICE_SYSTEM_DOMAIN"] || "#{system_ip}.xip.io"
config.vm.network "private_network", ip: system_ip
config.vm.box = "lattice/ubuntu-trusty-64"
config.vm.box_version = '0.2.5'
config.vm.provision "shell" do |s|
populate_lattice_env_file_script = <<-SCRIPT
mkdir -pv /var/lattice/setup
echo "CONSUL_SERVER_IP=#{system_ip}" >> /var/lattice/setup/lattice-environment
echo "SYSTEM_DOMAIN=#{system_domain}" >> /var/lattice/setup/lattice-environment
echo "LATTICE_CELL_ID=cell-01" >> /var/lattice/setup/lattice-environment
echo "GARDEN_EXTERNAL_IP=#{system_ip}" >> /var/lattice/setup/lattice-environment
SCRIPT
s.inline = populate_lattice_env_file_script
end
config.vm.provision "shell" do |s|
s.inline = "cp /var/lattice/setup/lattice-environment /vagrant/.lattice-environment"
end
if Vagrant.has_plugin?("vagrant-proxyconf")
config.vm.provision "shell" do |s|
s.inline = "grep -i proxy /etc/environment >> /var/lattice/setup/lattice-environment || true"
end
end
lattice_tar_version=File.read(File.join(File.dirname(__FILE__), "Version")).chomp
if lattice_tar_version =~ /\-[[:digit:]]+\-g[0-9a-fA-F]{7,10}$/
lattice_tar_url="https://s3-us-west-2.amazonaws.com/lattice/unstable/#{lattice_tar_version}/lattice.tgz"
else
lattice_tar_url="https://s3-us-west-2.amazonaws.com/lattice/releases/#{lattice_tar_version}/lattice.tgz"
end
config.vm.provision "shell" do |s|
s.path = "cluster/scripts/install-from-tar"
s.args = ["collocated", ENV["VAGRANT_LATTICE_TAR_PATH"].to_s, lattice_tar_url]
end
config.vm.provision "shell" do |s|
s.inline = "export $(cat /var/lattice/setup/lattice-environment) && echo \"Lattice is now installed and running. You may target it with the Lattice cli via: ltc target $SYSTEM_DOMAIN\""
end
end