vagrant-adbinfo 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/Gemfile +11 -0
- data/README.md +51 -0
- data/Rakefile +1 -0
- data/Vagrantfile +72 -0
- data/lib/command.rb +26 -0
- data/lib/vagrant-adbinfo.rb +12 -0
- data/vagrant-adbinfo.gemspec +15 -0
- metadata +82 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b601a8239cb4fda104bbbb7aa7406a9625138997
|
4
|
+
data.tar.gz: 994cb677baa05fc1582e27f3622a2dbadd140bb7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: dd7aa89b8d77f0e284b83c34e3fcebec20178c7ada7bda02332bd64aa8a360ccab49da6ed17591d8ffc7d3733c39da3f590a6d9b131469f74fd85780ffd052fb
|
7
|
+
data.tar.gz: 6fefe725adb2bf8cf3c55ccdf1a71a44d90eaac4e5c13c9de1573f5466e3d3897f60261701e6a49ba509936c9937eb4a93f849633c985a6c7228c63ed9686ed8
|
data/.gitignore
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
group :development do
|
4
|
+
gem 'vagrant', git: 'https://github.com/mitchellh/vagrant.git'
|
5
|
+
# added as the vagrant component wouldn't build without it
|
6
|
+
gem 'json'
|
7
|
+
end
|
8
|
+
|
9
|
+
group :plugins do
|
10
|
+
gem 'vagrant-adbinfo', path: '.'
|
11
|
+
end
|
data/README.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
Display docker information from a vagrant machine, similar to what boot2docker provides
|
2
|
+
|
3
|
+
Based in part on the work done by Michael Kuzmin for vagrant-guestip at https://github.com/mkuzmin/vagrant-guestip
|
4
|
+
|
5
|
+
#How to Develop/Test
|
6
|
+
|
7
|
+
1 - Install VirtualBox (http://www.if-not-true-then-false.com/2010/install-virtualbox-with-yum-on-fedora-centos-red-hat-rhel/)
|
8
|
+
|
9
|
+
2 - Get a box to test
|
10
|
+
|
11
|
+
3 - Build a vagrant file
|
12
|
+
|
13
|
+
4 - bundle install
|
14
|
+
|
15
|
+
5 - bundle exec vagrant up # starts the vagrant box
|
16
|
+
|
17
|
+
6 - bundle exec vagrant adbinfo # tests the command
|
18
|
+
|
19
|
+
7 - rake build # puts the gemfile in pkg/
|
20
|
+
|
21
|
+
|
22
|
+
# Potential Plans/Ideas (in Priority Order)
|
23
|
+
|
24
|
+
## VirtualBox Support (Priority 1a - implemented)
|
25
|
+
|
26
|
+
For the VirtualBox provider, the user is encouraged to use a forwarded_port directive (with auto_correct) in their Vagrantfile to expose the docker port.
|
27
|
+
|
28
|
+
The plugin will use the :forwarded_ports capability to find the forwarded port number and provide it with localhost as the IP address.
|
29
|
+
|
30
|
+
Why? By default Virtualbox creates a box that has no inbound network access. The pattern is to always forward ports, something that a daemon takes care.
|
31
|
+
|
32
|
+
## TLS Certificate Location Support, part 2 (Priority 1b - not started)
|
33
|
+
|
34
|
+
The TLS certificate will always land in a known spot, so we need to add that
|
35
|
+
|
36
|
+
## libvirt Support (Priority 2 - not started)
|
37
|
+
|
38
|
+
For the libvirt provider, the user will be encouraged to just start the box with no special directives in the Vagrantfile.
|
39
|
+
|
40
|
+
The plugin will use the standard-docker port combined with the private IP address of the vagrant box.
|
41
|
+
|
42
|
+
Why? vagrant-libvirt has two challenges:
|
43
|
+
|
44
|
+
1. There is currently no implementation of the :forwarded_ports capability to list all forwarded ports. Additionally the codebase does not keep track of these directly, so it is a non-trivial fix. (Though the fix may still be easy/medium).
|
45
|
+
2. Vagrant-libvirt doesn't actually support forwarded ports directly. Instead a private network is always started and when a forwarded port is requested and instance of `ssh` is spawned to take care of port forwarding. Since this has non-trivial overhead, there is no reason to use it when we can just get to the box directly
|
46
|
+
|
47
|
+
## Anti-Pattern Support (priority 3 - not started)
|
48
|
+
|
49
|
+
- Support inbound network and no port forward for VirtualBox.
|
50
|
+
- Support a port forward on libvirt.
|
51
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/Vagrantfile
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
# All Vagrant configuration is done below. The "2" in Vagrant.configure
|
5
|
+
# configures the configuration version (we support older styles for
|
6
|
+
# backwards compatibility). Please don't change it unless you know what
|
7
|
+
# you're doing.
|
8
|
+
Vagrant.configure(2) do |config|
|
9
|
+
# The most common configuration options are documented and commented below.
|
10
|
+
# For a complete reference, please see the online documentation at
|
11
|
+
# https://docs.vagrantup.com.
|
12
|
+
|
13
|
+
# Every Vagrant development environment requires a box. You can search for
|
14
|
+
# boxes at https://atlas.hashicorp.com/search.
|
15
|
+
config.vm.box = "centos7-cdk-test"
|
16
|
+
|
17
|
+
# Disable automatic box update checking. If you disable this, then
|
18
|
+
# boxes will only be checked for updates when the user runs
|
19
|
+
# `vagrant box outdated`. This is not recommended.
|
20
|
+
# config.vm.box_check_update = false
|
21
|
+
|
22
|
+
# Create a forwarded port mapping which allows access to a specific port
|
23
|
+
# within the machine from a port on the host machine. In the example below,
|
24
|
+
# accessing "localhost:8080" will access port 80 on the guest machine.
|
25
|
+
#config.vm.network "forwarded_port", guest: 80, host: 8080
|
26
|
+
config.vm.network "forwarded_port", guest: 2376, host: 5555
|
27
|
+
|
28
|
+
# Create a private network, which allows host-only access to the machine
|
29
|
+
# using a specific IP.
|
30
|
+
# config.vm.network "private_network", ip: "192.168.33.10"
|
31
|
+
|
32
|
+
# Create a public network, which generally matched to bridged network.
|
33
|
+
# Bridged networks make the machine appear as another physical device on
|
34
|
+
# your network.
|
35
|
+
# config.vm.network "public_network"
|
36
|
+
|
37
|
+
# Share an additional folder to the guest VM. The first argument is
|
38
|
+
# the path on the host to the actual folder. The second argument is
|
39
|
+
# the path on the guest to mount the folder. And the optional third
|
40
|
+
# argument is a set of non-required options.
|
41
|
+
# config.vm.synced_folder "../data", "/vagrant_data"
|
42
|
+
|
43
|
+
# Provider-specific configuration so you can fine-tune various
|
44
|
+
# backing providers for Vagrant. These expose provider-specific options.
|
45
|
+
# Example for VirtualBox:
|
46
|
+
#
|
47
|
+
# config.vm.provider "virtualbox" do |vb|
|
48
|
+
# # Display the VirtualBox GUI when booting the machine
|
49
|
+
# vb.gui = true
|
50
|
+
#
|
51
|
+
# # Customize the amount of memory on the VM:
|
52
|
+
# vb.memory = "1024"
|
53
|
+
# end
|
54
|
+
#
|
55
|
+
# View the documentation for the provider you are using for more
|
56
|
+
# information on available options.
|
57
|
+
|
58
|
+
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
|
59
|
+
# such as FTP and Heroku are also available. See the documentation at
|
60
|
+
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
|
61
|
+
# config.push.define "atlas" do |push|
|
62
|
+
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
|
63
|
+
# end
|
64
|
+
|
65
|
+
# Enable provisioning with a shell script. Additional provisioners such as
|
66
|
+
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
|
67
|
+
# documentation for more information about their specific syntax and use.
|
68
|
+
# config.vm.provision "shell", inline: <<-SHELL
|
69
|
+
# sudo apt-get update
|
70
|
+
# sudo apt-get install -y apache2
|
71
|
+
# SHELL
|
72
|
+
end
|
data/lib/command.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module DockerInfo
|
3
|
+
class Command < Vagrant.plugin(2, :command)
|
4
|
+
def self.synopsis
|
5
|
+
'provides the IP address:port and tls certificate file location for a docker daemon'
|
6
|
+
end
|
7
|
+
|
8
|
+
def execute
|
9
|
+
with_target_vms(nil, {:single_target=>true}) do |machine|
|
10
|
+
port = machine.provider.capability(:forwarded_ports).index(2376)
|
11
|
+
message =
|
12
|
+
<<-eos
|
13
|
+
Set the following environment variables to enable access to the
|
14
|
+
docker daemon running inside of the vagrant virtual machine:
|
15
|
+
|
16
|
+
export DOCKER_HOST=tcp://127.0.0.1:#{port}
|
17
|
+
export DOCKER_CERT_PATH=PATH_NEEDED
|
18
|
+
export DOCKER_TLS_VERIFY=1
|
19
|
+
export DOCKER_MACHINE_NAME=\"#{machine.id}\"
|
20
|
+
eos
|
21
|
+
@env.ui.info(message)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Gem::Specification.new do |spec|
|
2
|
+
spec.name = 'vagrant-adbinfo'
|
3
|
+
spec.version = '0.0.1'
|
4
|
+
spec.homepage = 'https://github.com/bexelbie/vagrant-adbinfo'
|
5
|
+
spec.summary = 'Vagrant plugin that provides the IP address:port and tls certificate file location for a docker daemon'
|
6
|
+
|
7
|
+
spec.authors = ['Brian Exelbierd', 'Navid Shaikh']
|
8
|
+
spec.email = ['bex@pobox.com', 'nshaikh@redhat.com']
|
9
|
+
|
10
|
+
spec.files = `git ls-files -z`.split("\x0")
|
11
|
+
spec.require_paths = ['lib']
|
12
|
+
|
13
|
+
spec.add_development_dependency 'bundler', '~> 1.6'
|
14
|
+
spec.add_development_dependency 'rake'
|
15
|
+
end
|
metadata
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vagrant-adbinfo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brian Exelbierd
|
8
|
+
- Navid Shaikh
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2015-09-11 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.6'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '1.6'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rake
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
description:
|
43
|
+
email:
|
44
|
+
- bex@pobox.com
|
45
|
+
- nshaikh@redhat.com
|
46
|
+
executables: []
|
47
|
+
extensions: []
|
48
|
+
extra_rdoc_files: []
|
49
|
+
files:
|
50
|
+
- ".gitignore"
|
51
|
+
- Gemfile
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- Vagrantfile
|
55
|
+
- lib/command.rb
|
56
|
+
- lib/vagrant-adbinfo.rb
|
57
|
+
- vagrant-adbinfo.gemspec
|
58
|
+
homepage: https://github.com/bexelbie/vagrant-adbinfo
|
59
|
+
licenses: []
|
60
|
+
metadata: {}
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options: []
|
63
|
+
require_paths:
|
64
|
+
- lib
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
requirements: []
|
76
|
+
rubyforge_project:
|
77
|
+
rubygems_version: 2.2.5
|
78
|
+
signing_key:
|
79
|
+
specification_version: 4
|
80
|
+
summary: Vagrant plugin that provides the IP address:port and tls certificate file
|
81
|
+
location for a docker daemon
|
82
|
+
test_files: []
|