-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbig.Vagrantfile
More file actions
91 lines (83 loc) · 3.2 KB
/
big.Vagrantfile
File metadata and controls
91 lines (83 loc) · 3.2 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
Vagrant.configure("2") do |config|
nodes = {
"redis_pub_sub" => {},
"sink" => {},
"w0" => { "BIG_ID" => "0" },
"w1" => { "BIG_ID" => "1" },
"w2" => { "BIG_ID" => "2" },
"w3" => { "BIG_ID" => "3" },
"w4" => { "BIG_ID" => "4" },
"w5" => { "BIG_ID" => "5" },
"w6" => { "BIG_ID" => "6" },
"w7" => { "BIG_ID" => "7" },
"w8" => { "BIG_ID" => "8" },
"w9" => { "BIG_ID" => "9" },
"w10" => { "BIG_ID" => "10" },
"w11" => { "BIG_ID" => "11" }
}
nodes.each do |name, env_vars|
config.vm.define name do |node|
node.vm.box = "generic/ubuntu2004"
ip_suffix = case name
when "sink" then 10
when "redis_pub_sub" then 9
else 11 + name[1..-1].to_i
end
node.vm.network "private_network", ip: "192.168.56.#{ip_suffix}"
node.vm.synced_folder ".", "/app"
node.vm.provision "shell", inline: <<-SHELL
apt-get update -qq && apt-get install -y docker.io linuxptp
if [ "#{name}" = "redis_pub_sub" ]; then
docker run -d --name redis --network host redis:8.2.4-alpine \
redis-server --maxmemory 256mb --maxmemory-policy allkeys-lru --save ""
exit 0
fi
# Every node gets own state store (default config is fine)
docker rm -f redis || true
docker run -d --name redis --network host redis:8.2.4-alpine
# Every node gets its own placement
docker rm -f placement || true
docker run -d --name placement --network host daprio/placement:1.16.0 ./placement --port 50006
# Sidecar
docker rm -f #{name}-sidecar || true
docker run -d \
--name #{name}-sidecar \
--network host \
-v /app/config/redis/components-vagrant:/components \
daprio/daprd:edge \
./daprd \
--app-id #{name}-sidecar \
--app-port 3000 \
--resources-path /components \
--placement-host-address localhost:50006 \
--metrics-port 9091
sleep 2
# Application
docker rm -f #{name} || true
if [ "#{name}" = "sink" ]; then
docker run -d \
--name #{name} \
--network host \
-e ROLE=sink \
-e DAPR_HTTP_ENDPOINT=http://localhost:3500 \
-e METRICS_DIRECTORY=/app/metrics \
-e DAPR_GRPC_ENDPOINT=http://localhost:50001 \
-v /app/big/runTest/metrics_#{name}:/app/metrics \
collaborativestatemachines/cirrina-baselines-big:unstable
else
docker run -d \
--name #{name} \
--network host \
-e ROLE=big \
-e BIG_ID=#{env_vars['BIG_ID']} \
-e DAPR_HTTP_ENDPOINT=http://localhost:3500 \
-e METRICS_DIRECTORY=/app/metrics \
-e DAPR_GRPC_ENDPOINT=http://localhost:50001 \
-v /app/big/runTest/metrics_#{name}:/app/metrics \
collaborativestatemachines/cirrina-baselines-big:unstable
fi
nohup bash -c 'while true; do docker stats --no-stream --format "$(date +%s),{{.Name}},{{.CPUPerc}},{{.MemUsage}}" >> /app/big/run/metrics_#{name}/docker_stats.csv; sleep 1; done' &
SHELL
end
end
end