From 9a8a45015b881aed34e7b35197b1249487afe413 Mon Sep 17 00:00:00 2001 From: Donal McBreen Date: Wed, 23 Oct 2024 15:05:20 +0100 Subject: [PATCH 1/2] Allow log max size to not be set The max-size log opt is not valid for all logging drivers, such as syslog. Allow the option to be removed from the boot config with: ``` kamal proxy boot_config set --log-max-size= or kamal proxy boot_config set --log-max-size="" ``` --- lib/kamal/cli/proxy.rb | 1 + lib/kamal/configuration.rb | 2 +- test/cli/proxy_test.rb | 9 +++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/kamal/cli/proxy.rb b/lib/kamal/cli/proxy.rb index d0e9ba2bf..d985e73ea 100644 --- a/lib/kamal/cli/proxy.rb +++ b/lib/kamal/cli/proxy.rb @@ -37,6 +37,7 @@ def boot_config(subcommand) ] on(KAMAL.proxy_hosts) do |host| + p boot_options execute(*KAMAL.proxy.ensure_proxy_directory) upload! StringIO.new(boot_options.join(" ")), KAMAL.config.proxy_options_file end diff --git a/lib/kamal/configuration.rb b/lib/kamal/configuration.rb index 86602fe18..eba096573 100644 --- a/lib/kamal/configuration.rb +++ b/lib/kamal/configuration.rb @@ -254,7 +254,7 @@ def proxy_publish_args(http_port, https_port) end def proxy_logging_args(max_size) - argumentize "--log-opt", "max-size=#{max_size}" + argumentize "--log-opt", "max-size=#{max_size}" if max_size.present? end def proxy_options_default diff --git a/test/cli/proxy_test.rb b/test/cli/proxy_test.rb index 9fe8f56c3..0a890451b 100644 --- a/test/cli/proxy_test.rb +++ b/test/cli/proxy_test.rb @@ -263,6 +263,15 @@ class CliProxyTest < CliTestCase end end + test "boot_config set no log max size" do + run_command("boot_config", "set", "--log-max-size=").tap do |output| + %w[ 1.1.1.1 1.1.1.2 ].each do |host| + assert_match "Running /usr/bin/env mkdir -p .kamal/proxy on #{host}", output + assert_match "Uploading \"--publish 80:80 --publish 443:443\" to .kamal/proxy/options on #{host}", output + end + end + end + test "boot_config set custom ports" do run_command("boot_config", "set", "--http-port", "8080", "--https-port", "8443").tap do |output| %w[ 1.1.1.1 1.1.1.2 ].each do |host| From 1980a79e737f83c0c73a0c3099ca36291bdc3b5c Mon Sep 17 00:00:00 2001 From: Donal McBreen Date: Fri, 25 Oct 2024 08:10:25 +0100 Subject: [PATCH 2/2] Update lib/kamal/cli/proxy.rb Co-authored-by: Sijawusz Pur Rahnama --- lib/kamal/cli/proxy.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/kamal/cli/proxy.rb b/lib/kamal/cli/proxy.rb index d985e73ea..d0e9ba2bf 100644 --- a/lib/kamal/cli/proxy.rb +++ b/lib/kamal/cli/proxy.rb @@ -37,7 +37,6 @@ def boot_config(subcommand) ] on(KAMAL.proxy_hosts) do |host| - p boot_options execute(*KAMAL.proxy.ensure_proxy_directory) upload! StringIO.new(boot_options.join(" ")), KAMAL.config.proxy_options_file end