dry-stack 0.1.25 → 0.1.27

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d9f6e94fed9c9ceb71959fd7e943a01933c71f51ef63541daadc54beb3b52d3
4
- data.tar.gz: 4b03a946eb20d4f57860d508ab5d8ddc7cd8800caf5b07de24ea71f2284d94e9
3
+ metadata.gz: 6cc31d2b83307688e1d43bc7b204f641cc03c3b81e5b51edad67b1c59ecf88b9
4
+ data.tar.gz: '04284bddd3f1e10b39ae1cfc113953c9cc52aa20c00b06fd24e6cf34fe29ab59'
5
5
  SHA512:
6
- metadata.gz: a109b0ac31ca83a57af54f18fb8816a12c63158af8bdaef8620c2427d01c4db8aff9653317d706517ebad76752c6df078f3cfc1532f226a218b9f3271e30d903
7
- data.tar.gz: a10de81ff5832f6e0f346a9966a2b36308d119fe044c9941897125fd4544efe277e39ce104adedcf4ae9f4d1eb11cce4fc43acd4f75eb8ac6abf7a005d490aa0
6
+ metadata.gz: 1f4e9f33b0dc3a2a192f2f85a3cba5a390b0c0c2197a057be65ed5819f107f6958a2be9f88efbc39ee8a1b357e05f45447912c56fcaefaac023e5259a49183b8
7
+ data.tar.gz: 8ef6dafd0c4645afea6341a753554dfb3a747727d8e8d866aada49b971be9b54b31bc6f7a30ae553397d24d0e78d77575c0666455d16e05938bc1aa218906ad8
@@ -190,6 +190,8 @@ module Dry
190
190
  domain = ing[:tls_domain] if ing[:tls_domain]
191
191
 
192
192
  ing[:passthrough] = false unless ing.key? :passthrough
193
+ # Without specifying entrypoints any/all are user by traefik to to connectio to the service
194
+ raise "'entrypoints' required for SNI tcp route" if ing[:entrypoints].to_s.empty?
193
195
 
194
196
  service[:deploy][:labels] += [
195
197
  "traefik.tcp.routers.#{service_name}-#{index}.tls=true",
@@ -197,6 +199,7 @@ module Dry
197
199
  "traefik.tcp.routers.#{service_name}-#{index}.tls.domains[0].main=#{domain}",
198
200
 
199
201
  "traefik.tcp.routers.#{service_name}-#{index}.service=#{service_name}-#{index}",
202
+ "traefik.tcp.routers.#{service_name}-#{index}.entrypoints=#{ing[:entrypoints]}",
200
203
  "traefik.tcp.services.#{service_name}-#{index}.loadbalancer.server.port=#{ing[:port]}",
201
204
 
202
205
  "traefik.tcp.routers.#{service_name}-#{index}.rule=HostSNI(`#{domain}`)",
@@ -267,11 +270,23 @@ module Dry
267
270
  service[:deploy][:labels] = service[:deploy][:labels].map{ env_sub[_1] }
268
271
  service[:environment].transform_values!{ _1.is_a?(String) ? (env_sub[_1]) : _1 }
269
272
 
270
- pp_i = @publish_ports[name]&.reject { _1.class == String }
273
+ pp_h = @publish_ports[name]&.select { _1.class == Hash }
274
+ pp_i = @publish_ports[name]&.select { _1.class == Integer }
271
275
  pp_s = @publish_ports[name]&.select { _1.class == String }
272
276
  service[:ports] = pp_i&.zip(service[:ports] || pp_i)&.map { _1.join ':' }
273
277
  service[:ports] = (service[:ports] || []) + pp_s unless pp_s.nil?
274
278
 
279
+ if pp_h&.any?
280
+ service[:ports] = service[:ports].map { |s|
281
+ if s.class == String
282
+ published, target = s.split(':').map(&:to_i)
283
+ { published:, target:, protocol: 'tcp', mode: 'ingress'}
284
+ else
285
+ s
286
+ end
287
+ } + pp_h
288
+ end
289
+
275
290
  service[:logging] ||= @logging[name.to_sym]
276
291
 
277
292
  service[:volumes]&.map!&.with_index do |volume, index|
@@ -388,7 +403,7 @@ module Dry
388
403
  end
389
404
 
390
405
  def PublishPorts(ports)
391
- @publish_ports.merge! ports.to_h { |k, v| [k,[v].flatten] }
406
+ @publish_ports.merge! ports.to_h { |k, v| [k,@publish_ports[k].to_a + [v].flatten] }
392
407
  end
393
408
 
394
409
  def Service(name, opts = {}, &block)
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Dry
2
2
  class Stack
3
- VERSION = '0.1.25'
3
+ VERSION = '0.1.27'
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.1.25
4
+ version: 0.1.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artyom B
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-29 00:00:00.000000000 Z
11
+ date: 2025-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake