aggkit 0.4.4.10477 → 0.4.4.11050
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/bin/aggwrap +30 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e382cdb9cfb986897ccc243f7c91f544c4834531
|
|
4
|
+
data.tar.gz: 1443f0a041c67d7c0adf82837a946a8b026d16fa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d6e652bf997f8de37bbc90b4e40fe94dcaf31aeb2806d98783a79d3c1ecc8602377c530e0b36fc79a4a779202a0af0f0b406bf777163e34ed6a0809ff0d7859f
|
|
7
|
+
data.tar.gz: d672dbe8d83d3354f72918927ed3b155a01ea0f5830faf33ca89497833ad5373ffc6e62710fdd6c36a308d09657967998a481215c077752c6d7a40539b60052f
|
data/bin/aggwrap
CHANGED
|
@@ -57,6 +57,8 @@ STDERR.sync
|
|
|
57
57
|
STDOUT.sync
|
|
58
58
|
|
|
59
59
|
UTIL = File.basename(__FILE__)
|
|
60
|
+
DEFAULT_RELOAD_INTERVAL = 60 # seconds
|
|
61
|
+
|
|
60
62
|
|
|
61
63
|
include Aggkit::Runner
|
|
62
64
|
|
|
@@ -67,7 +69,8 @@ end
|
|
|
67
69
|
@opts = {
|
|
68
70
|
service: ENV['AGGREDATOR_SERVICE'],
|
|
69
71
|
id: SecureRandom.hex(8),
|
|
70
|
-
consul: ENV['CONSUL_HTTP_ADDR']
|
|
72
|
+
consul: ENV['CONSUL_HTTP_ADDR'],
|
|
73
|
+
reload_interval: DEFAULT_RELOAD_INTERVAL
|
|
71
74
|
}
|
|
72
75
|
|
|
73
76
|
@opts[:exec] = (begin
|
|
@@ -113,6 +116,12 @@ parser = Aggkit::OptionParser.new do |o|
|
|
|
113
116
|
o.on('--script <FILE>', 'Create TTL consul check and pass script result to it') do |file|
|
|
114
117
|
@opts[:script] = file.to_s
|
|
115
118
|
end
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
o.on('--reload-config-interval <INTERVAL>', 'Seconds between check change service configuration') do |interval|
|
|
122
|
+
@opts[:reload_interval] = Integer(interval)
|
|
123
|
+
end
|
|
124
|
+
|
|
116
125
|
end
|
|
117
126
|
parser.parse!
|
|
118
127
|
|
|
@@ -272,6 +281,26 @@ Thread.new do
|
|
|
272
281
|
end
|
|
273
282
|
end
|
|
274
283
|
|
|
284
|
+
|
|
285
|
+
Thread.new(@opts[:reload_interval], @opts[:service]) do |sleep_interval, service_name|
|
|
286
|
+
kv_prefix = ['services', 'env']
|
|
287
|
+
config_hash = nil
|
|
288
|
+
service_kv_path = kv_prefix.append(service_name).join('/')
|
|
289
|
+
loop do
|
|
290
|
+
sleep sleep_interval
|
|
291
|
+
data = Diplomat::Kv.get(service_kv_path, recurse: true, convert_to_hash: true) rescue {}
|
|
292
|
+
|
|
293
|
+
service_data = data.dig(*kv_prefix)
|
|
294
|
+
next if service_data.nil?
|
|
295
|
+
new_hash = Digest::MD5.new.update(service_data.to_json).hexdigest
|
|
296
|
+
if !config_hash.nil? && config_hash != new_hash
|
|
297
|
+
die("Change kv configuration for consul service.")
|
|
298
|
+
end
|
|
299
|
+
config_hash = new_hash
|
|
300
|
+
end
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
|
|
275
304
|
$pid = fork do
|
|
276
305
|
STDERR.sync
|
|
277
306
|
STDOUT.sync
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: aggkit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.4.
|
|
4
|
+
version: 0.4.4.11050
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Godko Ivan
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2019-04-
|
|
12
|
+
date: 2019-04-29 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: diplomat
|