-
Notifications
You must be signed in to change notification settings - Fork 600
/
Vagrantfile
165 lines (133 loc) · 9.35 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "centos5-build" do |c|
c.vm.hostname = "centos-build"
c.vm.box = "bento/centos-5.11"
c.vm.provision "shell", inline: "rpm -qa | grep -qw epel-release || (cd /tmp && wget http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm && sudo rpm -U epel-release-5*.noarch.rpm)"
c.vm.provision "shell", inline: "rpm -qa | grep -qw 'git\|rpm-build\|python-configobj' || sudo yum install -y git rpm-build python-configobj"
c.vm.provision "shell", inline: "cp -rf /vagrant /tmp/Diamond"
c.vm.provision "shell", inline: "cd /tmp/Diamond && make rpm"
c.vm.provision "shell", inline: "cd /tmp/Diamond/dist && sudo bash -c 'for f in *.src.rpm; do mv $f `basename $f .src.rpm`.el5.src.rpm; done;'"
c.vm.provision "shell", inline: "cd /tmp/Diamond/dist && sudo bash -c 'for f in *.noarch.rpm; do mv $f `basename $f .noarch.rpm`.el5.noarch.rpm; done;'"
c.vm.provision "shell", inline: "mkdir -p /vagrant/dist/el5 && (cp -f /tmp/Diamond/dist/* /vagrant/dist/el5/ || grep -v 'cannot stat')"
end
config.vm.define "centos6-build" do |c|
c.vm.hostname = "centos-build"
c.vm.box = "bento/centos-6.9"
c.vm.provision "shell", inline: "sudo yum install -y git rpm-build python-configobj"
c.vm.provision "shell", inline: "cp -rf /vagrant /tmp/Diamond"
c.vm.provision "shell", inline: "cd /tmp/Diamond && make rpm"
c.vm.provision "shell", inline: "cd /tmp/Diamond/dist && sudo bash -c 'for f in *.src.rpm; do mv $f `basename $f .src.rpm`.el6.src.rpm; done;'"
c.vm.provision "shell", inline: "cd /tmp/Diamond/dist && sudo bash -c 'for f in *.noarch.rpm; do mv $f `basename $f .noarch.rpm`.el6.noarch.rpm; done;'"
c.vm.provision "shell", inline: "mkdir -p /vagrant/dist/el6 && (cp -f /tmp/Diamond/dist/* /vagrant/dist/el6/ || grep -v 'cannot stat')"
end
config.vm.define "centos7-build" do |c|
c.vm.hostname = "centos-build"
c.vm.box = "bento/centos-7.3"
c.vm.provision "shell", inline: "sudo yum install -y git rpm-build python-configobj"
c.vm.provision "shell", inline: "cp -rf /vagrant /tmp/Diamond"
c.vm.provision "shell", inline: "cd /tmp/Diamond && make rpm"
c.vm.provision "shell", inline: "cd /tmp/Diamond/dist && sudo bash -c 'for f in *.src.rpm; do mv $f `basename $f .src.rpm`.el7.src.rpm; done;'"
c.vm.provision "shell", inline: "cd /tmp/Diamond/dist && sudo bash -c 'for f in *.noarch.rpm; do mv $f `basename $f .noarch.rpm`.el7.noarch.rpm; done;'"
c.vm.provision "shell", inline: "mkdir -p /vagrant/dist/el6 && (cp -f /tmp/Diamond/dist/* /vagrant/dist/el6/ || grep -v 'cannot stat')"
end
config.vm.define "ubuntu-build" do |c|
c.vm.hostname = "ubuntu-build"
c.vm.box = "bento/ubuntu-12.04"
c.vm.provision "shell", inline: "sudo apt-get update"
c.vm.provision "shell", inline: "sudo apt-get install -y make git pbuilder python-mock python-configobj python-support cdbs"
c.vm.provision "shell", inline: "cp -rf /vagrant /tmp/Diamond"
c.vm.provision "shell", inline: "cd /tmp/Diamond && make deb"
c.vm.provision "shell", inline: "mkdir -p /vagrant/dist/deb && (cp -f /tmp/Diamond/build/*.deb /vagrant/dist/deb/ || grep -v 'cannot stat')"
end
config.vm.define "centos6-devel" do |c|
c.vm.hostname = "centos-devel"
c.vm.box = "bento/centos-6.9"
c.vm.provision "shell", inline: "sudo rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm"
c.vm.provision "shell", inline: "sudo yum install -y git rpm-build python-configobj python-test python-mock tree vim-enhanced"
end
config.vm.define "centos7-devel" do |c|
c.vm.hostname = "centos7-devel"
c.vm.box = "bento/centos-7.3"
c.vm.provision "shell", inline: "sudo rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm"
c.vm.provision "shell", inline: "sudo yum install -y git rpm-build python-configobj python-test python-mock tree vim-enhanced MySQL-python gcc"
end
config.vm.define "centos6-test" do |c|
c.vm.hostname = "centos-devel"
c.vm.box = "bento/centos-6.9"
c.vm.provision "shell", inline: "sudo rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm"
c.vm.provision "shell", inline: "sudo yum install -y git rpm-build python-configobj python-test python-mock tree vim-enhanced MySQL-python htop gcc"
# Install python libraries needed by specific collectors
c.vm.provision "shell", inline: "sudo yum install -y postgresql-devel" # req for psycopg2
c.vm.provision "shell", inline: "sudo yum install -y Cython" # req for pyutmp
c.vm.provision "shell", inline: "sudo yum install -y lm_sensors-devel lm_sensors python-devel" # req for pyutmp
c.vm.provision "shell", inline: "sudo yum install -y python-pip"
c.vm.provision "shell", inline: "sudo pip install psycopg2==2.6.2" # 2.7 requires PG 9.1+
c.vm.provision "shell", inline: "sudo pip install -r /vagrant/.travis.requirements.txt"
# Setup Diamond to run as a service
c.vm.provision "shell", inline: "sudo yum install -y python-setuptools"
c.vm.provision "shell", inline: "sudo mkdir -m 0750 /var/log/diamond"
c.vm.provision "shell", inline: "sudo ln -s /vagrant/conf/vagrant /etc/diamond"
c.vm.provision "shell", inline: "sudo ln -s /vagrant/bin/diamond /usr/bin/diamond"
c.vm.provision "shell", inline: "sudo ln -s /vagrant/src/diamond /usr/lib/python2.7/site-packages/diamond"
c.vm.provision "shell", inline: "sudo ln -s /vagrant/bin/init.d/diamond /etc/init.d/diamond"
# Start diamond
c.vm.provision "shell", inline: "sudo service diamond start"
end
config.vm.define "centos7-test" do |c|
c.vm.hostname = "centos7-test"
c.vm.box = "bento/centos-7.3"
c.vm.provider "virtualbox" do |v|
v.memory = 1024
v.cpus = 2
end
c.vm.provision "shell", inline: "sudo rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm"
c.vm.provision "shell", inline: "sudo yum install -y git rpm-build python-configobj python-test python-mock tree vim-enhanced MySQL-python htop gcc"
# Install python libraries needed by specific collectors
c.vm.provision "shell", inline: "sudo yum install -y postgresql-devel" # req for psycopg2
c.vm.provision "shell", inline: "sudo yum install -y Cython" # req for pyutmp
c.vm.provision "shell", inline: "sudo yum install -y lm_sensors-devel lm_sensors python-devel" # req for pyutmp
c.vm.provision "shell", inline: "sudo yum install -y python-pip"
c.vm.provision "shell", inline: "sudo pip install -r /vagrant/.travis.requirements.txt"
# Setup Diamond to run as a service
c.vm.provision "shell", inline: "sudo yum install -y python-setuptools"
c.vm.provision "shell", inline: "sudo mkdir /var/log/diamond"
c.vm.provision "shell", inline: "sudo ln -s /vagrant/conf/vagrant /etc/diamond"
c.vm.provision "shell", inline: "sudo ln -s /vagrant/bin/diamond /usr/bin/diamond"
c.vm.provision "shell", inline: "sudo ln -s /vagrant/src/diamond /usr/lib/python2.7/site-packages/diamond"
c.vm.provision "shell", inline: "sudo ln -s /vagrant/rpm/systemd/diamond.service /usr/lib/systemd/system/diamond.service"
# Install other components to test with
## Redis
c.vm.provision "shell", inline: "sudo yum install -y redis"
c.vm.provision "shell", inline: "sudo systemctl start redis.service"
# Build Diamond docs and run tests
c.vm.provision "shell", inline: "sudo pip install pep8==1.5.7"
c.vm.provision "shell", inline: "echo 'Build docs...' && python /vagrant/build_doc.py"
c.vm.provision "shell", inline: "echo 'Running tests...' && python /vagrant/test.py"
c.vm.provision "shell", inline: "echo 'Running pep8...' && pep8 --config=/vagrant/.pep8 /vagrant/src /vagrant/bin/diamond /vagrant/bin/diamond-setup /vagrant/build_doc.py /vagrant/setup.py /vagrant/test.py"
# Start diamond
c.vm.provision "shell", inline: "sudo systemctl start diamond.service"
end
config.vm.define "ubuntu1604-test" do |c|
c.vm.hostname = "ubuntu1604-test"
c.vm.box = "bento/ubuntu-16.04"
c.vm.provision "shell", inline: "sudo apt-get update"
c.vm.provision "shell", inline: "sudo apt-get install -y make git pbuilder python-mock python-configobj dh-python cdbs"
# Install python libraries needed by specific collectors
c.vm.provision "shell", inline: "sudo apt-get install -y libmysqlclient-dev" # req for MySQL-python
c.vm.provision "shell", inline: "sudo apt-get install -y lm-sensors" # req for pyutmp
c.vm.provision "shell", inline: "sudo apt-get install -y python-pip"
c.vm.provision "shell", inline: "sudo pip install -r /vagrant/.travis.requirements.txt"
# Setup Diamond to run as a service
c.vm.provision "shell", inline: "sudo apt-get install -y python-setuptools"
c.vm.provision "shell", inline: "sudo mkdir /var/log/diamond"
c.vm.provision "shell", inline: "sudo ln -s /vagrant/conf/vagrant /etc/diamond"
c.vm.provision "shell", inline: "sudo ln -s /vagrant/bin/diamond /usr/bin/diamond"
c.vm.provision "shell", inline: "sudo ln -s /vagrant/src/diamond /usr/lib/python2.7/dist-packages/diamond"
c.vm.provision "shell", inline: "sudo ln -s /vagrant/rpm/systemd/diamond.service /lib/systemd/system/diamond.service"
# Start diamond
c.vm.provision "shell", inline: "sudo systemctl start diamond.service"
end
end