summaryrefslogtreecommitdiffstats
path: root/storage/mroonga/packages/yum/Vagrantfile
blob: af14bc9a76b08e1c81b80935a745e76763a8b13c (plain)
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
# -*- mode: ruby -*-
# vi: set ft=ruby :

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  vms = [
    {
      :id => "centos-6-i386",
      :box => "bento/centos-6.9-i386",
    },
    {
      :id => "centos-6-x86_64",
      :box => "bento/centos-6.9",
    },
    {
      :id => "centos-7-x86_64",
      :box => "bento/centos-7.4",
    },
  ]

  vms.each do |vm|
    config.vm.define(vm[:id]) do |node|
      node.vm.box = vm[:box]
      node.vm.provision(:shell, :path => "build-rpm.sh")
      node.vm.provider("virtualbox") do |virtual_box|
        system_n_cpus = 1
        if File.exist?("/proc/cpuinfo")
          system_n_cpus = File.readlines("/proc/cpuinfo").grep(/^processor/).size
        end
        if system_n_cpus > 1
          vm_n_cpus = system_n_cpus / 2
        else
          vm_n_cpus = 1
        end
        virtual_box.cpus = vm_n_cpus
        virtual_box.memory = (ENV["VM_MEMORY"] || 1024).to_i
      end
    end
  end
end