Simplify domain language to just "boot" and unscoped config keys
This commit is contained in:
@@ -835,17 +835,17 @@ mrsk lock release
|
||||
|
||||
When deploying to large numbers of hosts, you might prefer not to restart your services on every host at the same time.
|
||||
|
||||
MRSK's default is to boot new containers on all hosts in parallel. But you can control this by configuring `group_limit` and `group_wait` as boot options:
|
||||
MRSK's default is to boot new containers on all hosts in parallel. But you can control this by configuring `boot/limit` and `boot/wait` as options:
|
||||
|
||||
```yaml
|
||||
service: myservice
|
||||
|
||||
boot:
|
||||
group_limit: 10 # Can also specify as a percentage of total hosts, such as "25%"
|
||||
group_wait: 2
|
||||
limit: 10 # Can also specify as a percentage of total hosts, such as "25%"
|
||||
wait: 2
|
||||
```
|
||||
|
||||
When `group_limit` is specified, containers will be booted on, at most, `group_limit` hosts at once. MRSK will pause for `group_wait` seconds between batches.
|
||||
When `limit` is specified, containers will be booted on, at most, `limit` hosts at once. MRSK will pause for `wait` seconds between batches.
|
||||
|
||||
These settings only apply when booting containers (using `mrsk deploy`, or `mrsk app boot`). For other commands, MRSK continues to run commands in parallel across all hosts.
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ class Mrsk::Cli::App < Mrsk::Cli::Base
|
||||
execute *MRSK.app.tag_current_as_latest
|
||||
end
|
||||
|
||||
on(MRSK.hosts, **MRSK.group_strategy) do |host|
|
||||
on(MRSK.hosts, **MRSK.boot_strategy) do |host|
|
||||
roles = MRSK.roles_on(host)
|
||||
|
||||
roles.each do |role|
|
||||
|
||||
@@ -51,9 +51,9 @@ class Mrsk::Commander
|
||||
end
|
||||
end
|
||||
|
||||
def group_strategy
|
||||
if config.boot.group_limit.present?
|
||||
{ in: :groups, limit: config.boot.group_limit, wait: config.boot.group_wait }
|
||||
def boot_strategy
|
||||
if config.boot.limit.present?
|
||||
{ in: :groups, limit: config.boot.limit, wait: config.boot.wait }
|
||||
else
|
||||
{}
|
||||
end
|
||||
|
||||
@@ -4,8 +4,9 @@ class Mrsk::Configuration::Boot
|
||||
@host_count = config.all_hosts.count
|
||||
end
|
||||
|
||||
def group_limit
|
||||
limit = @options["group_limit"]
|
||||
def limit
|
||||
limit = @options["limit"]
|
||||
|
||||
if limit.to_s.end_with?("%")
|
||||
@host_count * limit.to_i / 100
|
||||
else
|
||||
@@ -13,7 +14,7 @@ class Mrsk::Configuration::Boot
|
||||
end
|
||||
end
|
||||
|
||||
def group_wait
|
||||
@options["group_wait"]
|
||||
def wait
|
||||
@options["wait"]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -40,7 +40,7 @@ class CliAppTest < CliTestCase
|
||||
# Strategy is used when booting the containers
|
||||
Mrsk::Cli::App.any_instance.expects(:on).with([ "1.1.1.1" ], in: :groups, limit: 3, wait: 2).with_block_given
|
||||
|
||||
run_command("boot", config: :with_group_strategy)
|
||||
run_command("boot", config: :with_boot_strategy)
|
||||
end
|
||||
|
||||
test "start" do
|
||||
|
||||
@@ -55,19 +55,19 @@ class CommanderTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
test "default group strategy" do
|
||||
assert_empty @mrsk.group_strategy
|
||||
assert_empty @mrsk.boot_strategy
|
||||
end
|
||||
|
||||
test "specific limit group strategy" do
|
||||
configure_with(:deploy_with_group_strategy)
|
||||
configure_with(:deploy_with_boot_strategy)
|
||||
|
||||
assert_equal({ in: :groups, limit: 3, wait: 2 }, @mrsk.group_strategy)
|
||||
assert_equal({ in: :groups, limit: 3, wait: 2 }, @mrsk.boot_strategy)
|
||||
end
|
||||
|
||||
test "percentage-based group strategy" do
|
||||
configure_with(:deploy_with_precentage_group_strategy)
|
||||
configure_with(:deploy_with_precentage_boot_strategy)
|
||||
|
||||
assert_equal({ in: :groups, limit: 1, wait: 2 }, @mrsk.group_strategy)
|
||||
assert_equal({ in: :groups, limit: 1, wait: 2 }, @mrsk.boot_strategy)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -13,5 +13,5 @@ registry:
|
||||
password: pw
|
||||
|
||||
boot:
|
||||
group_limit: 3
|
||||
group_wait: 2
|
||||
limit: 3
|
||||
wait: 2
|
||||
@@ -13,5 +13,5 @@ registry:
|
||||
password: pw
|
||||
|
||||
boot:
|
||||
group_limit: 25%
|
||||
group_wait: 2
|
||||
limit: 25%
|
||||
wait: 2
|
||||
Reference in New Issue
Block a user