-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdiningPhilosophers.Vagrantfile
More file actions
34 lines (29 loc) · 1.13 KB
/
diningPhilosophers.Vagrantfile
File metadata and controls
34 lines (29 loc) · 1.13 KB
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
Vagrant.configure("2") do |config|
nodes = {
"arbitrator" => { "RUN" => "arbitrator" },
"w0" => { "RUN" => "0" }, "w1" => { "RUN" => "1" },
"w2" => { "RUN" => "2" }, "w3" => { "RUN" => "3" },
"w4" => { "RUN" => "4" }, "w5" => { "RUN" => "5" }
}
nodes.each do |name, env_vars|
config.vm.define name do |node|
influx_metric_url = ENV['INFLUX_METRIC_URL']
node.vm.box = "generic/ubuntu2004"
ip_suffix = name == "arbitrator" ? 10 : 11 + name[1..-1].to_i
node.vm.network "private_network", ip: "192.168.56.#{ip_suffix}"
node.vm.synced_folder "./diningPhilosophers", "/app/diningPhilosophers"
node.vm.provision "shell", inline: <<-SHELL
apt-get update -qq && apt-get install -y docker.io
docker rm -f #{name} || true
docker run -d \
--name #{name} \
--network host \
-e RUN="#{env_vars['RUN']}" \
-e INFLUX_METRIC_URL="#{influx_metric_url}" \
-e METRICS_DIRECTORY="/app/run/metrics_#{name}" \
-v /app/diningPhilosophers:/app \
collaborativestatemachines/cirrina:unstable
SHELL
end
end
end