-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
75 lines (60 loc) · 2.17 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
#!/usr/bin/env ruby
# method to insert a ssh key into the vm
require_relative './data/ansible/utils/key_authorization'
# prebuilt image types
# those are the defaults if the provider is set to virtualbox
# more machines are available at https://atlas.hashicorp.com/boxes/search
ubuntu_box = 'ubuntu/trusty64'
open_suse_box = 'webhippie/opensuse-13.2'
box_type = ubuntu_box
ip_address = '192.168.34.11'
rsa_key = '~/.ssh/vagrant_rsa.pub'
host_name = 'vak.telemetry.dev'
# https://docs.vagrantup.com/v2/providers/index.html
# possible values: docker, vmware, hyper-v
# additional plugins are available
vm_provider = 'virtualbox'
if (ENV['VAK_PROVIDER'].to_s == 'parallels')
vm_provider = ENV['VAK_PROVIDER']
ubuntu_box = 'parallels/ubuntu-14.04'
open_suse_box = 'bento/opensuse-13.2-x86_64'
end
if (ENV['box_type'].to_s == 'opensuse')
box_type = open_suse_box
end
# ports that should be forwarded to the host
ports = [
{ 'guest' => 3000, 'host' => 3000 }, # application
{ 'guest' => 8091, 'host' => 8091 }, # couchbase server admin panel
{ 'guest'=> 11210, 'host' => 11210 }, # client
{ 'guest'=> 4984, 'host' => 4984 }, # gateway
{ 'guest' => 4985, 'host' => 4985 } #gateway
]
Vagrant.configure(2) do | config |
# inserts a key into the machine so we can work on it
# emulates a remote machine workflow
# otherwise using vagrant ssh also works
authorize_key_for_root config, rsa_key
# disable librarian chef plugin
if Vagrant.has_plugin?('vagrant-librarian-chef')
config.librarian_chef.enabled = false
end
# disables removal of the /etc/hosts 'vak.telemetry.dev 192.168.34.11' entry on suspend
if Vagrant.has_plugin?('vagrant-hostsupdater')
config.hostsupdater.remove_on_suspend = false
end
# configure vm values
config.vm.hostname = host_name
config.vm.box = box_type
config.vm.network 'private_network', ip: ip_address
config.vm.synced_folder './shared/app', '/home/vak/app'
# forward given ports: see ports array
ports.each do | port |
config.vm.network 'forwarded_port', guest: port['guest'], host: port['host']
end
# customize vm provider
config.vm.provider vm_provider do | vb |
vb.memory = 2048
vb.cpus = 2
end
end