From 9a31c203219c5fbf9ccb9d04cfd62e3e55837480 Mon Sep 17 00:00:00 2001 From: acidtib Date: Wed, 10 May 2023 20:27:21 -0600 Subject: [PATCH] add healthcheck interval option --- README.md | 1 + lib/mrsk/configuration/role.rb | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index da83c9d6..f106f7ef 100644 --- a/README.md +++ b/README.md @@ -703,6 +703,7 @@ healthcheck: path: /healthz port: 4000 max_attempts: 7 + interval: 20s ``` This will ensure your application is configured with a traefik label for the healthcheck against `/healthz` and that the pre-deploy healthcheck that MRSK performs is done against the same path on port 4000. diff --git a/lib/mrsk/configuration/role.rb b/lib/mrsk/configuration/role.rb index 55b69731..048efe16 100644 --- a/lib/mrsk/configuration/role.rb +++ b/lib/mrsk/configuration/role.rb @@ -37,7 +37,7 @@ class Mrsk::Configuration::Role def health_check_args if health_check_cmd.present? - optionize({ "health-cmd" => health_check_cmd, "health-interval" => "1s" }) + optionize({ "health-cmd" => health_check_cmd, "health-interval" => health_check_interval }) else [] end @@ -50,6 +50,13 @@ class Mrsk::Configuration::Role options["cmd"] || http_health_check(port: options["port"], path: options["path"]) end + def health_check_interval + options = specializations["healthcheck"] || {} + options = config.healthcheck.merge(options) if running_traefik? + + options["interval"] || "1s" + end + def cmd specializations["cmd"] end