Ensure primary_role app hosts are sorted first
When booting non-primary role hosts we will always wait for a primary role host to boor first. So when booting in groups, if there are no primary role hosts in the first batch, then booting will stall. Sort primary role app_hosts first to avoid this. Fixes: https://github.com/basecamp/kamal/issues/1553
This commit is contained in:
@@ -149,6 +149,12 @@ class CommanderTest < ActiveSupport::TestCase
|
||||
assert_equal [], @kamal.accessory_hosts
|
||||
end
|
||||
|
||||
test "primary role hosts are first" do
|
||||
configure_with(:deploy_with_roles_workers_primary)
|
||||
assert_equal [ "1.1.1.1", "1.1.1.2", "1.1.1.3", "1.1.1.4" ], @kamal.hosts
|
||||
assert_equal [ "1.1.1.1", "1.1.1.2", "1.1.1.3", "1.1.1.4" ], @kamal.app_hosts
|
||||
end
|
||||
|
||||
private
|
||||
def configure_with(variant)
|
||||
@kamal = Kamal::Commander.new.tap do |kamal|
|
||||
|
||||
19
test/fixtures/deploy_with_roles_workers_primary.yml
vendored
Normal file
19
test/fixtures/deploy_with_roles_workers_primary.yml
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
service: app
|
||||
image: dhh/app
|
||||
servers:
|
||||
workers:
|
||||
- 1.1.1.1
|
||||
- 1.1.1.2
|
||||
web:
|
||||
- 1.1.1.3
|
||||
- 1.1.1.4
|
||||
env:
|
||||
REDIS_URL: redis://x/y
|
||||
registry:
|
||||
server: registry.digitalocean.com
|
||||
username: user
|
||||
password: pw
|
||||
builder:
|
||||
arch: amd64
|
||||
deploy_timeout: 1
|
||||
primary_role: workers
|
||||
Reference in New Issue
Block a user