This repository has been archived by the owner on Dec 29, 2020. It is now read-only.
forked from yep/usergrid-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
114 lines (90 loc) · 3.73 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# -*- mode: ruby -*-
# # vi: set ft=ruby :
# this file starts a core os virtual machine using vagrant.
#
# based on https://github.com/coreos/coreos-vagrant/blob/master/Vagrantfile
# published under the apache license
# https://github.com/coreos/coreos-vagrant/blob/master/LICENSE
require 'fileutils'
Vagrant.require_version ">= 1.6.0"
CLOUD_CONFIG_PATH = File.join(File.dirname(__FILE__), "user-data")
CONFIG = File.join(File.dirname(__FILE__), "config.rb")
# VM configuration
$num_instances = 1
$update_channel = "stable"
$enable_serial_logging = false
$vb_gui = false
$vb_memory = 3750
$vb_cpus = 2
# Attempt to apply the deprecated environment variable NUM_INSTANCES to
# $num_instances while allowing config.rb to override it
if ENV["NUM_INSTANCES"].to_i > 0 && ENV["NUM_INSTANCES"]
$num_instances = ENV["NUM_INSTANCES"].to_i
end
if File.exist?(CONFIG)
require CONFIG
end
Vagrant.configure("2") do |config|
config.vm.box = "coreos-%s" % $update_channel
config.vm.box_version = ">= 308.0.1"
config.vm.box_url = "http://%s.release.core-os.net/amd64-usr/current/coreos_production_vagrant.json" % $update_channel
config.vm.provider :vmware_fusion do |vb, override|
override.vm.box_url = "http://%s.release.core-os.net/amd64-usr/current/coreos_production_vagrant_vmware_fusion.json" % $update_channel
end
config.vm.provider :virtualbox do |v|
# On VirtualBox, we don't have guest additions or a functional vboxsf
# in CoreOS, so tell Vagrant that so it can be smarter.
v.check_guest_additions = false
v.functional_vboxsf = false
end
# plugin conflict
if Vagrant.has_plugin?("vagrant-vbguest") then
config.vbguest.auto_update = false
end
(1..$num_instances).each do |i|
config.vm.define vm_name = "core%01d" % i do |config|
config.vm.hostname = vm_name
if $enable_serial_logging
logdir = File.join(File.dirname(__FILE__), "log")
FileUtils.mkdir_p(logdir)
serialFile = File.join(logdir, "%s-serial.txt" % vm_name)
FileUtils.touch(serialFile)
config.vm.provider :vmware_fusion do |v, override|
v.vmx["serial0.present"] = "TRUE"
v.vmx["serial0.fileType"] = "file"
v.vmx["serial0.fileName"] = serialFile
v.vmx["serial0.tryNoRxLoss"] = "FALSE"
end
config.vm.provider :virtualbox do |vb, override|
vb.customize ["modifyvm", :id, "--uart1", "0x3F8", "4"]
vb.customize ["modifyvm", :id, "--uartmode1", serialFile]
end
end
if $expose_docker_tcp
config.vm.network "forwarded_port", guest: 2375, host: ($expose_docker_tcp + i - 1), auto_correct: true
end
config.vm.provider :vmware_fusion do |vb|
vb.gui = $vb_gui
end
config.vm.provider :virtualbox do |vb|
vb.gui = $vb_gui
vb.memory = $vb_memory
vb.cpus = $vb_cpus
end
# Private networking with static IPs
# ip = "172.17.8.#{i+100}"
# config.vm.network :private_network, ip: ip
# Public networking with static IPs
ip = "192.168.1.34"
config.vm.network :public_network, ip: ip
config.vm.network "forwarded_port", guest: 8080, host: 8080, auto_correct: false # usergrid http api
# Synced folder with rsync
# Unfortunately, rsync is one of the few supported options for syncing folders on windows
config.vm.synced_folder ".", "/home/core/share", type: "rsync"
# On OSX, it is also possible to use nfs instead of rsync. It additionally supports bidirectional sync.
# config.vm.synced_folder ".", "/home/core/share", id: "core", :nfs => true, :mount_options => ['nolock,vers=3,udp']
# Run provision script
config.vm.provision :shell, :path => "provision/provision.sh", :args => ip
end
end
end