forked from OpenSolo/OpenSolo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
executable file
·44 lines (33 loc) · 1.11 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.box_check_update = false
config.vm.provision "shell", path: "install-vagrant-deps.sh"
# detect number of cores,
# http://stackoverflow.com/questions/891537/detect-number-of-cpus-installed
def self.processor_count
case RbConfig::CONFIG['host_os']
when /darwin9/
`hwprefs cpu_count`.to_i
when /darwin/
((`which hwprefs` != '') ? `hwprefs thread_count` : `sysctl -n hw.ncpu`).to_i
when /linux/
`cat /proc/cpuinfo | grep processor | wc -l`.to_i
when /freebsd/
`sysctl -n hw.ncpu`.to_i
when /mswin|mingw/
require 'win32ole'
wmi = WIN32OLE.connect("winmgmts://")
cpu = wmi.ExecQuery("select NumberOfCores from Win32_Processor") # TODO count hyper-threaded in this
cpu.to_enum.first.NumberOfCores
end
end
# fwd host ssh for git access
config.ssh.forward_agent = true
config.vm.provider "virtualbox" do |vb|
# not recommended to use less than 6GB
vb.memory = "6144"
vb.cpus = processor_count
end
end