dry-stack 0.0.80 → 0.0.81

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: 494e6afe2e8c38f8109678bc6f8c484c77449cf0cff675f97cc81419f0405efb
4
- data.tar.gz: 4f5944de12d4532a931697c61799343c25c3a68b4c98ae23ec683f3b0df6075c
3
+ metadata.gz: 758974f16669de0183b226fe54b60a63ff0f83dce670049922d86968b5d4d7ad
4
+ data.tar.gz: afeaef4ec662565cda18cd38deef6b7e55977ab8b96838622665d2ac0e4c88f4
5
5
  SHA512:
6
- metadata.gz: fd69e49a774071f6589affa27995b099d854dba54e7d9f31bd0e3a1f76eb62cf3eb647c622dfac1f831d9f9cc3de3c8bd7f9b1070ca3fe3346701bcf41fbceaf
7
- data.tar.gz: 4340c7640966ac12f8302042a9e04f34a1404c01823b17aba4738b81b55a9e8557ce82737e762931996a7527a3139b9da128638c185f9924b3011813115a800d
6
+ metadata.gz: '09f0cbddbcc9ccc2465352bf5dd1365e0b0cb2a2f5788536b09e4018c7b4b5f9cb7677930540ab6e82c064724e1aa805c88c18a79e6a2e66bc27388f72b33ea0'
7
+ data.tar.gz: 4d1a5fe073d29742e48a8d26eef50620f37ff4f7a3d42b9c899d303824f64e472900ae9545d6b76d733cc0521b95ec9386afb78375820af91d5727a89fc2a2e7
@@ -11,7 +11,9 @@ Dry::CommandLine::COMMANDS[:to_compose] = Class.new do
11
11
  _params[:'no-env'] ? $stdout.puts(yaml) : system("echo \"#{yaml.gsub("`", '\\\`')}\"")
12
12
  end
13
13
 
14
- def help = 'Print stack in docker compose format'
14
+ def help = ['Print stack in docker compose format',
15
+ '[... to_compose <deploy name>] ']
16
+
15
17
  end.new
16
18
 
17
19
 
@@ -3,6 +3,7 @@ require 'yaml'
3
3
  require 'json'
4
4
  require 'optparse'
5
5
  require 'digest'
6
+ require 'bcrypt'
6
7
 
7
8
  # class TrueClass
8
9
  # def encode_with(coder) = coder.represent_scalar('tag:yaml.org,2002:str', 'true')
@@ -56,6 +57,7 @@ module Dry
56
57
  def logging(opts) = (@service[:logging] ||= {}).merge! opts
57
58
  def user(user) = @service[:user] = user # "${UID}:${GID}", "www-data:www-data"
58
59
  def network(names) = (@service[:networks] ||= []) << names
60
+ def basic_auth(user_and_password) = @service[:basic_auth] = user_and_password
59
61
  end
60
62
 
61
63
  class SwarmFunction
@@ -126,6 +128,7 @@ module Dry
126
128
 
127
129
  opts.merge! @swarm_deploy[deploy_name][:options]
128
130
  end
131
+
129
132
  compose = {
130
133
  # name: @name.to_s, # https://docs.docker.com/compose/compose-file/#name-top-level-element
131
134
  # Not allowed by docker stack deploy
@@ -146,6 +149,14 @@ module Dry
146
149
  service[:deploy][:labels] ||= []
147
150
  service[:deploy][:labels] += @labels.map { "#{_1}=#{_2}" }
148
151
 
152
+ if service[:basic_auth]
153
+ ba_user, ba_password = service[:basic_auth].split ':'
154
+ hashed_password = BCrypt::Password.create ba_password
155
+ service[:deploy][:labels] << "traefik.http.middlewares.%{service-name}_auth.basicauth.users=#{ba_user}:#{hashed_password.gsub('$','$$')}"
156
+ service[:deploy][:labels] << "traefik.http.routers.%{service-name}.middlewares=%{service-name}_auth"
157
+ service.delete :basic_auth
158
+ end
159
+
149
160
  if ingress[0] && (opts[:ingress] || opts[:traefik] || opts[:traefik_tls])
150
161
  service[:networks] ||= []
151
162
  service[:networks] << 'default' if service[:networks].empty?
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Dry
2
2
  class Stack
3
- VERSION = '0.0.80'
3
+ VERSION = '0.0.81'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-stack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.80
4
+ version: 0.0.81
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-06-12 00:00:00.000000000 Z
11
+ date: 2024-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bcrypt
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rake
15
29
  requirement: !ruby/object:Gem::Requirement