landrush 1.0.0 → 1.1.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +8 -8
  3. data/.rubocop.yml +1 -0
  4. data/.travis.yml +3 -0
  5. data/CHANGELOG.md +4 -4
  6. data/CONTRIBUTING.md +54 -17
  7. data/Gemfile +4 -8
  8. data/README.md +152 -40
  9. data/features/dns_resolution.feature +9 -0
  10. data/features/landrush-ip.feature +57 -0
  11. data/features/step_definitions/ip.rb +13 -0
  12. data/landrush.gemspec +3 -1
  13. data/lib/landrush/action/setup.rb +49 -10
  14. data/lib/landrush/cap/all/read_host_visible_ip_address.rb +49 -0
  15. data/lib/landrush/config.rb +17 -11
  16. data/lib/landrush/plugin.rb +2 -2
  17. data/lib/landrush/resolver_config.rb +3 -7
  18. data/lib/landrush/server.rb +48 -22
  19. data/lib/landrush/util/retry.rb +16 -0
  20. data/lib/landrush/version.rb +1 -1
  21. data/lib/landrush/win_network_config.rb +185 -0
  22. data/lib/landrush.rb +6 -1
  23. data/test/landrush/action/setup_test.rb +44 -1
  24. data/test/landrush/action/teardown_test.rb +1 -1
  25. data/test/landrush/cap/all/read_host_visible_ip_address_test.rb +87 -0
  26. data/test/landrush/cap/linux/configured_dns_servers_test.rb +1 -1
  27. data/test/landrush/cap/linux/redirect_dns_test.rb +1 -1
  28. data/test/landrush/config_test.rb +1 -1
  29. data/test/landrush/dependent_vms_test.rb +1 -1
  30. data/test/landrush/resolver_config_test.rb +1 -3
  31. data/test/landrush/server_test.rb +1 -1
  32. data/test/landrush/store_test.rb +1 -1
  33. data/test/landrush/util/rety_test.rb +50 -0
  34. data/test/landrush/win_network_config_test.rb +70 -0
  35. data/test/support/fake_ui.rb +1 -0
  36. data/test/test_helper.rb +26 -11
  37. metadata +46 -12
  38. data/Gemfile.lock +0 -178
  39. data/examples/Vagrantfile +0 -20
  40. data/issues/vbox/Vagrantfile +0 -122
  41. data/lib/landrush/cap/linux/read_host_visible_ip_address.rb +0 -47
  42. data/lib/landrush/os.rb +0 -19
  43. data/test/landrush/cap/linux/read_host_visible_ip_address_test.rb +0 -37
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dca00c2118b83c6948f4fa0dc6ed8622578a2034
4
- data.tar.gz: a7f236f3c4f9faa00693066a7abe68cb8a444909
3
+ metadata.gz: e6fdf85d7935a91c069c3502b4be6a10c97937e5
4
+ data.tar.gz: d3ee3e5dc3b09473d3a401225e97ee631d450e39
5
5
  SHA512:
6
- metadata.gz: ad79c5ea216a2e430693f94a903a6b2b72811d66737032c0ca29817447aa3fa7ccec9f819f2b370f9da93185abb6c20acaa04f143396297eb87985c89f334ddf
7
- data.tar.gz: d2f6bd9ab02449069f340633d8c9fdee567922c9b75a38447e82719c125fb4c7393962bb80d857a384bfcea74b9925816fff30fb89216622689db6eb1e594bd8
6
+ metadata.gz: 3ef9fea8ed8a474c5eb6ee8e4ee6af181c5321941c8c4a249ed9599a621daf331d4313ae436d0ccffb3d6abb2ec56b312ef0126c029c79ec44d7b2eb4c023a95
7
+ data.tar.gz: 6b09eba1246096affd1f44a999fb80048c84df0efc8b0f8db0df006dcd07aa5769980ce02992992a4f623a405087198bf910f029e75e35eba11cdf23b80f1237
data/.gitignore CHANGED
@@ -1,22 +1,22 @@
1
+ # Bundler
2
+ Gemfile.lock
3
+ .bundle
4
+
5
+ # Ruby / RVM
1
6
  .ruby-gemset
2
7
  .ruby-version
3
- *.rbc
4
- .bundle
8
+
9
+ # Rake / Build
5
10
  .yardoc
6
- InstalledFiles
7
11
  _yardoc
8
12
  coverage
9
13
  lib/bundler/man
10
14
  pkg
11
15
  rdoc
12
16
  spec/reports
13
- test/tmp
14
- test/version_tmp
15
17
  build
16
18
  tmp
17
- tags
18
-
19
- .vagrant
20
19
 
20
+ # IDE
21
21
  *.iml
22
22
  .idea
data/.rubocop.yml CHANGED
@@ -4,3 +4,4 @@ AllCops:
4
4
  Exclude:
5
5
  - 'build/**/*'
6
6
  - 'vendor/**/*'
7
+ - 'tmp/**/*'
data/.travis.yml CHANGED
@@ -1,5 +1,8 @@
1
1
  language: ruby
2
2
 
3
+ before_install:
4
+ - gem install bundler -v 1.12.5
5
+
3
6
  cache: bundler
4
7
 
5
8
  rvm:
data/CHANGELOG.md CHANGED
@@ -1,8 +1,8 @@
1
- ## [Unreleased][unreleased]
1
+ ## [1.0.0] - 2016-05-18
2
2
 
3
3
  - Added: Acceptance CI tests ([#136](https://github.com/vagrant-landrush/landrush/issues/136))
4
- - Fixed: Making sure that the right Vagrant data dir is used ([#172](https://github.com/vagrant-landrush/landrush/pull/172))
5
- - Added: Getting Landrush to work on Windows ([#170](https://github.com/vagrant-landrush/landrush/pull/170))
4
+ - Fixed: Making sure that the right Vagrant data dir is used ([#157](https://github.com/vagrant-landrush/landrush/issues/157))
5
+ - Added: Getting Landrush to work on Windows ([#16](https://github.com/vagrant-landrush/landrush/issues/16))
6
6
 
7
7
  ## [0.19.0] - 2016-03-10
8
8
  - Added: Support for libvirt provider (#138)
@@ -19,7 +19,7 @@
19
19
  ## [0.16.0] - 2015-01-18
20
20
  - Added: Support for IN::PTR records (#98)
21
21
 
22
- [unreleased]: https://github.com/phinze/landrush/compare/v0.19.0...HEAD
22
+ [1.0.0]: https://github.com/phinze/landrush/compare/v0.19.0...v1.0.0
23
23
  [0.19.0]: https://github.com/phinze/landrush/compare/v0.18.0...v0.19.0
24
24
  [0.18.0]: https://github.com/phinze/landrush/compare/v0.17.0...v0.18.0
25
25
  [0.17.0]: https://github.com/phinze/landrush/compare/v0.16.0...v0.17.0
data/CONTRIBUTING.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Contributing to Landrush
2
2
 
3
+ <!-- MarkdownTOC -->
4
+
5
+ - [Working on an issue](#working-on-an-issue)
6
+ - [Merging pull requests](#merging-pull-requests)
7
+ - [Releasing](#releasing)
8
+ - [Maintainers](#maintainers)
9
+
10
+ <!-- /MarkdownTOC -->
11
+
12
+
3
13
  The following is a set of guidelines for contributing to Landrush.
4
14
  These are just guidelines, please use your best judgment and feel free
5
15
  to propose changes to this document in a pull request.
@@ -7,24 +17,50 @@ to propose changes to this document in a pull request.
7
17
  At this point, this document is not complete, but as decisions are made
8
18
  they will be added to this document.
9
19
 
10
- ## Pull Requests
20
+ <a name="working-on-an-issue"></a>
21
+ ## Working on an issue
11
22
 
12
- * All changes should be made by pull request (PR), even from maintainers.
23
+ * All changes should have a matching issue in the GitHub [issue tracker](https://github.com/vagrant-landrush/landrush/issues). If there is none, create one.
24
+ * Prepend each commit of a porposed change with the GitHub issue key, eg `Issue #xyz Fixing foo in bar`
25
+ * All changes should be applied to master via [pull requests](https://help.github.com/articles/using-pull-requests/) (even from maintainers).
13
26
  * All changes should include documentation updates.
14
27
  * Small changes need only 1 ACK. Larger changes need 2 ACKs from
15
- maintainers before they will be merged. If the author of the PR is a
16
- maintainer, the submission is considered 1 of the 2 ACKs. Therefore PRs
28
+ maintainers before they will be merged. If the author of the pull request is a
29
+ maintainer, the submission is considered 1 of the 2 ACKs. Therefore pull requests
17
30
  from maintainers only require one additional ACK. By "2 ACKs" we mean
18
31
  that 2 maintainers must acknowledge that the change is a good one. The
19
- 2nd person to ACK the PR should merge the PR with a comment including
20
- their agreement. We default to moving forward and using revert if needed.
32
+ 2nd person to ACK the pull request should merge the pull request with a
33
+ comment including their agreement. We default to moving forward and using
34
+ revert if needed.
35
+
36
+ <a name="merging-pull-requests"></a>
37
+ ## Merging pull requests
38
+
39
+ 1. Merging committer should merge the pull request. Avoid using GitHub UI and
40
+ prefer merges over the the command line to avoid merge commits and to keep
41
+ a linear commit history:
42
+
43
+ ```
44
+ # Create a local branch for the pull request
45
+ $ git checkout -b <branch-name> master
46
+
47
+ # Pull the changes
48
+ $ git pull <remote> <branch-name>
49
+
50
+ # If necessary rebase changes on master to ensure we have a fast forward. Also resolve any conflicts
51
+ $ git rebase -i master
52
+
53
+ # Merge changes into master
54
+ $ git checkout master
55
+ $ git merge <branch-name>
21
56
 
22
- ## Merging PRs
57
+ # Update changelog in the unreleased section. Commit!
23
58
 
24
- 1. Merging committer should first merge the PR
25
- 2. Merging committer should update the changelog in the unreleased
26
- section. Using the github web UI is sufficient
59
+ # Push to origin
60
+ $ git push origin master
61
+ ```
27
62
 
63
+ <a name="releasing"></a>
28
64
  ## Releasing
29
65
 
30
66
  Prereqs:
@@ -35,14 +71,15 @@ Prereqs:
35
71
  Steps:
36
72
 
37
73
  1. Update `lib/landrush/version.rb` with version number.
38
- 2. Update `CHANGELOG.md` header with version number and current date.
39
- 3. Make release commit: `git add lib/landrush/version.rb CHANGELOG.md; git commit -m 'cut vX.Y.Z'`
40
- 4. Make release tag: `git tag -m vX.Y.Z vX.Y.Z`
41
- 5. Push release commit: `git push origin master`
42
- 6. Build release: `rake build`
43
- 7. Push released gem: `gem push pkg/landrush-X.Y.Z.gem`
44
- 8. Update CHANGELOG to add an "Unreleased" section, commit as "clean up after vX.Y.Z".
74
+ 1. Update `CHANGELOG.md` header with version number and current date.
75
+ 1. Make release commit: `git add lib/landrush/version.rb CHANGELOG.md; git commit -m 'cut vX.Y.Z'`
76
+ 1. Make release tag: `git tag -m vX.Y.Z vX.Y.Z`
77
+ 1. Push release commit: `git push origin master`
78
+ 1. Build release: `rake build`
79
+ 1. Push released gem: `gem push pkg/landrush-X.Y.Z.gem`
80
+ 1. Update CHANGELOG to add an "Unreleased" section, commit as "clean up after vX.Y.Z".
45
81
 
82
+ <a name="maintainers"></a>
46
83
  ## Maintainers
47
84
 
48
85
  * Brian Exelbierd (@bexelbie)
data/Gemfile CHANGED
@@ -3,24 +3,20 @@ source 'https://rubygems.org'
3
3
  # Can't use `gemspec` to pull in dependencies, because the landrush gem needs
4
4
  # to be in the :plugins group for Vagrant to detect and load it in development
5
5
 
6
- gem 'rubydns', '0.8.5'
7
- gem 'rake'
8
- gem 'json'
6
+ gemspec
9
7
 
10
8
  # Vagrant's special group
11
9
  group :plugins do
12
10
  gem 'landrush', path: '.'
13
11
  end
14
12
 
15
- group :test do
16
- gem 'rubocop', '~> 0.38.0'
17
- end
18
-
19
13
  group :development do
20
14
  gem 'vagrant',
21
15
  :git => 'git://github.com/mitchellh/vagrant.git',
22
- :ref => 'v1.8.1'
16
+ :ref => 'v1.8.4'
23
17
 
18
+ gem 'rake', '~> 10'
19
+ gem 'rubocop', '~> 0.38.0'
24
20
  gem 'byebug'
25
21
  gem 'mocha'
26
22
  gem 'minitest'
data/README.md CHANGED
@@ -1,10 +1,11 @@
1
1
  # Landrush: DNS for Vagrant [![Build Status](https://travis-ci.org/vagrant-landrush/landrush.png)](https://travis-ci.org/vagrant-landrush/landrush)
2
2
 
3
- Simple cross-platform DNS that's visible on both the guest and the host.
3
+ Landrush is a simple cross-platform DNS for Vagrant VMs that is visible on both,
4
+ the guest and the host.
4
5
 
5
- Landrush spins up a small DNS server and redirects DNS traffic from your
6
+ It spins up a small DNS server and redirects DNS traffic from your
6
7
  VMs to use it, automatically registering/unregistering IP addresses of guests
7
- as they come up and down.
8
+ as they come up and go down.
8
9
 
9
10
  **Note**: Windows support is currently considered experimental. If you having
10
11
  problems using Landrush on Windows please let us know.
@@ -13,7 +14,7 @@ problems using Landrush on Windows please let us know.
13
14
 
14
15
  - [Installation](#installation)
15
16
  - [Usage](#usage)
16
- - [Get started](#get-started)
17
+ - [Getting started](#getting-started)
17
18
  - [Dynamic entries](#dynamic-entries)
18
19
  - [Static entries](#static-entries)
19
20
  - [Wildcard Subdomains](#wildcard-subdomains)
@@ -25,6 +26,8 @@ problems using Landrush on Windows please let us know.
25
26
  - [Windows](#windows)
26
27
  - [Other Devices \(phone\)](#other-devices-phone)
27
28
  - [Additional CLI commands](#additional-cli-commands)
29
+ - [Miscellaneous Tricks and Tips](#miscellaneous-tricks-and-tips)
30
+ - [How to avoid providing sudo password on OS X](#how-to-avoid-providing-sudo-password-on-os-x)
28
31
  - [Development](#development)
29
32
  - [Help Out!](#help-out)
30
33
 
@@ -40,35 +43,77 @@ Install under Vagrant (1.1 or later):
40
43
  <a name="usage"></a>
41
44
  ## Usage
42
45
 
43
- <a name="get-started"></a>
44
- ### Get started
46
+ <a name="getting-started"></a>
47
+ ### Getting started
45
48
 
46
- Enable the plugin in your `Vagrantfile`:
49
+ 1. Enable the plugin in your `Vagrantfile`:
47
50
 
48
- config.landrush.enabled = true
51
+ config.landrush.enabled = true
49
52
 
50
- Bring up a machine.
53
+ 1. Bring up a machine.
51
54
 
52
- $ vagrant up
55
+ $ vagrant up
53
56
 
54
- And you should be able to get your hostname from your host:
57
+ 1. You are able to get your VM's hostname resolved on your host:
55
58
 
56
59
  $ dig -p 10053 @localhost myhost.vagrant.test
57
60
 
58
- If you shut down your guest, the entries associated with it will be removed.
61
+ 1. If you shut down your guest, the entries associated with it will be removed.
59
62
 
60
- Landrush assigns your vm's hostname from either the vagrant config (see the `examples/Vagrantfile`) or system's actual hostname by running the `hostname` command. A default of "guest-vm" is assumed if hostname is otherwise not available.
63
+ Landrush retrieves your VM's hostname from either the vagrant config
64
+ or it uses the system's actual hostname by running the `hostname` command.
65
+ A default of "guest-vm" is assumed if hostname is otherwise not available.
66
+
67
+ A Landrush example configuration could look like this:
68
+
69
+ Vagrant.configure("2") do |config|
70
+ config.vm.box = "hashicorp/precise64"
71
+
72
+ config.landrush.enabled = true
73
+
74
+ config.vm.hostname = "myhost.vagrant.test"
75
+
76
+ config.landrush.host 'static1.example.com', '1.2.3.4'
77
+ config.landrush.host 'static2.example.com', '2.3.4.5'
78
+ end
61
79
 
62
80
  <a name="dynamic-entries"></a>
63
81
  ### Dynamic entries
64
82
 
65
- Every time a VM is started, its IP address is automatically detected and a DNS record is created that maps the hostname to its IP.
83
+ Every time a VM is started, its IP address is automatically detected and a DNS record is created
84
+ that maps the hostname to its IP. The detection works by listing all configured interfaces of the
85
+ guest using [landrush-ip](https://rubygems.org/gems/landrush-ip/versions/0.2.3), picking the last
86
+ valid IP found, while ignoring any excluded interfaces.
87
+
88
+ Excluded interfaces are an array of regular expressions; the value shown here is the default used
89
+ when no explicit value for `config.landrush.host_interface_excludes` is specified in your
90
+ `Vagrantfile`:
91
+
92
+ config.landrush.host_interface_excludes = [/lo[0-9]*/, /docker[0-9]+/, /tun[0-9]+/]
93
+
94
+ If Landrush fails to detect the correct IP address (or none at all), you can extend this exclusion
95
+ range to exclude more interfaces.
66
96
 
67
- If for any reason the auto-detection detects no IP address or the wrong IP address, or you want to override it, you can do like so:
97
+ If you need or want to select an interface explicitly and you know its name, you can also tell
98
+ Landrush to grab that interface's IP address explicitly:
99
+
100
+ config.landrush.host_interface = 'eth0'
101
+
102
+ Do note that, if you specify an interface explicitly, it will have priority over
103
+ `config.landrush.host_interface_excludes`. In other words, if `config.landrush.host_interface_excludes`
104
+ is set to `[/eth[0-9]*/]`, but `config.landrush.host_interface` is set to `eth0` and `eth0` exists
105
+ as an interface, the IP address of `eth0` is returned. The interface setting takes precedence over
106
+ the exclude setting. If the interface does not exist, the regular heuristics will apply and Landrush
107
+ will pick the last non-excluded IP found.
108
+
109
+ If all else fails, you can override it entirely:
68
110
 
69
111
  config.landrush.host_ip_address = '1.2.3.4'
70
112
 
71
- If you are using a multi-machine `Vagrantfile`, configure this inside each of your `config.vm.define` sections.
113
+ This setting will override both the exclude and interface settings completely.
114
+
115
+ If you are using a multi-machine `Vagrantfile`, configure this inside each of your `config.vm.define`
116
+ sections.
72
117
 
73
118
  <a name="static-entries"></a>
74
119
  ### Static entries
@@ -77,25 +122,35 @@ You can add static host entries to the DNS server in your `Vagrantfile` like so:
77
122
 
78
123
  config.landrush.host 'myhost.example.com', '1.2.3.4'
79
124
 
80
- This is great for overriding production services for nodes you might be testing locally. For example, perhaps you might want to override the hostname of your puppetmaster to point to a local vagrant box instead.
125
+ This is great for overriding production services for nodes you might be testing locally. For example,
126
+ perhaps you might want to override the hostname of your puppetmaster to point to a local vagrant box
127
+ instead.
81
128
 
82
129
  <a name="wildcard-subdomains"></a>
83
130
  ### Wildcard Subdomains
84
131
 
85
- For your convenience, any subdomain of a DNS entry known to landrush will resolve to the same IP address as the entry. For example: given `myhost.vagrant.test -> 1.2.3.4`, both `foo.myhost.vagrant.test` and `bar.myhost.vagrant.test` will also resolve to `1.2.3.4`.
132
+ For your convenience, any subdomain of a DNS entry known to landrush will resolve to the same IP
133
+ address as the entry. For example: given `myhost.vagrant.test -> 1.2.3.4`, both
134
+ `foo.myhost.vagrant.test` and `bar.myhost.vagrant.test` will also resolve to `1.2.3.4`.
86
135
 
87
- If you would like to configure your guests to be accessible from the host as subdomains of something other than the default `vagrant.test`, you can use the `config.landrush.tld` option in your Vagrantfile like so:
136
+ If you would like to configure your guests to be accessible from the host as subdomains of something
137
+ other than the default `vagrant.test`, you can use the `config.landrush.tld` option in your
138
+ Vagrantfile like so:
88
139
 
89
140
  config.landrush.tld = 'vm'
90
141
 
91
- Note that from the __host__, you will only be able to access subdomains of your configured TLD by default- so wildcard subdomains only apply to that space. For the __guest__, wildcard subdomains work for anything.
142
+ Note that from the __host__, you will only be able to access subdomains of your configured TLD by
143
+ default- so wildcard subdomains only apply to that space. For the __guest__, wildcard subdomains
144
+ work for anything.
92
145
 
93
146
  <a name="unmatched-queries"></a>
94
147
  ### Unmatched Queries
95
148
 
96
- Any DNS queries that do not match will be passed through to an upstream DNS server, so this will be able to serve as the one-stop shop for your guests' DNS needs.
149
+ Any DNS queries that do not match will be passed through to an upstream DNS server, so this will be
150
+ able to serve as the one-stop shop for your guests' DNS needs.
97
151
 
98
- If you would like to configure your own upstream servers, add upstream entries to your `Vagrantfile` like so:
152
+ If you would like to configure your own upstream servers, add upstream entries to your
153
+ `Vagrantfile` like so:
99
154
 
100
155
  config.landrush.upstream '10.1.1.10'
101
156
  # Set the port to 1001
@@ -106,46 +161,59 @@ If you would like to configure your own upstream servers, add upstream entries t
106
161
  <a name="visibility-on-the-guest"></a>
107
162
  ### Visibility on the Guest
108
163
 
109
- Linux guests should automatically have their DNS traffic redirected via `iptables` rules to the Landrush DNS server. File an issue if this does not work for you.
164
+ Linux guests should automatically have their DNS traffic redirected via `iptables` rules to the
165
+ Landrush DNS server. File an issue if this does not work for you.
110
166
 
111
167
  To disable this functionality:
112
168
 
113
169
  config.landrush.guest_redirect_dns = false
114
170
 
115
- You may want to do this if you are already proxying all your DNS requests through your host (e.g. using VirtualBox's natdnshostresolver1 option) and you
116
- have DNS servers that you can easily set as upstreams in the daemon (e.g. DNS requests that go through the host's VPN connection).
171
+ You may want to do this if you are already proxying all your DNS requests through your host
172
+ (e.g. using VirtualBox's natdnshostresolver1 option) and you
173
+ have DNS servers that you can easily set as upstreams in the daemon (e.g. DNS requests that go
174
+ through the host's VPN connection).
117
175
 
118
176
  <a name="visibility-on-the-host"></a>
119
177
  ### Visibility on the Host
120
178
 
179
+ Visibility on the host means that the hostname of the VMs can be resolved on the host's DNS system.
180
+ Depending on the OS this might require some manual configuration.
181
+
121
182
  <a name="os-x"></a>
122
183
  #### OS X
123
184
 
124
- If you're on an OS X host, we use a nice trick to unobtrusively add a secondary DNS server only for specific domains.
125
- Landrush adds a file into `/etc/resolver` that points lookups for hostnames ending in your `config.landrush.tld` domain
126
- name to its DNS server. (Check out `man 5 resolver` on your Mac OS X host for more information on this file's syntax.)
127
-
185
+ If you're on an OS X host, we use a nice trick to unobtrusively add a secondary DNS server only for
186
+ specific domains. Landrush adds automatically during startup a file into `/etc/resolver`
187
+ that points lookups for hostnames ending in your `config.landrush.tld` domain to its DNS server.
188
+ (Check out `man 5 resolver` on your Mac OS X host for more information on this file's syntax.)
128
189
 
129
190
  <a name="linux"></a>
130
191
  #### Linux
131
192
 
132
- Though it's not automatically set up by landrush, similar behavior can be achieved on Linux hosts with `dnsmasq`. You
133
- can integrate Landrush with dnsmasq on Ubuntu like so (tested on Ubuntu 13.10):
193
+ Though it's not automatically set up by Landrush, similar behavior can be achieved on Linux hosts
194
+ with `dnsmasq`. You can integrate Landrush with `dnsmasq` on Ubuntu like so (tested on Ubuntu 13.10):
134
195
 
135
196
  sudo apt-get install -y resolvconf dnsmasq
136
197
  sudo sh -c 'echo "server=/vagrant.test/127.0.0.1#10053" > /etc/dnsmasq.d/vagrant-landrush'
137
198
  sudo service dnsmasq restart
138
199
 
139
- If you use a TLD other than the default `vagrant.test`, replace the TLD in the above instructions accordingly. Please be aware that anything ending in '.local' as TLD will not work because the `avahi` daemon reserves this TLD for its own uses.
200
+ If you use a TLD other than the default `vagrant.test`, replace the TLD in the above instructions
201
+ accordingly. Please be aware that anything ending in '.local' as TLD will not work because the
202
+ `avahi` daemon reserves this TLD for its own uses.
140
203
 
141
204
  <a name="windows"></a>
142
205
  #### Windows
143
206
 
144
- **Note**: Windows support is currently considered experimental. If you having
145
- problems using Landrush on Windows please let us know.
207
+ On Windows a secondary DNS server can be configured via the properties of the
208
+ network adapter used by the VM. Landrush will attempt to configure the adapter automatically
209
+ during startup. If this fails, please follow the manual setup instructions below.
210
+
211
+ It is recommended to use an elevated command prompt (command prompt with full administrator
212
+ permissions), since admin privileges are needed to make the required changes. Landrush will
213
+ try to elevate your prompt automatically, but this requires to spawn additional processes which in
214
+ turn loose some potentially important log messages.
146
215
 
147
- On Windows a secondary DNS server can be configured via the properties of a
148
- network adapter. This will be illustrated in the following using Windows 10 with
216
+ In the following section manual network configuration is described using Windows 10 and
149
217
  VirtualBox.
150
218
 
151
219
  When running VirtualBox on Windows in combination with Landrush the Network
@@ -221,9 +289,44 @@ Please refer to [/doc/proxy-mobile](/doc/proxy-mobile) for instructions.
221
289
  Check out `vagrant landrush` for additional commands to monitor the DNS server daemon.
222
290
 
223
291
 
292
+ <a name="miscellaneous-tricks-and-tips"></a>
293
+ ## Miscellaneous Tricks and Tips
294
+
295
+ <a name="how-to-avoid-providing-sudo-password-on-os-x"></a>
296
+ ### How to avoid providing sudo password on OS X
297
+
298
+ When using Landrush on OS X, Landrush will try to create a file in `/etc/resolver` to make the guest
299
+ VM visible via DNS on the host (see [OS X](#os-x) in the [visibility on host](#visibility-on-the-host)
300
+ section). To create this file sudo permissions are needed and Landrush will ask you for your sudo
301
+ password. This can be avoided by adding the following entries to the bottom of the sudoer
302
+ configuration. Make sure to edit your `/etc/sudoers` configuration via `sudo visudo`:
303
+
304
+ # Begin Landrush config
305
+ Cmnd_Alias VAGRANT_LANDRUSH_HOST_MKDIR = /bin/mkdir /etc/resolver/*
306
+ Cmnd_Alias VAGRANT_LANDRUSH_HOST_CP = /bin/cp /*/vagrant_landrush_host_config* /etc/resolver/*
307
+ Cmnd_Alias VAGRANT_LANDRUSH_HOST_CHMOD = /bin/chmod 644 /etc/resolver/*
308
+ %admin ALL=(ALL) NOPASSWD: VAGRANT_LANDRUSH_HOST_MKDIR, VAGRANT_LANDRUSH_HOST_CP, VAGRANT_LANDRUSH_HOST_CHMOD
309
+ # End Landrush config
310
+
224
311
  <a name="development"></a>
225
312
  ## Development
226
313
 
314
+ The following should get you started to develop on the Landrush code base. As a prerequisite you
315
+ will need a Ruby 2.0 environment. We recommend to use [RVM](https://rvm.io/) to create an isolated
316
+ development environment. On Windows the [RubyInstaller for Windows](http://rubyinstaller.org/) is
317
+ probably the easiest way to get started. In this case you will need the
318
+ [DevKit](http://rubyinstaller.org/add-ons/devkit/) as well.
319
+
320
+ Once you have a working Ruby environment it is time to
321
+ [fork](https://help.github.com/articles/fork-a-repo/) the repository
322
+ (refer to the [CONTRIBUTING.md](CONTRIBUTING.md) guide for more info].
323
+
324
+ The following are the most important commands you will need for development:
325
+
326
+ * Install [Bundler](http://bundler.io/):
327
+
328
+ $ gem install bundler
329
+
227
330
  * Install dependencies:
228
331
 
229
332
  $ bundle install
@@ -242,13 +345,17 @@ Check out `vagrant landrush` for additional commands to monitor the DNS server d
242
345
 
243
346
  * Run cucumber/aruba acceptance tests:
244
347
 
245
- $ bundle exec cucumber
348
+ $ bundle exec rake features
246
349
 
247
350
  Note, that the acceptance tests currently only work out of the box on OS X.
248
351
  On Linux one has to manually configure the host visibility for the TLD
249
352
  _landrush-acceptance-test_. See for [Linux](#linux). On Windows the acceptance
250
353
  tests won't work due to a current bug in [Aruba](https://github.com/cucumber/aruba/issues/387).
251
354
 
355
+ * Run a single cucumber/aruba acceptance tests:
356
+
357
+ $ bundle exec rake features FEATURE=features/<feature-filename>.feature
358
+
252
359
  * Build the Landrush gem:
253
360
 
254
361
  $ bundle exec rake install
@@ -257,14 +364,19 @@ Check out `vagrant landrush` for additional commands to monitor the DNS server d
257
364
 
258
365
  $ bundle exec rake clean clobber
259
366
 
260
- * Run the vagrant binary with the Landrush plugin loaded from your local
261
- source code:
367
+ * Deploy to RubyGems:
368
+
369
+ $ bundle exec rake release
370
+
371
+ * Run the vagrant binary with the Landrush plugin loaded from your local source code:
262
372
 
263
373
  bundle exec vagrant landrush <command>
264
374
 
265
375
  <a name="help-out"></a>
266
376
  ## Help Out!
267
377
 
268
- This project could use your feedback and help! Please don't hesitate to open issues or submit pull requests. NO HESITATION IS ALLOWED. NONE WHATSOEVER. See [CONTRIBUTING.md](CONTRIBUTING.md) for more details.
378
+ This project could use your feedback and help! Please don't hesitate to open issues or submit pull
379
+ requests. NO HESITATION IS ALLOWED. NONE WHATSOEVER. See [CONTRIBUTING.md](CONTRIBUTING.md) for
380
+ more details.
269
381
 
270
382
  The Maintainers try to meet periodically. [Notes](NOTES.md) are available.
@@ -20,6 +20,15 @@ Feature: dns_resolution
20
20
  And the hostname "my-host.landrush-acceptance-test" should resolve to "10.10.10.123" on the host
21
21
  And the hostname "my-host.landrush-acceptance-test" should resolve to "10.10.10.123" on the guest
22
22
 
23
+ When I successfully run `bundle exec vagrant landrush set my-static-host.landrush-acceptance-test 42.42.42.42`
24
+ Then the hostname "my-static-host.landrush-acceptance-test" should resolve to "42.42.42.42" on the internal DNS server
25
+ And the hostname "my-static-host.landrush-acceptance-test" should resolve to "42.42.42.42" on the host
26
+ And the hostname "my-static-host.landrush-acceptance-test" should resolve to "42.42.42.42" on the guest
27
+
28
+ When I successfully run `bundle exec vagrant landrush set my-static-cname-host.landrush-acceptance-test my-static-host.landrush-acceptance-test`
29
+ Then the hostname "my-static-cname-host.landrush-acceptance-test" should resolve to "42.42.42.42" on the internal DNS server
30
+ And the hostname "my-static-cname-host.landrush-acceptance-test" should resolve to "42.42.42.42" on the host
31
+
23
32
  Examples:
24
33
  | box | provider |
25
34
  | debian/jessie64 | virtualbox |
@@ -0,0 +1,57 @@
1
+ Feature: landrush-ip
2
+ Landrush should pick the desired IP, given multiple network interfaces.
3
+
4
+ Scenario Outline: booting a box and picking a specific interface
5
+ Given a file named "Vagrantfile" with:
6
+ """
7
+ Vagrant.configure('2') do |config|
8
+ config.vm.box = '<box>'
9
+ config.vm.hostname = 'my-host.landrush-acceptance-test'
10
+
11
+ config.vm.network :private_network, type: 'dhcp'
12
+ config.vm.network :private_network, type: 'dhcp'
13
+ config.vm.network :private_network, type: 'dhcp'
14
+ config.vm.network :private_network, type: 'dhcp'
15
+ config.vm.network :private_network, type: 'dhcp'
16
+
17
+ config.vm.synced_folder '.', '/vagrant', disabled: true
18
+
19
+ config.landrush.enabled = true
20
+ config.landrush.tld = 'landrush-acceptance-test'
21
+ config.landrush.host_interface = 'eth3'
22
+ config.landrush.host_interface_excludes = [/eth[0-9]+/]
23
+ end
24
+ """
25
+ When I successfully run `bundle exec vagrant up --provider <provider>`
26
+ Then the host visible IP address of the guest is the IP of interface "eth3"
27
+
28
+ Examples:
29
+ | box | provider |
30
+ | debian/jessie64 | virtualbox |
31
+
32
+ Scenario Outline: booting a box and excluding interfaces it should pick the last interface
33
+ Given a file named "Vagrantfile" with:
34
+ """
35
+ Vagrant.configure('2') do |config|
36
+ config.vm.box = '<box>'
37
+ config.vm.hostname = 'my-host.landrush-acceptance-test'
38
+
39
+ config.vm.network :private_network, type: 'dhcp'
40
+ config.vm.network :private_network, type: 'dhcp'
41
+ config.vm.network :private_network, type: 'dhcp'
42
+ config.vm.network :private_network, type: 'dhcp'
43
+ config.vm.network :private_network, type: 'dhcp'
44
+
45
+ config.vm.synced_folder '.', '/vagrant', disabled: true
46
+
47
+ config.landrush.enabled = true
48
+ config.landrush.tld = 'landrush-acceptance-test'
49
+ config.landrush.host_interface_excludes = [/eth1/, /eth2/, /eth5/]
50
+ end
51
+ """
52
+ When I successfully run `bundle exec vagrant up --provider <provider>`
53
+ Then the host visible IP address of the guest is the IP of interface "eth4"
54
+
55
+ Examples:
56
+ | box | provider |
57
+ | debian/jessie64 | virtualbox |
@@ -0,0 +1,13 @@
1
+ require 'landrush/server'
2
+
3
+ Then(/^the host visible IP address of the guest is the IP of interface "([^"]+)"/) do |interface|
4
+ cmd = "vagrant ssh -c \"ip addr list #{interface} | grep 'inet ' | cut -d' ' -f6| cut -d/ -f1\""
5
+ run(cmd)
6
+ expect(last_command_started).to have_output(/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/)
7
+
8
+ ip = last_command_started.output.split("\n").last
9
+
10
+ run('vagrant landrush list')
11
+
12
+ expect(last_command_started).to have_output(/#{ip}$/)
13
+ end
data/landrush.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  server as well. See the README for more documentation.
21
21
  DESCRIP
22
22
  spec.summary = %q{a vagrant plugin providing consistent DNS visible on host and guests}
23
- spec.homepage = 'https://github.com/phinze/landrush'
23
+ spec.homepage = 'https://github.com/vagrant-landrush/landrush'
24
24
  spec.license = 'MIT'
25
25
 
26
26
  spec.files = `git ls-files`.split($/)
@@ -29,4 +29,6 @@ Gem::Specification.new do |spec|
29
29
  spec.require_paths = ['lib']
30
30
 
31
31
  spec.add_dependency 'rubydns', '0.8.5'
32
+ spec.add_dependency 'win32-process'
33
+ spec.add_dependency 'landrush-ip', '~> 0.2.3'
32
34
  end