summaryrefslogtreecommitdiff
path: root/storage/mroonga/packages/apt/Vagrantfile
blob: 10a6faba115a93ad8f5423a360dc38ca20c1e91c (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
43
44
45
46
47
48
49
50
# -*- 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 => "debian-jessie-i386",
      :box => "bento/debian-8.9-i386",
    },
    {
      :id => "debian-jessie-amd64",
      :box => "bento/debian-8.9",
    },
    {
      :id => "debian-stretch-i386",
      :box_url => "http://packages.groonga.org/tmp/debian-9.0-i386.virtualbox.box",
    },
    {
      :id => "debian-stretch-amd64",
      :box => "bento/debian-9.1",
    },
  ]

  vms.each do |vm|
    config.vm.define(vm[:id]) do |node|
      # Use official box
      node.vm.box = vm[:box] if vm[:box]
      # Use box and box_url until official box is released
      node.vm.box = vm[:id] if vm[:box_url]
      node.vm.box_url = vm[:box_url] if vm[:box_url]
      node.vm.provision(:shell, :path => "build-deb.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 = (ENV["VM_CPUS"] || vm_n_cpus).to_i
        virtual_box.memory = (ENV["VM_MEMORY"] || 768).to_i
      end
    end
  end
end