capistrano3-consul 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +31 -4
- data/capistrano3-consul.gemspec +2 -0
- data/lib/capistrano/consul/version.rb +1 -1
- data/lib/capistrano/consul.rb +10 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c1dc53661e5990e5a1a71de57d8b16a9f3fdad1
|
4
|
+
data.tar.gz: 298f293f80fbdae3764f0c2554ef822aaa41f383
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87df52bc48e5f23c229154786bba477e746a8d217460d4f1c6165f0f47f971706b330c53aa63831773642c81aa026962576eab4024717e5598b2f802d0dad8c0
|
7
|
+
data.tar.gz: abb3cd5d1d3cd1700aa1a7f8582c39265f9566407eb95651ba9b7739b40e4f56143a8eb439149677995e434be6c1304b1142315a90573fe4a2e15a48cb6c4c18
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# Capistrano::Consul
|
2
2
|
|
3
|
-
|
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
|
-
|
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.
|
data/capistrano3-consul.gemspec
CHANGED
@@ -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'
|
data/lib/capistrano/consul.rb
CHANGED
@@ -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.
|
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-
|
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
|