consul_bridge 0.1.1 → 0.1.2
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 +4 -4
- data/Dockerfile +6 -3
- data/lib/consul_bridge/bootstrap_consul.rb +0 -1
- data/lib/consul_bridge/cli.rb +3 -1
- data/lib/consul_bridge/monitor_docker_events.rb +6 -2
- data/lib/consul_bridge/monitor_docker_events_actor.rb +11 -4
- data/lib/consul_bridge/run_bridge.rb +5 -4
- data/lib/consul_bridge/version.rb +1 -1
- metadata +2 -3
- data/lib/consul_bridge/detect_consul_bootstrap.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7a3236dc1a4f626e3d05b5623cc0ffd8ac68cfc
|
4
|
+
data.tar.gz: 0825eefa1db21df45fb39340275df04e182131fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af77e4bf8ddc95fb33b8128647bac7a798c9f62ff608f873495134c4d5dc02b28f2ab9986d8927220a9d1a3d0bd52d0dc48bd512f5c03bb657a7f706f9f89cca
|
7
|
+
data.tar.gz: 2d3f4d36af4dc8b94d1b5a142a0314720ce05a6e7f14a036add11255297ddd15834ff9a4b8a2efac579d2c01cc38773bdf9991c04385cc3476a551ea04ca1e25
|
data/Dockerfile
CHANGED
@@ -4,7 +4,7 @@ MAINTAINER Ryan Schlesinger <ryan@outstand.com>
|
|
4
4
|
RUN addgroup bridge && \
|
5
5
|
adduser -S -G bridge bridge
|
6
6
|
|
7
|
-
ENV CONSUL_BRIDGE_VERSION=0.1.
|
7
|
+
ENV CONSUL_BRIDGE_VERSION=0.1.1
|
8
8
|
|
9
9
|
# Use this to install an official release
|
10
10
|
RUN apk --no-cache add libxml2 libxslt \
|
@@ -15,10 +15,13 @@ RUN apk --no-cache add libxml2 libxslt \
|
|
15
15
|
|
16
16
|
# Use this to install a development version
|
17
17
|
# RUN apk --no-cache add build-base libxml2-dev libxslt-dev
|
18
|
-
# COPY . /consul_bridge/
|
18
|
+
# COPY Gemfile consul_bridge.gemspec /consul_bridge/
|
19
|
+
# COPY lib/consul_bridge/version.rb /consul_bridge/lib/consul_bridge/
|
19
20
|
# RUN cd /consul_bridge \
|
20
21
|
# && bundle config build.nokogiri --use-system-libraries \
|
21
|
-
# && bundle install
|
22
|
+
# && bundle install
|
23
|
+
# COPY . /consul_bridge/
|
24
|
+
# RUN cd /consul_bridge \
|
22
25
|
# && bundle exec rake install
|
23
26
|
|
24
27
|
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
data/lib/consul_bridge/cli.rb
CHANGED
@@ -11,13 +11,15 @@ module ConsulBridge
|
|
11
11
|
option :bucket, aliases: '-b', required: true, type: :string, banner: '<s3_bucket>'
|
12
12
|
option :container_name, aliases: '-n', required: true, type: :string, banner: '<container_name>'
|
13
13
|
option :join_all, aliases: '-a', type: :boolean, default: false
|
14
|
+
option :verbose, aliases: '-v', type: :boolean, default: false
|
14
15
|
def start
|
15
16
|
$stdout.sync = true
|
16
17
|
require 'consul_bridge/run_bridge'
|
17
18
|
RunBridge.call(
|
18
19
|
bucket: options[:bucket],
|
19
20
|
container_name: options[:container_name],
|
20
|
-
join_all: options[:join_all]
|
21
|
+
join_all: options[:join_all],
|
22
|
+
verbose: options[:verbose]
|
21
23
|
)
|
22
24
|
end
|
23
25
|
end
|
@@ -18,8 +18,12 @@ module ConsulBridge
|
|
18
18
|
end
|
19
19
|
rescue Docker::Error::TimeoutError
|
20
20
|
retry
|
21
|
-
rescue Excon::Errors::SocketError
|
22
|
-
|
21
|
+
rescue Excon::Errors::SocketError => e
|
22
|
+
if Errno::ENOENT === e.cause
|
23
|
+
raise
|
24
|
+
else
|
25
|
+
retry
|
26
|
+
end
|
23
27
|
end
|
24
28
|
end
|
25
29
|
end
|
@@ -13,10 +13,17 @@ module ConsulBridge
|
|
13
13
|
|
14
14
|
def on_message(message)
|
15
15
|
if message == :monitor
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
begin
|
17
|
+
MonitorDockerEvents.call(
|
18
|
+
container_name: @container_name,
|
19
|
+
handler: ->(event){ @bootstrap_actor << :bootstrap }
|
20
|
+
)
|
21
|
+
rescue Excon::Errors::SocketError => e
|
22
|
+
if Errno::ENOENT === e.cause
|
23
|
+
puts "Warning: #{e.cause.message}; retrying in 30 seconds"
|
24
|
+
Concurrent::ScheduledTask.execute(30){ tell :monitor }
|
25
|
+
end
|
26
|
+
end
|
20
27
|
else
|
21
28
|
pass
|
22
29
|
end
|
@@ -5,17 +5,18 @@ require 'concurrent'
|
|
5
5
|
|
6
6
|
module ConsulBridge
|
7
7
|
class RunBridge < Base
|
8
|
-
attr_accessor :bucket, :container_name, :join_all
|
8
|
+
attr_accessor :bucket, :container_name, :join_all, :verbose
|
9
9
|
|
10
|
-
def initialize(bucket:, container_name:, join_all: false)
|
10
|
+
def initialize(bucket:, container_name:, join_all: false, verbose: false)
|
11
11
|
self.bucket = bucket
|
12
12
|
self.container_name = container_name
|
13
13
|
self.join_all = join_all
|
14
|
+
self.verbose = verbose
|
14
15
|
end
|
15
16
|
|
16
17
|
def call
|
17
|
-
|
18
|
-
|
18
|
+
Concurrent.use_stdlib_logger(Logger::DEBUG) if self.verbose
|
19
|
+
|
19
20
|
self_read, self_write = IO.pipe
|
20
21
|
%w(INT TERM).each do |sig|
|
21
22
|
begin
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: consul_bridge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Schlesinger
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -160,7 +160,6 @@ files:
|
|
160
160
|
- lib/consul_bridge/bootstrap_consul_actor.rb
|
161
161
|
- lib/consul_bridge/cli.rb
|
162
162
|
- lib/consul_bridge/detect_consul.rb
|
163
|
-
- lib/consul_bridge/detect_consul_bootstrap.rb
|
164
163
|
- lib/consul_bridge/download_masters.rb
|
165
164
|
- lib/consul_bridge/get_private_ip.rb
|
166
165
|
- lib/consul_bridge/join_consul.rb
|