dry-stack 0.0.70 → 0.0.72

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
2
  SHA256:
3
- metadata.gz: 347130396d5cf0de94694fdc5d5edcce940833d0dd4e7c05726fa218c0669801
4
- data.tar.gz: c62702ddffe13310445c8c830fa5cabb06763ed9ae71477d4e41e15c7f8239c5
3
+ metadata.gz: 7f35a469754d680757e756d963d51626b61036f72ded01624da7b83c265df270
4
+ data.tar.gz: 505a63cfb76e1f52e616ad8db6d2a61f4d1c414c2db1e2930f47678669b4efdc
5
5
  SHA512:
6
- metadata.gz: 738b139b5a8ead311d1c1445a88418cdf0d31f4c18a6e200515338f32a6dd041c9e324dffb998b3df9f19d8ed1323c34b340027ef3786b6c43152ce27f007973
7
- data.tar.gz: 5f67d76cf8c9d3ebb4b4b8e21dd71d6a420dfa514c955bae2c23dc6d12005d3793587c91895992f767efd18c2d16d884bbd416f39fec995f5535873985336fe6
6
+ metadata.gz: b31cdaa49ea775772f96b7975cf2948eefb0aa2889efa4177aae65f6932d376e433c1cb3c857f1090b6576fb373c6fb0c087eef5957009d808dcbab620eba563
7
+ data.tar.gz: 2f5840ec782285994e355950fe7d3fa856f275729351160999c973f81520867f41f35934c9636ae3f49efe4ed0207afc5ea9b34991e23fc24063e44e53bd0578
data/bin/stack.drs CHANGED
@@ -2,12 +2,21 @@ Description <<~DSC
2
2
 
3
3
  DSC
4
4
 
5
- Options name: 'stack_name'
5
+ Options name: 'stack_name', traefik: true
6
6
  SwarmDeploy :sky_gates do
7
7
  context_host 'ssh://root@10.0.0.1'
8
8
  stack_name 'remote_stack'
9
9
  env REGISTRY_HOST: '10.100.0.2:5000'
10
10
  end
11
+ Ingress admin: [
12
+ {host: 'backend.*'},
13
+ {host: 'admin.*', path: '/api', port: 4000}
14
+ ]
15
+
16
+ Deploy [:admin, :operator], labels: [
17
+ 'traefik.http.middlewares.%{service-name}_auth.basicauth.users=admin:$$apr1$$i7hdbc9g$$Rkocxo9snhmuESvUg0TTv/',
18
+ "traefik.http.routers.%{service-name}.middlewares=%{service-name}_auth"
19
+ ]
11
20
 
12
21
  PublishPorts admin: 4000, operator: 4001, navigator: 4002, reports: 7000 # mode: ingress, protocol: tcp
13
22
 
@@ -13,6 +13,22 @@ require 'digest'
13
13
  # end
14
14
 
15
15
  module Dry
16
+ class ::Hash
17
+ def deep_merge!(second)
18
+ merger = proc { |_, v1, v2|
19
+ if Hash === v1 && Hash === v2
20
+ v1.merge!(v2, &merger)
21
+ else
22
+ if Array === v1 && Array === v2
23
+ v1 | v2
24
+ else
25
+ [:undefined, nil, :nil].include?(v2) ? v1 : v2
26
+ end
27
+ end
28
+ }
29
+ merge!(second.to_h, &merger)
30
+ end
31
+ end
16
32
 
17
33
  def each_recursive(parent, each_ =-> { _1.respond_to?(:each) ? _1.each : [] }, path = [], &blk)
18
34
  each2_ = each_.is_a?(Array) ? ->(p) { (m = each_.find { p.respond_to? _1 }) ? p.send(m) : [] } : each_
@@ -182,16 +198,16 @@ module Dry
182
198
  service[:environment].merge! STACK_NAME: @name.to_s, STACK_SERVICE_NAME: name.to_s
183
199
  service[:environment].transform_values! { !!_1 == _1 ? _1.to_s : _1 } # (false|true) to string
184
200
 
201
+ service[:deploy].deep_merge! @deploy[name] if @deploy[name]
202
+
185
203
  hash = {'service-name': service_name, 'stack-name': @name}
186
204
  hash.default = ''
187
205
  original_verbosity = $VERBOSE
188
206
  $VERBOSE = nil
189
- service[:deploy][:labels].map!{ _1 % hash }
207
+ service[:deploy][:labels] = service[:deploy][:labels].map{ _1 % hash }
190
208
  service[:environment].transform_values!{ _1.is_a?(String) ? (_1 % hash) : _1 }
191
209
  $VERBOSE = original_verbosity
192
210
 
193
- service[:deploy].merge! @deploy[name] if @deploy[name]
194
-
195
211
  pp_i = @publish_ports[name]&.reject { _1.class == String }
196
212
  pp_s = @publish_ports[name]&.select { _1.class == String }
197
213
  service[:ports] = pp_i&.zip(service[:ports] || pp_i)&.map { _1.join ':' }
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Dry
2
2
  class Stack
3
- VERSION = '0.0.70'
3
+ VERSION = '0.0.72'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-stack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.70
4
+ version: 0.0.72
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artyom B
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-01 00:00:00.000000000 Z
11
+ date: 2024-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake