This repository has been archived by the owner on Sep 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Vagrantfile
92 lines (73 loc) · 2.92 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
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
92
# -*- mode: ruby -*-
# vi: set ft=ruby :
WORKER_NAME_PREFIX = "taskmanager"
MASTER_NAME = "jobmanager"
MASTER_IP = "192.168.10.100"
WORKER_IP_TEMPLATE = "192.168.10.%d"
NUMBER_OF_WORKER_INSTANCES = 2
VAGRANTFILE_API_VERSION = "2"
def workername(i)
workername = "%s-%02d" % [WORKER_NAME_PREFIX, i]
return workername
end
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'"
# set up flink master
config.vm.define(MASTER_NAME, autostart: false) do |master|
master.vm.box = "ubuntu/trusty64"
master.vm.hostname = MASTER_NAME
master.vm.network "private_network", ip: MASTER_IP
master.vm.provider :virtualbox do |vb|
vb.name = $master_name
vb.memory = 1024
vb.cpus = 1
vb.customize ["modifyvm", :id, "--nic2", "hostonly"]
vb.customize ["modifyvm", :id, "--nicpromisc2", "allow-all"]
end
master.vm.provision "shell", path: "scripts/setup-os.sh", privileged:false
master.vm.provision "shell", path: "scripts/setup-java.sh", privileged:false
master.vm.provision "shell" do |s|
s.path = "scripts/setup-flink.sh"
s.args = " -t #{NUMBER_OF_WORKER_INSTANCES}"
s.privileged=false
end
# Set up passwordless ssh
master.vm.provision "shell" do |s|
s.path = "scripts/setup-ssh.sh"
s.args = "#{NUMBER_OF_WORKER_INSTANCES}"
s.privileged=false
end
# start flink cluster
master.vm.provision "shell", path: "scripts/start-flink-cluster.sh", privileged:false
master.vm.network "forwarded_port", guest: 8080, host: 8080
master.vm.network "forwarded_port", guest: 8081, host: 8081
master.vm.network "forwarded_port", guest: 6123, host: 6123
master.vm.network "forwarded_port", guest: 22, host: 2220, id: 'ssh'
end
# set up flink workers
(1..NUMBER_OF_WORKER_INSTANCES).each do |i|
vm_name = "%s-%02d" % [WORKER_NAME_PREFIX, i]
vm_static_ip = WORKER_IP_TEMPLATE % [100 + i]
vm_ssh_host_port = "222%01d" % [i]
config.vm.define(vm_name) do |worker|
worker.vm.box = "ubuntu/trusty64"
worker.vm.hostname = vm_name
worker.vm.network "private_network", ip: vm_static_ip
worker.vm.provider :virtualbox do |vb|
vb.name = vm_name
vb.memory = 1024
vb.cpus = 1
vb.customize ["modifyvm", :id, "--nic2", "hostonly"]
vb.customize ["modifyvm", :id, "--nicpromisc2", "allow-all"]
end
worker.vm.provision "shell", path: "scripts/setup-os.sh", privileged:false
worker.vm.provision "shell", path: "scripts/setup-java.sh", privileged:false
worker.vm.provision "shell" do |s|
s.path = "scripts/setup-flink.sh"
s.args = " -t #{NUMBER_OF_WORKER_INSTANCES}"
s.privileged=false
end
worker.vm.network "forwarded_port", guest: 22, host: vm_ssh_host_port, id: 'ssh'
end
end
end