vagrant-proxyconf 1.5.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +15 -14
- data/CHANGELOG.md +19 -0
- data/Gemfile +25 -7
- data/LICENSE.txt +1 -1
- data/README.md +117 -18
- data/Rakefile +1 -27
- data/development/Dockerfile +40 -0
- data/development/README.md +2 -0
- data/development/Vagrantfile.example +156 -9
- data/development/install-c7.sh +46 -0
- data/development/install-debian.sh +55 -0
- data/development/tinyproxy.conf +333 -0
- data/lib/vagrant-proxyconf/action.rb +15 -7
- data/lib/vagrant-proxyconf/action/base.rb +47 -5
- data/lib/vagrant-proxyconf/action/configure_apt_proxy.rb +17 -0
- data/lib/vagrant-proxyconf/action/configure_chef_proxy.rb +32 -27
- data/lib/vagrant-proxyconf/action/configure_docker_proxy.rb +113 -12
- data/lib/vagrant-proxyconf/action/configure_env_proxy.rb +58 -11
- data/lib/vagrant-proxyconf/action/configure_git_proxy.rb +25 -9
- data/lib/vagrant-proxyconf/action/configure_npm_proxy.rb +14 -6
- data/lib/vagrant-proxyconf/action/configure_pear_proxy.rb +15 -8
- data/lib/vagrant-proxyconf/action/configure_svn_proxy.rb +15 -8
- data/lib/vagrant-proxyconf/action/configure_yum_proxy.rb +16 -0
- data/lib/vagrant-proxyconf/cap/linux/chef_proxy_conf.rb +17 -0
- data/lib/vagrant-proxyconf/cap/linux/docker_proxy_conf.rb +2 -1
- data/lib/vagrant-proxyconf/cap/linux/yum_proxy_conf.rb +19 -0
- data/lib/vagrant-proxyconf/cap/util.rb +4 -5
- data/lib/vagrant-proxyconf/capability.rb +10 -0
- data/lib/vagrant-proxyconf/config.rb +20 -0
- data/lib/vagrant-proxyconf/config/chef_proxy.rb +25 -0
- data/lib/vagrant-proxyconf/config/docker_proxy.rb +25 -0
- data/lib/vagrant-proxyconf/config/git_proxy.rb +3 -0
- data/lib/vagrant-proxyconf/config/npm_proxy.rb +25 -0
- data/lib/vagrant-proxyconf/config/pear_proxy.rb +19 -0
- data/lib/vagrant-proxyconf/version.rb +1 -1
- data/locales/en.yml +38 -0
- data/resources/yum_config.awk +1 -0
- data/spec/spec_helper.rb +27 -9
- data/spec/unit/fixtures/docker_client_config_json_enabled_proxy +9 -0
- data/spec/unit/fixtures/docker_client_config_json_no_proxy +5 -0
- data/spec/unit/fixtures/etc_environment_only_http_proxy.conf +9 -0
- data/spec/unit/fixtures/yum_with_repository_and_proxy_containing_special_chars.conf +10 -0
- data/spec/unit/vagrant-proxyconf/action/base_spec.rb +191 -0
- data/spec/unit/vagrant-proxyconf/action/configure_apt_proxy_spec.rb +162 -0
- data/spec/unit/vagrant-proxyconf/action/configure_chef_proxy_spec.rb +32 -0
- data/spec/unit/vagrant-proxyconf/action/configure_docker_proxy_spec.rb +489 -0
- data/spec/unit/vagrant-proxyconf/action/configure_env_proxy_spec.rb +105 -4
- data/spec/unit/vagrant-proxyconf/action/configure_git_proxy_spec.rb +116 -0
- data/spec/unit/vagrant-proxyconf/action/configure_npm_proxy_spec.rb +67 -0
- data/spec/unit/vagrant-proxyconf/action/configure_pear_proxy_spec.rb +116 -0
- data/spec/unit/vagrant-proxyconf/action/configure_svn_proxy_spec.rb +85 -0
- data/spec/unit/vagrant-proxyconf/action/configure_yum_proxy_spec.rb +100 -0
- data/spec/unit/vagrant-proxyconf/cap/linux/docker_proxy_conf_spec.rb +1 -1
- data/spec/unit/vagrant-proxyconf/cap/util_spec.rb +2 -2
- data/spec/unit/vagrant-proxyconf/config/key_mixin_spec.rb +1 -1
- data/spec/unit/vagrant-proxyconf/resources/yum_config_spec.rb +14 -0
- data/travis/before_install +26 -0
- metadata +24 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29246610a402d179b8e3ac8f2d4f5761ffa37a0d
|
4
|
+
data.tar.gz: d35190d33063c461b8a4cf5551493b5d9c7d3673
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca2472979189cd4471b56e2a350796d496323616e1dff2cff864a6a8f092096a385556f999eea8dc418d23e71a56dd55cb738d47ca3973bc4bddc26cb9418737
|
7
|
+
data.tar.gz: '049c14499abe8e93de88abee505026e6a68c0ca7f062a5d9ad370a51c296684b7e17d647d0205db43b84c270b50aee2c29bfda1e624fa9f0edb63d627c398d08'
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -2,24 +2,25 @@ language: ruby
|
|
2
2
|
cache: bundler
|
3
3
|
sudo: false
|
4
4
|
|
5
|
-
before_install:
|
6
|
-
- rvm @global do gem uninstall bundler --all --executables
|
7
|
-
- gem uninstall bundler --all --executables
|
8
|
-
- gem install bundler --version '~> 1.5.2'
|
9
|
-
- bundle --version
|
5
|
+
before_install: ./travis/before_install
|
10
6
|
bundler_args: --without=development
|
11
7
|
|
12
|
-
|
13
|
-
|
8
|
+
env:
|
9
|
+
global:
|
10
|
+
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
11
|
+
|
12
|
+
rvm: 2.4.4
|
14
13
|
matrix:
|
15
14
|
include:
|
16
|
-
- env: VAGRANT_VERSION=
|
17
|
-
- env: VAGRANT_VERSION=
|
18
|
-
- env: VAGRANT_VERSION=
|
19
|
-
- env: VAGRANT_VERSION=v1.
|
20
|
-
rvm:
|
21
|
-
- env:
|
22
|
-
|
15
|
+
- env: VAGRANT_VERSION=v2.2.2
|
16
|
+
- env: VAGRANT_VERSION=v2.1.5
|
17
|
+
- env: VAGRANT_VERSION=v2.0.4
|
18
|
+
- env: VAGRANT_VERSION=v1.9.8
|
19
|
+
rvm: 2.3.4
|
20
|
+
- env:
|
21
|
+
- VAGRANT_VERSION=v1.8.7
|
22
|
+
- BUNDLER_VERSION=1.12.5
|
23
|
+
rvm: 2.2.5
|
23
24
|
- env: VAGRANT_VERSION=master
|
24
25
|
allow_failures:
|
25
26
|
- env: VAGRANT_VERSION=master
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
# 2.0.0 / 2019-01-03
|
2
|
+
|
3
|
+
Improvements:
|
4
|
+
|
5
|
+
- Significant refactor to support disabling a proxy. Now when `config.proxy.enabled = false` all supporting proxies will be uncofigured.
|
6
|
+
- Added new tests for new features.
|
7
|
+
- Updated README.md to reflect new behavior.
|
8
|
+
- Cleaned up travis builds to support newere versions of vagrant.
|
9
|
+
|
10
|
+
Features:
|
11
|
+
- Added new configuration parameter for `skipping` configuring a disabled or enabled proxy.
|
12
|
+
|
13
|
+
Bug Fixes:
|
14
|
+
|
15
|
+
- Disable proxy settings in provisioned box ([GH-167][])
|
16
|
+
- unable to disable proxy for chef provisioners ([GH-118][])
|
17
|
+
- Proxy remains enabled after updating config ([GH-87][])
|
18
|
+
|
19
|
+
|
1
20
|
# 1.5.2 / 2015-10-01
|
2
21
|
|
3
22
|
Improvements:
|
data/Gemfile
CHANGED
@@ -1,22 +1,40 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
+
#### Added due to https://groups.google.com/forum/#!topic/vagrant-up/J8J6LmhzBqM/discussion
|
4
|
+
embedded_locations = %w(/Applications/Vagrant/embedded /opt/vagrant/embedded)
|
5
|
+
|
6
|
+
embedded_locations.each do |p|
|
7
|
+
ENV['VAGRANT_INSTALLER_EMBEDDED_DIR'] = p if File.directory?(p)
|
8
|
+
end
|
9
|
+
|
10
|
+
unless ENV.key?('VAGRANT_INSTALLER_EMBEDDED_DIR')
|
11
|
+
$stderr.puts "Couldn't find a packaged install of vagrant, and we need this"
|
12
|
+
$stderr.puts 'in order to make use of the RubyEncoder libraries.'
|
13
|
+
$stderr.puts 'I looked in:'
|
14
|
+
embedded_locations.each do |p|
|
15
|
+
$stderr.puts " #{p}"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
#### End Added due to https://groups.google.com/forum/#!topic/vagrant-up/J8J6LmhzBqM/discussion
|
19
|
+
|
3
20
|
gem 'vagrant',
|
4
|
-
|
5
|
-
|
21
|
+
git: 'https://github.com/mitchellh/vagrant.git',
|
22
|
+
ref: ENV.fetch('VAGRANT_VERSION', 'v2.2.2')
|
6
23
|
|
7
|
-
gem 'cane', '~> 2.6'
|
8
|
-
gem 'coveralls', require: false
|
9
24
|
gem 'rake'
|
10
25
|
gem 'rspec', '~> 3.1'
|
11
26
|
gem 'rspec-its', '~> 1.0'
|
12
|
-
gem 'tailor', '~> 1.4'
|
13
27
|
|
14
28
|
group :development do
|
15
29
|
gem 'guard-rspec'
|
16
30
|
gem 'redcarpet'
|
17
|
-
gem 'yard', '~> 0.
|
31
|
+
gem 'yard', '~> 0.9.11'
|
18
32
|
end
|
19
33
|
|
34
|
+
# when testing our plugin we need to make sure some vagrant plugins are installed
|
35
|
+
# however, the syntax `Vagrant.require_plugin 'vagrant-proxyconf' was deprecated
|
36
|
+
# and this is the future for using testing vagrant behind bundler.
|
37
|
+
# https://stackoverflow.com/questions/19492738/demand-a-vagrant-plugin-within-the-vagrantfile
|
20
38
|
group :plugins do
|
21
|
-
gem 'vagrant-proxyconf', path:
|
39
|
+
gem 'vagrant-proxyconf', path: __dir__
|
22
40
|
end
|
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License
|
2
2
|
|
3
|
-
Copyright (c) 2013-
|
3
|
+
Copyright (c) 2013-2017 Teemu Matilainen <teemu.matilainen@iki.fi>
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -1,18 +1,11 @@
|
|
1
1
|
# Proxy Configuration Plugin for Vagrant
|
2
2
|
|
3
3
|
<span class="badges">
|
4
|
-
[![Gem Version](https://badge.fury.io/rb/vagrant-proxyconf.png)][gem]
|
5
|
-
[![Build Status](https://travis-ci.org/tmatilai/vagrant-proxyconf.png?branch=master)][travis]
|
6
|
-
[![Dependency Status](https://gemnasium.com/tmatilai/vagrant-proxyconf.png)][gemnasium]
|
7
|
-
[![Code Climate](https://codeclimate.com/github/tmatilai/vagrant-proxyconf.png)][codeclimate]
|
8
|
-
[![Coverage Status](https://coveralls.io/repos/tmatilai/vagrant-proxyconf/badge.png)][coveralls]
|
9
|
-
</span>
|
10
4
|
|
11
|
-
[
|
12
|
-
[travis]
|
13
|
-
|
14
|
-
|
15
|
-
[coveralls]: https://coveralls.io/r/tmatilai/vagrant-proxyconf
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/vagrant-proxyconf.png)](https://rubygems.org/gems/vagrant-proxyconf)
|
6
|
+
[![Build Status](https://travis-ci.org/tmatilai/vagrant-proxyconf.svg?branch=master)](https://travis-ci.org/tmatilai/vagrant-proxyconf)
|
7
|
+
|
8
|
+
</span>
|
16
9
|
|
17
10
|
A [Vagrant](http://www.vagrantup.com/) plugin that configures the virtual machine to use specified proxies. This is useful for example in case you are behind a corporate proxy server, or you have a caching proxy (for example [polipo](https://github.com/tmatilai/polipo-box)).
|
18
11
|
|
@@ -125,12 +118,12 @@ VAGRANT_HTTP_PROXY="http://proxy.example.com:8080" vagrant up
|
|
125
118
|
|
126
119
|
### Disabling the plugin
|
127
120
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
121
|
+
New Behavior Warning: Setting the plugin to disabled now unconfigures all or specific proxies.
|
122
|
+
|
123
|
+
The plugin can be disabled by setting `config.proxy.enabled` to `false` or empty string (`""`).
|
124
|
+
This can be also be used to disable a proxy for some provider.
|
125
|
+
Specific applications can be disabled by setting `config.proxy.enabled` to
|
126
|
+
a hash( like `{ svn: false }` or `{ svn: {enabled: false} }`).
|
134
127
|
|
135
128
|
```ruby
|
136
129
|
config.proxy.enabled # => all applications enabled(default)
|
@@ -141,6 +134,53 @@ config.proxy.enabled = "" # => all applications disabled
|
|
141
134
|
config.proxy.enabled = false # => all applications disabled
|
142
135
|
```
|
143
136
|
|
137
|
+
### Skipping the plugin
|
138
|
+
|
139
|
+
The plugin can also be skipped from applying/removing the proxy configuration for a specific provider.
|
140
|
+
|
141
|
+
#### When the plugin is disabled as in the following example:
|
142
|
+
|
143
|
+
```
|
144
|
+
{
|
145
|
+
:apt => {
|
146
|
+
:enabled => false,
|
147
|
+
:skip => true,
|
148
|
+
},
|
149
|
+
:svn => {
|
150
|
+
:enabled => false,
|
151
|
+
:skip => true,
|
152
|
+
},
|
153
|
+
}
|
154
|
+
```
|
155
|
+
|
156
|
+
The plugin is disabled, but `skip = true` means that no proxy configuration will be removed so the system
|
157
|
+
will remain in it's most recent state. This can be useful if you just want to skip over specific provider
|
158
|
+
being configured or unconfigured.
|
159
|
+
|
160
|
+
|
161
|
+
#### When the plugin is enabled as in the following example:
|
162
|
+
|
163
|
+
```
|
164
|
+
{
|
165
|
+
:apt => {
|
166
|
+
:enabled => true,
|
167
|
+
:skip => false,
|
168
|
+
},
|
169
|
+
:svn => {
|
170
|
+
:enabled => true,
|
171
|
+
:skip => true,
|
172
|
+
},
|
173
|
+
}
|
174
|
+
```
|
175
|
+
|
176
|
+
The plugin is enabled, but `skip = true` means that no proxy configuration will be applied so the system
|
177
|
+
will remain in it's most recent state. This can be useful if you just want to skip over specific provider
|
178
|
+
being configured or unconfigured.
|
179
|
+
|
180
|
+
In the example above the `apt` proxy will be enabled and proxy configuration will be applied, but the
|
181
|
+
`svn` proxy even though it's enabled will be skipped.
|
182
|
+
|
183
|
+
|
144
184
|
#### Example Vagrantfile
|
145
185
|
|
146
186
|
```ruby
|
@@ -186,12 +226,36 @@ end
|
|
186
226
|
#### Environment variables
|
187
227
|
These also override the Vagrantfile configuration. To disable or remove the proxy use "DIRECT" or an empty value.
|
188
228
|
|
189
|
-
For example to spin up a VM, run:
|
229
|
+
For example to spin up a VM and set the APT proxy to `http://proxy.example.com:8080, run:
|
190
230
|
|
191
231
|
```sh
|
192
232
|
VAGRANT_APT_HTTP_PROXY="http://proxy.example.com:8080" vagrant up
|
193
233
|
```
|
194
234
|
|
235
|
+
| Provider | Environment Variable | Descrption | Precendence |
|
236
|
+
|-----------|------------------------------|-------------------------------|-------------|
|
237
|
+
| apt | `VAGRANT_APT_HTTP_PROXY` | Configures APT http proxy | Highest |
|
238
|
+
| | `VAGRANT_APT_HTTPS_PROXY` | Configures APT https proxy | Highest |
|
239
|
+
| | `VAGRANT_APT_FTP_PROXY` | Configures APT ftp proxy | Highest |
|
240
|
+
| chef | `VAGRANT_CHEF_HTTP_PROXY` | Configures CHEF http proxy | Highest |
|
241
|
+
| | `VAGRANT_CHEF_HTTPS_PROXY` | Configures CHEF https proxy | Highest |
|
242
|
+
| | `VAGRANT_CHEF_NO_PROXY` | Configures CHEF no proxy | Highest |
|
243
|
+
| docker | `VAGRANT_DOCKER_HTTP_PROXY` | Configuers DOCKER http proxy | Highest |
|
244
|
+
| | `VAGRANT_DOCKER_HTTPS_PROXY` | Configures DOCKER https proxy | Highest |
|
245
|
+
| | `VAGRANT_DOCKER_NO_PROXY` | Configures DOCKER no proxy | Highest |
|
246
|
+
| env | `VAGRANT_ENV_HTTP_PROXY` | Configures ENV http proxy | Highest |
|
247
|
+
| | `VAGRANT_ENV_HTTPS_PROXY` | Configures ENV https proxy | Highest |
|
248
|
+
| | `VAGRANT_ENV_FTP_PROXY` | Configures ENV FTP proxy | Highest |
|
249
|
+
| | `VAGRANT_ENV_NO_PROXY` | Configures ENV no proxy | Highest |
|
250
|
+
| git | `VAGRANT_GIT_HTTP_PROXY` | Configures GIT http proxy | Highest |
|
251
|
+
| | `VAGRANT_GIT_HTTPS_PROXY` | Configures GIT https proxy | Highest |
|
252
|
+
| npm | `VAGRANT_NPM_HTTP_PROXY` | Configures NPM http proxy | Highest |
|
253
|
+
| | `VAGRANT_NPM_HTTPS_PROXY` | Configures NPM https proxy | Highest |
|
254
|
+
| | `VAGRANT_NPM_NO_PROXY` | Configures NPM no proxy | Highest |
|
255
|
+
| pear | `VAGRANT_PEAR_HTTP_PROXY` | Configures PEAR http proxy | Highest |
|
256
|
+
| svn | `VAGRANT_SVN_HTTP_PROXY` | Configures SVN http proxy | Highest |
|
257
|
+
| | `VAGRANT_SVN_NO_PROXY` | Configures SVN no proxy | Highest |
|
258
|
+
| yum | `VAGRANT_YUM_HTTP_PROXY` | Configures YUM http proxy | Highest |
|
195
259
|
|
196
260
|
## Related plugins and projects
|
197
261
|
|
@@ -201,3 +265,38 @@ VAGRANT_APT_HTTP_PROXY="http://proxy.example.com:8080" vagrant up
|
|
201
265
|
a Vagrant setup for [polipo](http://www.pps.univ-paris-diderot.fr/~jch/software/polipo/) caching web proxy.
|
202
266
|
* [vagrant-cachier](https://github.com/fgrehm/vagrant-cachier)<br/>
|
203
267
|
An excellent Vagrant plugin that shares various cache directories among similar VM instances. Should work fine together with vagrant-proxyconf.
|
268
|
+
|
269
|
+
|
270
|
+
## Development Known Issues
|
271
|
+
|
272
|
+
|
273
|
+
### When running `bundle exec vagrant status` I get `Encoded files can't be read outside of the Vagrant installer.`
|
274
|
+
|
275
|
+
```
|
276
|
+
$ bundle exec vagrant status
|
277
|
+
Vagrant failed to initialize at a very early stage:
|
278
|
+
|
279
|
+
The plugins failed to load properly. The error message given is
|
280
|
+
shown below.
|
281
|
+
|
282
|
+
Encoded files can't be read outside of the Vagrant installer.
|
283
|
+
```
|
284
|
+
|
285
|
+
The solution is to add this to the Gemfile
|
286
|
+
|
287
|
+
```
|
288
|
+
embedded_locations = %w(/Applications/Vagrant/embedded /opt/vagrant/embedded)
|
289
|
+
|
290
|
+
embedded_locations.each do |p|
|
291
|
+
ENV['VAGRANT_INSTALLER_EMBEDDED_DIR'] = p if File.directory?(p)
|
292
|
+
end
|
293
|
+
|
294
|
+
unless ENV.key?('VAGRANT_INSTALLER_EMBEDDED_DIR')
|
295
|
+
$stderr.puts "Couldn't find a packaged install of vagrant, and we need this"
|
296
|
+
$stderr.puts 'in order to make use of the RubyEncoder libraries.'
|
297
|
+
$stderr.puts 'I looked in:'
|
298
|
+
embedded_locations.each do |p|
|
299
|
+
$stderr.puts " #{p}"
|
300
|
+
end
|
301
|
+
end
|
302
|
+
```
|
data/Rakefile
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
require 'bundler/gem_tasks'
|
2
|
-
require 'cane/rake_task'
|
3
2
|
require 'rspec/core/rake_task'
|
4
|
-
require 'tailor/rake_task'
|
5
3
|
|
6
|
-
task :default =>
|
4
|
+
task :default => :test
|
7
5
|
|
8
6
|
# Remove 'install' task as the gem is installed to Vagrant, not to system
|
9
7
|
Rake::Task[:install].clear
|
@@ -17,30 +15,6 @@ desc "Run all tests"
|
|
17
15
|
task :test => ['test:unit']
|
18
16
|
task :spec => :test
|
19
17
|
|
20
|
-
Tailor::RakeTask.new do |task|
|
21
|
-
task.file_set('lib/**/*.rb', 'code') do |style|
|
22
|
-
style.allow_unnecessary_double_quotes false, level: :off
|
23
|
-
style.max_line_length 100, level: :warn
|
24
|
-
style.max_line_length 140, level: :error
|
25
|
-
end
|
26
|
-
task.file_set('spec/**/*.rb', 'tests') do |style|
|
27
|
-
style.allow_unnecessary_double_quotes false, level: :off
|
28
|
-
style.max_line_length 120, level: :warn
|
29
|
-
# allow vertical alignment of `let(:foo) { block }` blocks
|
30
|
-
style.spaces_before_lbrace 1, level: :off
|
31
|
-
style.indentation_spaces 2, level: :off
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
Cane::RakeTask.new(:cane) do |task|
|
36
|
-
task.abc_max = 16
|
37
|
-
task.style_measure = 140
|
38
|
-
task.options[:color] = true
|
39
|
-
end
|
40
|
-
|
41
|
-
desc 'Run all quality tasks'
|
42
|
-
task :quality => [:cane, :tailor]
|
43
|
-
|
44
18
|
desc "Update gh-pages"
|
45
19
|
task 'gh-pages' do
|
46
20
|
require 'tmpdir'
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# https://gist.github.com/codylane/6ebee3595a02f57d35c325db4e102c55
|
2
|
+
FROM centos:7
|
3
|
+
|
4
|
+
EXPOSE 22
|
5
|
+
|
6
|
+
RUN yum clean all && \
|
7
|
+
yum makecache fast && \
|
8
|
+
yum -y install \
|
9
|
+
curl \
|
10
|
+
device-mapper-persistent-data \
|
11
|
+
git \
|
12
|
+
lvm2 \
|
13
|
+
openssh-clients \
|
14
|
+
openssh-server \
|
15
|
+
rsync \
|
16
|
+
sudo \
|
17
|
+
wget \
|
18
|
+
yum-utils && \
|
19
|
+
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo && \
|
20
|
+
yum clean expire-cache && \
|
21
|
+
yum install -y docker-ce && \
|
22
|
+
/usr/sbin/sshd-keygen && \
|
23
|
+
getent passwd vagrant || useradd -m -d /home/vagrant -s /bin/bash vagrant && \
|
24
|
+
echo "vagrant:vagrant" | chpasswd && \
|
25
|
+
mkdir -p /etc/sudoers.d && \
|
26
|
+
echo 'Defaults:vagrant !requiretty' > /etc/sudoers.d/vagrant && \
|
27
|
+
echo 'vagrant ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/vagrant && \
|
28
|
+
chmod 0440 /etc/sudoers.d/vagrant && \
|
29
|
+
visudo -cf /etc/sudoers.d/vagrant && \
|
30
|
+
mkdir -p /var/run/sshd && \
|
31
|
+
mkdir -p /home/vagrant/.ssh && \
|
32
|
+
touch /home/vagrant/.ssh/authorized_keys
|
33
|
+
|
34
|
+
RUN grep -q 'OHlnVYCzRdK8jlqm8tehUc9c9WhQ==' /home/vagrant/.ssh/authorized_keys || echo "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ==" >> /home/vagrant/.ssh/authorized_keys && \
|
35
|
+
chmod 0600 /home/vagrant/.ssh/authorized_keys && \
|
36
|
+
chown vagrant:vagrant /home/vagrant/.ssh/authorized_keys
|
37
|
+
|
38
|
+
# -e write logs to stderr
|
39
|
+
# -D run in foreground
|
40
|
+
CMD ["/usr/sbin/sshd", "-e", "-D"]
|
data/development/README.md
CHANGED
@@ -6,6 +6,8 @@
|
|
6
6
|
|
7
7
|
2. Spin up the machine:
|
8
8
|
|
9
|
+
* If you don't have an external proxy set ENABLE_PROXY=false on the first run of the vm, then switch it to `true` after the VM has been built to avoid using the proxy before it is setup.
|
10
|
+
|
9
11
|
bundle exec vagrant up
|
10
12
|
|
11
13
|
3. Test, hack, edit _Vagrantfile_ and test again:
|
@@ -1,20 +1,167 @@
|
|
1
1
|
# -*- mode: ruby -*-
|
2
2
|
# vi: set ft=ruby :
|
3
|
+
require 'uri'
|
3
4
|
|
4
|
-
BOX = ENV.fetch('BOX', 'ubuntu
|
5
|
+
BOX = ENV.fetch('BOX', 'ubuntu/bionic64')
|
6
|
+
DISABLE_SHARE = true
|
7
|
+
ENABLE_PROXY = false
|
8
|
+
ENABLE_APP_SPECIFIC_PROXIES = !ENABLE_PROXY
|
5
9
|
|
6
|
-
|
10
|
+
APP_PROXIES = {
|
11
|
+
:apt => {
|
12
|
+
:enabled => true,
|
13
|
+
:skip => false,
|
14
|
+
},
|
15
|
+
:chef => {
|
16
|
+
:enabled => true,
|
17
|
+
:skip => false,
|
18
|
+
},
|
19
|
+
:docker => {
|
20
|
+
:enabled => true,
|
21
|
+
:skip => false
|
22
|
+
},
|
23
|
+
:env => {
|
24
|
+
:enabled => true,
|
25
|
+
:skip => false,
|
26
|
+
},
|
27
|
+
:git => {
|
28
|
+
:enabled => true,
|
29
|
+
:skip => false,
|
30
|
+
},
|
31
|
+
:npm => {
|
32
|
+
:enabled => true,
|
33
|
+
:skip => false,
|
34
|
+
},
|
35
|
+
:pear => {
|
36
|
+
:enabled => true,
|
37
|
+
:skip => false
|
38
|
+
},
|
39
|
+
:svn => {
|
40
|
+
:enabled => true,
|
41
|
+
:skip => false,
|
42
|
+
},
|
43
|
+
:yum => {
|
44
|
+
:enabled => true,
|
45
|
+
:skip => false,
|
46
|
+
},
|
47
|
+
}
|
48
|
+
|
49
|
+
|
50
|
+
DOCKER_SOCKET = "/var/run/docker.sock"
|
51
|
+
SUPPORTS_DOCKER_IN_DOCKER = File.exists?(DOCKER_SOCKET)
|
52
|
+
|
53
|
+
GLOBAL_PROXY_HOST = URI.parse(
|
54
|
+
ENV.fetch('HTTP_PROXY', '')
|
55
|
+
).hostname
|
56
|
+
|
57
|
+
GLOBAL_PROXY_PORT = URI.parse(
|
58
|
+
ENV.fetch('HTTP_PROXY', '')
|
59
|
+
).port
|
60
|
+
|
61
|
+
GLOBAL_NO_PROXY = ENV.fetch('NO_PROXY', '')
|
62
|
+
|
63
|
+
PROXY_HOST = GLOBAL_PROXY_HOST || '70.70.70.10'
|
64
|
+
PROXY_PORT = GLOBAL_PROXY_PORT || '8888'
|
65
|
+
NO_PROXY = GLOBAL_NO_PROXY || "localhost,*.localdomain"
|
7
66
|
|
8
67
|
Vagrant.configure('2') do |config|
|
9
|
-
|
10
|
-
|
11
|
-
config.
|
68
|
+
raise Exception, "Please install vagrant-proxyconf" unless Vagrant.has_plugin?('vagrant-proxyconf')
|
69
|
+
|
70
|
+
# config.proxy.enabled = true
|
71
|
+
config.proxy.http = "http://#{PROXY_HOST}:#{PROXY_PORT}"
|
72
|
+
config.proxy.https = "http://#{PROXY_HOST}:#{PROXY_PORT}"
|
73
|
+
config.proxy.no_proxy = "#{NO_PROXY}"
|
74
|
+
|
75
|
+
# APT proxy
|
76
|
+
# config.apt_proxy.http = 'http://#{PROXY_HOST}:#{PROXY_PORT}'
|
77
|
+
# config.apt_proxy.https = 'https://#{PROXY_HOST}:#{PROXY_PORT}'
|
78
|
+
|
79
|
+
# CHEF proxy
|
80
|
+
# config.chef_proxy.http = 'http://#{PROXY_HOST}:#{PROXY_PORT}'
|
81
|
+
# config.chef_proxy.https = 'https://#{PROXY_HOST}:#{PROXY_PORT}'
|
82
|
+
# config.chef_proxy.no_proxy = "#{NO_PROXY}"
|
83
|
+
|
84
|
+
# DOCKER proxy
|
85
|
+
# config.docker_proxy.http = config.proxy.http
|
86
|
+
# config.docker_proxy.https = config.proxy.https
|
87
|
+
# config.docker_proxy.no_proxy = config.proxy.no_proxy
|
88
|
+
|
89
|
+
# GIT proxy
|
90
|
+
# config.git_proxy.http = config.proxy.http
|
91
|
+
# config.git_proxy.https = config.proxy.https
|
92
|
+
|
93
|
+
# NPM proxy
|
94
|
+
# config.npm_proxy.http = config.proxy.http
|
95
|
+
# config.npm_proxy.https = config.proxy.https
|
96
|
+
# config.npm_proxy.no_proxy = config.proxy.no_proxy
|
97
|
+
|
98
|
+
# PEAR proxy
|
99
|
+
# config.pear_proxy.http = config.proxy.http
|
100
|
+
|
101
|
+
# SVN proxy
|
102
|
+
# config.svn_proxy.http = config.proxy.http
|
103
|
+
# config.svn_proxy.no_proxy = config.proxy.no_proxy
|
104
|
+
|
105
|
+
# YUM proxy
|
106
|
+
# config.yum_proxy.http = config.proxy.http
|
107
|
+
|
108
|
+
# app specific proxies
|
109
|
+
if ENABLE_APP_SPECIFIC_PROXIES
|
110
|
+
config.proxy.enabled = {}
|
111
|
+
|
112
|
+
APP_PROXIES.each do |k, v|
|
113
|
+
config.proxy.enabled[k] = v
|
114
|
+
end
|
115
|
+
else
|
116
|
+
config.proxy.enabled = ENABLE_PROXY
|
117
|
+
end
|
12
118
|
|
13
119
|
# Disable the default share
|
14
|
-
config.vm.synced_folder '.', '/vagrant', id: 'vagrant-root', disabled:
|
120
|
+
config.vm.synced_folder '.', '/vagrant', id: 'vagrant-root', disabled: DISABLE_SHARE
|
121
|
+
|
122
|
+
# config.vm.provision :chef_solo do |chef|
|
123
|
+
# chef.cookbooks_path = "."
|
124
|
+
# chef.install = true
|
125
|
+
# end
|
126
|
+
|
127
|
+
# Vagrant >= 1.7 wants to replace the insecure_key with public boxes, but
|
128
|
+
# there is a bug in that implentation so we just allow the insecure_key
|
129
|
+
# anyway.
|
130
|
+
config.ssh.insert_key = false
|
131
|
+
config.vm.box_check_update = false
|
132
|
+
|
133
|
+
config.vm.define "default" do |default|
|
134
|
+
# set this to true, if you want to use a global proxy
|
135
|
+
default.proxy.enabled = false if !GLOBAL_PROXY_HOST
|
136
|
+
default.proxy.enabled = {
|
137
|
+
:apt => false
|
138
|
+
}
|
139
|
+
|
140
|
+
default.vm.box = BOX
|
141
|
+
|
142
|
+
default.vm.provision "file", source: "./tinyproxy.conf", destination: "/tmp/tinyproxy.conf"
|
143
|
+
default.vm.provision :shell, path: 'install-debian.sh'
|
144
|
+
|
145
|
+
default.vm.network "private_network", ip: "70.70.70.10"
|
146
|
+
end
|
147
|
+
|
148
|
+
config.vm.define "centos7-client" do |centos7|
|
149
|
+
centos7.proxy.enabled = config.proxy.enabled
|
150
|
+
centos7.vm.box = "centos/7"
|
151
|
+
|
152
|
+
centos7.vm.network "private_network", ip: "70.70.70.20"
|
153
|
+
|
154
|
+
centos7.vm.provision :shell, path: 'install-c7.sh'
|
155
|
+
end
|
156
|
+
|
157
|
+
config.vm.provider :virtualbox do |vb, override|
|
158
|
+
# override.proxy.enabled = ENABLE_PROXY
|
159
|
+
vb.cpus = 1
|
160
|
+
vb.memory = 1024
|
161
|
+
|
162
|
+
vb.customize [ "modifyvm", :id, "--uartmode1", "disconnected" ] if config.vm.box =~ /xenial|bionic/
|
15
163
|
|
16
|
-
|
17
|
-
|
18
|
-
config.vm.box_url = 'https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_provisionerless.box'
|
164
|
+
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
|
165
|
+
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
|
19
166
|
end
|
20
167
|
end
|