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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/indocker/launchers/configuration_deployer.rb +6 -10
- data/lib/indocker/rsync.rb +14 -1
- data/lib/indocker/ssh_session.rb +8 -1
- data/lib/indocker/version.rb +1 -1
- data/lib/indocker.rb +16 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 70bf1241f0783dede869906f9f359c2a2137778a3059acaea9ae2fc7db30bb38
|
|
4
|
+
data.tar.gz: f4d906fc4ae36b9bf4482c7e5802c03b4a8633c7f839a0ffb71bbfc1571a5e30
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d45a4d6ab954e10b76fbaf2b4ca098c1368fd6b6365756f24bb210757d5f221d0fcfcf5b11b378cc5e31de38d72967158c90d91aaa3c9df53334f8a2596f12f0
|
|
7
|
+
data.tar.gz: a0ae86f49931e812d34761ff20f73f704a010b742edb1968dae8e70fc7798edbd75cab519f34632d8f6840ab0b87f5454c70773c50627ac10fc5693e263819cb
|
data/Gemfile.lock
CHANGED
|
@@ -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
|
-
|
|
111
|
-
|
|
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
|
-
|
|
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)
|
data/lib/indocker/rsync.rb
CHANGED
|
@@ -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
|
-
|
|
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
|
data/lib/indocker/ssh_session.rb
CHANGED
|
@@ -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, {
|
|
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
|
|
data/lib/indocker/version.rb
CHANGED
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.
|
|
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-
|
|
12
|
+
date: 2026-08-18 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: net-ssh
|