From f8f88af534e416006d23a378e90dba7f5bebcae8 Mon Sep 17 00:00:00 2001 From: Donal McBreen Date: Thu, 20 Jun 2024 08:28:37 +0100 Subject: [PATCH] Log on boot errors with one role We didn't log boot errors if there was one role because there was no barrier and the logging is done by the first host to close the barrier. Let's always create the barrier to fix this. --- lib/kamal/cli/app.rb | 2 +- lib/kamal/cli/app/boot.rb | 4 ++-- test/integration/broken_deploy_test.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/kamal/cli/app.rb b/lib/kamal/cli/app.rb index 149c71c2..19bf84cd 100644 --- a/lib/kamal/cli/app.rb +++ b/lib/kamal/cli/app.rb @@ -14,7 +14,7 @@ class Kamal::Cli::App < Kamal::Cli::Base end # Primary hosts and roles are returned first, so they can open the barrier - barrier = Kamal::Cli::Healthcheck::Barrier.new if KAMAL.roles.many? + barrier = Kamal::Cli::Healthcheck::Barrier.new on(KAMAL.hosts, **KAMAL.boot_strategy) do |host| KAMAL.roles_on(host).each do |role| diff --git a/lib/kamal/cli/app/boot.rb b/lib/kamal/cli/app/boot.rb index c4125771..b78763ce 100644 --- a/lib/kamal/cli/app/boot.rb +++ b/lib/kamal/cli/app/boot.rb @@ -72,7 +72,7 @@ class Kamal::Cli::App::Boot def release_barrier if barrier.open - info "First #{KAMAL.primary_role} container is healthy on #{host}, booting other roles" + info "First #{KAMAL.primary_role} container is healthy on #{host}, booting any other roles" end end @@ -87,7 +87,7 @@ class Kamal::Cli::App::Boot def close_barrier if barrier.close - info "First #{KAMAL.primary_role} container is unhealthy on #{host}, not booting other roles" + info "First #{KAMAL.primary_role} container is unhealthy on #{host}, not booting any other roles" error capture_with_info(*app.logs(version: version)) error capture_with_info(*app.container_health_log(version: version)) end diff --git a/test/integration/broken_deploy_test.rb b/test/integration/broken_deploy_test.rb index a3f74d45..5ab24f55 100644 --- a/test/integration/broken_deploy_test.rb +++ b/test/integration/broken_deploy_test.rb @@ -26,7 +26,7 @@ class BrokenDeployTest < IntegrationTest private def assert_failed_deploy(output) assert_match "Waiting for the first healthy web container before booting workers on vm3...", output - assert_match /First web container is unhealthy on vm[12], not booting other roles/, output + assert_match /First web container is unhealthy on vm[12], not booting any other roles/, output assert_match "First web container is unhealthy, not booting workers on vm3", output assert_match "nginx: [emerg] unexpected end of file, expecting \";\" or \"}\" in /etc/nginx/conf.d/default.conf:2", output assert_match 'ERROR {"Status":"unhealthy","FailingStreak":0,"Log":[]}', output