-
Notifications
You must be signed in to change notification settings - Fork 2
/
Vagrantfile
32 lines (24 loc) · 915 Bytes
/
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
# -*- mode: ruby -*-
# vi: set ft=ruby :
#
# Sizmek API Vagrant setup for development
#
Vagrant.configure(2) do |config|
puts "STARTING THE SIZMEK API VAGRANT BOX"
config.vm.box = "geerlingguy/ubuntu1204"
config.vm.synced_folder ".", "/home/vagrant/appnexus-api"
# Assess system RAM and CPU cores, and provision the VM with the largest reasonable resources
# We take half of the ram, and all but 1 of the cores
ram_as_bytes = /(hw.memsize: )(\d*)/.match(`sysctl hw.memsize`)[2].to_i
ram_as_megabytes = ram_as_bytes/1024/1024 #a.k.a., bytes/kilobytes/megabytes
vm_ram = ram_as_megabytes/2
cpu_core_count = /(hw.physicalcpu: )(\d*)/.match(`sysctl hw.physicalcpu`)[2].to_i
vm_cpu_cores = cpu_core_count-1
config.vm.provider "virtualbox" do |box|
box.cpus = vm_cpu_cores
box.memory = vm_ram
end
config.vm.provision "shell",
privileged: false,
path: "./provisioner"
end