indocker 0.1.7 → 0.1.8
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/example/indocker/bin/deploy +19 -13
- data/lib/indocker.rb +17 -12
- data/lib/indocker/configuration_deployer.rb +42 -12
- data/lib/indocker/deployment_progress.rb +7 -2
- data/lib/indocker/version.rb +1 -1
- metadata +6 -6
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: d9667ebbc4e293dd51830ec7cae6c57455fe1b59b09722e094d76fa934564001
         | 
| 4 | 
            +
              data.tar.gz: 4912748b481273ba9cc7a69e11698ebfc14cd01d942550bb7f67f014df0b1a46
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 553570ec945812578c4a3cfc1744e5455c8e18e584cc2bb0bed4f70227d751329d147c04d07858f0bd26390f3725eb7bed2ce6f5fab4e34ee3731e065cc54499
         | 
| 7 | 
            +
              data.tar.gz: f1b46f64d4be12e0d62de23623fc3aac49fc0f10246effe8868fde2d9721d6105776ca7d06edd3e8e9d368352882125720915ca81ab2952e0e1feecd0eab51e3
         | 
    
        data/example/indocker/bin/deploy
    CHANGED
    
    | @@ -8,9 +8,10 @@ configurations = list_configurations(File.expand_path(File.join(__dir__, '../con | |
| 8 8 | 
             
            ARGV << '-h' if ARGV.empty?
         | 
| 9 9 |  | 
| 10 10 | 
             
            options = {
         | 
| 11 | 
            -
              skip_build: | 
| 12 | 
            -
               | 
| 13 | 
            -
               | 
| 11 | 
            +
              skip_build:         false,
         | 
| 12 | 
            +
              skip_deploy:        false,
         | 
| 13 | 
            +
              force_restart:      false,
         | 
| 14 | 
            +
              skip_tags:          [],
         | 
| 14 15 | 
             
              skip_force_restart: [],
         | 
| 15 16 | 
             
            }
         | 
| 16 17 |  | 
| @@ -61,6 +62,10 @@ OptionParser.new do |opts| | |
| 61 62 | 
             
                options[:skip_build] = true
         | 
| 62 63 | 
             
              end
         | 
| 63 64 |  | 
| 65 | 
            +
              opts.on("-b", "--skip-deploy", "Skip image deploy") do |val|
         | 
| 66 | 
            +
                options[:skip_deploy] = true
         | 
| 67 | 
            +
              end
         | 
| 68 | 
            +
             | 
| 64 69 | 
             
              opts.on("-y", "--auto-confirm", "Automatically confirm deployment") do |val|
         | 
| 65 70 | 
             
                options[:auto_confirm] = true
         | 
| 66 71 | 
             
              end
         | 
| @@ -106,15 +111,16 @@ Indocker.set_configuration_name(options[:configuration]) | |
| 106 111 | 
             
            require_relative '../setup'
         | 
| 107 112 |  | 
| 108 113 | 
             
            Indocker.deploy(
         | 
| 109 | 
            -
              containers: | 
| 110 | 
            -
              tags: | 
| 111 | 
            -
              skip_containers: | 
| 112 | 
            -
              skip_dependent: | 
| 113 | 
            -
              servers: | 
| 114 | 
            -
              skip_build: | 
| 115 | 
            -
               | 
| 116 | 
            -
               | 
| 117 | 
            -
               | 
| 118 | 
            -
               | 
| 114 | 
            +
              containers:           options[:containers] || [],
         | 
| 115 | 
            +
              tags:                 options[:tags] || [],
         | 
| 116 | 
            +
              skip_containers:      options[:skip_containers] || [],
         | 
| 117 | 
            +
              skip_dependent:       !!options[:skip_dependent],
         | 
| 118 | 
            +
              servers:              options[:servers] || [],
         | 
| 119 | 
            +
              skip_build:           options[:skip_build],
         | 
| 120 | 
            +
              skip_deploy:          options[:skip_deploy],
         | 
| 121 | 
            +
              force_restart:        options[:force_restart],
         | 
| 122 | 
            +
              skip_tags:            options[:skip_tags] || [],
         | 
| 123 | 
            +
              skip_force_restart:   options[:skip_force_restart] || [],
         | 
| 124 | 
            +
              auto_confirm:         !!options[:auto_confirm],
         | 
| 119 125 | 
             
              require_confirmation: !!options[:require_confirmation],
         | 
| 120 126 | 
             
            )
         | 
    
        data/lib/indocker.rb
    CHANGED
    
    | @@ -318,21 +318,26 @@ module Indocker | |
| 318 318 | 
             
                  builder
         | 
| 319 319 | 
             
                end
         | 
| 320 320 |  | 
| 321 | 
            -
                def deploy(containers: [], skip_tags: [], tags: [], skip_dependent: false,  | 
| 321 | 
            +
                def deploy(containers: [], skip_tags: [], tags: [], skip_dependent: false, 
         | 
| 322 | 
            +
                  skip_containers: [], servers: [], skip_build: false, skip_deploy: false,
         | 
| 323 | 
            +
                  force_restart: false, skip_force_restart: [], auto_confirm: false, 
         | 
| 324 | 
            +
                  require_confirmation: false)
         | 
| 325 | 
            +
             | 
| 322 326 | 
             
                  Indocker::ConfigurationDeployer
         | 
| 323 327 | 
             
                    .new(Indocker.logger)
         | 
| 324 328 | 
             
                    .run(
         | 
| 325 | 
            -
                      configuration: | 
| 326 | 
            -
                      deploy_containers: | 
| 327 | 
            -
                      deploy_tags: | 
| 328 | 
            -
                      skip_dependent: | 
| 329 | 
            -
                      skip_containers: | 
| 330 | 
            -
                      servers: | 
| 331 | 
            -
                      skip_build: | 
| 332 | 
            -
                       | 
| 333 | 
            -
                       | 
| 334 | 
            -
                       | 
| 335 | 
            -
                       | 
| 329 | 
            +
                      configuration:        configuration,
         | 
| 330 | 
            +
                      deploy_containers:    containers,
         | 
| 331 | 
            +
                      deploy_tags:          tags,
         | 
| 332 | 
            +
                      skip_dependent:       skip_dependent,
         | 
| 333 | 
            +
                      skip_containers:      skip_containers,
         | 
| 334 | 
            +
                      servers:              servers,
         | 
| 335 | 
            +
                      skip_build:           skip_build,
         | 
| 336 | 
            +
                      skip_deploy:          skip_deploy,
         | 
| 337 | 
            +
                      force_restart:        force_restart,
         | 
| 338 | 
            +
                      skip_tags:            skip_tags,
         | 
| 339 | 
            +
                      skip_force_restart:   skip_force_restart,
         | 
| 340 | 
            +
                      auto_confirm:         auto_confirm,
         | 
| 336 341 | 
             
                      require_confirmation: require_confirmation,
         | 
| 337 342 | 
             
                    )
         | 
| 338 343 | 
             
                end
         | 
| @@ -18,7 +18,8 @@ class Indocker::ConfigurationDeployer | |
| 18 18 | 
             
              end
         | 
| 19 19 |  | 
| 20 20 | 
             
              def run(configuration:, deploy_containers:, skip_tags:, deploy_tags:, skip_dependent:,
         | 
| 21 | 
            -
                      skip_containers:, servers:, skip_build:, force_restart:, skip_force_restart:,  | 
| 21 | 
            +
                      skip_containers:, servers:, skip_build:, skip_deploy:, force_restart:, skip_force_restart:, 
         | 
| 22 | 
            +
                      auto_confirm:, require_confirmation:)
         | 
| 22 23 | 
             
                build_context_pool = nil
         | 
| 23 24 | 
             
                deployer = nil
         | 
| 24 25 |  | 
| @@ -31,6 +32,10 @@ class Indocker::ConfigurationDeployer | |
| 31 32 | 
             
                    @logger.warn("WARNING. Images build step will be skipped")
         | 
| 32 33 | 
             
                  end
         | 
| 33 34 |  | 
| 35 | 
            +
                  if skip_deploy
         | 
| 36 | 
            +
                    @logger.warn("WARNING. Images deploy step will be skipped")
         | 
| 37 | 
            +
                  end
         | 
| 38 | 
            +
             | 
| 34 39 | 
             
                  preload_containers(configuration)
         | 
| 35 40 |  | 
| 36 41 | 
             
                  containers = find_deploy_containers(configuration, deploy_containers, deploy_tags, skip_dependent, skip_containers, servers, skip_tags, auto_confirm, require_confirmation)
         | 
| @@ -56,13 +61,14 @@ class Indocker::ConfigurationDeployer | |
| 56 61 |  | 
| 57 62 | 
             
                  @progress.setup(
         | 
| 58 63 | 
             
                    binaries_servers: servers,
         | 
| 59 | 
            -
                    build_servers: | 
| 60 | 
            -
                    deploy_servers: | 
| 61 | 
            -
                    env_files: | 
| 62 | 
            -
                    repositories: | 
| 63 | 
            -
                    force_restart: | 
| 64 | 
            -
                    skip_build: | 
| 65 | 
            -
                     | 
| 64 | 
            +
                    build_servers:    build_servers,
         | 
| 65 | 
            +
                    deploy_servers:   deploy_servers,
         | 
| 66 | 
            +
                    env_files:        configuration.env_files.keys,
         | 
| 67 | 
            +
                    repositories:     configuration.repositories.keys,
         | 
| 68 | 
            +
                    force_restart:    force_restart,
         | 
| 69 | 
            +
                    skip_build:       skip_build,
         | 
| 70 | 
            +
                    skip_deploy:      skip_deploy,
         | 
| 71 | 
            +
                    containers:       containers,
         | 
| 66 72 | 
             
                    artifact_servers: configuration.artifact_servers,
         | 
| 67 73 | 
             
                  )
         | 
| 68 74 |  | 
| @@ -81,7 +87,17 @@ class Indocker::ConfigurationDeployer | |
| 81 87 | 
             
                  update_crontab_redeploy_rules(configuration, build_servers.first)
         | 
| 82 88 |  | 
| 83 89 | 
             
                  containers.uniq.each do |container|
         | 
| 84 | 
            -
                    recursively_deploy_container( | 
| 90 | 
            +
                    recursively_deploy_container(
         | 
| 91 | 
            +
                      configuration, 
         | 
| 92 | 
            +
                      deployer, 
         | 
| 93 | 
            +
                      build_context_pool, 
         | 
| 94 | 
            +
                      container, 
         | 
| 95 | 
            +
                      containers, 
         | 
| 96 | 
            +
                      skip_build, 
         | 
| 97 | 
            +
                      skip_deploy, 
         | 
| 98 | 
            +
                      force_restart, 
         | 
| 99 | 
            +
                      skip_force_restart
         | 
| 100 | 
            +
                    )
         | 
| 85 101 | 
             
                  end
         | 
| 86 102 |  | 
| 87 103 | 
             
                  Thread
         | 
| @@ -285,9 +301,21 @@ class Indocker::ConfigurationDeployer | |
| 285 301 | 
             
                build_context.set_compiled(image)
         | 
| 286 302 | 
             
              end
         | 
| 287 303 |  | 
| 288 | 
            -
              def recursively_deploy_container(configuration, deployer, build_context_pool, container,  | 
| 304 | 
            +
              def recursively_deploy_container(configuration, deployer, build_context_pool, container, 
         | 
| 305 | 
            +
                containers, skip_build, skip_deploy, force_restart, skip_force_restart)
         | 
| 306 | 
            +
             | 
| 289 307 | 
             
                container.dependent_containers.each do |container|
         | 
| 290 | 
            -
                  recursively_deploy_container( | 
| 308 | 
            +
                  recursively_deploy_container(
         | 
| 309 | 
            +
                    configuration, 
         | 
| 310 | 
            +
                    deployer, 
         | 
| 311 | 
            +
                    build_context_pool, 
         | 
| 312 | 
            +
                    container, 
         | 
| 313 | 
            +
                    containers, 
         | 
| 314 | 
            +
                    skip_build, 
         | 
| 315 | 
            +
                    skip_deploy,
         | 
| 316 | 
            +
                    force_restart, 
         | 
| 317 | 
            +
                    skip_force_restart
         | 
| 318 | 
            +
                  )
         | 
| 291 319 | 
             
                end
         | 
| 292 320 |  | 
| 293 321 | 
             
                return if !containers.include?(container)
         | 
| @@ -304,7 +332,9 @@ class Indocker::ConfigurationDeployer | |
| 304 332 |  | 
| 305 333 | 
             
                @progress.finish_building_container(container)
         | 
| 306 334 |  | 
| 307 | 
            -
                 | 
| 335 | 
            +
                if !skip_deploy
         | 
| 336 | 
            +
                  deployer.deploy(container, force_restart, skip_force_restart, @progress)
         | 
| 337 | 
            +
                end
         | 
| 308 338 | 
             
              end
         | 
| 309 339 |  | 
| 310 340 | 
             
              class RemoteOperation
         | 
| @@ -70,9 +70,10 @@ class Indocker::DeploymentProgress | |
| 70 70 | 
             
              end
         | 
| 71 71 |  | 
| 72 72 | 
             
              def setup(binaries_servers:, build_servers:, deploy_servers:, env_files:, artifact_servers:,
         | 
| 73 | 
            -
                        repositories:, force_restart:, skip_build:, containers:)
         | 
| 73 | 
            +
                        repositories:, force_restart:, skip_build:, skip_deploy:, containers:)
         | 
| 74 74 | 
             
                @force_restart = force_restart
         | 
| 75 | 
            -
                @skip_build | 
| 75 | 
            +
                @skip_build    = skip_build
         | 
| 76 | 
            +
                @skip_deploy   = skip_deploy
         | 
| 76 77 |  | 
| 77 78 | 
             
                binaries_servers.each do |server|
         | 
| 78 79 | 
             
                  @synced_binaries[server] = {
         | 
| @@ -250,6 +251,10 @@ class Indocker::DeploymentProgress | |
| 250 251 | 
             
                  @logger.info("Warning: Image build is skipped for all containers".purple)
         | 
| 251 252 | 
             
                end
         | 
| 252 253 |  | 
| 254 | 
            +
                if @skip_deploy
         | 
| 255 | 
            +
                  @logger.info("Warning: All container deployment is skipped".purple)
         | 
| 256 | 
            +
                end
         | 
| 257 | 
            +
             | 
| 253 258 | 
             
                if @force_restart
         | 
| 254 259 | 
             
                  @logger.info("Warning: All containers will be force restarted".purple)
         | 
| 255 260 | 
             
                end
         | 
    
        data/lib/indocker/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,15 +1,15 @@ | |
| 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.8
         | 
| 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-07- | 
| 12 | 
            +
            date: 2020-07-23 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: net-ssh
         | 
| @@ -159,7 +159,7 @@ homepage: https://github.com/ArtStation/indocker | |
| 159 159 | 
             
            licenses:
         | 
| 160 160 | 
             
            - MIT
         | 
| 161 161 | 
             
            metadata: {}
         | 
| 162 | 
            -
            post_install_message:
         | 
| 162 | 
            +
            post_install_message: 
         | 
| 163 163 | 
             
            rdoc_options: []
         | 
| 164 164 | 
             
            require_paths:
         | 
| 165 165 | 
             
            - lib
         | 
| @@ -174,8 +174,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 174 174 | 
             
                - !ruby/object:Gem::Version
         | 
| 175 175 | 
             
                  version: '0'
         | 
| 176 176 | 
             
            requirements: []
         | 
| 177 | 
            -
            rubygems_version: 3.0. | 
| 178 | 
            -
            signing_key:
         | 
| 177 | 
            +
            rubygems_version: 3.0.3
         | 
| 178 | 
            +
            signing_key: 
         | 
| 179 179 | 
             
            specification_version: 4
         | 
| 180 180 | 
             
            summary: Docker Containers Deployment
         | 
| 181 181 | 
             
            test_files: []
         |