Merge branch 'main' into cleanup-excessive-containers-running
* main: (24 commits) Bump version for 0.11.0 Labels can be added to Traefik Make rollbacks role-aware fix typo role to roles Explained the latest modifications of Traefik container labels Remove .idea folder Updated README.md with new healthcheck.max_attempts option Fix test case: console output message was not updated to display the current/total attempts Require net-ssh ~> 7.0 for SHA-2 support Improved deploy lock acquisition Excess CR Style Simpler Make it explicit, focus on Ubuntu More explicit Not that --bundle is a Rails 7+ option Update README.md Update README.md Improved: configurable max_attempts for healthcheck Traefik service name to be derived from role and destination ...
This commit is contained in:
@@ -83,21 +83,26 @@ class Mrsk::Cli::Main < Mrsk::Cli::Base
|
||||
with_lock do
|
||||
MRSK.config.version = version
|
||||
|
||||
if container_name_available?(MRSK.config.service_with_version)
|
||||
if container_available?(version)
|
||||
say "Start version #{version}, then wait #{MRSK.config.readiness_delay}s for app to boot before stopping the old version...", :magenta
|
||||
|
||||
cli = self
|
||||
old_version = nil
|
||||
|
||||
on(MRSK.hosts) do |host|
|
||||
old_version = capture_with_info(*MRSK.app.current_running_version).strip.presence
|
||||
roles = MRSK.roles_on(host)
|
||||
|
||||
execute *MRSK.app.start
|
||||
roles.each do |role|
|
||||
app = MRSK.app(role: role)
|
||||
old_version = capture_with_info(*app.current_running_version).strip.presence
|
||||
|
||||
if old_version
|
||||
sleep MRSK.config.readiness_delay
|
||||
execute *app.start
|
||||
|
||||
execute *MRSK.app.stop(version: old_version), raise_on_non_zero_exit: false
|
||||
if old_version
|
||||
sleep MRSK.config.readiness_delay
|
||||
|
||||
execute *app.stop(version: old_version), raise_on_non_zero_exit: false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -220,10 +225,15 @@ class Mrsk::Cli::Main < Mrsk::Cli::Base
|
||||
subcommand "lock", Mrsk::Cli::Lock
|
||||
|
||||
private
|
||||
def container_name_available?(container_name, host: MRSK.primary_host)
|
||||
container_names = nil
|
||||
on(host) { container_names = capture_with_info(*MRSK.app.list_container_names).split("\n") }
|
||||
Array(container_names).include?(container_name)
|
||||
def container_available?(version, host: MRSK.primary_host)
|
||||
available = nil
|
||||
|
||||
on(host) do
|
||||
first_role = MRSK.roles_on(host).first
|
||||
available = capture_with_info(*MRSK.app(role: first_role).container_id_for_version(version)).present?
|
||||
end
|
||||
|
||||
available
|
||||
end
|
||||
|
||||
def deploy_options
|
||||
|
||||
Reference in New Issue
Block a user