Customizable stop wait time
Configurable via a global `stop_wait_time` option. The default is `10` which matches Docker defaults.
This commit is contained in:
@@ -333,6 +333,15 @@ servers:
|
|||||||
|
|
||||||
That'll start the job containers with `docker run ... --cap-add --cpu-count 4 ...`.
|
That'll start the job containers with `docker run ... --cap-add --cpu-count 4 ...`.
|
||||||
|
|
||||||
|
### Using a different stop wait time
|
||||||
|
|
||||||
|
On a new deploy, each old running container is gracefully shut down with a `SIGTERM`, and after a grace period of `10` seconds a `SIGKILL` is sent.
|
||||||
|
You can configure this value via the `stop_wait_time` option:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
stop_wait_time: 30
|
||||||
|
```
|
||||||
|
|
||||||
### Using remote builder for native multi-arch
|
### Using remote builder for native multi-arch
|
||||||
|
|
||||||
If you're developing on ARM64 (like Apple Silicon), but you want to deploy on AMD64 (x86 64-bit), you can use multi-architecture images. By default, MRSK will setup a local buildx configuration that does this through QEMU emulation. But this can be quite slow, especially on the first build.
|
If you're developing on ARM64 (like Apple Silicon), but you want to deploy on AMD64 (x86 64-bit), you can use multi-architecture images. By default, MRSK will setup a local buildx configuration that does this through QEMU emulation. But this can be quite slow, especially on the first build.
|
||||||
|
|||||||
@@ -27,10 +27,12 @@ class Mrsk::Commands::App < Mrsk::Commands::Base
|
|||||||
docker :start, service_with_version_and_destination_and_role
|
docker :start, service_with_version_and_destination_and_role
|
||||||
end
|
end
|
||||||
|
|
||||||
|
DEFAULT_STOP_WAIT_TIME = 10
|
||||||
|
|
||||||
def stop(version: nil)
|
def stop(version: nil)
|
||||||
pipe \
|
pipe \
|
||||||
version ? container_id_for_version(version) : current_container_id,
|
version ? container_id_for_version(version) : current_container_id,
|
||||||
xargs(docker(:stop))
|
xargs(docker(:stop, "-t", config.stop_wait_time || DEFAULT_STOP_WAIT_TIME))
|
||||||
end
|
end
|
||||||
|
|
||||||
def info
|
def info
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ require "erb"
|
|||||||
require "net/ssh/proxy/jump"
|
require "net/ssh/proxy/jump"
|
||||||
|
|
||||||
class Mrsk::Configuration
|
class Mrsk::Configuration
|
||||||
delegate :service, :image, :servers, :env, :labels, :registry, :builder, to: :raw_config, allow_nil: true
|
delegate :service, :image, :servers, :env, :labels, :registry, :builder, :stop_wait_time,
|
||||||
|
to: :raw_config, allow_nil: true
|
||||||
delegate :argumentize, :argumentize_env_with_secrets, to: Mrsk::Utils
|
delegate :argumentize, :argumentize_env_with_secrets, to: Mrsk::Utils
|
||||||
|
|
||||||
attr_accessor :destination
|
attr_accessor :destination
|
||||||
|
|||||||
@@ -55,13 +55,13 @@ class CommandsAppTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
test "stop" do
|
test "stop" do
|
||||||
assert_equal \
|
assert_equal \
|
||||||
"docker ps --quiet --filter label=service=app --filter label=role=web | xargs docker stop",
|
"docker ps --quiet --filter label=service=app --filter label=role=web | xargs docker stop -t 10",
|
||||||
new_command.stop.join(" ")
|
new_command.stop.join(" ")
|
||||||
end
|
end
|
||||||
|
|
||||||
test "stop with version" do
|
test "stop with version" do
|
||||||
assert_equal \
|
assert_equal \
|
||||||
"docker container ls --all --filter name=app-web-123 --quiet | xargs docker stop",
|
"docker container ls --all --filter name=app-web-123 --quiet | xargs docker stop -t 10",
|
||||||
new_command.stop(version: "123").join(" ")
|
new_command.stop(version: "123").join(" ")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user