capistrano3-consul 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5509c46cd5fc618f268bce16d3b58bada6ee6cb3
4
- data.tar.gz: 9bcbd772ddb34997510609573e764d037977e821
3
+ metadata.gz: 0c1dc53661e5990e5a1a71de57d8b16a9f3fdad1
4
+ data.tar.gz: 298f293f80fbdae3764f0c2554ef822aaa41f383
5
5
  SHA512:
6
- metadata.gz: 3a4c775a52557f9bdef2183787ddc48f752b8b34785d1f4709f49cdd961f0dabbb47298ab4c3612ec980ee01c92f51cf2fbe4479ec99e4542dbb95dfb5cb131b
7
- data.tar.gz: a676d04ee6bdb93840761a484e573f09a5ac5597e3bc7b07c02f6ce9f995786e89a2d8cd033f072a04c38273075673789fb8bf8615ce04f5f45c686f127dac98
6
+ metadata.gz: 87df52bc48e5f23c229154786bba477e746a8d217460d4f1c6165f0f47f971706b330c53aa63831773642c81aa026962576eab4024717e5598b2f802d0dad8c0
7
+ data.tar.gz: abb3cd5d1d3cd1700aa1a7f8582c39265f9566407eb95651ba9b7739b40e4f56143a8eb439149677995e434be6c1304b1142315a90573fe4a2e15a48cb6c4c18
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # Capistrano::Consul
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/capistrano/consul`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ Allows capistrano to obtain the list of servers using a consul server
6
4
 
7
5
  ## Installation
8
6
 
@@ -22,8 +20,37 @@ Or install it yourself as:
22
20
 
23
21
  ## Usage
24
22
 
25
- TODO: Write usage instructions here
23
+ In capistrano.
24
+
25
+ ```ruby
26
+ require 'capistrano/consul'
27
+ ```
28
+
29
+ In your code, then you can map a consul service to roles in capistrano
30
+ ```ruby
31
+ consul_service 'app_server', roles %w{web app}
32
+ ```
33
+
34
+ Also, you can use #consul_all_nodes to refer to every node in consul (useful for some tasks)
35
+
36
+ ```ruby
37
+ consul_all_nodes roles %w{web app}
38
+ ```
26
39
 
40
+ ## Configuration
41
+ **consul_url** The api endpoint
42
+ **consul_ssh_gateway** You can configure an ssh gateway (i.e. a tunner that will be created before connecting to consul).
43
+
44
+ Example:
45
+ ``` ruby
46
+ set :consul_url, 'http://localhost:8500'
47
+ set :consul_ssh_gateway, {
48
+ host: your.gateway.server,
49
+ user: ENV['USER'],
50
+ port: 8500, (this port will be used for tunneling)
51
+ options: {ssh options here}
52
+ }
53
+ ```
27
54
  ## Development
28
55
 
29
56
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -21,6 +21,8 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.add_dependency 'capistrano', '>= 3.1'
23
23
  spec.add_dependency 'diplomat', '~> 0.15.0'
24
+ spec.add_runtime_dependency 'net-ssh-gateway'
25
+
24
26
  spec.add_development_dependency 'bundler', '~> 1.11'
25
27
  spec.add_development_dependency 'rake', '~> 10.0'
26
28
  spec.add_development_dependency 'rspec', '~> 3.0'
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Consul
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
@@ -1,5 +1,6 @@
1
1
  require 'capistrano/consul/version'
2
2
  require 'diplomat'
3
+ require 'net/ssh/gateway'
3
4
 
4
5
  module Capistrano
5
6
  module Consul
@@ -7,7 +8,16 @@ module Capistrano
7
8
  return if @url
8
9
  @url = fetch(:consul_url)
9
10
  return false unless @url
11
+ @ssh_gateway = fetch(:consul_ssh_gateway)
12
+ if @ssh_gateway
13
+ @gateway = Net::SSH::Gateway.new(@ssh_gateway[:host], @ssh_gateway[:username], @ssh_gateway[:options])
14
+ @gateway.open('127.0.0.1', @ssh_gateway[:port], @ssh_gateway[:port])
15
+ end
10
16
 
17
+ if @use_ssh_proxy
18
+ @ssh_options = fetch(:ssh_options)
19
+ return false unless @ssh_options[:proxy]
20
+ end
11
21
  Diplomat.configure do |config|
12
22
  config.url = @url
13
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano3-consul
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jose Fernandez (magec)
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-20 00:00:00.000000000 Z
11
+ date: 2016-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.15.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: net-ssh-gateway
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: bundler
43
57
  requirement: !ruby/object:Gem::Requirement