-
Notifications
You must be signed in to change notification settings - Fork 15
/
Vagrantfile
73 lines (57 loc) · 2.08 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
73
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
host_port = ENV["GIRDER_HOST_PORT"] || 8080
sync_folders = ENV["DEVELOPMENT_SYNC_FOLDERS"] || false
config.vm.network "forwarded_port", guest: 8080, host: host_port
config.vm.define "gaiavagrant" do |node| end
config.vm.provider "virtualbox" do |vb|
host = RbConfig::CONFIG['host_os']
# Give VM 1/4 system memory & access to 1/2 of the cpu cores on the host
if host =~ /darwin/
cpus = `sysctl -n hw.ncpu`.to_i
cpus = cpus / 4
# sysctl returns Bytes and we need to convert to MB
mem = `sysctl -n hw.memsize`.to_i / 1024 / 1024 / 4
elsif host =~ /linux/
cpus = `nproc`.to_i
cpus = cpus / 2
# meminfo shows KB and we need to convert to MB
mem = `grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'`.to_i / 1024 / 4
else # Guess!
cpus = 2
mem = 4096
end
vb.customize ["modifyvm", :id, "--memory", mem]
vb.customize ["modifyvm", :id, "--cpus", cpus]
vb.customize ["modifyvm", :id, "--nictype1", "virtio"]
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
end
config.vm.synced_folder ".", "/vagrant", disabled: true
if sync_folders
# This is experimental and intended for developers who are
# working directly on code in the virtualized instance,
# no support, warranty or ganuntee of correctness!
GIRDER_UID = GIRDER_GID = 1002
config.vm.synced_folder ".", "/opt/gaia", owner: GIRDER_UID, group: GIRDER_GID
end
ansible_tags = ENV["VAGRANT_ANSIBLE_TAGS"] || false
config.vm.provision "ansible" do |ansible|
ansible.verbose = "vv"
if ansible_tags
ansible.tags = ansible_tags
end
ansible.groups = {
"all" => ['gaiavagrant'],
"girder" => ['gaiavagrant'],
"mongo" => ['gaiavagrant'],
"rabbitmq" => ['gaiavagrant']
}
ansible.extra_vars = {
default_user: "vagrant"
}
ansible.playbook = "ansible/site.yml"
end
end