indocker 0.0.6 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +10 -2
- data/.rspec +2 -0
- data/.travis.yml +7 -0
- data/Gemfile +5 -2
- data/Gemfile.lock +19 -49
- data/LICENSE.txt +17 -18
- data/README.md +20 -1
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/example/indocker/bin/deploy +120 -0
- data/example/indocker/bin/remote/compile +72 -0
- data/example/indocker/bin/remote/run +66 -0
- data/example/indocker/bin/utils/configurations.rb +3 -0
- data/example/indocker/bounded_contexts/shared/ruby/Dockerfile +10 -0
- data/example/indocker/bounded_contexts/shared/ruby/container.rb +5 -0
- data/example/indocker/bounded_contexts/shared/ruby/image.rb +3 -0
- data/example/indocker/configurations/dev.rb +9 -0
- data/example/indocker/infrastructure/build_servers.rb +8 -0
- data/example/indocker/infrastructure/networks.rb +1 -0
- data/example/indocker/infrastructure/registries.rb +3 -0
- data/example/indocker/infrastructure/servers.rb +8 -0
- data/example/indocker/setup.rb +24 -0
- data/indocker.gemspec +27 -25
- data/lib/indocker.rb +437 -130
- data/lib/indocker/artifacts/git.rb +25 -0
- data/lib/indocker/build_context.rb +87 -0
- data/lib/indocker/build_context_helper.rb +109 -0
- data/lib/indocker/build_context_pool.rb +36 -0
- data/lib/indocker/build_server.rb +2 -0
- data/lib/indocker/colored_string.rb +33 -0
- data/lib/indocker/concerns/inspectable.rb +12 -0
- data/lib/indocker/configuration_deployer.rb +525 -0
- data/lib/indocker/configurations/configuration.rb +122 -0
- data/lib/indocker/configurations/configuration_builder.rb +250 -0
- data/lib/indocker/configurations/formatters/stdout.rb +36 -0
- data/lib/indocker/container_deployer.rb +73 -0
- data/lib/indocker/container_helper.rb +13 -0
- data/lib/indocker/container_runner.rb +23 -0
- data/lib/indocker/containers/container.rb +118 -0
- data/lib/indocker/containers/container_builder.rb +186 -0
- data/lib/indocker/containers/restart_policy.rb +36 -0
- data/lib/indocker/context_args.rb +43 -0
- data/lib/indocker/crontab_redeploy_rules_builder.rb +54 -0
- data/lib/indocker/deploy_context.rb +126 -0
- data/lib/indocker/deployment_checker.rb +121 -0
- data/lib/indocker/deployment_progress.rb +495 -0
- data/lib/indocker/docker.rb +87 -0
- data/lib/indocker/docker_run_args.rb +183 -0
- data/lib/indocker/env_file_helper.rb +13 -0
- data/lib/indocker/env_files/local.rb +8 -0
- data/lib/indocker/env_files/remote.rb +8 -0
- data/lib/indocker/hash_merger.rb +9 -0
- data/lib/indocker/images/image.rb +86 -0
- data/lib/indocker/images/image_builder.rb +98 -0
- data/lib/indocker/images/image_compiler.rb +68 -0
- data/lib/indocker/images/template_compiler.rb +15 -0
- data/lib/indocker/images/templates_compiler.rb +28 -0
- data/lib/indocker/images_compiler.rb +38 -0
- data/lib/indocker/indocker_helper.rb +9 -0
- data/lib/indocker/network.rb +12 -0
- data/lib/indocker/network_helper.rb +7 -0
- data/lib/indocker/registries/abstract.rb +17 -0
- data/lib/indocker/registries/local.rb +5 -0
- data/lib/indocker/registries/remote.rb +12 -0
- data/lib/indocker/repositories/abstract.rb +25 -0
- data/lib/indocker/repositories/clonner.rb +17 -0
- data/lib/indocker/repositories/git.rb +24 -0
- data/lib/indocker/repositories/local.rb +20 -0
- data/lib/indocker/repositories/no_sync.rb +20 -0
- data/lib/indocker/rsync.rb +52 -0
- data/lib/indocker/server.rb +20 -0
- data/lib/indocker/server_pool.rb +30 -0
- data/lib/indocker/shell.rb +60 -0
- data/lib/indocker/ssh_result_logger.rb +18 -0
- data/lib/indocker/ssh_session.rb +92 -0
- data/lib/indocker/version.rb +1 -1
- data/lib/indocker/volume_helper.rb +7 -0
- data/lib/indocker/volumes/external.rb +8 -0
- data/lib/indocker/volumes/local.rb +9 -0
- data/lib/indocker/volumes/repository.rb +9 -0
- metadata +107 -222
- data/bin/indocker +0 -9
- data/lib/indocker/application_initializer.rb +0 -19
- data/lib/indocker/cli.rb +0 -27
- data/lib/indocker/configs/config.rb +0 -147
- data/lib/indocker/configs/config_factory.rb +0 -37
- data/lib/indocker/configs/config_initializer.rb +0 -9
- data/lib/indocker/configs/locator.rb +0 -23
- data/lib/indocker/container/container_builder.rb +0 -29
- data/lib/indocker/container/container_directives_runner.rb +0 -54
- data/lib/indocker/container/container_dsl.rb +0 -83
- data/lib/indocker/container/container_evaluator.rb +0 -13
- data/lib/indocker/container/container_inspector.rb +0 -26
- data/lib/indocker/container/container_manager.rb +0 -122
- data/lib/indocker/container/container_metadata.rb +0 -112
- data/lib/indocker/container/container_metadata_factory.rb +0 -30
- data/lib/indocker/container/container_metadata_repository.rb +0 -27
- data/lib/indocker/directives/base.rb +0 -17
- data/lib/indocker/directives/container_directives/base.rb +0 -23
- data/lib/indocker/directives/container_directives/cmd.rb +0 -7
- data/lib/indocker/directives/container_directives/depends_on.rb +0 -7
- data/lib/indocker/directives/container_directives/env.rb +0 -7
- data/lib/indocker/directives/container_directives/env_file.rb +0 -7
- data/lib/indocker/directives/container_directives/expose.rb +0 -7
- data/lib/indocker/directives/container_directives/from.rb +0 -14
- data/lib/indocker/directives/container_directives/network.rb +0 -12
- data/lib/indocker/directives/container_directives/ports.rb +0 -15
- data/lib/indocker/directives/container_directives/ready.rb +0 -16
- data/lib/indocker/directives/container_directives/volume.rb +0 -23
- data/lib/indocker/directives/image_directives/base.rb +0 -27
- data/lib/indocker/directives/image_directives/cmd.rb +0 -19
- data/lib/indocker/directives/image_directives/copy.rb +0 -32
- data/lib/indocker/directives/image_directives/docker_cp.rb +0 -20
- data/lib/indocker/directives/image_directives/entrypoint.rb +0 -19
- data/lib/indocker/directives/image_directives/env.rb +0 -9
- data/lib/indocker/directives/image_directives/env_file.rb +0 -19
- data/lib/indocker/directives/image_directives/expose.rb +0 -9
- data/lib/indocker/directives/image_directives/from.rb +0 -36
- data/lib/indocker/directives/image_directives/registry.rb +0 -30
- data/lib/indocker/directives/image_directives/run.rb +0 -17
- data/lib/indocker/directives/image_directives/workdir.rb +0 -9
- data/lib/indocker/directives/partial.rb +0 -21
- data/lib/indocker/docker_api/container_config.rb +0 -121
- data/lib/indocker/docker_api/docker_api.rb +0 -207
- data/lib/indocker/dsl_context.rb +0 -21
- data/lib/indocker/envs/env_metadata.rb +0 -39
- data/lib/indocker/envs/loader.rb +0 -19
- data/lib/indocker/errors.rb +0 -21
- data/lib/indocker/git/git_api.rb +0 -32
- data/lib/indocker/git/git_helper.rb +0 -34
- data/lib/indocker/git/git_service.rb +0 -21
- data/lib/indocker/handlers/container_run.rb +0 -20
- data/lib/indocker/handlers/container_stop.rb +0 -17
- data/lib/indocker/handlers/performable.rb +0 -22
- data/lib/indocker/image/image_builder.rb +0 -54
- data/lib/indocker/image/image_dependencies_manager.rb +0 -47
- data/lib/indocker/image/image_directives_runner.rb +0 -99
- data/lib/indocker/image/image_dockerfile_builder.rb +0 -24
- data/lib/indocker/image/image_dsl.rb +0 -89
- data/lib/indocker/image/image_evaluator.rb +0 -21
- data/lib/indocker/image/image_helper.rb +0 -9
- data/lib/indocker/image/image_metadata.rb +0 -50
- data/lib/indocker/image/image_metadata_factory.rb +0 -31
- data/lib/indocker/image/image_metadata_repository.rb +0 -29
- data/lib/indocker/networks/network_metadata.rb +0 -9
- data/lib/indocker/networks/network_metadata_factory.rb +0 -9
- data/lib/indocker/networks/network_metadata_repository.rb +0 -34
- data/lib/indocker/partial/partial_metadata.rb +0 -8
- data/lib/indocker/partial/partial_metadata_repository.rb +0 -26
- data/lib/indocker/registry/registry_api.rb +0 -46
- data/lib/indocker/registry/registry_helper.rb +0 -20
- data/lib/indocker/registry/registry_service.rb +0 -28
- data/lib/indocker/utils/ioc_container.rb +0 -17
- data/lib/indocker/utils/logger.rb +0 -62
- data/lib/indocker/utils/logger_factory.rb +0 -13
- data/lib/indocker/utils/registry_authenticator.rb +0 -19
- data/lib/indocker/utils/render_namespace.rb +0 -11
- data/lib/indocker/utils/render_util.rb +0 -15
- data/lib/indocker/utils/string_utils.rb +0 -11
- data/lib/indocker/utils/tar_helper.rb +0 -40
- data/lib/indocker/utils/test_logger_factory.rb +0 -9
- data/lib/indocker/volumes/volume_metadata.rb +0 -9
- data/lib/indocker/volumes/volume_metadata_factory.rb +0 -9
- data/lib/indocker/volumes/volume_metadata_repository.rb +0 -34
- data/spec/example/.indocker/config.rb +0 -30
- data/spec/example/.indocker/images_and_containers.rb +0 -25
- data/spec/example/assets/index.css +0 -1
- data/spec/example/assets/index.js +0 -1
- data/spec/fixtures/spec.env +0 -2
- data/spec/indocker/configs/config_factory_spec.rb +0 -18
- data/spec/indocker/configs/config_spec.rb +0 -88
- data/spec/indocker/container/container_builder_spec.rb +0 -67
- data/spec/indocker/container/container_manager_spec.rb +0 -278
- data/spec/indocker/docker_api/container_config_spec.rb +0 -64
- data/spec/indocker/docker_api/docker_api_spec.rb +0 -112
- data/spec/indocker/handlers/container_run_spec.rb +0 -60
- data/spec/indocker/image/image_builder_spec.rb +0 -153
- data/spec/indocker/image/image_directives_runner_spec.rb +0 -141
- data/spec/indocker/image/image_dockerfile_builder_spec.rb +0 -25
- data/spec/indocker/image/image_evaluator_spec.rb +0 -85
- data/spec/spec_helper.rb +0 -68
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1cdf31c973694a91abe68af66b52d8162884883444e4b64f1ff8d6a20e4c48a8
|
4
|
+
data.tar.gz: d9d73ae46e572e5ea2823a65b3b2bb83b94aacdafe2f5c1a22bd27b2e29d28c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74929814f68d270a04e0b3fb9d9134b594faa82f04828ff0b7785f2c654ad03c9aec99f251e4d05c5a929f30eb83b639c93acea21cca2654952615b3bafd8fe5
|
7
|
+
data.tar.gz: 7c2c091c56ecdf66071440dbd338317e95fa1e4f18e3d44d0e436bb33e14545a6afa6ef04a925f29afa9a5e5687086e38516deffadc1b9876042d5c0a8e0212f
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,67 +1,37 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
indocker (0.
|
5
|
-
|
6
|
-
colorize
|
7
|
-
docker-api
|
8
|
-
docker_registry2
|
9
|
-
git
|
10
|
-
smart_ioc
|
11
|
-
thor
|
4
|
+
indocker (0.1.4)
|
5
|
+
net-ssh
|
12
6
|
|
13
7
|
GEM
|
14
8
|
remote: https://rubygems.org/
|
15
9
|
specs:
|
16
|
-
byebug (9.1.0)
|
17
|
-
colorize (0.8.1)
|
18
10
|
diff-lcs (1.3)
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
http-cookie (1.0.3)
|
29
|
-
domain_name (~> 0.5)
|
30
|
-
mime-types (3.1)
|
31
|
-
mime-types-data (~> 3.2015)
|
32
|
-
mime-types-data (3.2016.0521)
|
33
|
-
multi_json (1.12.2)
|
34
|
-
netrc (0.11.0)
|
35
|
-
rest-client (2.0.2)
|
36
|
-
http-cookie (>= 1.0.2, < 2.0)
|
37
|
-
mime-types (>= 1.16, < 4.0)
|
38
|
-
netrc (~> 0.8)
|
39
|
-
rspec (3.7.0)
|
40
|
-
rspec-core (~> 3.7.0)
|
41
|
-
rspec-expectations (~> 3.7.0)
|
42
|
-
rspec-mocks (~> 3.7.0)
|
43
|
-
rspec-core (3.7.0)
|
44
|
-
rspec-support (~> 3.7.0)
|
45
|
-
rspec-expectations (3.7.0)
|
11
|
+
net-ssh (6.1.0)
|
12
|
+
rake (10.5.0)
|
13
|
+
rspec (3.9.0)
|
14
|
+
rspec-core (~> 3.9.0)
|
15
|
+
rspec-expectations (~> 3.9.0)
|
16
|
+
rspec-mocks (~> 3.9.0)
|
17
|
+
rspec-core (3.9.1)
|
18
|
+
rspec-support (~> 3.9.1)
|
19
|
+
rspec-expectations (3.9.0)
|
46
20
|
diff-lcs (>= 1.2.0, < 2.0)
|
47
|
-
rspec-support (~> 3.
|
48
|
-
rspec-mocks (3.
|
21
|
+
rspec-support (~> 3.9.0)
|
22
|
+
rspec-mocks (3.9.1)
|
49
23
|
diff-lcs (>= 1.2.0, < 2.0)
|
50
|
-
rspec-support (~> 3.
|
51
|
-
rspec-support (3.
|
52
|
-
smart_ioc (0.2.1)
|
53
|
-
thor (0.20.0)
|
54
|
-
unf (0.1.4)
|
55
|
-
unf_ext
|
56
|
-
unf_ext (0.0.7.4)
|
24
|
+
rspec-support (~> 3.9.0)
|
25
|
+
rspec-support (3.9.2)
|
57
26
|
|
58
27
|
PLATFORMS
|
59
28
|
ruby
|
60
29
|
|
61
30
|
DEPENDENCIES
|
62
|
-
|
31
|
+
bundler (~> 1.17)
|
63
32
|
indocker!
|
64
|
-
|
33
|
+
rake (~> 10.0)
|
34
|
+
rspec (~> 3.0)
|
65
35
|
|
66
36
|
BUNDLED WITH
|
67
|
-
1.
|
37
|
+
1.17.3
|
data/LICENSE.txt
CHANGED
@@ -1,22 +1,21 @@
|
|
1
|
-
|
1
|
+
The MIT License (MIT)
|
2
2
|
|
3
|
-
|
3
|
+
Copyright (c) 2020 TODO: Write your name
|
4
4
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
the following conditions:
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
12
11
|
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
15
14
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
OF
|
22
|
-
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1 +1,20 @@
|
|
1
|
-
|
1
|
+
# InDocker
|
2
|
+
|
3
|
+
Docker Containers Deployment
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
```
|
8
|
+
$ gem install indocker
|
9
|
+
```
|
10
|
+
|
11
|
+
## Development: Launch example app
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
cd example
|
15
|
+
bundle exec indocker/bin/deploy -C dev -c ruby -d
|
16
|
+
```
|
17
|
+
|
18
|
+
## License
|
19
|
+
|
20
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "indocker"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
require_relative 'utils/configurations'
|
5
|
+
|
6
|
+
configurations = list_configurations(File.expand_path(File.join(__dir__, '../configurations')))
|
7
|
+
|
8
|
+
ARGV << '-h' if ARGV.empty?
|
9
|
+
|
10
|
+
options = {
|
11
|
+
skip_build: false,
|
12
|
+
force_restart: false,
|
13
|
+
skip_tags: [],
|
14
|
+
skip_force_restart: [],
|
15
|
+
}
|
16
|
+
|
17
|
+
OptionParser.new do |opts|
|
18
|
+
opts.banner = "Usage: indocker/bin/deploy [options]"
|
19
|
+
|
20
|
+
opts.on("-d", "--debug", "Debug mode") do |val|
|
21
|
+
options[:debug] = true
|
22
|
+
end
|
23
|
+
|
24
|
+
opts.on("-C", "--configuration REQUIRED", String, "Configuration name") do |val|
|
25
|
+
options[:configuration] = val
|
26
|
+
end
|
27
|
+
|
28
|
+
opts.on("-c", "--container OPTIONAL", String, "Deploy by container name") do |val|
|
29
|
+
options[:containers] ||= []
|
30
|
+
options[:containers].push(val.to_sym)
|
31
|
+
end
|
32
|
+
|
33
|
+
opts.on("-t", "--tag OPTIONAL", String, "Deploy containers by tag") do |val|
|
34
|
+
options[:tags] ||= []
|
35
|
+
options[:tags].push(val)
|
36
|
+
end
|
37
|
+
|
38
|
+
opts.on("-s", "--skip OPTIONAL", String, "Skip container during deployment") do |val|
|
39
|
+
options[:skip_containers] ||= []
|
40
|
+
options[:skip_containers] << val.to_sym
|
41
|
+
end
|
42
|
+
|
43
|
+
opts.on("-S", "--server OPTIONAL", String, "Deploy containers that include specfic server") do |val|
|
44
|
+
options[:servers] ||= []
|
45
|
+
options[:servers].push(val.to_sym)
|
46
|
+
end
|
47
|
+
|
48
|
+
opts.on("-D", "--skip-dependent", "Do not deploy dependent containers") do |val|
|
49
|
+
options[:skip_dependent] = true
|
50
|
+
end
|
51
|
+
|
52
|
+
opts.on("-f", "--force-restart", "Force to restart each container") do |val|
|
53
|
+
options[:force_restart] = true
|
54
|
+
end
|
55
|
+
|
56
|
+
opts.on("-F", "--skip-force-restart OPTIONAL", "Skip force restart of specific container for force restart mode") do |val|
|
57
|
+
options[:skip_force_restart].push(val.to_sym)
|
58
|
+
end
|
59
|
+
|
60
|
+
opts.on("-B", "--skip-build", "Skip image build") do |val|
|
61
|
+
options[:skip_build] = true
|
62
|
+
end
|
63
|
+
|
64
|
+
opts.on("-y", "--auto-confirm", "Automatically confirm deployment") do |val|
|
65
|
+
options[:auto_confirm] = true
|
66
|
+
end
|
67
|
+
|
68
|
+
opts.on("-r", "--require-confirmation", "Require deploy confirmation") do |val|
|
69
|
+
options[:require_confirmation] = true
|
70
|
+
end
|
71
|
+
|
72
|
+
opts.on("-T", "--skip-tag OPTIONAL", "Skip containers tagged by specific tags") do |val|
|
73
|
+
options[:skip_tags].push(val)
|
74
|
+
end
|
75
|
+
|
76
|
+
opts.on_tail("-h", "--help", "Show help") do
|
77
|
+
puts opts
|
78
|
+
exit
|
79
|
+
end
|
80
|
+
end.parse!
|
81
|
+
|
82
|
+
if !options.has_key?(:configuration)
|
83
|
+
puts "You should specify configuration using -C or --configuration option.\nAvailable configurations: #{configurations.sort.join(', ')}"
|
84
|
+
exit 1
|
85
|
+
end
|
86
|
+
|
87
|
+
if !configurations.include?(options[:configuration])
|
88
|
+
puts "Invalid configuration provided: #{options[:configuration]}.\nAvailable configurations: #{configurations.inspect}"
|
89
|
+
exit 1
|
90
|
+
end
|
91
|
+
|
92
|
+
begin
|
93
|
+
require 'indocker'
|
94
|
+
rescue LoadError
|
95
|
+
puts "InDocker has been moved into a separate gem. Please install using `gem install indocker`"
|
96
|
+
exit
|
97
|
+
end
|
98
|
+
|
99
|
+
if options[:debug]
|
100
|
+
Indocker.set_log_level(Logger::DEBUG)
|
101
|
+
else
|
102
|
+
Indocker.set_log_level(Logger::INFO)
|
103
|
+
end
|
104
|
+
|
105
|
+
Indocker.set_configuration_name(options[:configuration])
|
106
|
+
require_relative '../setup'
|
107
|
+
|
108
|
+
Indocker.deploy(
|
109
|
+
containers: options[:containers] || [],
|
110
|
+
tags: options[:tags] || [],
|
111
|
+
skip_containers: options[:skip_containers] || [],
|
112
|
+
skip_dependent: !!options[:skip_dependent],
|
113
|
+
servers: options[:servers] || [],
|
114
|
+
skip_build: options[:skip_build],
|
115
|
+
force_restart: options[:force_restart],
|
116
|
+
skip_tags: options[:skip_tags] || [],
|
117
|
+
skip_force_restart: options[:skip_force_restart] || [],
|
118
|
+
auto_confirm: !!options[:auto_confirm],
|
119
|
+
require_confirmation: !!options[:require_confirmation],
|
120
|
+
)
|
@@ -0,0 +1,72 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
require_relative '../utils/configurations'
|
5
|
+
|
6
|
+
configurations = list_configurations(File.expand_path(File.join(__dir__, '../../configurations')))
|
7
|
+
|
8
|
+
ARGV << '-h' if ARGV.empty?
|
9
|
+
|
10
|
+
options = {}
|
11
|
+
|
12
|
+
OptionParser.new do |opts|
|
13
|
+
opts.banner = "Usage: indocker/bin/remote/compile [options] (only on remote server)"
|
14
|
+
|
15
|
+
opts.on("-C", "--configuration REQUIRED", String, "Configuration name") do |val|
|
16
|
+
options[:configuration] = val
|
17
|
+
end
|
18
|
+
|
19
|
+
opts.on("-d", "--debug", "Debug mode") do |val|
|
20
|
+
options[:debug] = true
|
21
|
+
end
|
22
|
+
|
23
|
+
opts.on("-i", "--image REQUIRED", String, "Image to be compiled") do |val|
|
24
|
+
options[:images] ||= []
|
25
|
+
options[:images].push(val.to_sym)
|
26
|
+
end
|
27
|
+
|
28
|
+
opts.on("-s", "--skip-dependent", String, "Do not compile dependent images") do |val|
|
29
|
+
options[:skip_dependent] = true
|
30
|
+
end
|
31
|
+
|
32
|
+
opts.on_tail("-h", "--help", "Show help") do
|
33
|
+
puts opts
|
34
|
+
exit
|
35
|
+
end
|
36
|
+
end.parse!
|
37
|
+
|
38
|
+
if !options.has_key?(:configuration)
|
39
|
+
puts "You should specify configuration using -C or --configuration option.\nAvailable configurations: #{configurations.sort.join(', ')}"
|
40
|
+
exit 1
|
41
|
+
end
|
42
|
+
|
43
|
+
if !configurations.include?(options[:configuration])
|
44
|
+
puts "Invalid configuration provided: #{options[:configuration]}.\nAvailable configurations: #{configurations.inspect}"
|
45
|
+
exit 1
|
46
|
+
end
|
47
|
+
|
48
|
+
if !options.has_key?(:images)
|
49
|
+
puts "At least one image should be provided"
|
50
|
+
end
|
51
|
+
|
52
|
+
begin
|
53
|
+
require 'indocker'
|
54
|
+
rescue LoadError
|
55
|
+
puts "InDocker has been moved into a separate gem. Please install using `gem install indocker`"
|
56
|
+
exit 1
|
57
|
+
end
|
58
|
+
|
59
|
+
if options[:debug]
|
60
|
+
Indocker.set_log_level(Logger::DEBUG)
|
61
|
+
else
|
62
|
+
Indocker.set_log_level(Logger::INFO)
|
63
|
+
end
|
64
|
+
|
65
|
+
Indocker.set_configuration_name(options[:configuration])
|
66
|
+
require_relative '../../setup'
|
67
|
+
|
68
|
+
|
69
|
+
Indocker.compile(
|
70
|
+
images: options[:images] || [],
|
71
|
+
skip_dependent: !!options[:skip_dependent]
|
72
|
+
)
|
@@ -0,0 +1,66 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
require_relative '../utils/configurations'
|
5
|
+
|
6
|
+
configurations = list_configurations(File.expand_path(File.join(__dir__, '../../configurations')))
|
7
|
+
|
8
|
+
ARGV << '-h' if ARGV.empty?
|
9
|
+
|
10
|
+
options = {
|
11
|
+
force_restart: false,
|
12
|
+
}
|
13
|
+
|
14
|
+
OptionParser.new do |opts|
|
15
|
+
opts.banner = "Usage: indocker/bin/remote/run [options] (only on remove server)"
|
16
|
+
|
17
|
+
opts.on("-C", "--configuration REQUIRED", String, "Configuration name") do |val|
|
18
|
+
options[:configuration] = val
|
19
|
+
end
|
20
|
+
|
21
|
+
opts.on("-d", "--debug", "Debug mode") do |val|
|
22
|
+
options[:debug] = true
|
23
|
+
end
|
24
|
+
|
25
|
+
opts.on("-c", "--container REQUIRED", String, "Container name") do |val|
|
26
|
+
options[:container] = val.to_sym
|
27
|
+
end
|
28
|
+
|
29
|
+
opts.on("-f", "--force-restart", "Force to restart each container") do |val|
|
30
|
+
options[:force_restart] = true
|
31
|
+
end
|
32
|
+
|
33
|
+
opts.on_tail("-h", "--help", "Show help") do
|
34
|
+
puts opts
|
35
|
+
exit
|
36
|
+
end
|
37
|
+
end.parse!
|
38
|
+
|
39
|
+
if !options.has_key?(:configuration)
|
40
|
+
puts "You should specify configuration using -C or --configuration option.\nAvailable configurations: #{configurations.sort.join(', ')}"
|
41
|
+
exit 1
|
42
|
+
end
|
43
|
+
|
44
|
+
if !configurations.include?(options[:configuration])
|
45
|
+
puts "Invalid configuration provided: #{options[:configuration]}.\nAvailable configurations: #{configurations.inspect}"
|
46
|
+
exit 1
|
47
|
+
end
|
48
|
+
|
49
|
+
begin
|
50
|
+
require 'indocker'
|
51
|
+
rescue LoadError
|
52
|
+
puts "InDocker has been moved into a separate gem. Please install using `gem install indocker`"
|
53
|
+
exit 1
|
54
|
+
end
|
55
|
+
|
56
|
+
if options[:debug]
|
57
|
+
Indocker.set_log_level(Logger::DEBUG)
|
58
|
+
else
|
59
|
+
Indocker.set_log_level(Logger::INFO)
|
60
|
+
end
|
61
|
+
|
62
|
+
Indocker.set_configuration_name(options[:configuration])
|
63
|
+
require_relative '../../setup'
|
64
|
+
|
65
|
+
|
66
|
+
Indocker.run(options[:container], options[:force_restart])
|