Browse code

Merge pull request #857 from edx/856-vagrant-port-forwarding

* Vagrantfile: Add an option to forward all ports to the vagrant host that have been ex...

Guillaume J. Charmes authored on 2013/06/15 06:37:55
Showing 1 changed files
... ...
@@ -5,6 +5,7 @@ BOX_NAME = ENV['BOX_NAME'] || "ubuntu"
5 5
 BOX_URI = ENV['BOX_URI'] || "http://files.vagrantup.com/precise64.box"
6 6
 AWS_REGION = ENV['AWS_REGION'] || "us-east-1"
7 7
 AWS_AMI    = ENV['AWS_AMI']    || "ami-d0f89fb9"
8
+FORWARD_DOCKER_PORTS = ENV['FORWARD_DOCKER_PORTS']
8 9
 
9 10
 Vagrant::Config.run do |config|
10 11
   # Setup virtual machine box. This VM configuration code is always executed.
... ...
@@ -71,3 +72,17 @@ Vagrant::VERSION >= "1.1.0" and Vagrant.configure("2") do |config|
71 71
     config.vm.box_url = BOX_URI
72 72
   end
73 73
 end
74
+
75
+if !FORWARD_DOCKER_PORTS.nil?
76
+    Vagrant::VERSION < "1.1.0" and Vagrant::Config.run do |config|
77
+        (49000..49900).each do |port|
78
+            config.vm.forward_port port, port
79
+        end
80
+    end
81
+
82
+    Vagrant::VERSION >= "1.1.0" and Vagrant.configure("2") do |config|
83
+        (49000..49900).each do |port|
84
+            config.vm.network :forwarded_port, :host => port, :guest => port
85
+        end
86
+    end
87
+end