indocker 0.5.3 → 0.5.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 738373105e7204366594f9789bc989e5c83453bc209fe0053485ef239156cc7a
4
- data.tar.gz: 63dc5708eee2e75caab7a4bfaa8ac9c0e80c73fb46fbca987215d28309f07d86
3
+ metadata.gz: 70bf1241f0783dede869906f9f359c2a2137778a3059acaea9ae2fc7db30bb38
4
+ data.tar.gz: f4d906fc4ae36b9bf4482c7e5802c03b4a8633c7f839a0ffb71bbfc1571a5e30
5
5
  SHA512:
6
- metadata.gz: 477f6ae6ffd9fa9087743f06e354d751af669e803c4f9f5a7ee74c820bbfb5872674c379a0a006d46200f5fe174bf7f1779b088df093b6dfeabe51c2fcd3e7b9
7
- data.tar.gz: 355bee8644ae9e6e478cc878f41ee26c3f73bcf31c951561dc80fdc2c4bdde162e1d3d0bd387633d74501767c2b089a3f7cb20610795c5a6d2808a2b61dd079f
6
+ metadata.gz: d45a4d6ab954e10b76fbaf2b4ca098c1368fd6b6365756f24bb210757d5f221d0fcfcf5b11b378cc5e31de38d72967158c90d91aaa3c9df53334f8a2596f12f0
7
+ data.tar.gz: a0ae86f49931e812d34761ff20f73f704a010b742edb1968dae8e70fc7798edbd75cab519f34632d8f6840ab0b87f5454c70773c50627ac10fc5693e263819cb
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- indocker (0.5.3)
4
+ indocker (0.5.4)
5
5
  net-ssh
6
6
 
7
7
  GEM
@@ -1,9 +1,7 @@
1
- require 'timeout'
2
1
  require 'benchmark'
3
2
  require 'tempfile'
4
3
 
5
4
  class Indocker::Launchers::ConfigurationDeployer
6
- REMOTE_OPERATION_TIMEOUT = 60
7
5
 
8
6
  def initialize(logger:, global_logger:)
9
7
  Thread.abort_on_exception = true # abort all threads if exception occurs
@@ -107,12 +105,8 @@ class Indocker::Launchers::ConfigurationDeployer
107
105
 
108
106
  def wait_remote_operations(remote_operations)
109
107
  remote_operations.each do |remote_operation|
110
- begin
111
- Timeout::timeout(REMOTE_OPERATION_TIMEOUT) do
112
- remote_operation.thread.join
113
- end
114
- rescue Timeout::Error
115
- @global_logger.error("Deployment aborted. Remote operation :#{remote_operation.operation} on server #{remote_operation.server.user}@#{remote_operation.server.host} did not finish during #{REMOTE_OPERATION_TIMEOUT} seconds.")
108
+ if remote_operation.thread.join(Indocker.remote_operation_timeout).nil?
109
+ @global_logger.error("Deployment aborted. Remote operation :#{remote_operation.operation} on server #{remote_operation.server.user}@#{remote_operation.server.host} did not finish during #{Indocker.remote_operation_timeout} seconds.")
116
110
  exit 1
117
111
  end
118
112
  end
@@ -460,11 +454,13 @@ class Indocker::Launchers::ConfigurationDeployer
460
454
 
461
455
  @logger.info("Updating crontab file #{deploy_user}:#{crontab_filepath}")
462
456
 
463
- Indocker::Shell.command("scp #{tmp_crontab_file.path} #{deploy_user}:#{crontab_filepath}", @logger)
457
+ ssh_options = "-o BatchMode=yes -o ConnectTimeout=#{Indocker.ssh_connect_timeout}"
458
+
459
+ Indocker::Shell.command("scp #{ssh_options} #{tmp_crontab_file.path} #{deploy_user}:#{crontab_filepath}", @logger)
464
460
 
465
461
  tmp_crontab_file.unlink
466
462
 
467
- Indocker::Shell.command("ssh #{deploy_user} 'crontab #{crontab_filepath}'", @logger)
463
+ Indocker::Shell.command("ssh #{ssh_options} #{deploy_user} 'crontab #{crontab_filepath}'", @logger)
468
464
  end
469
465
 
470
466
  def sync_indocker(servers)
@@ -29,7 +29,20 @@ class Indocker::Rsync
29
29
  sync_local_cp(from, to, raise_on_error: raise_on_error)
30
30
  end
31
31
  else
32
- command = "rsync --delete-after -a -e 'ssh -p #{session.port}' #{from} #{session.user}@#{session.host}:#{to}"
32
+ # BatchMode/ConnectTimeout: an unreachable server must fail in seconds with
33
+ # a clear rsync error instead of hanging silently (or prompting for a password)
34
+ # until the deployment-wide remote operation timeout kills the whole deploy.
35
+ # ServerAlive*: a path that accepts the connection and then stops delivering
36
+ # packets (seen when a cloud NAT address half-works) would otherwise hang
37
+ # just as long — keepalives tear such a session down in ~30s.
38
+ ssh_command = [
39
+ "ssh -p #{session.port}",
40
+ "-o BatchMode=yes",
41
+ "-o ConnectTimeout=#{Indocker.ssh_connect_timeout}",
42
+ "-o ServerAliveInterval=10",
43
+ "-o ServerAliveCountMax=3",
44
+ ].join(' ')
45
+ command = "rsync --delete-after -a -e '#{ssh_command}' #{from} #{session.user}@#{session.host}:#{to}"
33
46
  Indocker.logger.debug("sync #{from} #{session.user}@#{session.host}:#{to}")
34
47
  Indocker::Shell.command(command, Indocker.logger, raise_on_error: raise_on_error)
35
48
  end
@@ -29,7 +29,14 @@ class Indocker::SshSession
29
29
 
30
30
  if host != LOCALHOST
31
31
  require 'net/ssh'
32
- @ssh = Net::SSH.start(@host, @user, {port: @port})
32
+ @ssh = Net::SSH.start(@host, @user, {
33
+ port: @port,
34
+ non_interactive: true,
35
+ timeout: Indocker.ssh_connect_timeout,
36
+ keepalive: true,
37
+ keepalive_interval: 10,
38
+ keepalive_maxcount: 3,
39
+ })
33
40
  end
34
41
  end
35
42
 
@@ -1,3 +1,3 @@
1
1
  module Indocker
2
- VERSION = "0.5.3"
2
+ VERSION = "0.5.4"
3
3
  end
data/lib/indocker.rb CHANGED
@@ -135,6 +135,22 @@ module Indocker
135
135
  @redeploy_crontab_path = val
136
136
  end
137
137
 
138
+ def set_remote_operation_timeout(seconds)
139
+ @remote_operation_timeout = seconds
140
+ end
141
+
142
+ def remote_operation_timeout
143
+ @remote_operation_timeout || 300
144
+ end
145
+
146
+ def set_ssh_connect_timeout(seconds)
147
+ @ssh_connect_timeout = seconds
148
+ end
149
+
150
+ def ssh_connect_timeout
151
+ @ssh_connect_timeout || 15
152
+ end
153
+
138
154
  def redeploy_crontab_path
139
155
  @redeploy_crontab_path
140
156
  end
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.5.3
4
+ version: 0.5.4
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: 2026-07-07 00:00:00.000000000 Z
12
+ date: 2026-08-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: net-ssh