This repository has been archived by the owner on Oct 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathVagrantfile
251 lines (240 loc) · 11.6 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# -*- mode: ruby -*-
# vi: set ft=ruby :
# rubocop:disable Metrics/BlockLength
#
# defines VMs for testing NAD and building NAD omnibus packages
#
# extract node version to use from common place
node_ver = File.read(File.join(File.dirname(__FILE__), '.node_version')).strip
#
# this links up these VMs with a local cosi-site for testing
#
# !!! IMPORTANT !!! -- NOT REQUIRED for NAD plugin development
#
# git clone https://github.com/circonus-labs/circonus-one-step-install
# cd src && make package # !! NOTE !! build requirements in cosi's readme...
# cd ../demo && vagrant up site
# each VM below will add an alias to /etc/hosts for 'cosi-site'
# (use http://cosi-site/install ... --cosiurl http://cosi-site/)
cosi_site_ip = '192.168.100.10'
Vagrant.configure('2') do |config|
config.vm.define 'c7', autostart: false do |c7|
c7.vm.box = 'maier/centos-7.3.1611-x86_64'
c7.vm.provider 'virtualbox' do |vb|
vb.name = 'c7_nad'
end
c7.vm.network 'private_network', ip: '192.168.100.202'
c7.vm.provision 'shell', inline: <<-SHELL
echo "#{cosi_site_ip} cosi-site" >> /etc/hosts
yum -q -e 0 makecache fast
echo "Installing needed packages for 'make install' and 'make install-rhel'"
yum -q install -y rsync gcc
echo "Installing needed packages for 'packaging/make-omnibus'"
yum -q install -y git wget rpm-build redhat-rpm-config
mkdir -p /mnt/node-agent/packages
chown -R vagrant:vagrant /mnt/node-agent
node_tgz="node-#{node_ver}-linux-x64.tar.gz"
[[ -f /vagrant/${node_tgz} ]] || {
echo "Fetching $node_tgz"
curl -sSL "https://nodejs.org/dist/#{node_ver}/${node_tgz}" -o /vagrant/$node_tgz
}
[[ -x /opt/circonus/bin/node ]] || {
echo "Installing $node_tgz"
[[ -d /opt/circonus ]] || mkdir -p /opt/circonus
tar --strip-components=1 -zxf /vagrant/$node_tgz -C /opt/circonus
}
SHELL
end
config.vm.define 'c6', autostart: false do |c6|
c6.vm.box = 'maier/centos-6.8-x86_64'
c6.vm.provider 'virtualbox' do |vb|
vb.name = 'c6_nad'
end
c6.vm.network 'private_network', ip: '192.168.100.201'
c6.vm.provision 'shell', inline: <<-SHELL
echo "#{cosi_site_ip} cosi-site" >> /etc/hosts
yum -q -e 0 makecache fast
echo "Installing needed packages for 'make install' and 'make install-rhel'"
yum -q install -y rsync gcc
echo "Installing needed packages for 'packaging/make-omnibus'"
yum -q install -y git wget rpm-build redhat-rpm-config
mkdir -p /mnt/node-agent/packages
chown -R vagrant:vagrant /mnt/node-agent
node_tgz="node-#{node_ver}-linux-x64.tar.gz"
[[ -f /vagrant/${node_tgz} ]] || {
echo "Fetching $node_tgz"
curl -sSL "https://nodejs.org/dist/#{node_ver}/${node_tgz}" -o /vagrant/$node_tgz
}
[[ -x /opt/circonus/bin/node ]] || {
echo "Installing $node_tgz"
[[ -d /opt/circonus ]] || mkdir -p /opt/circonus
tar --strip-components=1 -zxf /vagrant/$node_tgz -C /opt/circonus
}
SHELL
end
config.vm.define 'c63', autostart: false do |c63|
c63.vm.box = 'maier/centos-6.3-x86_64'
c63.vm.provider 'virtualbox' do |vb|
vb.name = 'c63_nad'
end
c63.vm.network 'private_network', ip: '192.168.100.200'
c63.vm.provision 'shell', inline: <<-SHELL
echo "#{cosi_site_ip} cosi-site" >> /etc/hosts
yum -q -e 0 makecache fast
echo "Installing needed packages for 'make install' and 'make install-rhel'"
yum -q install -y rsync gcc make
echo "Installing needed packages for 'packaging/make-omnibus'"
yum -q install -y git wget rpm-build redhat-rpm-config
mkdir -p /mnt/node-agent/packages
chown -R vagrant:vagrant /mnt/node-agent
# node_tgz="node-#{node_ver}-linux-x64.tar.gz"
# [[ -f /vagrant/${node_tgz} ]] || {
# echo "Fetching $node_tgz"
# curl -sSL "https://nodejs.org/dist/#{node_ver}/${node_tgz}" -o /vagrant/$node_tgz
# }
# [[ -x /opt/circonus/bin/node ]] || {
# echo "Installing $node_tgz"
# [[ -d /opt/circonus ]] || mkdir -p /opt/circonus
# tar --strip-components=1 -zxf /vagrant/$node_tgz -C /opt/circonus
# }
SHELL
end
config.vm.define 'u16', autostart: false do |u16|
u16.vm.box = 'maier/ubuntu-16.04-x86_64'
# prevent 'mesg: ttyname failed: Inappropriate ioctl for device' errors
u16.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'"
u16.vm.provider 'virtualbox' do |vb|
vb.name = 'u16_nad'
end
u16.vm.network 'private_network', ip: '192.168.100.212'
u16.vm.provision 'shell', inline: <<-SHELL
echo "#{cosi_site_ip} cosi-site" >> /etc/hosts
apt-get update -qq
echo "Installing needed packages for 'make install' and 'make install-ubuntu'"
apt-get install -qq gcc
echo "Installing needed packages for 'packaging/make-omnibus'"
apt-get install -qq git build-essential checkinstall python ruby ruby-dev
gem install fpm
mkdir -p /mnt/node-agent/packages
chown -R vagrant:vagrant /mnt/node-agent
node_tgz="node-#{node_ver}-linux-x64.tar.gz"
[[ -f /vagrant/${node_tgz} ]] || {
echo "Fetching $node_tgz"
curl -sSL "https://nodejs.org/dist/#{node_ver}/${node_tgz}" -o /vagrant/$node_tgz
}
[[ -x /opt/circonus/bin/node ]] || {
echo "Installing $node_tgz"
[[ -d /opt/circonus ]] || mkdir -p /opt/circonus
tar --strip-components=1 -zxf /vagrant/$node_tgz -C /opt/circonus
}
SHELL
end
config.vm.define 'u14', autostart: false do |u14|
u14.vm.box = 'maier/ubuntu-14.04-x86_64'
# prevent 'mesg: ttyname failed: Inappropriate ioctl for device' errors
u14.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'"
u14.vm.provider 'virtualbox' do |vb|
vb.name = 'u14_nad'
end
u14.vm.network 'private_network', ip: '192.168.100.211'
u14.vm.provision 'shell', inline: <<-SHELL
echo "#{cosi_site_ip} cosi-site" >> /etc/hosts
apt-get update -qq
echo "Installing needed packages for 'make install' and 'make install-ubuntu'"
apt-get install -qq gcc
echo "Installing needed packages for 'packaging/make-omnibus'"
apt-get install -qq git build-essential checkinstall python ruby ruby-dev
gem install fpm
mkdir -p /mnt/node-agent/packages
chown -R vagrant:vagrant /mnt/node-agent
node_tgz="node-#{node_ver}-linux-x64.tar.gz"
[[ -f /vagrant/${node_tgz} ]] || {
echo "Fetching $node_tgz"
curl -sSL "https://nodejs.org/dist/#{node_ver}/${node_tgz}" -o /vagrant/$node_tgz
}
[[ -x /opt/circonus/bin/node ]] || {
echo "Installing $node_tgz"
[[ -d /opt/circonus ]] || mkdir -p /opt/circonus
tar --strip-components=1 -zxf /vagrant/$node_tgz -C /opt/circonus
}
SHELL
end
config.vm.define 'o14', autostart: false do |o14|
o14.vm.box = 'maier/omnios-r151014-x86_64'
o14.vm.provider 'virtualbox' do |vb|
vb.name = 'o14_nad'
end
o14.vm.network 'private_network', ip: '192.168.100.221'
o14.vm.provision 'shell', inline: <<-SHELL
echo "#{cosi_site_ip} cosi-site" >> /etc/hosts
echo "Installing needed packages for 'make install' and 'make install-illumos'"
pkg set-publisher -g http://updates.circonus.net/omnios/r151014/ circonus
pkg install -q platform/runtime/nodejs network/rsync developer/gcc48
[[ $(grep -c "PATH" /root/.bashrc) -eq 0 ]] && {
echo '[[ -f ~/.bashrc ]] && source ~/.bashrc' >> /root/.profile
echo 'export PATH="$PATH:$(ls -d /opt/gcc*)/bin"' >> /root/.bashrc
}
SHELL
end
config.vm.define 'bsd11', autostart: false do |bsd11|
bsd11.vm.guest = :freebsd
bsd11.vm.box = 'freebsd/FreeBSD-11.0-RELEASE-p1'
# bsd11.vm.box = 'freebsd/FreeBSD-11.1-RELEASE'
bsd11.vm.synced_folder '.', '/vagrant', id: 'vagrant-root', disabled: true
bsd11.vm.synced_folder '.', '/vagrant', type: 'nfs'
# mac not set in base box, just needs to be set to something to avoid vagrant errors
bsd11.vm.base_mac = ''
bsd11.ssh.shell = 'sh'
bsd11.vm.provider 'virtualbox' do |vb|
vb.name = 'bsd11_nad'
vb.customize ['modifyvm', :id, '--memory', '2048']
vb.customize ['modifyvm', :id, '--cpus', '2']
vb.customize ['modifyvm', :id, '--hwvirtex', 'on']
vb.customize ['modifyvm', :id, '--audio', 'none']
vb.customize ['modifyvm', :id, '--nictype1', 'virtio']
vb.customize ['modifyvm', :id, '--nictype2', 'virtio']
end
bsd11.vm.network 'private_network', ip: '192.168.100.232'
bsd11.vm.provision 'shell', inline: <<-SHELL
echo "#{cosi_site_ip} cosi-site" >> /etc/hosts
echo "Installing needed packages for 'make install' and 'make install-freebsd'"
pkg install -y -q gcc node npm gmake bash logrotate curl
echo "Installing needed packages for 'packaging/make-omnibus'"
pkg install -y -q wget python git
mkdir -p /mnt/node-agent/packages
chown -R vagrant:vagrant /mnt/node-agent
if [ $(grep -c fdescfs /etc/fstab) -eq 0 ]; then
mount -t fdescfs fdescfs /dev/fd
echo 'fdescfs /dev/fd fdescfs rw,late 0 0' >> /etc/fstab
fi
SHELL
end
config.vm.define 'bsd10', autostart: false do |bsd10|
bsd10.vm.guest = :freebsd
bsd10.vm.box = 'freebsd/FreeBSD-10.3-RELEASE'
bsd10.vm.synced_folder '.', '/vagrant', id: 'vagrant-root', disabled: true
bsd10.vm.synced_folder '.', '/vagrant', type: 'nfs'
# mac not set in base box, just needs to be set to something to avoid vagrant errors
bsd10.vm.base_mac = ''
bsd10.ssh.shell = 'sh'
bsd10.vm.provider 'virtualbox' do |vb|
vb.name = 'bsd10_nad'
vb.customize ['modifyvm', :id, '--memory', '2048']
vb.customize ['modifyvm', :id, '--cpus', '2']
vb.customize ['modifyvm', :id, '--hwvirtex', 'on']
vb.customize ['modifyvm', :id, '--audio', 'none']
vb.customize ['modifyvm', :id, '--nictype1', 'virtio']
vb.customize ['modifyvm', :id, '--nictype2', 'virtio']
end
bsd10.vm.network 'private_network', ip: '192.168.100.231'
bsd10.vm.provision 'shell', inline: <<-SHELL
echo "#{cosi_site_ip} cosi-site" >> /etc/hosts
echo "Installing needed packages for 'make install' and 'make install-freebsd'"
pkg install -y -q gcc node npm gmake bash logrotate curl
if [ $(grep -c fdescfs /etc/fstab) -eq 0 ]; then
mount -t fdescfs fdescfs /dev/fd
echo 'fdescfs /dev/fd fdescfs rw,late 0 0' >> /etc/fstab
fi
SHELL
end
end