indocker 0.1.9 → 0.1.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/Gemfile +0 -1
- data/Gemfile.lock +10 -4
- data/example/indocker/bounded_contexts/shared/{container_failing_build → bad_container_build}/Dockerfile +0 -1
- data/example/indocker/bounded_contexts/shared/bad_container_build/container.rb +6 -0
- data/example/indocker/bounded_contexts/shared/bad_container_build/image.rb +3 -0
- data/example/indocker/bounded_contexts/shared/bad_container_start/Dockerfile +8 -0
- data/example/indocker/bounded_contexts/shared/bad_container_start/build_context/bin/run +3 -0
- data/example/indocker/bounded_contexts/shared/bad_container_start/container.rb +6 -0
- data/example/indocker/bounded_contexts/shared/bad_container_start/image.rb +3 -0
- data/example/indocker/bounded_contexts/shared/daemon_container/Dockerfile +4 -0
- data/example/indocker/bounded_contexts/shared/daemon_container/container.rb +6 -0
- data/example/indocker/bounded_contexts/shared/daemon_container/image.rb +3 -0
- data/example/indocker/bounded_contexts/shared/good_container/Dockerfile +4 -0
- data/example/indocker/bounded_contexts/shared/good_container/container.rb +6 -0
- data/example/indocker/bounded_contexts/shared/good_container/image.rb +3 -0
- data/example/indocker/bounded_contexts/shared/ruby/container.rb +2 -1
- data/example/indocker/configurations/external.rb +13 -2
- data/example/indocker/infrastructure/artifacts.rb +10 -0
- data/example/indocker/setup.rb +1 -0
- data/indocker.gemspec +2 -1
- data/lib/indocker.rb +24 -12
- data/lib/indocker/build_context.rb +6 -41
- data/lib/indocker/container_deployer.rb +12 -23
- data/lib/indocker/crontab_redeploy_rules_builder.rb +2 -1
- data/lib/indocker/deploy_context.rb +4 -32
- data/lib/indocker/docker_run_args.rb +2 -2
- data/lib/indocker/images/image_compiler.rb +0 -1
- data/lib/indocker/{configuration_deployer.rb → launchers/configuration_deployer.rb} +29 -30
- data/lib/indocker/{container_runner.rb → launchers/container_runner.rb} +2 -3
- data/lib/indocker/{images_compiler.rb → launchers/images_compiler.rb} +3 -3
- data/lib/indocker/{network.rb → networks/network.rb} +1 -1
- data/lib/indocker/{network_helper.rb → networks/network_helper.rb} +1 -1
- data/lib/indocker/server_pools/build_server_connection.rb +15 -0
- data/lib/indocker/server_pools/build_server_pool.rb +40 -0
- data/lib/indocker/server_pools/deploy_server_connection.rb +17 -0
- data/lib/indocker/server_pools/deploy_server_pool.rb +41 -0
- data/lib/indocker/server_pools/server_connection.rb +36 -0
- data/lib/indocker/ssh_session.rb +18 -9
- data/lib/indocker/version.rb +1 -1
- data/lib/indocker/{volume_helper.rb → volumes/volume_helper.rb} +1 -1
- metadata +44 -17
- data/example/indocker/bounded_contexts/shared/container_failing_build/container.rb +0 -5
- data/example/indocker/bounded_contexts/shared/container_failing_build/image.rb +0 -3
- data/example/spec/indocker_spec.rb +0 -31
- data/example/spec/spec_helper.rb +0 -39
- data/lib/indocker/build_context_pool.rb +0 -42
- data/lib/indocker/server_pool.rb +0 -38
data/lib/indocker/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: indocker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ruslan Gatiyatov
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-08-
|
12
|
+
date: 2020-08-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: net-ssh
|
@@ -45,14 +45,14 @@ dependencies:
|
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version:
|
48
|
+
version: 12.3.3
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
55
|
+
version: 12.3.3
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: rspec
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,6 +67,20 @@ dependencies:
|
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '3.0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: simplecov
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 0.18.5
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 0.18.5
|
70
84
|
description: Docker Containers Deployment
|
71
85
|
email:
|
72
86
|
- gvalmon@gmail.com
|
@@ -76,6 +90,7 @@ extra_rdoc_files: []
|
|
76
90
|
files:
|
77
91
|
- ".gitignore"
|
78
92
|
- ".rspec"
|
93
|
+
- ".ruby-version"
|
79
94
|
- ".travis.yml"
|
80
95
|
- Gemfile
|
81
96
|
- Gemfile.lock
|
@@ -88,37 +103,43 @@ files:
|
|
88
103
|
- example/indocker/bin/remote/compile
|
89
104
|
- example/indocker/bin/remote/run
|
90
105
|
- example/indocker/bin/utils/configurations.rb
|
91
|
-
- example/indocker/bounded_contexts/shared/
|
92
|
-
- example/indocker/bounded_contexts/shared/
|
93
|
-
- example/indocker/bounded_contexts/shared/
|
106
|
+
- example/indocker/bounded_contexts/shared/bad_container_build/Dockerfile
|
107
|
+
- example/indocker/bounded_contexts/shared/bad_container_build/container.rb
|
108
|
+
- example/indocker/bounded_contexts/shared/bad_container_build/image.rb
|
109
|
+
- example/indocker/bounded_contexts/shared/bad_container_start/Dockerfile
|
110
|
+
- example/indocker/bounded_contexts/shared/bad_container_start/build_context/bin/run
|
111
|
+
- example/indocker/bounded_contexts/shared/bad_container_start/container.rb
|
112
|
+
- example/indocker/bounded_contexts/shared/bad_container_start/image.rb
|
113
|
+
- example/indocker/bounded_contexts/shared/daemon_container/Dockerfile
|
114
|
+
- example/indocker/bounded_contexts/shared/daemon_container/container.rb
|
115
|
+
- example/indocker/bounded_contexts/shared/daemon_container/image.rb
|
116
|
+
- example/indocker/bounded_contexts/shared/good_container/Dockerfile
|
117
|
+
- example/indocker/bounded_contexts/shared/good_container/container.rb
|
118
|
+
- example/indocker/bounded_contexts/shared/good_container/image.rb
|
94
119
|
- example/indocker/bounded_contexts/shared/ruby/Dockerfile
|
95
120
|
- example/indocker/bounded_contexts/shared/ruby/container.rb
|
96
121
|
- example/indocker/bounded_contexts/shared/ruby/image.rb
|
97
122
|
- example/indocker/configurations/dev.rb
|
98
123
|
- example/indocker/configurations/external.rb
|
124
|
+
- example/indocker/infrastructure/artifacts.rb
|
99
125
|
- example/indocker/infrastructure/build_servers.rb
|
100
126
|
- example/indocker/infrastructure/networks.rb
|
101
127
|
- example/indocker/infrastructure/registries.rb
|
102
128
|
- example/indocker/infrastructure/servers.rb
|
103
129
|
- example/indocker/setup.rb
|
104
|
-
- example/spec/indocker_spec.rb
|
105
|
-
- example/spec/spec_helper.rb
|
106
130
|
- indocker.gemspec
|
107
131
|
- lib/indocker.rb
|
108
132
|
- lib/indocker/artifacts/git.rb
|
109
133
|
- lib/indocker/build_context.rb
|
110
134
|
- lib/indocker/build_context_helper.rb
|
111
|
-
- lib/indocker/build_context_pool.rb
|
112
135
|
- lib/indocker/build_server.rb
|
113
136
|
- lib/indocker/colored_string.rb
|
114
137
|
- lib/indocker/concerns/inspectable.rb
|
115
|
-
- lib/indocker/configuration_deployer.rb
|
116
138
|
- lib/indocker/configurations/configuration.rb
|
117
139
|
- lib/indocker/configurations/configuration_builder.rb
|
118
140
|
- lib/indocker/configurations/formatters/stdout.rb
|
119
141
|
- lib/indocker/container_deployer.rb
|
120
142
|
- lib/indocker/container_helper.rb
|
121
|
-
- lib/indocker/container_runner.rb
|
122
143
|
- lib/indocker/containers/container.rb
|
123
144
|
- lib/indocker/containers/container_builder.rb
|
124
145
|
- lib/indocker/containers/restart_policy.rb
|
@@ -139,11 +160,13 @@ files:
|
|
139
160
|
- lib/indocker/images/image_compiler.rb
|
140
161
|
- lib/indocker/images/template_compiler.rb
|
141
162
|
- lib/indocker/images/templates_compiler.rb
|
142
|
-
- lib/indocker/images_compiler.rb
|
143
163
|
- lib/indocker/indocker_helper.rb
|
164
|
+
- lib/indocker/launchers/configuration_deployer.rb
|
165
|
+
- lib/indocker/launchers/container_runner.rb
|
166
|
+
- lib/indocker/launchers/images_compiler.rb
|
144
167
|
- lib/indocker/logger_factory.rb
|
145
|
-
- lib/indocker/network.rb
|
146
|
-
- lib/indocker/network_helper.rb
|
168
|
+
- lib/indocker/networks/network.rb
|
169
|
+
- lib/indocker/networks/network_helper.rb
|
147
170
|
- lib/indocker/registries/abstract.rb
|
148
171
|
- lib/indocker/registries/local.rb
|
149
172
|
- lib/indocker/registries/remote.rb
|
@@ -154,15 +177,19 @@ files:
|
|
154
177
|
- lib/indocker/repositories/no_sync.rb
|
155
178
|
- lib/indocker/rsync.rb
|
156
179
|
- lib/indocker/server.rb
|
157
|
-
- lib/indocker/
|
180
|
+
- lib/indocker/server_pools/build_server_connection.rb
|
181
|
+
- lib/indocker/server_pools/build_server_pool.rb
|
182
|
+
- lib/indocker/server_pools/deploy_server_connection.rb
|
183
|
+
- lib/indocker/server_pools/deploy_server_pool.rb
|
184
|
+
- lib/indocker/server_pools/server_connection.rb
|
158
185
|
- lib/indocker/shell.rb
|
159
186
|
- lib/indocker/ssh_result_logger.rb
|
160
187
|
- lib/indocker/ssh_session.rb
|
161
188
|
- lib/indocker/version.rb
|
162
|
-
- lib/indocker/volume_helper.rb
|
163
189
|
- lib/indocker/volumes/external.rb
|
164
190
|
- lib/indocker/volumes/local.rb
|
165
191
|
- lib/indocker/volumes/repository.rb
|
192
|
+
- lib/indocker/volumes/volume_helper.rb
|
166
193
|
homepage: https://github.com/ArtStation/indocker
|
167
194
|
licenses:
|
168
195
|
- MIT
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Indocker do
|
4
|
-
it "has a version number" do
|
5
|
-
expect(Indocker::VERSION).not_to be nil
|
6
|
-
end
|
7
|
-
|
8
|
-
describe "successful deployment" do
|
9
|
-
it "doesn't raise any error" do
|
10
|
-
expect{
|
11
|
-
launch_deployment(containers: [:ruby])
|
12
|
-
}.to_not raise_error
|
13
|
-
end
|
14
|
-
|
15
|
-
it "shows a message about successful deploy" do
|
16
|
-
allow(Indocker.global_logger).to receive(:info).at_least(:once)
|
17
|
-
|
18
|
-
launch_deployment(containers: [:ruby])
|
19
|
-
|
20
|
-
expect(Indocker.global_logger).to have_received(:info).at_least(:once).with(/Deployment finished/)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe "failed build" do
|
25
|
-
it "exits with an error" do
|
26
|
-
expect{
|
27
|
-
launch_deployment(containers: [:container_failing_build])
|
28
|
-
}.to raise_error(SystemExit)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
data/example/spec/spec_helper.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
require "bundler/setup"
|
2
|
-
require "indocker"
|
3
|
-
require "pry"
|
4
|
-
|
5
|
-
RSpec.configure do |config|
|
6
|
-
# Enable flags like --only-failures and --next-failure
|
7
|
-
config.example_status_persistence_file_path = ".rspec_status"
|
8
|
-
|
9
|
-
# Disable RSpec exposing methods globally on `Module` and `main`
|
10
|
-
config.disable_monkey_patching!
|
11
|
-
|
12
|
-
config.expect_with :rspec do |c|
|
13
|
-
c.syntax = :expect
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def launch_deployment(options = {})
|
18
|
-
require_relative '../indocker/bin/utils/configurations'
|
19
|
-
|
20
|
-
Indocker.set_configuration_name(options[:configuration] || "external")
|
21
|
-
require_relative '../indocker/setup'
|
22
|
-
|
23
|
-
Indocker.set_log_level(options[:debug] ? Logger::DEBUG : Logger::INFO)
|
24
|
-
|
25
|
-
Indocker.deploy(
|
26
|
-
containers: options[:containers] || [],
|
27
|
-
tags: options[:tags] || [],
|
28
|
-
skip_containers: options[:skip_containers] || [],
|
29
|
-
skip_dependent: !!options[:skip_dependent],
|
30
|
-
servers: options[:servers] || [],
|
31
|
-
skip_build: options[:skip_build],
|
32
|
-
skip_deploy: options[:skip_deploy],
|
33
|
-
force_restart: options[:force_restart],
|
34
|
-
skip_tags: options[:skip_tags] || [],
|
35
|
-
skip_force_restart: options[:skip_force_restart] || [],
|
36
|
-
auto_confirm: !!options[:auto_confirm],
|
37
|
-
require_confirmation: !!options[:require_confirmation],
|
38
|
-
)
|
39
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
class Indocker::BuildContextPool
|
2
|
-
def initialize(configuration:, logger:, global_logger:)
|
3
|
-
@logger = logger
|
4
|
-
@configuration = configuration
|
5
|
-
@global_logger = global_logger
|
6
|
-
|
7
|
-
@contexts = configuration.build_servers.map do |build_server|
|
8
|
-
Indocker::BuildContext.new(
|
9
|
-
logger: @logger,
|
10
|
-
configuration: configuration,
|
11
|
-
build_server: build_server,
|
12
|
-
global_logger: @global_logger,
|
13
|
-
)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def create_sessions!
|
18
|
-
@contexts.each(&:create_session!)
|
19
|
-
end
|
20
|
-
|
21
|
-
def get
|
22
|
-
context = nil
|
23
|
-
|
24
|
-
loop do
|
25
|
-
context = @contexts.detect {|c| !c.busy?}
|
26
|
-
sleep(0.1)
|
27
|
-
break if context
|
28
|
-
end
|
29
|
-
|
30
|
-
context
|
31
|
-
end
|
32
|
-
|
33
|
-
def each(&proc)
|
34
|
-
@contexts.each(&proc)
|
35
|
-
end
|
36
|
-
|
37
|
-
def close_sessions
|
38
|
-
@contexts.each(&:close_session)
|
39
|
-
rescue => e
|
40
|
-
@logger.error("error during session close: #{e.inspect}")
|
41
|
-
end
|
42
|
-
end
|
data/lib/indocker/server_pool.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
class Indocker::ServerPool
|
2
|
-
def initialize(configuration:, logger:)
|
3
|
-
@logger = logger
|
4
|
-
@configuration = configuration
|
5
|
-
|
6
|
-
@contexts = configuration.servers.map do |server|
|
7
|
-
Indocker::DeployContext.new(
|
8
|
-
logger: @logger,
|
9
|
-
configuration: configuration,
|
10
|
-
server: server,
|
11
|
-
)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def create_sessions!
|
16
|
-
@contexts.each(&:create_session!)
|
17
|
-
end
|
18
|
-
|
19
|
-
# NOTE: get is a bad name here, because we create a new connection.
|
20
|
-
# TODO: why we create a new connection here?
|
21
|
-
def get(server)
|
22
|
-
context = Indocker::DeployContext.new(
|
23
|
-
logger: @logger,
|
24
|
-
configuration: @configuration,
|
25
|
-
server: server,
|
26
|
-
)
|
27
|
-
context.create_session!
|
28
|
-
context
|
29
|
-
end
|
30
|
-
|
31
|
-
def each(&proc)
|
32
|
-
@contexts.each(&proc)
|
33
|
-
end
|
34
|
-
|
35
|
-
def close_sessions
|
36
|
-
@contexts.each(&:close_session)
|
37
|
-
end
|
38
|
-
end
|