forked from vernemq/vernemq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
72 lines (64 loc) · 2.42 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
# _*_ mode: ruby _*_
# vi: set ft=ruby :
$script = <<SCRIPT
if [ "$2" = "apt" ]; then
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get -y upgrade
if [ "$1" = "precise" ]; then
# precise comes with a too old version of git, not compatible with rebar3
sudo apt-get install -y software-properties-common python-software-properties
sudo add-apt-repository -y ppa:git-core/ppa
# precise comes with a too old C++ compiler, not compatible with mzmetrics
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get -y install build-essential gcc-4.8 g++-4.8
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50
fi
sudo apt-get -y install curl build-essential git packaging-dev libssl-dev openssl libncurses5-dev
elif [ "$2" = "yum" ]; then
sudo yum -y update
sudo yum -y groupinstall 'Development Tools'
sudo yum -y install curl git ncurses-devel openssl openssl-devel
fi
curl -O https://raw.githubusercontent.com/yrashk/kerl/master/kerl
chmod a+x kerl
./kerl update releases
./kerl build $4 $4
mkdir -p erlang-$4
./kerl install $4 erlang-$4/
. erlang-$4/activate
if cd vernemq; then
git checkout master
git pull
else
git clone git://github.com/erlio/vernemq vernemq
cd vernemq
fi
git checkout $3
make rel
SCRIPT
$vernemq_release = '1.7.0'
$erlang_release = '20.3'
$configs = {
:jessie => {:sys => :apt, :img => 'debian/jessie64'},
:wheezy => {:sys => :apt, :img => 'debian/wheezy64'},
:trusty => {:sys => :apt, :img => 'ubuntu/trusty64', :primary => true},
:precise => {:sys => :apt, :img => 'ubuntu/precise64'},
:centos7 => {:sys => :yum, :img => 'puppetlabs/centos-7.0-64-nocm'},
:xenial => {:sys => :apt, :img => 'ubuntu/xenial64'},
}
Vagrant.configure(2) do |config|
$configs.each do |dist, dist_config|
config.vm.define dist,
primary: dist_config[:primary],
autostart: dist_config[:primary] do |c|
c.vm.box = dist_config[:img]
c.vm.provision :shell do |s|
s.privileged = false
s.inline = $script
s.args = ["#{dist}", "#{dist_config[:sys]}", $vernemq_release, $erlang_release]
end
end
end
end