indocker 0.1.0 → 0.1.5
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 +4 -4
- data/Gemfile.lock +3 -1
- data/README.md +7 -20
- 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 +1 -0
- data/lib/indocker.rb +9 -1
- data/lib/indocker/configuration_deployer.rb +6 -4
- data/lib/indocker/context_args.rb +2 -3
- data/lib/indocker/docker_run_args.rb +8 -0
- data/lib/indocker/repositories/clonner.rb +3 -1
- data/lib/indocker/repositories/git.rb +5 -2
- data/lib/indocker/version.rb +1 -1
- metadata +33 -6
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 969dd78ffb984ee7bbf45cca5d1c6fca115e38429975b08c07f4698a5bfd05a7
         | 
| 4 | 
            +
              data.tar.gz: dfeeaceb39626a7974c95648fca8de8391e46f24756f0112634c750ecf6ad17c
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 4e8a80818b4e69361ed8f51fec6a45cfe08fe63fa53d8449dd00e00877c776984b1b8c8c886a9b619857868bc0f55ad7f1f0e613cc2f282593e08a45652b225f
         | 
| 7 | 
            +
              data.tar.gz: 6cf020eb3455d8230a8e2bf5392df10e63f6d2b9ff2f181b22a87ef747b6460d28eb5dcd7c3f2d094ca5fafc94fe9628cf86260aa2b7a64cfcf59f0dd28a17a0
         | 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -4,29 +4,16 @@ Docker Containers Deployment | |
| 4 4 |  | 
| 5 5 | 
             
            ## Installation
         | 
| 6 6 |  | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
            ```ruby
         | 
| 10 | 
            -
            gem 'indocker'
         | 
| 7 | 
            +
            ```
         | 
| 8 | 
            +
            $ gem install indocker
         | 
| 11 9 | 
             
            ```
         | 
| 12 10 |  | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
                $ bundle
         | 
| 16 | 
            -
             | 
| 17 | 
            -
            Or install it yourself as:
         | 
| 18 | 
            -
             | 
| 19 | 
            -
                $ gem install indocker
         | 
| 20 | 
            -
             | 
| 21 | 
            -
            ## Usage
         | 
| 22 | 
            -
             | 
| 23 | 
            -
            TODO: Write usage instructions here
         | 
| 24 | 
            -
             | 
| 25 | 
            -
            ## Development
         | 
| 26 | 
            -
             | 
| 27 | 
            -
            After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
         | 
| 11 | 
            +
            ## Development: Launch example app
         | 
| 28 12 |  | 
| 29 | 
            -
             | 
| 13 | 
            +
            ```ruby
         | 
| 14 | 
            +
            cd example
         | 
| 15 | 
            +
            bundle exec indocker/bin/deploy -C dev -c ruby -d
         | 
| 16 | 
            +
            ```
         | 
| 30 17 |  | 
| 31 18 | 
             
            ## License
         | 
| 32 19 |  | 
| @@ -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])
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            Indocker.define_network(:app_net)
         | 
| @@ -0,0 +1,24 @@ | |
| 1 | 
            +
            require 'indocker'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            root_dir = File.join(__dir__, '..', '..')
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            Indocker.set_root_dir(__dir__)
         | 
| 6 | 
            +
            Indocker.set_deploy_dir(File.join(root_dir, 'tmp', 'deployment'))
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            Indocker.set_dockerignore [
         | 
| 9 | 
            +
              'Dockerfile',
         | 
| 10 | 
            +
              '.DS_Store',
         | 
| 11 | 
            +
              '**/.DS_Store',
         | 
| 12 | 
            +
              '**/*.log',
         | 
| 13 | 
            +
              '.vscode',
         | 
| 14 | 
            +
              'tmp',
         | 
| 15 | 
            +
            ]
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            require_relative 'infrastructure/registries'
         | 
| 18 | 
            +
            require_relative 'infrastructure/servers'
         | 
| 19 | 
            +
            require_relative 'infrastructure/build_servers'
         | 
| 20 | 
            +
            require_relative 'infrastructure/networks'
         | 
| 21 | 
            +
             | 
| 22 | 
            +
            Indocker.set_bounded_contexts_dir(File.join(__dir__, 'bounded_contexts'))
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            require_relative "configurations/#{Indocker.configuration_name}"
         | 
    
        data/indocker.gemspec
    CHANGED
    
    | @@ -23,6 +23,7 @@ Gem::Specification.new do |spec| | |
| 23 23 | 
             
              spec.executables   = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
         | 
| 24 24 | 
             
              spec.require_paths = ["lib"]
         | 
| 25 25 |  | 
| 26 | 
            +
              spec.add_dependency "net-ssh"
         | 
| 26 27 | 
             
              spec.add_development_dependency "bundler", "~> 1.17"
         | 
| 27 28 | 
             
              spec.add_development_dependency "rake", "~> 10.0"
         | 
| 28 29 | 
             
              spec.add_development_dependency "rspec", "~> 3.0"
         | 
    
        data/lib/indocker.rb
    CHANGED
    
    | @@ -103,10 +103,18 @@ module Indocker | |
| 103 103 | 
             
                  @deploy_dir = val
         | 
| 104 104 | 
             
                end
         | 
| 105 105 |  | 
| 106 | 
            -
             | 
| 106 | 
            +
                def set_root_dir(val)
         | 
| 107 107 | 
             
                  @root_dir = val
         | 
| 108 108 | 
             
                end
         | 
| 109 109 |  | 
| 110 | 
            +
                def set_redeploy_crontab_path(val)
         | 
| 111 | 
            +
                  @redeploy_crontab_path = val
         | 
| 112 | 
            +
                end
         | 
| 113 | 
            +
             | 
| 114 | 
            +
                def redeploy_crontab_path
         | 
| 115 | 
            +
                  @redeploy_crontab_path
         | 
| 116 | 
            +
                end
         | 
| 117 | 
            +
             | 
| 110 118 | 
             
                def deploy_dir
         | 
| 111 119 | 
             
                  if @deploy_dir
         | 
| 112 120 | 
             
                    @deploy_dir
         | 
| @@ -67,13 +67,15 @@ class Indocker::ConfigurationDeployer | |
| 67 67 | 
             
                  )
         | 
| 68 68 |  | 
| 69 69 | 
             
                  remote_operations = sync_indocker(servers)
         | 
| 70 | 
            +
                  wait_remote_operations(remote_operations)
         | 
| 70 71 |  | 
| 72 | 
            +
                  remote_operations = sync_env_files(deploy_servers, configuration.env_files)
         | 
| 71 73 | 
             
                  wait_remote_operations(remote_operations)
         | 
| 72 74 |  | 
| 73 | 
            -
                  remote_operations  | 
| 74 | 
            -
                  remote_operations | 
| 75 | 
            -
                  remote_operations += sync_artifacts(clonner, configuration.artifact_servers)
         | 
| 75 | 
            +
                  remote_operations = pull_repositories(clonner, build_servers, configuration.repositories)
         | 
| 76 | 
            +
                  wait_remote_operations(remote_operations)
         | 
| 76 77 |  | 
| 78 | 
            +
                  remote_operations = sync_artifacts(clonner, configuration.artifact_servers)
         | 
| 77 79 | 
             
                  wait_remote_operations(remote_operations)
         | 
| 78 80 |  | 
| 79 81 | 
             
                  update_crontab_redeploy_rules(configuration, build_servers.first)
         | 
| @@ -423,7 +425,7 @@ class Indocker::ConfigurationDeployer | |
| 423 425 | 
             
                @logger.info("{timestamp}")
         | 
| 424 426 |  | 
| 425 427 | 
             
                deploy_user       = "#{server.user}@#{server.host}"
         | 
| 426 | 
            -
                crontab_filepath  =  | 
| 428 | 
            +
                crontab_filepath  = Indocker.redeploy_crontab_path
         | 
| 427 429 |  | 
| 428 430 | 
             
                crontab = Indocker::CrontabRedeployRulesBuilder
         | 
| 429 431 | 
             
                  .new(
         | 
| @@ -14,9 +14,8 @@ class Indocker::ContextArgs | |
| 14 14 | 
             
                end
         | 
| 15 15 |  | 
| 16 16 | 
             
                value = @context_args.fetch(name) do
         | 
| 17 | 
            -
                  Indocker.logger. | 
| 18 | 
            -
                  Indocker.logger. | 
| 19 | 
            -
                  exit 1
         | 
| 17 | 
            +
                  Indocker.logger.warn("build arg '#{format_arg(name)}' is not defined#{@container ? " for container :#{@container.name}" : ""}")
         | 
| 18 | 
            +
                  Indocker.logger.warn("available args: #{@context_args.inspect}")
         | 
| 20 19 | 
             
                end
         | 
| 21 20 |  | 
| 22 21 | 
             
                if value.is_a?(Hash)
         | 
| @@ -60,6 +60,14 @@ class Indocker::DockerRunArgs | |
| 60 60 | 
             
                    end
         | 
| 61 61 | 
             
                  end
         | 
| 62 62 |  | 
| 63 | 
            +
                  sysctl = container.get_start_option(:sysctl)
         | 
| 64 | 
            +
                  
         | 
| 65 | 
            +
                  if sysctl
         | 
| 66 | 
            +
                    Array(sysctl).each do |val|
         | 
| 67 | 
            +
                      args.push("--sysctl #{val}")
         | 
| 68 | 
            +
                    end
         | 
| 69 | 
            +
                  end
         | 
| 70 | 
            +
             | 
| 63 71 | 
             
                  if container.is_daemonized?
         | 
| 64 72 | 
             
                    args.push("--detach")
         | 
| 65 73 | 
             
                  end
         | 
| @@ -10,6 +10,8 @@ class Indocker::Repositories::Clonner | |
| 10 10 | 
             
                raise ArgumenError.new("only git repositories should be clonned") if !repository.is_git?
         | 
| 11 11 |  | 
| 12 12 | 
             
                session.exec!("rm -rf #{repository.clone_path} && mkdir -p #{repository.clone_path}")
         | 
| 13 | 
            -
                 | 
| 13 | 
            +
                
         | 
| 14 | 
            +
                git_command = "git clone -b #{repository.branch} --depth 1 #{repository.remote_url} #{repository.clone_path}"
         | 
| 15 | 
            +
                session.exec!("ssh-agent bash -c 'ssh-add ~/.ssh/#{repository.ssh_key}; #{git_command}'")
         | 
| 14 16 | 
             
              end
         | 
| 15 17 | 
             
            end
         | 
| @@ -1,13 +1,16 @@ | |
| 1 1 | 
             
            class Indocker::Repositories::Git < Indocker::Repositories::Abstract
         | 
| 2 | 
            -
              attr_reader :remote_url, :remote_name, :email, :password, :branch
         | 
| 2 | 
            +
              attr_reader :remote_url, :remote_name, :email, :password, :branch, :ssh_key
         | 
| 3 3 |  | 
| 4 | 
            -
               | 
| 4 | 
            +
              DEFAULT_SSH_KEY = "id_rsa"
         | 
| 5 | 
            +
             | 
| 6 | 
            +
              def setup(remote_name:, remote_url:, email: nil, password: nil, branch:, clone_path: nil, ssh_key: DEFAULT_SSH_KEY)
         | 
| 5 7 | 
             
                @remote_name = remote_name
         | 
| 6 8 | 
             
                @remote_url = remote_url
         | 
| 7 9 | 
             
                @email = email
         | 
| 8 10 | 
             
                @password = password
         | 
| 9 11 | 
             
                @branch = branch
         | 
| 10 12 | 
             
                @clone_path = clone_path
         | 
| 13 | 
            +
                @ssh_key = ssh_key
         | 
| 11 14 | 
             
                self
         | 
| 12 15 | 
             
              end
         | 
| 13 16 |  | 
    
        data/lib/indocker/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,16 +1,30 @@ | |
| 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.5
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Ruslan Gatiyatov
         | 
| 8 8 | 
             
            - Iskander Khaziev
         | 
| 9 | 
            -
            autorequire: | 
| 9 | 
            +
            autorequire:
         | 
| 10 10 | 
             
            bindir: exe
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2020- | 
| 12 | 
            +
            date: 2020-06-30 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 15 | 
            +
              name: net-ssh
         | 
| 16 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 17 | 
            +
                requirements:
         | 
| 18 | 
            +
                - - ">="
         | 
| 19 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 20 | 
            +
                    version: '0'
         | 
| 21 | 
            +
              type: :runtime
         | 
| 22 | 
            +
              prerelease: false
         | 
| 23 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 24 | 
            +
                requirements:
         | 
| 25 | 
            +
                - - ">="
         | 
| 26 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 27 | 
            +
                    version: '0'
         | 
| 14 28 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 29 | 
             
              name: bundler
         | 
| 16 30 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -70,6 +84,19 @@ files: | |
| 70 84 | 
             
            - Rakefile
         | 
| 71 85 | 
             
            - bin/console
         | 
| 72 86 | 
             
            - bin/setup
         | 
| 87 | 
            +
            - example/indocker/bin/deploy
         | 
| 88 | 
            +
            - example/indocker/bin/remote/compile
         | 
| 89 | 
            +
            - example/indocker/bin/remote/run
         | 
| 90 | 
            +
            - example/indocker/bin/utils/configurations.rb
         | 
| 91 | 
            +
            - example/indocker/bounded_contexts/shared/ruby/Dockerfile
         | 
| 92 | 
            +
            - example/indocker/bounded_contexts/shared/ruby/container.rb
         | 
| 93 | 
            +
            - example/indocker/bounded_contexts/shared/ruby/image.rb
         | 
| 94 | 
            +
            - example/indocker/configurations/dev.rb
         | 
| 95 | 
            +
            - example/indocker/infrastructure/build_servers.rb
         | 
| 96 | 
            +
            - example/indocker/infrastructure/networks.rb
         | 
| 97 | 
            +
            - example/indocker/infrastructure/registries.rb
         | 
| 98 | 
            +
            - example/indocker/infrastructure/servers.rb
         | 
| 99 | 
            +
            - example/indocker/setup.rb
         | 
| 73 100 | 
             
            - indocker.gemspec
         | 
| 74 101 | 
             
            - lib/indocker.rb
         | 
| 75 102 | 
             
            - lib/indocker/artifacts/git.rb
         | 
| @@ -132,7 +159,7 @@ homepage: https://github.com/ArtStation/indocker | |
| 132 159 | 
             
            licenses:
         | 
| 133 160 | 
             
            - MIT
         | 
| 134 161 | 
             
            metadata: {}
         | 
| 135 | 
            -
            post_install_message: | 
| 162 | 
            +
            post_install_message:
         | 
| 136 163 | 
             
            rdoc_options: []
         | 
| 137 164 | 
             
            require_paths:
         | 
| 138 165 | 
             
            - lib
         | 
| @@ -147,8 +174,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 147 174 | 
             
                - !ruby/object:Gem::Version
         | 
| 148 175 | 
             
                  version: '0'
         | 
| 149 176 | 
             
            requirements: []
         | 
| 150 | 
            -
            rubygems_version: 3.0. | 
| 151 | 
            -
            signing_key: | 
| 177 | 
            +
            rubygems_version: 3.0.8
         | 
| 178 | 
            +
            signing_key:
         | 
| 152 179 | 
             
            specification_version: 4
         | 
| 153 180 | 
             
            summary: Docker Containers Deployment
         | 
| 154 181 | 
             
            test_files: []
         |