Skip to content

Commit

Permalink
Merge pull request #96 from jongiddy/http-proxy-config
Browse files Browse the repository at this point in the history
Add network proxy configuration settings
  • Loading branch information
grtjn committed May 26, 2016
2 parents d987148 + cc6d4ae commit 8bba82b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ You first need to download and install prerequisites and mlvagrant itself:
- Download and install [Vagrant](https://www.vagrantup.com/downloads.html)
- Install the [vagrant-hostmanager](https://github.com/smdahlen/vagrant-hostmanager) plugin:
- `vagrant plugin install vagrant-hostmanager`
- If a proxy is required to access the external network, install the [vagrant-proxyconf](https://github.com/tmatilai/vagrant-proxyconf) plugin:
- `vagrant plugin install vagrant-proxyconf`
- Create /space/software (**For Windows**: `c:\space\software`):
- `sudo mkdir -p /space/software`
- Make sure Vagrant has write access to that folder:
Expand Down Expand Up @@ -137,6 +139,14 @@ Note: enabling this makes your VMs accessible from outside, beware of security l
### priv_net_ip
Assign dedicated private IP to master node - slaves get same ip + i

### net_proxy
URL for a network proxy for FTP, HTTP, and HTTPS requests

Use of this setting requires installation of the `vagrant-proxyconf` plugin

### no_proxy
Hostnames or IP addresses that do not require use of the network proxy

### shared_folder_host/shared_folder_guest
Mount an extra folder from host on vm - project dir is automatically shared as /vagrant

Expand Down
14 changes: 14 additions & 0 deletions project/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ end
@priv_net_ip = ENV["MLV_PRIV_NET_IP"] || @properties["PRIV_NET_IP"] || ""
@shared_folder_host = ENV["MLV_SHARED_FOLDER_HOST"] || @properties["SHARED_FOLDER_HOST"] || ""
@shared_folder_guest = ENV["MLV_SHARED_FOLDER_GUEST"] || @properties["SHARED_FOLDER_GUEST"] || ""
@net_proxy = ENV["MLV_NET_PROXY"] || @properties["NET_PROXY"] || ""
@no_proxy = ENV["MLV_NO_PROXY"] || @properties["NO_PROXY"] || "localhost,127.0.0.1"

unless @net_proxy.empty? or Vagrant.has_plugin?("vagrant-proxyconf")
abort 'To use net_proxy setting, run "vagrant plugin install vagrant-proxyconf" first.'
end

@vm_name = get_vm_name("{i}")

Expand Down Expand Up @@ -134,6 +140,14 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

mastername = get_vm_name(1)

unless @net_proxy.empty?
hostnames = (1..@nr_hosts).map{|i| get_vm_name(i)}.join(",")
config.proxy.ftp = @net_proxy
config.proxy.http = @net_proxy
config.proxy.https = @net_proxy
config.proxy.no_proxy = "#{@no_proxy},#{hostnames}"
end

config.hostmanager.enabled = false
config.hostmanager.manage_host = true
config.hostmanager.include_offline = true
Expand Down
10 changes: 10 additions & 0 deletions project/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ master_cpus=2
#
#priv_net_ip=

##
# Network proxy - requires vagrant-proxyconf plugin
#
#net_proxy=http://proxy:8080/

##
# Hosts that do not require network proxy
#
#no_proxy=localhost,127.0.0.1

##
# Mount an extra folder from host on vm - project dir is automatically shared as /vagrant
#
Expand Down

0 comments on commit 8bba82b

Please sign in to comment.