1
1
# -*- mode: ruby -*-
2
2
# vi: set ft=ruby :
3
3
4
+ # Load in custom vagrant settings
5
+ if File . file? ( "vagrant.yml" )
6
+ require 'yaml'
7
+ custom_settings = YAML . load_file 'vagrant.yml'
8
+ puts '== Using Custom Vagrant Settings =='
9
+ end
10
+
4
11
VAGRANTFILE_API_VERSION = "2"
5
12
6
13
$box = 'coderwall'
@@ -21,24 +28,39 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
21
28
22
29
config . vm . network :private_network , ip : '192.168.237.95' # 192.168.cdr.wl
23
30
24
- # Rails
25
- config . vm . network :forwarded_port , guest : 3000 , host : 3000
26
-
27
- # Postgres
28
- config . vm . network :forwarded_port , guest : 5432 , host : 2200
29
- # Redis
30
- config . vm . network :forwarded_port , guest : 6379 , host : 2201
31
- # ElasticSearch
32
- config . vm . network :forwarded_port , guest : 9200 , host : 9200
33
- # MongoDB
34
- config . vm . network :forwarded_port , guest : 27017 , host : 27017
31
+ # Use custom settings unless they don't exist
32
+ unless custom_settings . nil?
33
+ config . vm . network :forwarded_port , guest : 3000 , host : custom_settings [ 'network' ] [ 'port_mappings' ] [ 'rails' ]
34
+ config . vm . network :forwarded_port , guest : 5432 , host : custom_settings [ 'network' ] [ 'port_mappings' ] [ 'postgres' ]
35
+ config . vm . network :forwarded_port , guest : 6379 , host : custom_settings [ 'network' ] [ 'port_mappings' ] [ 'redis' ]
36
+ config . vm . network :forwarded_port , guest : 9200 , host : custom_settings [ 'network' ] [ 'port_mappings' ] [ 'elasticsearch' ]
37
+ config . vm . network :forwarded_port , guest : 27017 , host : custom_settings [ 'network' ] [ 'port_mappings' ] [ 'mongodb' ]
38
+ else
39
+ # Rails
40
+ config . vm . network :forwarded_port , guest : 3000 , host : 3000
41
+ # Postgres
42
+ config . vm . network :forwarded_port , guest : 5432 , host : 2200
43
+ # Redis
44
+ config . vm . network :forwarded_port , guest : 6379 , host : 2201
45
+ # ElasticSearch
46
+ config . vm . network :forwarded_port , guest : 9200 , host : 9200
47
+ # MongoDB
48
+ config . vm . network :forwarded_port , guest : 27017 , host : 27017
49
+ end
35
50
36
51
config . vm . synced_folder '.' , '/home/vagrant/web' , nfs : true
37
52
38
53
config . vm . provider :virtualbox do |vb |
39
- vb . customize [ 'modifyvm' , :id , '--cpus' , '4' ]
54
+ # Use custom settings unless they don't exist
55
+ unless custom_settings . nil?
56
+ vb . customize [ 'modifyvm' , :id , '--cpus' , custom_settings [ 'virtualbox' ] [ 'cpus' ] ]
57
+ vb . customize [ 'modifyvm' , :id , '--memory' , custom_settings [ 'virtualbox' ] [ 'memory' ] ]
58
+ else
59
+ vb . customize [ 'modifyvm' , :id , '--cpus' , '4' ]
60
+ vb . customize [ 'modifyvm' , :id , '--memory' , '4096' ]
61
+ end
62
+
40
63
vb . customize [ 'modifyvm' , :id , '--ioapic' , 'on' ]
41
- vb . customize [ 'modifyvm' , :id , '--memory' , '4096' ]
42
64
43
65
# https://github.com/mitchellh/vagrant/issues/1807
44
66
# whatupdave: my VM was super slow until I added these:
0 commit comments