aggkit 0.4.0.9116 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 844a18ca83b6410264ca53fc074af96faefb2daa
4
- data.tar.gz: 61b02b6cfed3fc5607ebb4815bff46eae875627c
2
+ SHA256:
3
+ metadata.gz: de3b3e58fad75455718b669cb92d79fa8f1e786f403291e6692ce381ba8ac8c3
4
+ data.tar.gz: 9ee14a7a2d706199556dac49acc1e52273f1bd574de7122022295d5991cdd560
5
5
  SHA512:
6
- metadata.gz: d5f65efc47c2b7ca7c2ff80406ae497e92f454d1ec5bb5a43ce3b45889613dbd75bcf5524c3ef7227aa01a550e593e7d9d8d236c651be147973dfe17829613b4
7
- data.tar.gz: 0b29500dcc20687233669362853244fab6acfeaa9ae2cc4aff1b009b8e753b6aa9102e9909153acd9d330c15f8b228656074295d4c42c1a215f864e1175d9681
6
+ metadata.gz: 791214ae9804d7bb28332c6aa5c5c8eb4d244ac5464a1a83250a6a9ae2fb400c261720cb1cb9e2b43401f2ce2eee15ea692b8966ee9632e87ffccddfad03ef54
7
+ data.tar.gz: 9b8f555454809b7198ff16a6cf13195eb64e99447ec2577f3856a5ffe41cc6d3c127562d0583eaa79c1604da601d8896ba8e6813d456b5adb3ec6324c31b4fd7
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- aggkit (0.4.0.9116)
4
+ aggkit (0.4.1)
5
5
  diplomat
6
6
  dotenv
7
7
  json
data/bin/aggmerge CHANGED
@@ -122,8 +122,7 @@ def remove_build_section(hash)
122
122
  end
123
123
 
124
124
  if File.basename($PROGRAM_NAME) == File.basename(__FILE__)
125
- # version в базовом хэше для того чтобы первым попасть в итоговый файл.
126
- result = ENV['COMPOSE_FILE'].split(':').reduce({'version' => nil}) do |parent, file|
125
+ result = ENV['COMPOSE_FILE'].split(':').reduce({}) do |parent, file|
127
126
  yml = process_compose_hash(YAML.load(File.read(file)), File.dirname(file), parent)
128
127
  if yml['version'] && parent['version'] && yml['version'] != parent['version']
129
128
  raise "version mismatch: #{file}"
data/bin/aggstart CHANGED
@@ -12,7 +12,8 @@ end
12
12
  service: ENV['AGGREDATOR_SERVICE'],
13
13
  consul: ENV['CONSUL_HTTP_ADDR'],
14
14
  consulconf: [],
15
- depends: []
15
+ depends: [],
16
+ watch: true,
16
17
  }
17
18
 
18
19
  @opts[:exec] = (begin
@@ -51,6 +52,10 @@ parser = Aggkit::OptionParser.new do |o|
51
52
  o.on('--depends=mq,db,router...', 'Set list of services to wait for ready before start') do |list|
52
53
  @opts[:depends] = list.to_s.split(/[ ;,|]/).map(&:to_s).reject(&:empty?)
53
54
  end
55
+
56
+ o.on('--[no-]watch', 'use exec instead of watcher') do |watch|
57
+ @opts[:watch] = watch
58
+ end
54
59
  end
55
60
  parser.parse!
56
61
 
@@ -68,27 +73,37 @@ ENV['NODE_NAME'] = @opts[:node_name]
68
73
 
69
74
  init_service @opts[:service], @opts
70
75
 
71
- envsubst '/home/app/consul'
76
+ envsubst '/home/app/consul' rescue nil
72
77
 
73
- Aggkit::Watcher.new.exec do |watcher|
74
- if @opts[:consulconf]
75
- configs = @opts[:consulconf].map do |folder|
76
- "-config-dir #{folder}"
77
- end.join(' ').strip
78
-
79
- watcher.add "consul agent #{configs} -node #{@opts[:node_name]}".split
80
- end
81
78
 
79
+ def init_and_wait
82
80
  execute!("aggwait -t 20 --consul-addr=#{@opts[:consul]} --consul", 'Timeout for consul service')
83
-
84
81
  load_envs_from_consul(@opts[:consul], @opts[:service])
85
82
 
86
83
  @opts[:depends].each do |service|
87
84
  execute!("aggwait -t 60 --consul-addr=#{@opts[:consul]} --consul-service #{service}", "Timeout for #{service} service")
88
85
  end
89
-
90
86
  sleep 2
87
+ end
91
88
 
92
- watcher.add @opts[:exec]
89
+ if @opts[:watch]
90
+ Aggkit::Watcher.new.exec do |watcher|
91
+ if @opts[:consulconf]
92
+ configs = @opts[:consulconf].map do |folder|
93
+ "-config-dir #{folder}"
94
+ end.join(' ').strip
95
+
96
+ watcher.add *%W{"consul agent #{configs} -node #{@opts[:node_name]}}
97
+ @opts[:consul] = ENV['CONSUL_HTTP_ADDR'] = 'localhost'
98
+ end
99
+
100
+ init_and_wait
101
+ watcher.add *@opts[:exec]
102
+ end
103
+ else
104
+ init_and_wait
105
+ exec *@opts[:exec]
93
106
  end
94
107
 
108
+
109
+
@@ -1,6 +1,6 @@
1
1
  module Aggkit
2
2
 
3
- VERSION = '0.4.0'.freeze
3
+ VERSION = '0.4.1'.freeze
4
4
 
5
5
  end
6
6
 
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.0.9116
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Godko Ivan
@@ -192,7 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
192
192
  version: '0'
193
193
  requirements: []
194
194
  rubyforge_project:
195
- rubygems_version: 2.6.3
195
+ rubygems_version: 2.7.3
196
196
  signing_key:
197
197
  specification_version: 4
198
198
  summary: Helper scripts for work with docker and consul in Aggredator