-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathVagrantfile
125 lines (96 loc) · 4.24 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
require 'inifile'
require 'json'
# read config file
file = IniFile.load('waltz-test/src/main/python/waltz_ducktape/config.ini')
cfg = file['Vagrant Google']
Vagrant.configure("2") do |config|
# Enable hostmanager so nodes can talk to eachother by DNS
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.include_offline = false
config.vm.box = "google/gce"
# Provision waltz-storage nodes
(0..3).each do |i|
config.vm.define "storage-#{i}" do |node|
node.vm.provider :google do |google, override|
# google project & service account
google.google_project_id = cfg['GoogleProjectId']
google.google_json_key_location = cfg['GoogleJsonKeyLocation']
# gce image config
google.image = cfg['WaltzStorageImage']
google.image_project_id = cfg['GoogleProjectId']
google.disk_size = Integer(cfg['WaltzStorageBootDiskSizeGb'])
# additional image config
google.additional_disks = JSON.parse(cfg['WaltzStorageAdditionalDisks'], {:symbolize_names => true})
google.external_ip = false
google.use_private_ip = true
google.name = cfg['WaltzStorageInstanceName'] + "-#{i}"
google.machine_type = cfg['WaltzStorageInstanceMachineType']
google.zone = JSON.parse(cfg['WaltzStorageInstanceZones'])[i/3]
# the instance needs to be on the poc network
google.network = cfg['GoogleNetwork']
google.subnetwork = cfg['GoogleSubnetwork']
override.ssh.username = cfg['WaltzSshUsername']
override.ssh.private_key_path = cfg['WaltzSshPrivateKeyPath']
end
# Mount the synced folders
node.vm.synced_folder "vagrant/sync/storage", "/vagrant"
# Provision for Waltz storage
node.vm.provision "shell", path: "script/storage-provision.sh"
end
end
# Provision waltz-server nodes
(0..1).each do |i|
config.vm.define "server-#{i}" do |node|
node.vm.provider :google do |google, override|
# google project & service account
google.google_project_id = cfg['GoogleProjectId']
google.google_json_key_location = cfg['GoogleJsonKeyLocation']
# gce image config
google.image = cfg['WaltzServerImage']
google.image_project_id = cfg['GoogleProjectId']
google.disk_size = Integer(cfg['WaltzServerBootDiskSizeGb'])
google.external_ip = false
google.use_private_ip = true
google.name = cfg['WaltzServerInstanceName'] + "-#{i}"
google.machine_type = cfg['WaltzServerInstanceMachineType']
google.zone = cfg['WaltzServerInstanceZone']
google.network = cfg['GoogleNetwork']
google.subnetwork = cfg['GoogleSubnetwork']
override.ssh.username = cfg['WaltzSshUsername']
override.ssh.private_key_path = cfg['WaltzSshPrivateKeyPath']
end
# Mount the synced folders
node.vm.synced_folder "vagrant/sync/server", "/vagrant"
# Provision for Waltz server
node.vm.provision "shell", path: "script/server-provision.sh"
end
end
# Provision waltz-client nodes
(0..0).each do |i|
config.vm.define "client-#{i}" do |node|
node.vm.provider :google do |google, override|
# google project & service account
google.google_project_id = cfg['GoogleProjectId']
google.google_json_key_location = cfg['GoogleJsonKeyLocation']
# gce image config
google.image = cfg['WaltzClientImage']
google.image_project_id = cfg['GoogleProjectId']
google.disk_size = Integer(cfg['WaltzClientBootDiskSizeGb'])
google.external_ip = false
google.use_private_ip = true
google.name = cfg['WaltzClientInstanceName'] + "-#{i}"
google.machine_type = cfg['WaltzClientInstanceMachineType']
google.zone = cfg['WaltzClientInstanceZone']
google.network = cfg['GoogleNetwork']
google.subnetwork = cfg['GoogleSubnetwork']
override.ssh.username = cfg['WaltzSshUsername']
override.ssh.private_key_path = cfg['WaltzSshPrivateKeyPath']
end
# Mount the synced folders
node.vm.synced_folder "vagrant/sync/client", "/vagrant"
# Provision for Waltz client
node.vm.provision "shell", path: "script/client-provision.sh"
end
end
end